feat(units): typed quaternion rotation siblings + LengthVec3::direction #42

Merged
patman merged 1 commit from patman/uom-rotation-direction into main 2026-07-09 23:11:50 +00:00
Owner

What this does

  • Extracts the quaternion rotation formula (v + 2w(u×v) + 2u×(u×v)) into one private rotate_si3([f64;3]) -> [f64;3]; rotate_vec3 and the new typed siblings are thin wrappers over it (formula now lives in exactly one place).
  • Adds typed free-vector rotations: rotate_velocity, rotate_acceleration, rotate_jerk, rotate_angular_velocity — each documented free-vector-rotation only (point velocities on a rotating body pick up an ω × r term these do NOT add; that reference-point change is deferred to the frame-tagged milestone).
  • Adds LengthVec3::direction() -> ([f64;3] unit, Length) and refactors Stewart leg_axes/leg_jacobian normalization onto it.

Verification

buck2 test //common:common-tests102 passed (7 new). Stewart FD proptests + leg_axes_are_unit_length pass unchanged (behavior-preserving). Adversarial review confirmed the rotation extraction is verbatim and the Stewart singular-leg guard is preserved (high confidence). No transform.rs drift.

Notes for review

  • rotate_twist/rotate_spatial_* are deferred (they need the reference-point distinction the frame-tagged types will enforce).
  • The typed rotate_* siblings are forward-prep — no first-stack consumer yet; prune if you prefer consumer-gating strictly.

Stack position

PR 2 → base #41 (SI seam). Night-session build; see docs/superpowers/cam-typed-layer-design.md.

## What this does - Extracts the quaternion rotation formula (`v + 2w(u×v) + 2u×(u×v)`) into one private `rotate_si3([f64;3]) -> [f64;3]`; `rotate_vec3` and the new typed siblings are thin wrappers over it (formula now lives in exactly one place). - Adds typed free-vector rotations: `rotate_velocity`, `rotate_acceleration`, `rotate_jerk`, `rotate_angular_velocity` — each documented **free-vector-rotation only** (point velocities on a rotating body pick up an `ω × r` term these do NOT add; that reference-point change is deferred to the frame-tagged milestone). - Adds `LengthVec3::direction() -> ([f64;3] unit, Length)` and refactors Stewart `leg_axes`/`leg_jacobian` normalization onto it. ## Verification `buck2 test //common:common-tests` → **102 passed** (7 new). Stewart FD proptests + `leg_axes_are_unit_length` pass unchanged (behavior-preserving). Adversarial review confirmed the rotation extraction is verbatim and the Stewart singular-leg guard is preserved (high confidence). No `transform.rs` drift. ## Notes for review - `rotate_twist`/`rotate_spatial_*` are deferred (they need the reference-point distinction the frame-tagged types will enforce). - The typed `rotate_*` siblings are forward-prep — no first-stack consumer yet; prune if you prefer consumer-gating strictly. ## Stack position PR 2 → base #41 (SI seam). Night-session build; see `docs/superpowers/cam-typed-layer-design.md`.
Extract the quaternion rotation formula into one private rotate_si3 core and add
thin typed wrappers (rotate_velocity/acceleration/jerk/angular_velocity), each
documented free-vector-rotation-only. Add LengthVec3::direction -> (unit [f64;3],
Length) and refactor Stewart leg-axis normalization onto it (behavior-preserving).

Co-authored-by: patman-assist <patrick-ai@kgroo.co>
patman changed target branch from patman/uom-si-seam to main 2026-07-09 23:11:49 +00:00
patman merged commit da21931766 into main 2026-07-09 23:11:50 +00:00
Sign in to join this conversation.
No description provided.