📜  Python| Sympy Ellipse.is_tangent() 方法

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

Python| Sympy Ellipse.is_tangent() 方法

在 Sympy 中,函数Ellipse.is_tangent()用于检查 Ellipse、LinearEntity 或 Polygon 是否与给定的 Ellipse 相切。
Syntax: is_tangent(o)

Parameters: o  an Ellipse, LinearEntity or Polygon

Returns: True if o is tangent to the ellipse, False otherwise.

Raises: NotImplementedError When the wrong type of argument is supplied.

示例 #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