📜  Python| Sympy Plane.projection() 方法

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

Python| Sympy Plane.projection() 方法

在 Sympy 中,函数Plane.projection()用于将给定点沿平面法线投影到给定平面上,这意味着投影沿平面的法线向量方向。
Syntax:  Plane.projection(pt)

Parameters: 
 pt: Point or Point3D

Returns: Point3D

示例 #1:

# import sympy and Plane, Point, Point3D
from sympy import Plane, Point, Point3D
  
p = Point(2, 2)
  
# using Plane()
p1 = Plane(Point3D(1, 2, 3), normal_vector =(0, 1, 1))
  
# using projection()
projectionPoint = p1.projection(p)
  
print(projectionPoint)

输出:

Point3D(2, 7/2, 3/2)

示例 #2:

# import sympy and Plane, Point, Point3D
from sympy import Plane, Point, Point3D
  
p = Point3D(2, 2, 2)
  
# using Plane()
p1 = Plane(Point3D(1, 2, 3), normal_vector =(0, 1, 1))
  
# using projection()
projectionPoint = p1.projection(p)
  
print(projectionPoint)

输出:

Point3D(2, 5/2, 5/2)