整数 多項式 幾何学

SymPy で平面と点の距離を測る

最終更新日 2023.02.18

SymPy で平面と点の距離を測るには distance を使います。

from sympy import Point3D, Plane

plane = Plane(Point3D(2, 5, -1), normal_vector=(1, 2, 3))
point = Point3D(0, 1, 1)

distance = plane.distance(point)

print(distance)  # 2*sqrt(14)/7