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


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)



相關用法


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