Module parquet_instancing

Module parquet_instancing 

Source
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§

MeshGeometryKey 🔒
Content-hash fallback used by BOTH writers: collate_rotation_aware_placements runs first, this catches what it did not place. Two meshes with bit-identical (origin-relative) positions, indices AND normals collapse onto one shape.
RotatedPlacement 🔒
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, so P^-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::instance describes: Rᵀ · T(-rtc), read straight off the ProcessingResult by ifc_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 in meshes to the verified placement it should be emitted with; a mesh absent from the map falls back to the pre-#3575 content-hash dedup in parquet_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 identity mesh_to_yup_in_place relies on for positions/origin, applied to a 3x3 instead of a 3-vector.
verify_and_derive_placement 🔒
Given rel (row-major mat4, the InstanceOccurrence::transform that maps the TEMPLATE’s baked world geometry onto this occurrence’s baked world geometry — see ifc_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 exceeds RECOMPOSITION_TOLERANCE_M or is non-finite (mismatched vertex counts).