tpt-math-spatial
In-house (no external-crate) spatial kinematics for the tpt-math substrate:
Featherstone 6-D spatial vectors, Plücker / adjoint transforms, dual quaternions
and screw theory (exponential / logarithmic maps).
Everything is built on tpt-math-geometry
(Isometry3, Quaternion, UnitQuaternion, …) and
tpt-math-linalg-fixed. It is #![no_std] and
allocator-free (stack-allocated fixed-size storage), and carries no nalgebra
dependency, matching the workspace license policy (ADR-0007).
Why in-house? (ADR-0007)
The obvious off-the-shelf choice, spatial-math, ships under a non-MIT/Apache
"Custom license" and does not cover dual quaternions / screw theory anyway.
This crate re-implements the combined scope in-repo against the existing
fixed-size linear-algebra and geometry backends, so there is no license
exposure.
Implemented primitives
- Spatial (6-D) vectors —
MotionVector/ForceVector(theSpatialVector<K>family) with Featherstone'scrm/crfcross products, tagged by a kind marker so the result kind is type-checked at compile time. - Adjoint (Plücker) transforms —
adjoint_motion/adjoint_forceover anIsometry3, plustransform_byon the spatial vectors. - Dual quaternions —
DualQuaternionwith Hamilton product, conjugate, normalisation, and rigid-transform conversion (from_isometry/to_isometry). - Screw theory —
Screw(a twist inse(3)) with the exponential/logarithm mapsexp/logto and fromIsometry3.
Conventions (stated explicitly)
- Active (alibi) rotations — a transform acts on a vector
vasR * v; the point/vector is rotated, not the coordinate frame. - Column vectors — transformations apply as
M * v. - Right-handed coordinates — positive angle about
+zrotatesx → y;x × y = z. - Spatial (6-D) vectors are stored
[angular (top 3); linear (bottom 3)]. - Screw exponential follows the standard Lynch–Park
se(3)exponential with an active, right-handed rotation.
Example
use ;
use ;
use Vector3;
// A 90° active rotation about +Z.
let rot = from_axis_angle;
let iso = new;
// A pure-linear motion (1,0,0): after the rotation its linear part is (0,1,0).
let m = new;
let m2 = m.transform_by;
assert!;
assert!;
// A screw twist exponentiates to the same isometry.
let screw = new;
let iso2 = screw.exp;
assert!;
License
Licensed under either of MIT or Apache-2.0 at your option.