Python Sympy is_tangent()方法
在Sympy中,函数is_tangent()是用来检查给定的直线是否与给定的圆相切的。
语法: Circle().is_tangent(line)
返回: True:如果直线与圆相切,否则为False。
示例 #1:
# import sympy and geometry module
from sympy import *
from sympy.geometry import *
x = Point(0, 0)
# making line with given points
l = Line(Point(5, -5), Point(5, 5))
# making circle with Circle() of
# radius 5 and using is_tangent()
isTangent = Circle(x, 5).is_tangent(l)
print(isTangent)
输出:
True
示例 #2:
# import sympy and geometry module
from sympy import *
from sympy.geometry import *
x = Point(0, 0)
y = Point(1, 1)
# making line with given points
l = Line(x, y)
# making circle with Circle() of radius 5 and using is_tangent()
isTangent = Circle(x, 5).is_tangent(l)
print(isTangent)
输出:
False