當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python Sympy Plane.projection_line()用法及代碼示例

在Sympy中,該函數Plane.projection_line()用於將給定線通過包含該線的法線平麵投影到給定平麵上。
用法: Plane.projection_line(line)

參數:
 line: LinearEntity or LinearEntity3D

返回: 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))



相關用法


注:本文由純淨天空篩選整理自ravikishor大神的英文原創作品 Python | Sympy Plane.projection_line() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。