gt

geom-triangulate

Splits quad or polygon faces into triangles

Showing:

Popularity

Downloads/wk

3

GitHub Stars

7

Maintenance

Last Commit

6yrs ago

Contributors

0

Package

Dependencies

1

Size (min+gzip)

0.8KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

geom-triangulate

stable

Splits quad or polygon faces into triangles.

Implemented using naive face triangulation - builds a triangle fan anchored at the first face vertex.

Usage

NPM

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.

Example

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], ...]

License

MIT, see LICENSE.md for details.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100