Expand description
The IFC Z-up to WebGL Y-up frame, defined once.
S maps (x, y, z) to (x, z, -y); a proper rotation (det +1), so
S⁻¹ = Sᵀ maps (x, y, z) to (x, -z, y).
- Points and vectors swap components. The swap never folds the sign of
zero:
-yof+0.0is-0.0, in every copy on main. - Boxes reverse min/max on the negated axis (
aabb_zup_to_yup). - Matrices are conjugated,
M' = S·M·Sᵀ. Conjugating by a signed permutation moves each entry toM'[r][c] = s(r)·s(c)·M[p(r)][p(c)], so it is done as exactly that, with+ 0.0folding the sign of zero. For every finite input this is bit-equal to theS·M·Sᵀmatmul (each matmul output is0.0 + .. + (±m), which is±mwith every zero positive). It is storage-agnostic: conjugation commutes with transposition, so it applies to row- and column-major arrays alike. A non-finite entry stays in its own slot instead of spreadingNaNacross a row.
Constants§
- YUP_
TO_ ZUP Sᵀ.- ZUP_
TO_ YUP Sas a row-major 4x4 (linear part only).
Functions§
- aabb_
zup_ to_ yup - Swap an AABB
[minx, miny, minz, maxx, maxy, maxz]from Z-up to Y-up. Swappingmin/maxper component is WRONG: negating Y flips which corner is the min along the new Z, so the new Z range is[-maxY, -minY]. - conjugate3_
zup_ to_ yup conjugate_zup_to_yupfor a 3x3 rotation.- conjugate_
yup_ to_ zup Sᵀ·M·S, the inverse ofconjugate_zup_to_yup.- conjugate_
zup_ to_ yup S·M·Sᵀfor a Z-up matrix, as a signed permutation (see the module docs).- yup_
to_ zup (x, y, z)to(x, -z, y), the inverse ofzup_to_yup.- zup_
to_ yup (x, y, z)to(x, z, -y). Generic so f32 vertex buffers and f64 origins share it; it monomorphises in the caller and always inlines.- zup_
to_ yup_ in_ place zup_to_yupover a flatx, y, z, ...buffer. Only complete triplets are rewritten; a 1-2 float tail is left alone.