Variable mergeSimilarGeometriesConst

mergeSimilarGeometries: Fix = ...

Auto-fix for GEOMETRY_SIMILAR.

For each similar geometry in issue.context.similar, computes the rigid transform T : similarLocal → canonicalLocal via Kabsch / Horn's quaternion method on the dequantized vertex positions, then bakes T⁻¹ into each referencing mesh's matrix and repoints the mesh at the canonical geometry — so the world placement of every transformed mesh is preserved while the scene now stores a single canonical copy of the shape.

Best-effort under same-vertex-order assumption. Kabsch needs a vertex correspondence; this fix uses positional correspondence by index (vertex k of similar pairs with vertex k of canonical). That holds for the common case (templated exporters that emit byte-different but order-preserved instances) but not when the loader has reordered vertices. Geometries whose fit residual exceeds the tolerance gate are skipped — left in place rather than silently mis-aligned.

Constraints:

  • A similar geometry whose meshes did not all redirect (because its fit failed the residual gate, say) is left in place rather than destroyed mid-bind.