Expand description
Geometry module built on tpt_math_linalg_fixed.
A from-scratch, const-generic geometry layer (matching the breadth of
nalgebra’s geometry module) with no nalgebra dependency and no
allocator — everything here is stack-allocated fixed-size storage. It
provides points, translations, rotations (2-D and 3-D), unit quaternions,
isometries, similarities, uniform scaling and the perspective / orthographic
projection matrices.
§Conventions (stated explicitly)
- Active (alibi) rotations. A rotation acts on a vector
vasR * v(matrix–vector multiplication with the vector on the right), which rotates the point/vector rather than the coordinate frame. - Column vectors. Points and vectors are column vectors; transformations
are applied as
M * v. - Right-handed coordinates. The 2-D rotation by a positive angle is
counter-clockwise. The 3-D right-handed basis is
x × y = z. - Euler angles (3-D) use the intrinsic Tait–Bryan order
Rz(yaw) · Ry(pitch) · Rx(roll)— that is, the vector is first rolled aboutx, then pitched abouty, then yawed aboutz. - Quaternions are Hamilton quaternions
q = w + x i + y j + z k(scalar partwlast), matchingnalgebra’s memory layout. - Projection matrices are right-handed, look down
-z, with Normalised Device Coordinateszin[-1, 1](OpenGL-style depth range). - Isometry composition is written as
B * Aand means “applyA, thenB”: `(B * A)(p) = B.rotation * (A.rotation * p + A.translation)- B.translation`.
Structs§
- Isometry
- A rigid motion: a rotation followed by a translation.
- Orthographic3
- A right-handed orthographic projection (view space → clip space), looking
down
-z, with NDC depth in[-1, 1](OpenGL-style). - Perspective3
- A right-handed perspective projection (view space → clip space), looking
down
-z, with NDC depth in[-1, 1](OpenGL-style). - Point
- A point in
D-dimensional Euclidean space. - Quaternion
- A quaternion
q = w + x i + y j + z k(Hamilton convention, scalarwlast). - Rotation
- An orthogonal, orientation-preserving (determinant
+1) linear map inDdimensions, stored as its rotation matrix. - Scale
- A non-uniform (axis-aligned) scaling.
- Similarity
- A similarity transform: a uniform scaling, then a rotation, then a translation.
- Translation
- A translation in
D-dimensional space. - Unit
Quaternion - A unit (normalised) quaternion, representing a 3-D rotation.