Skip to main content

Crate spatial6

Crate spatial6 

Source
Expand description

Backend-agnostic spatial vectors, motion subspaces, transforms, and inertias.

The default builtin feature uses fixed Rust arrays. Disable default features to provide your own SpatialRepresentation, or enable nalgebra and/or glam to use Nalgebra and Glam as the second public type parameter, for example MotionVector<f64, Nalgebra>.

The library source is always no_std. The default std feature forwards std support to enabled numeric dependencies. Disable defaults for bare-metal use; floating-point fallback support is enabled automatically. With supplied backends and f32/f64, verified operations require no global allocator. Custom implementations and serialization adapters control their own resource requirements. This crate provides no panic handler or panic-free guarantee.

Fixed-storage motion/force pairing with the builtin feature:

use spatial6::{Builtin, ForceVector, MotionVector};

let motion = MotionVector::<f64, Builtin>::new([0.0, 0.0, 1.0], [2.0, 0.0, 0.0]);
let force = ForceVector::<f64, Builtin>::new([0.0, 0.0, 3.0], [4.0, 0.0, 0.0]);
assert_eq!(motion.dot(&force), 11.0);

Structs§

ArticulatedBodyInertia
A finite symmetric six-by-six spatial operator stored as its twenty-one upper-triangular components in row-major order.
Builtin
Uses fixed-size Rust arrays for all vector, matrix, and rotation storage: [T; 3] for Vector3, [T; 6] for Vector6, [[T; 3]; 3] for Matrix3 and Rotation3, and [[T; 6]; 6] for Matrix6.
ForceVector
A Plücker force vector, with moment coordinates before force coordinates.
Glam
Uses glam Vec3/DVec3 for Vector3 and Mat3/DMat3 for both Matrix3 and Rotation3 (glam has no dedicated rotation type); Vector6 and Matrix6 remain Rust arrays because glam has no 6D types.
MotionSubspace
A fixed-size motion subspace whose columns are spatial motion vectors.
MotionVector
A Plücker motion vector, with angular coordinates before linear coordinates.
Nalgebra
Uses nalgebra’s statically sized types as backend storage: Vector3<T> for Vector3, SVector<T, 6> for Vector6, Matrix3<T> for Matrix3, SMatrix<T, 6, 6> for Matrix6, and Rotation3<T> for Rotation3.
RigidBodyInertia
A rigid-body spatial inertia stored as ten scalar parameters: mass, center of mass, and the six independent components of the rotational inertia about the center of mass. Also available under its usual name, SpatialInertia.
SpatialTransform
A compact spatial coordinate transform from a source frame to a destination frame.

Enums§

InertiaError
Errors returned when constructing or operating on an inertia.

Traits§

SpatialRepresentation
Maps semantic spatial arrays to backend-specific storage.
SpatialScalar
A scalar type supported by spatial vector and matrix operations.

Type Aliases§

SpatialCoordinates
The six coordinates used by spatial motion and force vectors.
SpatialInertia
The usual name for RigidBodyInertia.
SpatialMatrix
A 6x6 spatial matrix.