2.0.0 • Published 9 months ago
geom-edges v2.0.0
geom-edges
Computes unique edges for a list of faces.
Installation
npm install geom-edges
Usage
import computeEdges from "geom-edges";
const faces = [[0, 1, 2, 3], [3, 2, 5, 4], ...];
const edges = computeEdges(faces); // [[0, 1], [1, 2], ...]
API
computeEdges(faces): edges
Parameters
- faces:
TypedArray | Array | Array<[x, y, z]>
– list of face indicesnew Array([a, b, c, d], [a, b, c, d], ...)
Note: if faces is a TypedArray (eg. new Uint32Array([a, b, c, a, b, c, ...]
) or a flat array of positions (eg. new Array(a, b, c, a, b, c, ...)
), we assumes faces are triangles.
Returns
- edges:
Array<[a, b]>
– list of edges (new Array([a, b], [b, c], [c, d], ...)
)
License
MIT. See license file.