Splits quad or polygon faces into triangles.
Implemented using naive face triangulation - builds a triangle fan anchored at the first face vertex.
triangulate(faces | geometry)
Parameters:
faces
- list of face indices e.g. [[0,1,2,3], [3,2,5,4],...]
geometry
- simplicial complex geometry { positions: [], cells: [] }
Returns:
If faces
is supplied a list of triangles will be returned.
If geometry
is supplied a new geometry with cloned positions and triangulated faces will be returned.
var triangulate = require('geom-triangulate');
var faces = [[0,1,2,3], [3,2,5,4],...];
var tris = triangulate(faces); //[[0,1,2], [0,2,3], ...]
MIT, see LICENSE.md for details.