box3d_rust/math_functions/mod.rs
1//! Vectors, quaternions, transforms, and deterministic scalar math.
2//!
3//! Core types ([`Vec3`], [`Quat`], [`Pos`], [`Transform`], [`Aabb`], …) and the
4//! hand-rolled trig used for cross-platform determinism. Many of these are
5//! re-exported at the crate root (`box3d_rust::Vec3`, `Pos`, …).
6//!
7//! With the `double-precision` feature, [`Pos`] (and related world-space
8//! scalars) widen to match `BOX3D_DOUBLE_PRECISION`; collision math stays `f32`.
9//!
10//! Port of `include/box3d/math_functions.h` and `src/math_functions.c`.
11//! Submodules form one flat namespace via re-exports here.
12//!
13//! SPDX-FileCopyrightText: 2025 Erin Catto
14//! SPDX-License-Identifier: MIT
15
16// Float literals are written with the exact digits of the C source, and Pos math casts
17// through PosScalar so the same expression compiles in both precision modes (the cast is
18// a no-op in single precision). These allows cascade into the submodules below.
19#![allow(clippy::excessive_precision)]
20#![allow(clippy::unnecessary_cast)]
21
22mod internal;
23mod matrix;
24mod quat;
25mod query;
26mod ray_triangle;
27mod scalar;
28mod transform;
29mod types;
30mod validate;
31mod vector;
32
33pub use internal::*;
34pub use matrix::*;
35pub use quat::*;
36pub use query::*;
37pub use ray_triangle::{
38 intersect_ray_triangle, test_bounds_overlap, test_bounds_ray_overlap,
39 test_bounds_triangle_overlap,
40};
41pub use scalar::*;
42pub use transform::*;
43pub use types::*;
44pub use validate::*;
45pub use vector::*;