Namespace matrix

xeokit Matrix Math Utilities


Mathematical functions and types for working with matrices


Helpers for building and manipulating 3×3 and 4×4 matrices used throughout the SDK for camera projection, object transforms, and coordinate conversion.

Matrices are represented as either typed arrays (Float32Array / Float64Array) or plain JS numeric tuples. All functions accept either form and (where supported) can write results into an optional destination array to reduce allocations.

This module assumes an affine transform layout where translation occupies the last column (m[12], m[13], m[14]) and the homogeneous component is m[15]. Many functions treat the matrix as an affine transform (rotation/scale + translation), while projection helpers (perspective/frustum/ortho) create full projective matrices.

Several helpers (eg. decomposeMat4, some closures like scalingMat4c) keep internal scratch vectors/matrices to avoid repeated allocations. These are not thread-safe/re-entrant, but are safe for typical single-threaded JS execution.

Type Aliases

Mat3
Mat3Float32
Mat3Float64
Mat4
Mat4Float32
Mat4Float64

Variables

vec3FromMat4Scale

Functions

compareMat4
composeMat4
composeMat4Euler
createMat3
createMat4Float32
createMat4Float64
decomposeMat4
determinantMat4
frustumMat4
frustumMat4v
identityMat3
identityMat4
inverseMat4
isIdentityMat4
lerpMat4
lookAtMat4v
mat3ToMat4
mat4ToEuler
mulMat3
mulMat4
mulMat4v4
orthoMat4c
perspectiveMat4
rotationMat4v
scaleMat4c
scaleMat4v
scalingMat3v
scalingMat4c
scalingMat4s
scalingMat4v
setMat4Translation
transformPoint3
transformPoint4
transformPoints3
transformPositions3
transformPositions4
transformVec3
transformVec4
translateMat4c
translateMat4v
translationMat3v
translationMat4c
translationMat4s
translationMat4v
transposeMat4