spatial_math/
lib.rs

1// Copyright (C) 2020-2025 spatial-math authors. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#![doc = include_str!("../README.md")]
16#![deny(warnings)]
17#![warn(clippy::pedantic)]
18#![allow(clippy::module_name_repetitions)]
19#![allow(clippy::must_use_candidate)]
20
21pub extern crate nalgebra as na;
22
23// Internal modules
24mod alias;
25mod matrix;
26mod spatial_inertia;
27mod spatial_vec;
28mod traits;
29mod transform;
30
31// Public modules
32pub mod exts;
33
34// Re-export core types and traits
35pub use alias::*;
36pub use matrix::SymmetricMat3;
37pub use spatial_inertia::{ArticulatedBodyInertia, RigidBodyInertia};
38pub use spatial_vec::{SpatialForceVector, SpatialMotionVector, SpatialVector};
39pub use traits::SpatialVec;
40pub use transform::{PluckerTransform, PlukerRotation, Pose};
41
42#[cfg(feature = "f64")]
43mod real {
44    pub type Real = f64;
45    pub const PI: Real = std::f64::consts::PI;
46    pub const FRAC_PI_2: Real = std::f64::consts::FRAC_PI_2;
47}
48
49#[cfg(not(feature = "f64"))]
50mod real {
51    pub type Real = f32;
52    pub const PI: Real = std::f32::consts::PI;
53    pub const FRAC_PI_2: Real = std::f32::consts::FRAC_PI_2;
54}
55
56pub use real::*;