@web-engine-dev/math
@web-engine-dev/math
@web-engine-dev/math
High-performance vector, matrix, and quaternion math library for game engines.
API Design
- Default operations are immutable and return new instances
- Mutable operations (suffix
Mut) modify in place for performance - Out-parameter operations (suffix
Out) write to pre-allocated targets - Batch operations (
BatchMath) operate on packed Float32Arrays
Example
ts
// Immutable (safe, allocates)
const result = a.add(b);
// Mutable (fast, modifies a)
a.addMut(b);
// Out-parameter (fast, writes to result)
Vec3.addOut(a, b, result);
// Batch (fastest, operates on arrays)
BatchMath.transformVec3PointArray(vertices, matrix, vertices);
@packageDocumentation