MINCONVEXHULL Return the unique minimal convex hull of a set of 3D points.
FACES = minConvexHull(PTS)
NODES is a set of 3D points (as a Nx3 array). The function computes
the convex hull, and merge contiguous coplanar faces. The result is a
set of polygonal faces, such that there are no coplanar faces.
FACES is a cell array, each cell containing the vector of indices of
nodes given in NODES for the corresponding face.
FACES = minConvexHull(PTS, PRECISION)
Adjust the threshold for deciding if two faces are coplanar or
parallel. Default value is 1e-14.
Example
% extract square faces from a cube
[n, e, f] = createCube;
f2 = minConvexHull(n);
drawMesh(n, f2);
% Subdivides and smooths a mesh rpresenting a cube
[n, e, f] = createCube;
[n2, f2] = subdivideMesh(n, triangulateFaces(f), 4);
[n3, f3] = smoothMesh(n2, f2);
figure; drawMesh(n3, f3);
axis equal; view(3);
% merge coplanar faces, making apparent the faces of the original cube
f4 = minConvexHull(n3);
figure; drawMesh(n3, f4);
axis equal; view(3);
See also
meshes3d, mergeCoplanarFaces, drawMesh, convhull, convhulln
Package: matgeom