Expand description
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, is
#![no_std] and allocator-free (stack-allocated fixed-size storage), and
carries no nalgebra dependency (matching the workspace license policy,
ADR-0007). It exists to fill the spatial-algebra gap in-house.
§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)]: a motion vectorv = (ω, v)and a force/wrenchf = (n, f)(moment, force). - Spatial cross product follows Featherstone’s
crm/crfoperators (seeSpatialVector::crossand friends); the result kind is determined by the operand kinds (motion⊗motion→motion, motion⊗force→force, force⊗motion→force, force⊗force→motion). - Screw exponential
expmaps a twist(ω, v) ∈ se(3)to anIsometry3;logis its inverse. The convention is the standard Lynch–Parkse(3)exponential with an active, right-handed rotation. - Dual quaternions are Hamilton quaternions
q + ε·qₑrepresenting a rigid transform (rotation quaternion + half the translation quaternion pre-multiplied by the rotation).
§Examples
use tpt_math_spatial::{MotionVector, Screw};
use tpt_math_geometry::{Isometry3, Rotation3, Translation};
use tpt_math_linalg_fixed::Vector3;
// A 90° active rotation about +Z.
let rot = Rotation3::from_axis_angle(&Vector3::new([0.0_f64, 0.0, 1.0]), std::f64::consts::FRAC_PI_2);
let iso = Isometry3::new(Translation::new(Vector3::new([0.0, 0.0, 0.0])), rot);
// A pure-linear motion (1,0,0): after the rotation its linear part is (0,1,0).
let m = MotionVector::new(Vector3::new([0.0, 0.0, 0.0]), Vector3::new([1.0, 0.0, 0.0]));
let m2 = m.transform_by(&iso);
assert!((m2.linear().x()).abs() < 1e-12);
assert!((m2.linear().y() - 1.0).abs() < 1e-12);
// A screw twist exponentiates to the same isometry.
let screw = Screw::new(Vector3::new([0.0, 0.0, std::f64::consts::FRAC_PI_2]), Vector3::new([0.0, 0.0, 0.0]));
let iso2 = screw.exp();
assert!((iso2.rotation.matrix().data[0][1] - (-1.0)).abs() < 1e-12);Structs§
- Dual
Quaternion - A dual quaternion
q = real + ε·dual, each part a HamiltonQuaternion(wlast). A unit dual quaternion represents a rigid transform (rotation + translation) with no scaling. - Force
- Marker type for force-type spatial vectors (wrenches: moment + force).
- Motion
- Marker type for motion-type spatial vectors (velocities, accelerations).
- Screw
- A screw (twist) in
se(3), stored as the 6-D spatial motion vector(ω, v)whereωis the angular part (rotation axis × angle) andvis the linear part. - Spatial
Vector - A 6-D spatial vector
v = [angular (top 3); linear (bottom 3)], tagged byK ∈ {Motion,Force}to control cross-product and transform semantics (Featherstone’scrm/crfoperators).
Functions§
- adjoint_
force - The force adjoint
Ad_X*of an isometry(R, t): - adjoint_
motion - The motion adjoint
Ad_Xof an isometry(R, t):
Type Aliases§
- Force
Vector - A force / wrench spatial vector
(n, f). - Matrix6
- A
6 × 6matrix (fixed-size, row-major). - Motion
Vector - A motion spatial vector
(ω, v).