Creates a new MutableMatrix44 instance.
A Float32Array containing 16 elements representing the matrix in column-major order
Gets the class name identifier for this matrix type.
The string 'MutableMatrix44'
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 value at position (0,0) in the matrix.
The value at position (0,0)
Sets the value at position (0,0) in the matrix.
The value to set
Gets the value at position (0,1) in the matrix.
The value at position (0,1)
Sets the value at position (0,1) in the matrix.
The value to set
Gets the value at position (0,2) in the matrix.
The value at position (0,2)
Sets the value at position (0,2) in the matrix.
The value to set
Gets the value at position (0,3) in the matrix.
The value at position (0,3)
Sets the value at position (0,3) in the matrix.
The value to set
Gets the value at position (1,0) in the matrix.
The value at position (1,0)
Sets the value at position (1,0) in the matrix.
The value to set
Gets the value at position (1,1) in the matrix.
The value at position (1,1)
Sets the value at position (1,1) in the matrix.
The value to set
Gets the value at position (1,2) in the matrix.
The value at position (1,2)
Sets the value at position (1,2) in the matrix.
The value to set
Gets the value at position (1,3) in the matrix.
The value at position (1,3)
Sets the value at position (1,3) in the matrix.
The value to set
Gets the value at position (2,0) in the matrix.
The value at position (2,0)
Sets the value at position (2,0) in the matrix.
The value to set
Gets the value at position (2,1) in the matrix.
The value at position (2,1)
Sets the value at position (2,1) in the matrix.
The value to set
Gets the value at position (2,2) in the matrix.
The value at position (2,2)
Sets the value at position (2,2) in the matrix.
The value to set
Gets the value at position (2,3) in the matrix.
The value at position (2,3)
Sets the value at position (2,3) in the matrix.
The value to set
Gets the value at position (3,0) in the matrix.
The value at position (3,0)
Sets the value at position (3,0) in the matrix.
The value to set
Gets the value at position (3,1) in the matrix.
The value at position (3,1)
Sets the value at position (3,1) in the matrix.
The value to set
Gets the value at position (3,2) in the matrix.
The value at position (3,2)
Sets the value at position (3,2) in the matrix.
The value to set
Gets the value at position (3,3) in the matrix.
The value at position (3,3)
Sets the value at position (3,3) in the matrix.
The value to set
Gets the X translation component from the matrix.
The X translation value
Sets the X translation component in the matrix.
The X translation value to set
Gets the Y translation component from the matrix.
The Y translation value
Sets the Y translation component in the matrix.
The Y translation value to set
Gets the Z translation component from the matrix.
The Z translation value
Sets the Z translation component in the matrix.
The Z translation value to set
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
Adds the given vector to the current translation component.
The translation vector to add
This matrix instance for method chaining
Creates a copy of this matrix.
A new MutableMatrix44 instance with the same values as this matrix
Copies all components from another matrix to this matrix.
The source matrix to copy from
This matrix instance for method chaining
Sets this matrix to a rotation matrix based on the given quaternion.
The quaternion to convert to a rotation matrix
This matrix instance for method chaining
Extracts the rotation part of this matrix.
A new MutableMatrix44 instance containing only the rotation transformation
Extracts the scale part of this matrix.
A new MutableVector3 instance containing the scale values 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 part of this matrix.
A new MutableVector3 instance containing the translation values
Extracts the translation part of this matrix into the provided vector.
The vector to store the translation values
The output vector with translation values
Sets this matrix to the identity matrix.
This matrix instance for method chaining
Inverts this matrix in place. The matrix must be invertible (determinant != 0), otherwise an error is logged.
This matrix instance for method chaining
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 by another matrix from the right side (this * mat). This operation transforms this matrix in place.
The matrix to multiply from the right
This matrix instance for method chaining
Multiplies this matrix by another matrix from the left side (mat * this). This operation transforms this matrix in place.
The matrix to multiply from the left
This matrix instance for method chaining
Multiplies the scaling factors to the current matrix. This applies scaling transformation to each column of the matrix.
The scaling factors for X, Y, and Z axes
This matrix instance for method chaining
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
Sets the translation component of this matrix without affecting other components.
The translation vector to set
This matrix instance for method chaining
Sets this matrix to a rotation matrix from a vector containing X, Y, Z rotation angles.
Vector containing rotation angles (x, y, z) in radians
This matrix instance for method chaining
Sets this matrix to a rotation matrix around the X-axis.
The rotation angle in radians
This matrix instance for method chaining
Sets this matrix to a rotation matrix with rotations around X, Y, and Z axes in that order. The rotation order is: Z * Y * X (applied from right to left).
Rotation angle around X-axis in radians
Rotation angle around Y-axis in radians
Rotation angle around Z-axis in radians
This matrix instance for method chaining
Sets this matrix to a rotation matrix around the Y-axis.
The rotation angle in radians
This matrix instance for method chaining
Sets this matrix to a rotation matrix around the Z-axis.
The rotation angle in radians
This matrix instance for method chaining
Sets this matrix to a scaling matrix with the given vector.
The scaling factors for X, Y, and Z axes
This matrix instance for method chaining
Sets a value at the specified row and column position.
The row index (0-3)
The column index (0-3)
The value to set
This matrix instance for method chaining
Sets all 16 components of the matrix with individual values. Values are specified in row-major order but stored internally in column-major order.
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
This matrix instance for method chaining
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
Sets this matrix to a translation matrix with the given vector.
The translation vector
This matrix instance for method chaining
Transposes this matrix in place (swaps rows and columns).
This matrix instance for method chaining
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
Sets this matrix to the zero matrix (all elements are 0).
This matrix instance for method chaining
Static
dummyCreates a dummy matrix (typically used as a placeholder).
A new MutableMatrix44 instance representing a dummy matrix
Static
fromCreates a matrix from 16 values in column-major order.
A new MutableMatrix44 instance
Static
fromCreates a matrix from 16 values in row-major order. Values are provided in row-major order but stored internally in column-major order.
A new MutableMatrix44 instance
Static
fromCreates a new MutableMatrix44 from an Array16 in column-major order. This method copies the array data into a new Float32Array.
An Array16 containing 16 elements in column-major order
A new MutableMatrix44 instance with copied data
Static
fromCreates a new MutableMatrix44 from an Array16 in row-major order. The input data is converted from row-major to column-major order during creation.
An Array16 containing 16 elements in row-major order
A new MutableMatrix44 instance with data converted to column-major order
Static
fromCreates a new MutableMatrix44 from a regular array in column-major order. Only the first 16 elements are used if the array is larger.
An array containing at least 16 elements in column-major order
A new MutableMatrix44 instance with copied data
Static
fromCreates a new MutableMatrix44 from a regular array in row-major order. The input data is converted from row-major to column-major order during creation. Only the first 16 elements are used if the array is larger.
An array containing at least 16 elements in row-major order
A new MutableMatrix44 instance with data converted to column-major order
Static
fromCreates a new MutableMatrix44 from a Float32Array in column-major order. This method creates a copy of the input array, so modifications to the matrix will not affect the original array.
A Float32Array containing 16 elements in column-major order
A new MutableMatrix44 instance with copied data
Static
fromCreates a new MutableMatrix44 from a Float32Array in row-major order. The input data is converted from row-major to column-major order during creation.
A Float32Array containing 16 elements in row-major order
A new MutableMatrix44 instance with data converted to column-major order
Static
fromCreates a new MutableMatrix44 from a 3x3 matrix. The 3x3 matrix is embedded in the upper-left corner of the 4x4 matrix, with the bottom row and right column set to [0, 0, 0, 1].
The source 3x3 matrix to convert
A new MutableMatrix44 instance with the 3x3 matrix embedded
Static
fromCreates a new MutableMatrix44 from an existing Matrix44 instance. This creates a copy of the matrix data, so modifications to the new matrix will not affect the original.
The source Matrix44 to copy from
A new MutableMatrix44 instance with copied data
Static
fromCreates a matrix from a quaternion.
The quaternion to convert
A new MutableMatrix44 instance representing the rotation
Static
fromCreates a new MutableMatrix44 directly from a Float32Array in column-major order. This method does not copy the array, so the matrix will share the same memory as the input array.
A Float32Array containing 16 elements in column-major order
A new MutableMatrix44 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 an identity matrix.
A new MutableMatrix44 instance representing the 4x4 identity matrix
Static
invertCreates an inverted matrix from the given matrix.
The matrix to invert
A new MutableMatrix44 instance that is the inverse of the input matrix
Static
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
multiplyMultiplies two matrices and returns the result as a new matrix.
A new MutableMatrix44 instance representing the product l_mat * r_mat
Static
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
rotateCreates a rotation matrix from a vector containing X, Y, Z rotation angles.
Vector containing rotation angles (x, y, z) in radians
A new MutableMatrix44 instance representing the rotation transformation
Static
rotateXCreates a rotation matrix around the X-axis.
The rotation angle in radians
A new MutableMatrix44 instance representing the X-axis rotation
Static
rotateXYZCreates a rotation matrix with rotations around X, Y, and Z axes in that order.
Rotation angle around X-axis in radians
Rotation angle around Y-axis in radians
Rotation angle around Z-axis in radians
A new MutableMatrix44 instance representing the combined rotation
Static
rotateYCreates a rotation matrix around the Y-axis.
The rotation angle in radians
A new MutableMatrix44 instance representing the Y-axis rotation
Static
rotateZCreates a rotation matrix around the Z-axis.
The rotation angle in radians
A new MutableMatrix44 instance representing the Z-axis rotation
Static
scaleCreates a scaling matrix from the given vector.
The scaling factors for X, Y, and Z axes
A new MutableMatrix44 instance representing the scaling transformation
Static
translateCreates a translation matrix from the given vector.
The translation vector
A new MutableMatrix44 instance representing the translation transformation
Static
transposeStatic
zeroCreates a zero matrix (all elements are 0).
A new MutableMatrix44 instance with all elements set to 0
A mutable 4x4 matrix class that extends the immutable Matrix44 class.
This class provides a mutable interface for 4x4 matrix operations commonly used in 3D graphics, including transformations, rotations, scaling, and projections. The matrix is stored in column-major order internally, which is compatible with WebGL.
Example