📜  Python – Sympy Triangle.is_right() 方法

📅  最后修改于: 2022-05-13 01:55:04.306000             🧑  作者: Mango

Python – Sympy Triangle.is_right() 方法

在 Sympy 中,函数Triangle.is_right()用于检查给定三角形是否为直角三角形。直角三角形是其中一个角是直角(90 度)的三角形。
Syntax: Triangle.is_right()

Returns: 
 True: if it is right-angled, otherwise False

示例 #1:

# import Triangle, Point
from sympy.geometry import Triangle, Point
    
# using Triangle()
t1 = Triangle(Point(0, 0), Point(4, 0), Point(4, 3))
    
# using is_right()
isRight = t1.is_right()
print(isRight)

输出:

True


示例 #2:

# import Triangle, Point
from sympy.geometry import Triangle, Point
    
# using Triangle()
t2 = Triangle(Point(0, 0), Point(2, 0), Point(4, 3))
    
# using is_right()
isRight = t2.is_right()
print(isRight)

输出:

False