Gets the class name of this matrix instance.
The name of the constructor function (class name)
Converts the matrix to a GLSL mat4 string representation with float precision.
A GLSL-compatible string representation of the matrix
Converts the matrix to a GLSL mat4 string representation with integer values.
A GLSL-compatible string representation of the matrix with integer values
Indicates whether this matrix is an identity matrix class.
This property should be overridden in derived classes that represent identity matrices to return true.
False for the base AbstractMatrix class
Gets the matrix element at row 0, column 0.
The m00 component of the matrix
Gets the matrix element at row 0, column 1.
The m01 component of the matrix
Gets the matrix element at row 0, column 2.
The m02 component of the matrix
Gets the matrix element at row 0, column 3.
The m03 component of the matrix
Gets the matrix element at row 1, column 0.
The m10 component of the matrix
Gets the matrix element at row 1, column 1.
The m11 component of the matrix
Gets the matrix element at row 1, column 2.
The m12 component of the matrix
Gets the matrix element at row 1, column 3.
The m13 component of the matrix
Gets the matrix element at row 2, column 0.
The m20 component of the matrix
Gets the matrix element at row 2, column 1.
The m21 component of the matrix
Gets the matrix element at row 2, column 2.
The m22 component of the matrix
Gets the matrix element at row 2, column 3.
The m23 component of the matrix
Gets the matrix element at row 3, column 0.
The m30 component of the matrix
Gets the matrix element at row 3, column 1.
The m31 component of the matrix
Gets the matrix element at row 3, column 2.
The m32 component of the matrix
Gets the matrix element at row 3, column 3.
The m33 component of the matrix
Gets the X component of the translation vector from this matrix.
The X translation value
Gets the Y component of the translation vector from this matrix.
The Y translation value
Gets the Z component of the translation vector from this matrix.
The Z translation value
Converts the matrix to a WGSL mat4x4f string representation with float precision.
A WGSL-compatible string representation of the matrix
Converts the matrix to a WGSL mat4x4i string representation with integer values.
A WGSL-compatible string representation of the matrix with integer values
Static
compositionGets the composition type for this matrix class.
The composition type enum value
Extracts the scale factors from this matrix and stores them in an output vector.
The output vector to store the scale factors
The output vector containing the scale components
Extracts the translation vector from this matrix and stores it in an output vector.
The output vector to store the translation
The output vector containing the translation components
Checks if this matrix is approximately equal to another matrix.
The matrix to compare with
The tolerance for floating-point comparison (default: Number.EPSILON)
true if matrices are approximately equal within the given tolerance
Checks if this matrix is exactly equal to another matrix. Uses strict equality comparison for all elements.
The matrix to compare with
true if matrices are exactly equal, false otherwise
Checks if the matrix's internal storage shares the same ArrayBuffer as the provided one.
This method is useful for determining if two matrices share the same underlying memory, which can be important for performance optimizations and avoiding unnecessary data copying.
The ArrayBuffer to compare against
True if the internal storage uses the same ArrayBuffer, false otherwise
Multiplies this matrix with a 3D vector and stores the result (treating it as a point with w=1).
The 3D vector to multiply
The output vector to store the result
The output vector containing the transformed point
Multiplies this matrix with a 4D vector and stores the result in an output vector.
The 4D vector to multiply
The output vector to store the result
The output vector containing the multiplication result
Multiplies this matrix with a 4D vector and stores the XYZ components in a 3D vector.
The 4D vector to multiply
The output 3D vector to store the XYZ components
The output vector containing the XYZ components of the result
Converts this transformation matrix to Euler angles and stores them in an output vector.
The output vector to store the Euler angles
The output vector containing the Euler angles [x, y, z] in radians
Gets the matrix element at the specified flat index.
This provides direct access to the underlying Float32Array storage using a single index rather than row/column coordinates.
The zero-based flat index into the matrix storage
The matrix element value at the specified index
Static
dummyStatic
fromCreates a matrix from 16 individual values in column-major order. This matches the internal storage format used by WebGL.
Element at row 0, column 0
Element at row 1, column 0
Element at row 2, column 0
Element at row 3, column 0
Element at row 0, column 1
Element at row 1, column 1
Element at row 2, column 1
Element at row 3, column 1
Element at row 0, column 2
Element at row 1, column 2
Element at row 2, column 2
Element at row 3, column 2
Element at row 0, column 3
Element at row 1, column 3
Element at row 2, column 3
Element at row 3, column 3
A new Matrix44 instance
Static
fromCreates a matrix from 16 individual values in row-major order. This is the most intuitive way to specify matrix values, as you can write them in the same 4x4 layout as they appear visually. Note that internally, WebGL uses column-major storage.
Element at row 0, column 0
Element at row 0, column 1
Element at row 0, column 2
Element at row 0, column 3
Element at row 1, column 0
Element at row 1, column 1
Element at row 1, column 2
Element at row 1, column 3
Element at row 2, column 0
Element at row 2, column 1
Element at row 2, column 2
Element at row 2, column 3
Element at row 3, column 0
Element at row 3, column 1
Element at row 3, column 2
Element at row 3, column 3
A new Matrix44 instance
Static
fromStatic
fromCreates a matrix from a fixed-size array (Array16) in row-major order. The input array is converted from row-major to column-major order.
An Array16 containing exactly 16 matrix elements in row-major order
A new Matrix44 instance with converted values
Static
fromStatic
fromCreates a matrix from a variable-length array in row-major order. The input array is converted from row-major to column-major order.
An array containing at least 16 matrix elements in row-major order
A new Matrix44 instance with converted values
Static
fromStatic
fromCreates a matrix from a Float32Array in row-major order with copying. The input array is assumed to be in row-major order and will be converted to column-major order for internal storage.
A Float32Array containing 16 matrix elements in row-major order
A new Matrix44 instance with converted values
Static
fromCreates a 4x4 matrix from a 3x3 matrix by embedding it in the upper-left corner. The resulting matrix has the 3x3 matrix in the upper-left, with the bottom-right element set to 1 and other elements set to 0.
The 3x3 matrix to embed
A new Matrix44 instance
Static
fromStatic
fromCreates a rotation matrix from a quaternion.
The quaternion representing the rotation
A new Matrix44 instance representing the rotation transformation
Static
fromCreates a matrix directly from a Float32Array in column-major order. The array is used directly without copying (shares the same memory).
A Float32Array containing 16 matrix elements
A new Matrix44 instance using the provided array
Static
fromCreates a rotation matrix from a quaternion and stores it in an output matrix.
The quaternion representing the rotation
The output matrix to store the result
The output matrix containing the rotation matrix
Static
identityCreates a 4x4 identity matrix.
A new IdentityMatrix44 instance representing the identity matrix
Static
invertStatic
invertComputes the inverse of a matrix and stores the result in an output matrix. This is the mutable version of the invert method for performance optimization.
The matrix to invert
The output matrix to store the result
The output matrix containing the inverted matrix
Static
multiplyStatic
multiplyMultiplies two 4x4 matrices and stores the result in an output matrix. This is the mutable version of the multiply method for performance optimization.
The left matrix in the multiplication
The right matrix in the multiplication
The output matrix to store the result
The output matrix containing the multiplication result
Static
multiplyMultiplies a matrix with data from a typed array and stores the result. This method is optimized for working with raw array data.
The left matrix in the multiplication
The right operand as a typed array
The output matrix to store the result
The offset in the array for composition data
The output matrix containing the multiplication result
Static
rotateStatic
rotateXStatic
rotateXYZCreates a rotation matrix from Euler angles (XYZ order). Applies rotations in the order: X, then Y, then Z.
Rotation around X-axis in radians
Rotation around Y-axis in radians
Rotation around Z-axis in radians
A new Matrix44 instance representing the combined rotation
Static
rotateYStatic
rotateZStatic
scaleStatic
translateStatic
transposeCreates a transpose matrix from the given matrix. For identity matrices, returns the same matrix since transpose of identity is identity.
The matrix to transpose
A new Matrix44 instance representing the transposed matrix
Static
zero
Represents a 4x4 matrix stored in column-major order (OpenGL/WebGL style). This class provides immutable matrix operations and is used for 3D transformations including translation, rotation, and scaling.
Example