Auto-fix for GEOMETRY_DEGENERATE_TRIANGLES — rewrites
geom.indices to drop every triangle that has repeated indices
or whose cross-product magnitude is below the area epsilon.
Touches indices only — vertex arrays
(positionsCompressed / normalsCompressed / uvsCompressed /
edgeIndices) are left intact, so geometries that survive the
filter still have a valid AABB and stable vertex slots. The
companion compactUnusedVertices can then sweep up any
vertex slots that became unused as a side-effect.
Idempotent: returns {fixed: false} when no triangles meet the
degenerate criterion. The geometry's indices field is mutated
in place via typed cast (the same pattern
addMissingUVs uses for uvsCompressed).
Auto-fix for
GEOMETRY_DEGENERATE_TRIANGLES— rewritesgeom.indicesto drop every triangle that has repeated indices or whose cross-product magnitude is below the area epsilon.Touches
indicesonly — vertex arrays (positionsCompressed/normalsCompressed/uvsCompressed/edgeIndices) are left intact, so geometries that survive the filter still have a valid AABB and stable vertex slots. The companion compactUnusedVertices can then sweep up any vertex slots that became unused as a side-effect.Idempotent: returns
{fixed: false}when no triangles meet the degenerate criterion. The geometry'sindicesfield is mutated in place via typed cast (the same pattern addMissingUVs uses foruvsCompressed).