TRIANGULATEFACES Convert face array to an array of triangular faces. TRI = triangulateFaces(FACES) Returns a 3-columns array of indices, based on the data stored in the argument FACES: - if FACES is a N-by-3 array, returns the same array - if FACES is a N-by-4 array, returns an array with 2*N rows and 3 columns, splitting each square into 2 triangles (uses first and third vertex of each square as diagonal). - if FACES is a cell array, split each face into a set of triangles, and returns the union of all triangles. Faces are assumed to be convex. [TRI INDS] = triangulateFaces(FACES) Also returns original face index of each new triangular face. INDS has the same number of rows as TRI, and has values between 1 and the number of rows of the original FACES array. Example % create a basic shape [n e f] = createCubeOctahedron; % draw with plain faces figure; drawMesh(n, f); % draw as a triangulation tri = triangulateFaces(f); figure; patch('vertices', n, 'faces', tri, 'facecolor', 'r'); See also meshes3d, drawMesh, mergeCoplanarFaces
Package: matgeom