tpt-math-geometry
A from-scratch, const-generic geometry module built on
tpt-math-linalg-fixed: points,
translations, rotations, unit quaternions, isometries, similarities, uniform
per-axis scaling, and the perspective / orthographic projection matrices.
It deliberately carries no nalgebra dependency and no allocator —
everything is stack-allocated fixed-size storage — so it can drop into any
no_std target. It exists because nalgebra (the usual home of this module)
is Apache-2.0-only and disqualified as a wrap target by the workspace license
policy (ADR-0007); it is built entirely in-house on tpt-math-linalg-fixed,
so it fills the gap with no external geometry/linear-algebra dependency.
Part of tpt-math
Part of tpt-math, the numeric
substrate for the TPT science / engineering / formal stack. It sits at the top
of the linear-algebra layer and depends only on tpt-math-linalg-fixed and
tpt-math-numeric.
Conventions (stated explicitly)
- Active (alibi) rotations — a rotation acts on a vector
vasR * v(matrix–vector product, vector on the right). - Column vectors — transformations apply as
M * v. - Right-handed coordinates — positive 2-D angle is counter-clockwise;
x × y = z. - Euler angles (3-D) use the intrinsic Tait–Bryan order
Rz(yaw) · Ry(pitch) · Rx(roll). - Hamilton quaternions
q = w + x i + y j + z k(scalarwlast). - Projection matrices are right-handed, look down
-z, NDC depth in[-1, 1](OpenGL-style). - Isometry composition
B * Ameans "applyA, thenB".
Quick start
[]
= "0.1"
use ;
use Vector3 as FVector3;
// Rotate 90° about Z, then translate by (1, 2, 3).
let iso = new;
let p = new;
let q = iso.transform_point;
The example also uses tpt-math-linalg-fixed directly, so add it to your
dependencies alongside this crate.
Notes
Rotation::from_matrixorthonormalises its input and returnsNonefor a reflection (determinant-1) or a numerically singular matrix.- The
UnitQuaternionproduct renormalises its result.
Features
std(default) — enablestpt-math-linalg-fixed/stdandtpt-math-numeric/std.alloc— allocator signal (this crate is fully allocator-free; enabling it only forwards the feature to its dependencies).no_stdsupport: the crate is#![no_std]and needs no allocator, so it builds with--no-default-featuresdirectly.
License
Licensed under either of MIT or Apache-2.0 at your option.