spatial6
Backend-agnostic 6D spatial vectors, transforms, and inertias for rigid-body dynamics. Spatial coordinates store angular components before linear components.
[]
= "1.1"
The crate provides MotionVector, ForceVector, SpatialTransform,
RigidBodyInertia, and ArticulatedBodyInertia.
| Feature | Backend |
|---|---|
builtin (default) |
Fixed Rust arrays |
nalgebra |
Native nalgebra vectors and matrices |
glam |
Native glam vectors and matrices |
serde |
Serialize/Deserialize for all public types |
| No default features | User-defined SpatialRepresentation |
Enable optional backends with features = ["nalgebra"] or features = ["glam"].
Enable features = ["serde"] for serialization support; combined with nalgebra
or glam, it also enables that backend's own serde integration so the
underlying vector/matrix types serialize too.
See the API documentation for usage and conventions,
and examples/ for worked algorithms built on these types:
composite rigid-body inertia, inverse dynamics via the Recursive Newton-Euler
Algorithm, and articulated-body inertia. Each of these three algorithms, plus
a minimal single-rigid-body case, is worked through all three backends in a
_nalgebra/_glam-suffixed sibling file (_builtin/no suffix is the
default), so switching backends can be seen changing only the storage type,
never the answer:
to_pose_parts() returns the local-to-reference rotation Q and the local
origin's position p in reference coordinates. Use from_pose_parts() to
rebuild a transform from those owned parts; the stored transform rotation and
translation remain the source-to-destination E/r representation.
let = transform.to_pose_parts;
let restored = from_pose_parts;
ArticulatedBodyInertia represents the current articulated inertia, including
the reduced symmetric operator produced by eliminating a joint acceleration
under a specified joint force. The core reduction uses only backend-agnostic
public operations:
let full = try_from?;
let u = full.apply;
let d = joint_motion.dot;
assert!;
let reduced = full.try_rank_one_updated?;
let child_in_parent = reduced.try_transformed?;
let accumulated = parent.try_combined?;
The aba_builtin example is a minimal fixed-base serial-chain ABA
forward-dynamics walkthrough using the public ArticulatedBodyInertia API.
Contributing
Install Rust (stable, including rustfmt and Clippy) and uv, then run:
Before submitting a change, run the same checks CI runs (which treats rustdoc warnings as errors):
License
Copyright 2026 Daisuke Nagao.
Licensed under either the MIT License or the
Apache License, Version 2.0, at your option
(MIT OR Apache-2.0). Copyright and SPDX license information is recorded in
Rust file headers.