Auto-fix for GEOMETRY_DUPLICATE_INDICES — rewrites
geom.indices keeping only the first occurrence of each
triangle (canonical key = sorted vertex tuple, so any rotation
or winding of the same vertex set collapses).
Doesn't touch vertex arrays — duplicate indices waste
traversal / overdraw, not vertex storage. If the dropped
triangles' vertices become unreferenced, the matching
compactUnusedVertices cleans those up on a separate
pass.
Degenerate triangles (any pair of repeated indices) are kept
as-is — they're handled by dropDegenerateTriangles.
Idempotent: returns {fixed: false} when no triangle's
canonical key is seen twice.
Auto-fix for
GEOMETRY_DUPLICATE_INDICES— rewritesgeom.indiceskeeping only the first occurrence of each triangle (canonical key = sorted vertex tuple, so any rotation or winding of the same vertex set collapses).Doesn't touch vertex arrays — duplicate indices waste traversal / overdraw, not vertex storage. If the dropped triangles' vertices become unreferenced, the matching compactUnusedVertices cleans those up on a separate pass.
Degenerate triangles (any pair of repeated indices) are kept as-is — they're handled by dropDegenerateTriangles.
Idempotent: returns
{fixed: false}when no triangle's canonical key is seen twice.