rs-math3d
rs-math3d is a no_std-friendly 2D/3D math library focused on computer graphics and geometry. It provides vectors, matrices, quaternions, transforms, and common geometric primitives with utility traits for intersection and distance queries.
Features
- Vector math (2D/3D/4D), dot/cross products, swizzles, and float-only normalization helpers
- Matrix math (2x2/3x3/4x4), determinants, and float-only inverses and affine fast-paths
- Quaternions and transforms for floating-point rotations and projections
- Geometric primitives: rays, planes, triangles, boxes, spheres, line segments
- Query traits for intersection and distance computations
no_stdsupport with an optionalstdfeature
Integer vectors, boxes, rectangles, and matrix arithmetic are supported for discrete geometry
and storage. Operations that require fractional results, such as normalization, inversion,
quaternions, transforms, rays, planes, and geometric queries, are restricted to f32/f64.
Usage
Add to Cargo.toml:
[]
= { = "0.10", = false }
Select one math backend:
= { = "0.10", = false, = ["std"] }
= { = "0.10", = false, = ["libm"] }
= { = "0.10", = false, = ["system-libm"] }
When no math backend feature is selected, normal library builds fall back to system-libm.
Test builds without an explicit backend use std.
If more than one backend feature is enabled, precedence is std, then libm, then
system-libm.
Example
use Vector3;
use transforms;
use EPS_F32;
use PI;
Modules
- vector: vector types and operations
- matrix: matrix types and operations
- quaternion: quaternion math for rotations
- transforms: common 3D transforms
- primitives: geometric shapes and intersection helpers
- queries: query traits and implementations
- basis: coordinate system basis helpers
- scalar: scalar traits and constants