Class: Matrix4

Matrix4()

Utility class for working with 4x4 matrices in column-major order.

Constructor

new Matrix4()

Source:

Methods

(static) createIdentity() → {Float32Array}

Creates a new 4x4 identity matrix.
Source:
Returns:
- A new identity matrix.
Type
Float32Array

(static) createPerspective(fieldOfViewRadians, aspectRatio, near, far) → {Float32Array}

Creates a perspective projection matrix.
Parameters:
Name Type Description
fieldOfViewRadians number Vertical field of view in radians.
aspectRatio number Viewport aspect ratio (width / height).
near number Near clipping plane, must be > 0.
far number Far clipping plane, must be > near.
Source:
Returns:
- A new perspective projection matrix.
Type
Float32Array

(static) createRotationX(angleRadians) → {Float32Array}

Creates a rotation matrix around the X axis.
Parameters:
Name Type Description
angleRadians number Angle in radians.
Source:
Returns:
- A new rotation matrix.
Type
Float32Array

(static) createRotationY(angleRadians) → {Float32Array}

Creates a rotation matrix around the Y axis.
Parameters:
Name Type Description
angleRadians number Angle in radians.
Source:
Returns:
- A new rotation matrix.
Type
Float32Array

(static) createRotationZ(angleRadians) → {Float32Array}

Creates a rotation matrix around the Z axis.
Parameters:
Name Type Description
angleRadians number Angle in radians.
Source:
Returns:
- A new rotation matrix.
Type
Float32Array

(static) createScale(scaleX, scaleY, scaleZ) → {Float32Array}

Creates a scale matrix.
Parameters:
Name Type Description
scaleX number Scale along X.
scaleY number Scale along Y.
scaleZ number Scale along Z.
Source:
Returns:
- A new scale matrix.
Type
Float32Array

(static) createTranslation(translateX, translateY, translateZ) → {Float32Array}

Creates a translation matrix.
Parameters:
Name Type Description
translateX number Translation along X axis.
translateY number Translation along Y axis.
translateZ number Translation along Z axis.
Source:
Returns:
- A new translation matrix.
Type
Float32Array

(static) invert(matrix) → {Float32Array}

Inverts a 4x4 matrix.
Parameters:
Name Type Description
matrix Float32Array Input 4x4 matrix.
Source:
Returns:
- A new inverted matrix.
Type
Float32Array

(static) invertTo(out, matrix) → {Float32Array}

Inverts a 4x4 matrix into an existing output matrix.
Parameters:
Name Type Description
out Float32Array Output 4x4 matrix.
matrix Float32Array Input 4x4 matrix.
Source:
Returns:
- The output matrix (out).
Type
Float32Array

(static) multiply(leftMatrix, rightMatrix) → {Float32Array}

Multiplies two 4x4 matrices: result = leftMatrix * rightMatrix.
Parameters:
Name Type Description
leftMatrix Float32Array Left-hand matrix (4x4).
rightMatrix Float32Array Right-hand matrix (4x4).
Source:
Returns:
- A new matrix containing the product.
Type
Float32Array

(static) multiplyMany(…matrices) → {Float32Array}

Multiplies several matrices in sequence: result = m0 * m1 * m2 * ... * mn Notes: If no matrices are provided, returns a new identity matrix. If exactly one matrix is provided, returns the same matrix instance (no copy).
Parameters:
Name Type Attributes Description
matrices Float32Array <repeatable>
Matrices to multiply, in order.
Source:
Returns:
- The resulting matrix.
Type
Float32Array

(static) multiplyTo(out, leftMatrix, rightMatrix) → {Float32Array}

Multiplies two 4x4 matrices into an existing output matrix: out = leftMatrix * rightMatrix. Notes: out must not be the same object as leftMatrix or rightMatrix.
Parameters:
Name Type Description
out Float32Array Output 4x4 matrix.
leftMatrix Float32Array Left-hand matrix (4x4).
rightMatrix Float32Array Right-hand matrix (4x4).
Source:
Returns:
- The output matrix (out).
Type
Float32Array

(static) transpose(matrix) → {Float32Array}

Transposes a 4x4 matrix.
Parameters:
Name Type Description
matrix Float32Array Input 4x4 matrix.
Source:
Returns:
- A new transposed matrix.
Type
Float32Array

(static) transposeTo(out, matrix) → {Float32Array}

Transposes a 4x4 matrix into an existing output matrix. Notes: out must not be the same object as matrix.
Parameters:
Name Type Description
out Float32Array Output 4x4 matrix.
matrix Float32Array Input 4x4 matrix.
Source:
Returns:
- The output matrix (out).
Type
Float32Array