Python| Sympy is_tangent() 方法
在 Sympy 中,函数is_tangent()
用于检查给定线是否与给定圆相切。
Syntax: Circle().is_tangent(line)
Return: True:if line is tangent to circle, otherwise 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