Expand description
Rotation-aware instancing, shared by both Parquet transports (issues #3575, #3888).
The ONE place that groups occurrences by representation identity, verifies
each occurrence’s derived rigid placement against its own baked geometry,
and converts a verified placement into the Y-up origin + rotation a table
emits. Split out of parquet_optimized.rs when it was /optimized-only;
a sibling of both writers since the flat route started sharing shapes, so
the module neither transport owns is not named after either of them.
Structs§
- Mesh
Geometry 🔒Key - Content-hash fallback used by BOTH writers:
collate_rotation_aware_placementsruns first, this catches what it did not place. Two meshes with bit-identical (origin-relative) positions, indices AND normals collapse onto one shape. - Rotated
Placement 🔒 - A verified rotation-aware placement for one occurrence: which unique mesh (identified by the index of its TEMPLATE occurrence in the input slice) it draws, and the origin/rotation (Z-up, pre-Y-up-swap) that places it there.
Constants§
- IDENTITY_
ROTATION 🔒 - P_
ZUP_ 🔒TO_ YUP - Z-up → Y-up basis change (see
services::axis::zup_to_yup), as a rotation matrix:P * v = (v.x, v.z, -v.y). Orthogonal, soP^-1 == P^T. - P_
ZUP_ 🔒TO_ YUP_ T - RECOMPOSITION_
TOLERANCE_ 🔒M - Maximum reconstructed-vertex residual (metres) a rotation-aware instance
placement may carry and still be trusted (issue #3575). Compared against
the ORIGINAL f32/f64 positions, before quantization, so it is independent
of
VERTEX_MULTIPLIER.
Functions§
- apply_
r_ 🔒t - Row-major 3x3 apply:
R * p + t. - baked_
basis_ 🔒zup - The frame this route’s baked vertices are in, relative to the native frame
MeshData::instancedescribes:Rᵀ · T(-rtc), read straight off theProcessingResultbyifc_lite_processing::native_to_baked. - collate_
rotation_ 🔒aware_ placements - Group instanceable meshes by representation identity (
collate_refs) and verify each occurrence’s derived rigid placement against its own baked geometry (issue #3575). Returns a map from a mesh’s index inmeshesto the verified placement it should be emitted with; a mesh absent from the map falls back to the pre-#3575 content-hash dedup inparquet_optimized.rs. Verification is all-or-nothing per group: one occurrence over tolerance drops the ENTIRE representation group from the map, not just that occurrence, so a group never ships half-instanced. - hash_
f32_ 🔒slice - Compute a fast hash of a f32 slice (using bit representation).
- hash_
u32_ 🔒slice - Compute a fast hash of a u32 slice.
- mat3_
mul 🔒 - mesh_
geometry_ 🔒key - Build the content-hash key for one mesh’s (origin-relative) geometry.
- optimized_
wire_ 🔒version - The optimized format’s wire version, chosen by what the payload CONTAINS.
- rotation_
zup_ 🔒to_ yup - Conjugate a Z-up rotation into the Y-up wire frame:
P * R * P^T. The swap is linear (zup_to_yup), so this is the same identitymesh_to_yup_in_placerelies on for positions/origin, applied to a 3x3 instead of a 3-vector. - verify_
and_ 🔒derive_ placement - Given
rel(row-major mat4, theInstanceOccurrence::transformthat maps the TEMPLATE’s baked world geometry onto this occurrence’s baked world geometry — seeifc_lite_geometry::instancing), derive this occurrence’s origin + rotation and verify them against the occurrence’s OWN (ground truth) baked positions. Returns(max_residual_m, origin_zup, rotation_zup); the caller must reject the placement when the residual exceedsRECOMPOSITION_TOLERANCE_Mor is non-finite (mismatched vertex counts).