Compute the polygons resulting from plane-mesh intersection. POLYS = intersectPlaneMesh(P, V, F) Computes the interection between a plane and a mesh given by vertex and face lists. The result is a cell array of polygons. The function currently returns at most one polygon in the cell array POLYS. Example % Intersect a cube by a plane [v f] = createCube; v = v * 10; plane = createPlane([5 5 5], [3 4 5]); % draw the primitives figure; hold on; set(gcf, 'renderer', 'opengl'); axis([-10 20 -10 20 -10 20]); view(3); drawMesh(v, f); drawPlane3d(plane); % compute intersection polygon polys = intersectPlaneMesh(plane, v, f); drawPolygon3d(polys, 'LineWidth', 2); % Intersect a torus by a set of planes, and draw the results % first creates a torus slightly shifted and rotated torus = [.5 .6 .7 30 10 3 4]; figure; drawTorus(torus, 'nTheta', 180, 'nPhi', 180); hold on; view (3); axis equal; light; % convert to mesh representation [v, f] = torusMesh(torus, 'nTheta', 64, 'nPhi', 64); % compute intersections with collection of planes xList = -50:5:50; polySet = cell(length(xList), 1); for i = 1:length(xList) x0 = xList(i); plane = createPlane([x0 .5 .5], [1 .2 .3]); polySet{i} = intersectPlaneMesh2(plane, v, f); end % draw the resulting 3D polygons drawPolygon3d(polySet, 'lineWidth', 2, 'color', 'k') See also meshes3d, intersectPlanes, intersectEdgePlane
Package: matgeom