Computes unique edges for a list of faces.
npm install geom-edges
import computeEdges from "geom-edges";
const faces = [[0, 1, 2, 3], [3, 2, 5, 4], ...];
const edges = computeEdges(faces); // [[0, 1], [1, 2], ...]
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], ...)
)
MIT. See license file.