CLIPCONVEXPOLYHEDRONHP Clip a convex polyhedron by a plane.

   [NODES2, FACES2] = clipConvexPolyhedronHP(NODES, FACES, PLANE)

   return the new (convex) polyhedron whose vertices are 'below' the
   specified plane, and with faces clipped accordingly. NODES2 contains
   clipped vertices and new created vertices, FACES2 contains references
   to NODES2 vertices.

   Example
     [N, F] = createCube;
     P = createPlane([.5 .5 .5], [1 1 1]);
     [N2, F2] = clipConvexPolyhedronHP(N, F, P);
     figure('color','w'); view(3); axis equal
     drawPolyhedron(N2, F2);
 
     [v, f] = createSoccerBall;
     p = createPlane([-.5 .5 -.5], [1 1 1]);
     [v2, f2] = clipConvexPolyhedronHP(v, f, p);
     figure('color','w'); view(3); axis equal
     drawMesh(v, f, 'faceColor', 'none');
     drawMesh(v2, f2);

   See also
     meshes3d, polyhedra, planes3d

Package: matgeom