📜  Python| Sympy 包含_point() 方法

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

Python| Sympy 包含_point() 方法

在 sympy 中,函数encloses_point encloses_point()用于检查给定点是否被给定椭圆包围。
Syntax: Ellipse.encloses_point(point)

Return: True:if point is enclosed by ellipse, otherwise False.

示例 #1:

# import sympy and geometry module 
from sympy import * 
from sympy.geometry import * 
  
x = Point(0, 0) 
  
# making ellipse with given point as center and radii
e1 = Ellipse(x, 3, 2)
  
# using encloses_point() method
isEnclosed = e1.encloses_point((0, 0))
  
print(isEnclosed)
  

输出:

True

示例 #2:

# import sympy and geometry module 
from sympy import * 
from sympy.geometry import * 
  
x = Point(3, 1) 
  
# making ellipse with given point as center, hradius and eccentricity
e2 = Ellipse(x, hradius = 3, eccentricity = Rational(4, 5))
  
# using encloses_point() method
isEnclosed = e2.encloses_point((4, 6))
  
print(isEnclosed)
  

输出:

False