convhulln
Convex hull of points in n dimensions, as facets of point indices.
Category: Mathematics > Computational Geometry
Syntax
H = convhulln(P)
Returns the facets of the hull of the points in the rows of P.
[H, V] = convhulln(P)
Also returns the volume enclosed by the hull.
Description
Unlike convhull, which returns an ordered boundary loop in 2-D, convhulln returns an unordered list of facets, one per row. This general form is the same in any dimension. The point set must span the full dimension: coplanar points in 3-D, for instance, have no volume and raise an error.
Input arguments
P- Matrix with one point per row and one column per dimension.
Output arguments
H- One row per facet, listing the indices of the points on it: 2 columns in 2-D, 3 in 3-D.
V- Volume of the hull (area in 2-D).
Example
Faces and volume of a tetrahedron
P = [0 0 0; 1 0 0; 0 1 0; 0 0 1];
[H, V] = convhulln(P)
Output
H = 4×3
2 3 1
3 4 1
4 2 1
4 3 2
V = 0.1667