def from_points(cls, p1, p2, p3):
'''
If the points are oriented in a counterclockwise direction, the plane's
normal extends towards you.
'''
from blmath.numerics import as_numeric_array
p1 = as_numeric_array(p1, shape=(3,))
p2 = as_numeric_array(p2, shape=(3,))
p3 = as_numeric_array(p3, shape=(3,))
v1 = p2 - p1
v2 = p3 - p1
normal = np.cross(v1, v2)
return cls(point_on_plane=p1, unit_normal=normal)
评论列表
文章目录