📜  Python| Sympy Plane.projection_line() 方法

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

Python| Sympy Plane.projection_line() 方法

在 Sympy 中,函数Plane.projection_line()用于通过包含该线的法线平面将给定线投影到给定平面上。
Syntax: Plane.projection_line(line)

Parameters:
 line: LinearEntity or LinearEntity3D

Returns: Point3D, Line3D, Ray3D or Segment3D

示例 #1:

# import sympy and Plane, Line, Line3D, Point, Point3D
from sympy import Plane, Line, Line3D, Point, Point3D
  
p = Line(Point(1, 2), Point(2, 3))
  
# using Plane()
p1 = Plane(Point3D(1, 2, 3), normal_vector =(1, 0, 1))
  
# using projection_line()
projectionLine = p1.projection_line(p)
  
print(projectionLine)

输出:

Line3D(Point3D(5/2, 2, 3/2), Point3D(3, 3, 1))

示例 #2:

# import sympy and Plane, Line, Line3D, Point, Point3D
from sympy import Plane, Line, Line3D, Point, Point3D
  
p = Line3D(Point3D(1, 2, 3), Point(0, 0, 0))
  
# using Plane()
p2 = Plane(Point3D(1, 1, 1), normal_vector =(0, 0, 0))
  
# using projection_line()
projectionLine = p2.projection_line(p)
  
print(projectionLine)

输出:

Line3D(Point3D(1, 2, 3), Point3D(2, 0, 2))