MERGECOPLANARFACES Merge coplanar faces of a polyhedral mesh.

   [NODES, FACES] = mergeCoplanarFaces(NODES, FACES)
   [NODES, EDGES, FACES] = mergeCoplanarFaces(NODES, EDGES, FACES)
   NODES is a set of 3D points (as a nNodes-by-3 array), 
   and FACES is one of:
   - a nFaces-by-X array containing vertex indices of each face, with each
   face having the same number of vertices,
   - a nFaces-by-1 cell array, each cell containing indices of a face.
   The function groups faces which are coplanar and contiguous, resulting
   in a "lighter" mesh. This can be useful for visualizing binary 3D
   images for example.

   FACES = mergeCoplanarFaces(..., PRECISION)
   Adjust the threshold for deciding if two faces are coplanar or
   parallel. Default value is 1e-5.

   Example
   [v, e, f] = createCube;
   figure; drawMesh(v, f); view(3); axis equal;
   [v2, f2] = mergeCoplanarFaces(v, f);
   figure; drawMesh(v2, f2); 
   view(3); axis equal; view(3);

   See also
     meshes3d, drawMesh, minConvexHull, triangulateFaces

Package: matgeom