Skip to main content

convex_hull_3d

Function convex_hull_3d 

Source
pub fn convex_hull_3d(points: &[[f64; 3]]) -> Option<Hull3D>
Expand description

The 3D convex hull by Quickhull (Barber, Dobkin and Huhdanpaa): starting from a tetrahedron, each face keeps the points outside it, and the point farthest above a face is added by replacing the faces it sees with a cone to their horizon. O(n log n) expected for typical inputs, O(n²) in the worst case.

Returns None if there are fewer than four points or they are all coplanar (within a tolerance relative to the extent of the data) or contain non-finite values. Points strictly inside the hull and duplicates are never vertices of the result, and nor, usually, are points lying on a face or edge of the hull (a 5×5×5 grid gives its 8 corners). Such a point can still become a vertex of coplanar triangles if it is the farthest point above some intermediate face, so Hull3D::vertices is guaranteed to contain the extreme points but may, for degenerate inputs, contain a few more. The volume and surface area are unaffected.