pub fn collate_refs(
meshes: &[InstanceMeshRef<'_>],
min_group: usize,
rtc: [f64; 3],
) -> CollatedExpand description
Group instanceable meshes by representation identity into templates +
per-instance transforms. min_group is the smallest occurrence count worth
instancing (groups below it are emitted flat); use 2 to instance any repeat.
rtc is the model RTC offset (InstanceMeta.transform is documented pre-RTC
at georeferenced magnitude, while each mesh’s baked origin is post-RTC and
small). The per-occurrence relative transform is computed in the post-RTC
frame: on raw absolute placements rel = m_k · m_ref⁻¹ lets a rotated
occurrence’s translation reach T_k − R_rel·T_ref ≈ 2× rtc (the two ~1e6 m
terms add instead of cancel), which then places the occurrence at twice the
georeference and collapses f32 GLB exports. Reducing both transforms by rtc
first keeps rel.translation at building scale and consistent with the small
template origin.
InstanceMeta.transform (hence rel) is native-frame (IFC Z-up); positions
must share that frame — see collate_refs_in_basis otherwise.