Python Sympy Ellipse.is_tangent()方法
在Sympy中,函数Ellipse.is_tangent()用来检查一个椭圆、线性实体或多边形是否与给定的椭圆相切。
语法: is_tangent(o)
参数: o 椭圆、线性实体或多边形。
返回: 如果o与椭圆相切为真,否则为假。
Raises: NotImplementedError 当提供错误的参数类型时。
示例 #1:
# import sympy and Point, Ellipse, Line
from sympy import Point, Ellipse, Line
p0, p1, p2 = Point(0, 0), Point(3, 0), Point(3, 3)
# using Line and Ellipse method
e1 = Ellipse(p0, 3, 2)
l1 = Line(p1, p2)
# using is_tangent method
e1.is_tangent(l1)
输出:
True
示例 #2:
# import sympy and Point, Ellipse, Line
from sympy import Point, Ellipse, Line
p0, p1, p2 = Point(0, 0), Point(4, 0), Point(4, 2)
# using Line and Ellipse method
e1 = Ellipse(p0, 3, 2)
l1 = Line(p1, p2)
# using is_tangent method
e1.is_tangent(l1)
输出:
False