feat(units): typed vector MulDt/DivDt + dimension-checked advance_rigid_body #43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "patman/uom-typed-integrator"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this does
Extends the existing
MulDt/DivDttraits to the*Vec3boundary types (raw-SI compute, not routed through thedimcurrency /AngleKind— critique C8), so the jerk-constant polynomial integration becomes dimension-checked:jerk.mul_dt(dt)steps up the integral chain (m/s³ → m/s² → m/s → m), and the wrong chain would not type-check. Then rewritesadvance_linear_vec3and the angular-rate (ω, α) update inadvance_rigid_bodyusing them.The quaternion-exp Lie step stays raw f64 (Ring 3) — byte-for-byte unchanged. The angular
mul_dtchain stops atAngularVelocityVec3(noAngleVec3; finite rotations live on SO(3) via the quaternion).Verification
buck2 test //common:common-tests→ 107 passed (5 new vector-op tests). All existing integrator proptests pass unchanged (rigid_body_bisected_matches_single_step,..._forward_then_backward_...,..._pure_rotation_..., etc.) — the behavior-preserving gate. Two independent adversarial reviews approved (high confidence).⚠️ Decision point — floating-point rounding
The
mul_dtchain reassociates the polynomial products (e.g.((j·t)·t)·0.5vs the old(0.5·j)·(t·t)). It is algebraically exact and withinapprox_eqtolerance, but not bit-identical to the previous grouping (measured ≤4 ULP on random inputs). The new code is fully deterministic run-to-run; the only difference is vs the prior grouping. For a pre-release system with no frozen baselines this is almost certainly fine, but flagging it since KGROO values determinism (digital-twin recordings / cross-platform). If bit-exact preservation is wanted, I can match the original product grouping (at the cost of the elegantmul_dtexpression) — say the word.Hot-path note (C10)
Vector ops use only the
constSI accessors (as_meters/as_rad_per_sfamily viato_si_3), never CNC-unit readouts (runtime uom multiplies). A codegen/bench confirmation that the typed step inlines to the hand-written arithmetic is the one remaining gate item I could not run under buck2 tonight (trybuild-style/cargo-asm); recommend a quick bench before relying on it in the 1 kHz loop.Stack position
PR 3 → base #42. Night-session build; see
docs/superpowers/cam-typed-layer-design.md.