def planar_hull(points, normal, origin=None, input_convex=False):
'''
Find the convex outline of a set of points projected to a plane.
Arguments
-----------
points: (n,3) float, input points
normal: (3) float vector, normal vector of plane
origin: (3) float, location of plane origin
input_convex: bool, if True we assume the input points are already from
a convex hull which provides a speedup.
Returns
-----------
hull_lines: (n,2,2) set of unordered line segments
T: (4,4) float, transformation matrix
'''
if origin is None:
origin = np.zeros(3)
if not input_convex:
pass
planar, T = project_to_plane(points,
plane_normal = normal,
plane_origin = origin,
return_planar = False,
return_transform = True)
hull_edges = ConvexHull(planar[:,0:2]).simplices
hull_lines = planar[hull_edges]
planar_z = planar[:,2]
height = np.array([planar_z.min(),
planar_z.max()])
return hull_lines, T, height
评论列表
文章目录