def from_points_and_vector(cls, p1, p2, vector):
'''
Compute a plane which contains two given points and the given
vector. Its reference point will be p1.
For example, to find the vertical plane that passes through
two landmarks:
from_points_and_normal(p1, p2, vector)
Another way to think about this: identify the plane to which
your result plane should be perpendicular, and specify vector
as its normal vector.
'''
from blmath.numerics import as_numeric_array
p1 = as_numeric_array(p1, shape=(3,))
p2 = as_numeric_array(p2, shape=(3,))
v1 = p2 - p1
v2 = as_numeric_array(vector, shape=(3,))
normal = np.cross(v1, v2)
return cls(point_on_plane=p1, unit_normal=normal)
评论列表
文章目录