Algebrix
Math for game engines: vectors, matrices, quaternions, and geometry. Uses SIMD on x86_64 and aarch64 when the simd feature is on; otherwise scalar. Originally split out from a larger codebase and kept as a separate crate.
What's in it
- Vectors:
Vec2,Vec3,Vec4(float);IVec2/3/4,UVec2/3/4,BVec2/3/4;DVec3for double. Swizzles supported. Float vectors also havenormalize_fast()andlength_fast()(rsqrt-based) when you care more about speed than precision. - Matrices:
Mat2,Mat3,Mat4, andDMat4for double 4x4. - Quaternions:
QuatandDQuatfor rotations. - Transforms:
Affine2andAffine3for combined rotation, scale, and translation. - Geometry:
Plane,Ray,Aabb2,Aabb3,Frustumfor culling and raycasting. - Angles:
Rad,Deg, andEulerRotfor type-safe radians/degrees.
Usage
use ;
let v = new;
let normalized = v.normalize;
let angle = from;
Feature flags
std– standard library (default).simd– SIMD on; backend chosen from target (default).simd-x86– force x86_64 (SSE/AVX).simd-arm– force ARM (NEON).scalar-math– no SIMD.glam-compatibility–From/Intobetween algebrix and glam forVec2/Vec3/Vec4,Mat2/Mat3/Mat4,Quat.nalgebra-compatibility–From/Intobetween algebrix and nalgebra forVector2/3/4,Matrix2/3/4,Quaternion.
Default features: ["std", "simd"]. Use default-features = false and opt in to what you need if you want a smaller dependency set or a specific SIMD backend.