Skip to main content

Module convex_hull

Module convex_hull 

Source
Expand description

Convex hulls of point sets in two and three dimensions.

See the book entry Convex hulls and polygon booleans.

Structs§

Hull3D
A convex polyhedron: triangular faces indexing into the input points, with counter-clockwise winding when seen from outside (normals point outward).

Functions§

convex_hull_2d
The convex hull of 2D points by Andrew’s monotone chain, O(n log n).
convex_hull_3d
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.
convex_polygon_contains_2d
Whether p lies inside or on a convex counter-clockwise polygon.
polygon_area_2d
Area enclosed by a polygon given by indices into points (shoelace formula; positive for counter-clockwise order).