Creates a new Matrix44 instance.
A Float32Array containing 16 matrix elements in column-major order
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
StaticcompositionGets the composition type for this matrix class.
The composition type enum value
Gets a matrix element at the specified row and column.
The row index (0-3)
The column index (0-3)
The matrix element at the given position
Calculates the determinant of this 4x4 matrix.
The determinant value
Flattens the matrix into a regular JavaScript array. Elements are returned in column-major order (WebGL compatible).
An array containing all 16 matrix elements
Extracts the rotation part of this transformation matrix. Removes scaling effects to get pure rotation.
A new Matrix44 containing only the rotation transformation
Extracts the scale factors from this transformation matrix.
A new Vector3 containing the scale components for each axis
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 transformation matrix.
A new Vector3 containing the translation 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 is a dummy matrix (empty array).
true if the matrix has no elements, false otherwise
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 (XYZ rotation order).
A Vector3 containing the Euler angles [x, y, z] in radians
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
Converts the matrix to a human-readable string representation. Elements are displayed in row-major order for intuitive reading.
A formatted string representation of the matrix
Converts the matrix to a human-readable string with rounded values. Uses financial rounding for better readability of floating-point numbers.
A formatted string representation with approximated values
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
StaticdummyCreates a dummy matrix with zero-length array (for placeholder purposes).
A new Matrix44 instance with an empty array
StaticfromCreates 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
StaticfromCreates 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
StaticfromStaticfromStaticfromCreates a matrix from a variable-length array in column-major order.
An array containing at least 16 matrix elements
A new Matrix44 instance with copied values
StaticfromCreates 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
StaticfromCreates a matrix from a Float32Array in column-major order with copying.
A Float32Array containing 16 matrix elements
A new Matrix44 instance with copied values
StaticfromCreates 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
StaticfromStaticfromStaticfromCreates a rotation matrix from a quaternion.
The quaternion representing the rotation
A new Matrix44 instance representing the rotation transformation
StaticfromCreates 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
StaticfromCreates 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
StaticidentityCreates a 4x4 identity matrix.
A new IdentityMatrix44 instance representing the identity matrix
StaticinvertStaticinvertComputes 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
StaticmultiplyMultiplies two 4x4 matrices and returns the result. Optimized to handle identity matrices efficiently.
A new Matrix44 instance representing the matrix product (l_mat * r_mat)
StaticmultiplyMultiplies 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
StaticmultiplyMultiplies 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
StaticrotateStaticrotateCreates a rotation matrix around the X-axis.
The rotation angle in radians
A new Matrix44 instance representing the X-axis rotation
StaticrotateCreates 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
StaticrotateCreates a rotation matrix around the Y-axis.
The rotation angle in radians
A new Matrix44 instance representing the Y-axis rotation
StaticrotateCreates a rotation matrix around the Z-axis.
The rotation angle in radians
A new Matrix44 instance representing the Z-axis rotation
StaticscaleStatictranslateStatictransposeStaticzeroCreates a zero matrix (all elements are 0).
A new Matrix44 instance with all elements set to 0
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