glamx/
lib.rs

1//! # glamx - Extensions for glam
2//!
3//! This crate provides additional types and utilities for the `glam` math library:
4//!
5//! - [`Rot2`] / [`DRot2`]: 2D rotations represented as unit complex numbers
6//! - [`Rot3`] / [`DRot3`]: 3D rotations (re-exports of glam's quaternions)
7//! - [`Pose2`] / [`DPose2`]: 2D rigid body transformations (rotation + translation)
8//! - [`Pose3`] / [`DPose3`]: 3D rigid body transformations (rotation + translation)
9//! - [`MatExt`]: Extension traits for glam matrix types
10//! - [`SymmetricEigen2`] / [`SymmetricEigen3`]: Eigendecomposition for symmetric matrices
11//! - [`Svd2`] / [`Svd3`]: Singular Value Decomposition for 2x2 and 3x3 matrices
12//!
13//! ## Naming Convention
14//!
15//! Types without a prefix use `f32` precision, while types with a `D` prefix use `f64` precision:
16//! - `Rot2` (f32) / `DRot2` (f64)
17//! - `Pose2` (f32) / `DPose2` (f64)
18//! - `SymmetricEigen2` (f32) / `DSymmetricEigen2` (f64)
19//!
20//! ## Feature Flags
21//!
22//! - `std` (default): Enables standard library support
23//! - `serde`: Enables serialization support via serde
24//! - `bytemuck`: Enables bytemuck derive for Rot2/DRot2
25//! - `nalgebra`: Enables conversions to/from nalgebra types
26//! - `libm`: Uses libm for no_std math operations
27//!
28//! ## glam Re-exports
29//!
30//! This crate re-exports all of glam's types so you can use it as a drop-in replacement without
31//! an explicit dependency to `glam`.
32//! Alternatively, depending on your coding style preferences, you can use the `glam` re-export.
33
34#![no_std]
35
36#[cfg(feature = "std")]
37extern crate std;
38
39extern crate alloc;
40
41// Re-export approx for convenience
42#[cfg(feature = "approx")]
43pub use approx;
44/// Re-export of the glam crate.
45pub use glam;
46
47mod eigen2;
48mod eigen3;
49mod matrix_ext;
50mod pose2;
51mod pose3;
52mod rot2;
53mod rot3;
54mod svd2;
55mod svd3;
56
57pub use eigen2::{DSymmetricEigen2, SymmetricEigen2};
58pub use eigen3::{DSymmetricEigen3, SymmetricEigen3, SymmetricEigen3A};
59pub use glam::*;
60pub use matrix_ext::MatExt;
61pub use pose2::{DPose2, Pose2};
62pub use pose3::{DPose3, Pose3, Pose3A};
63pub use rot2::{DRot2, Rot2};
64pub use rot3::{DRot3, Rot3};
65pub use svd2::{DSvd2, Svd2};
66pub use svd3::{DSvd3, Svd3, Svd3A};
67
68/// Prelude module for convenient imports.
69///
70/// This module re-exports all public types and traits.
71pub mod prelude {
72    pub use crate::eigen2::{DSymmetricEigen2, SymmetricEigen2};
73    pub use crate::eigen3::{DSymmetricEigen3, SymmetricEigen3, SymmetricEigen3A};
74    pub use crate::matrix_ext::MatExt;
75    pub use crate::pose2::{DPose2, Pose2};
76    pub use crate::pose3::{DPose3, Pose3};
77    pub use crate::rot2::{DRot2, Rot2};
78    pub use crate::rot3::{DRot3, Rot3};
79    pub use crate::svd2::{DSvd2, Svd2};
80    pub use crate::svd3::{DSvd3, Svd3, Svd3A};
81}