Python Sympy Plane.projection()方法
在Sympy中,函数Plane.projection()用于将给定的点沿着平面法线投影到给定的平面上,这意味着,投影是沿着平面的法向量方向。
语法: Plane.projection(pt)
参数 :
pt: Point or Point3D
返回: 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)