rhodonite
    Preparing search index...

    Class MutableMatrix33_<T>

    A mutable 3x3 matrix class that extends Matrix33 and provides mutating operations. This class stores matrix data in column-major order as a Float32Array. All transformation methods modify the matrix in place and return the same instance for method chaining.

    Matrix layout in memory (column-major order):

    [m00, m10, m20, m01, m11, m21, m02, m12, m22]
    [0] [1] [2] [3] [4] [5] [6] [7] [8]

    Which represents the matrix:

    | m00  m01  m02 |
    | m10 m11 m12 |
    | m20 m21 m22 |

    Type Parameters

    Hierarchy (View Summary)

    Implements

    Index
    _v: TypedArray = ...

    Internal typed array storage for matrix elements (Float32Array or Float64Array)

    • get className(): string

      Gets the class name for debugging purposes.

      Returns string

      The string 'MutableMatrix33'

    • get glslStrAsFloat(): string

      Gets the matrix as a GLSL mat3 string with float precision.

      Returns string

      GLSL mat3 constructor string

    • get glslStrAsInt(): string

      Gets the matrix as a GLSL mat3 string with integer values.

      Returns string

      GLSL mat3 constructor string with floored values

    • get glslStrAsUint(): string

      Gets the GLSL string representation of the matrix as unsigned integer values.

      Returns string

      GLSL-formatted string for unsigned integer values with 'u' suffix

      Error - Must be implemented by subclasses

    • get isIdentityMatrixClass(): boolean

      Indicates whether this matrix is an identity matrix class.

      This property should be overridden in derived classes that represent identity matrices to return true.

      Returns boolean

      False for the base AbstractMatrix class

    • get m00(): number

      Gets the matrix element at position (0,0).

      Returns number

      The value at position (0,0)

    • set m00(val: number): void

      Sets the matrix element at position (0,0).

      Parameters

      • val: number

        The value to set

      Returns void

    • get m01(): number

      Gets the matrix element at position (0,1).

      Returns number

      The value at position (0,1)

    • set m01(val: number): void

      Sets the matrix element at position (0,1).

      Parameters

      • val: number

        The value to set

      Returns void

    • get m02(): number

      Gets the matrix element at position (0,2).

      Returns number

      The value at position (0,2)

    • set m02(val: number): void

      Sets the matrix element at position (0,2).

      Parameters

      • val: number

        The value to set

      Returns void

    • get m10(): number

      Gets the matrix element at position (1,0).

      Returns number

      The value at position (1,0)

    • set m10(val: number): void

      Sets the matrix element at position (1,0).

      Parameters

      • val: number

        The value to set

      Returns void

    • get m11(): number

      Gets the matrix element at position (1,1).

      Returns number

      The value at position (1,1)

    • set m11(val: number): void

      Sets the matrix element at position (1,1).

      Parameters

      • val: number

        The value to set

      Returns void

    • get m12(): number

      Gets the matrix element at position (1,2).

      Returns number

      The value at position (1,2)

    • set m12(val: number): void

      Sets the matrix element at position (1,2).

      Parameters

      • val: number

        The value to set

      Returns void

    • get m20(): number

      Gets the matrix element at position (2,0).

      Returns number

      The value at position (2,0)

    • set m20(val: number): void

      Sets the matrix element at position (2,0).

      Parameters

      • val: number

        The value to set

      Returns void

    • get m21(): number

      Gets the matrix element at position (2,1).

      Returns number

      The value at position (2,1)

    • set m21(val: number): void

      Sets the matrix element at position (2,1).

      Parameters

      • val: number

        The value to set

      Returns void

    • get m22(): number

      Gets the matrix element at position (2,2).

      Returns number

      The value at position (2,2)

    • set m22(val: number): void

      Sets the matrix element at position (2,2).

      Parameters

      • val: number

        The value to set

      Returns void

    • get wgslStrAsFloat(): string

      Gets the matrix as a WGSL mat3x3f string with float precision.

      Returns string

      WGSL mat3x3f constructor string

    • get wgslStrAsInt(): string

      Gets the matrix as a WGSL mat3x3i string with integer values.

      Returns string

      WGSL mat3x3i constructor string with floored values

    • get wgslStrAsUint(): string

      Gets the WGSL string representation of the matrix as unsigned integer values.

      Returns string

      WGSL-formatted string for unsigned integer values with 'u' suffix

      Error - Must be implemented by subclasses

    • get compositionType(): CompositionTypeClass<"MAT3">

      Gets the composition type for this matrix.

      Returns CompositionTypeClass<"MAT3">

      CompositionType.Mat3

    • Gets the matrix element at the specified row and column.

      Parameters

      • row_i: number

        The row index (0-2)

      • column_i: number

        The column index (0-2)

      Returns number

      The matrix element at the specified position

    • Converts the matrix to a flat array in column-major order.

      Returns number[]

      An array containing all 9 matrix elements

    • Inverts this matrix in place using the determinant method.

      If the matrix is numerically singular, it is set to the identity matrix instead of being filled with Infinity/NaN. Use MutableMatrix33.tryInvert when the caller needs to detect the failure.

      Returns MutableMatrix33

      This matrix instance for method chaining

    • Checks if this matrix is a dummy matrix (empty data array).

      Returns boolean

      True if the matrix has no data, false otherwise

    • Checks if this matrix is approximately equal to another matrix.

      Parameters

      • mat: IMatrix33

        The matrix to compare with

      • delta: number = Number.EPSILON

        The tolerance for comparison (default: Number.EPSILON)

      Returns boolean

      True if matrices are approximately equal, false otherwise

    • Checks if this matrix is strictly equal to another matrix.

      Parameters

      • mat: Matrix33

        The matrix to compare with

      Returns boolean

      True if all elements 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.

      Parameters

      • arrayBuffer: ArrayBuffer

        The ArrayBuffer to compare against

      Returns boolean

      True if the internal storage uses the same ArrayBuffer, false otherwise

    • Multiplies this matrix by another matrix from the right side (this = this * mat). If the input matrix is an identity matrix, no operation is performed for optimization.

      Parameters

      • mat: IMatrix33

        The matrix to multiply with from the right

      Returns MutableMatrix33

      This matrix instance for method chaining

    • Multiplies this matrix by another matrix from the left side (this = mat * this). If the input matrix is an identity matrix, no operation is performed for optimization.

      Parameters

      • mat: IMatrix33

        The matrix to multiply with from the left

      Returns MutableMatrix33

      This matrix instance for method chaining

    • Multiplies this matrix by a scale matrix, applying scaling to the existing transformation. Each column of the matrix is scaled by the corresponding component of the vector.

      Parameters

      • vec: IVector3

        A vector containing scale factors for X, Y, and Z axes

      Returns MutableMatrix33

      This matrix instance for method chaining

    • Gets the raw Float32Array containing the matrix data.

      Returns TypedArray

      The underlying Float32Array in column-major order

    • Sets this matrix to a rotation matrix from a vector containing rotation angles.

      Parameters

      • vec: IVector3

        A vector containing rotation angles for X, Y, and Z axes in radians

      Returns MutableMatrix33

      This matrix instance for method chaining

    • Sets this matrix to a rotation matrix around the X-axis.

      Parameters

      • radian: number

        The rotation angle in radians

      Returns MutableMatrix33

      This matrix instance for method chaining

    • Sets this matrix to a rotation matrix for combined X, Y, and Z axis rotations. Rotations are applied in the order: Z * Y * X (which means X is applied first, then Y, then Z).

      Parameters

      • x: number

        Rotation angle around X-axis in radians

      • y: number

        Rotation angle around Y-axis in radians

      • z: number

        Rotation angle around Z-axis in radians

      Returns MutableMatrix33

      This matrix instance for method chaining

    • Sets this matrix to a rotation matrix around the Y-axis.

      Parameters

      • radian: number

        The rotation angle in radians

      Returns MutableMatrix33

      This matrix instance for method chaining

    • Sets this matrix to a rotation matrix around the Z-axis.

      Parameters

      • radian: number

        The rotation angle in radians

      Returns MutableMatrix33

      This matrix instance for method chaining

    • Sets a value at the specified row and column position.

      Parameters

      • row_i: number

        The row index (0-2)

      • column_i: number

        The column index (0-2)

      • value: number

        The value to set

      Returns MutableMatrix33

      This matrix instance for method chaining

    • Sets all matrix components using row-major order parameters.

      Parameters

      • m00: number

        Element at position (0,0)

      • m01: number

        Element at position (0,1)

      • m02: number

        Element at position (0,2)

      • m10: number

        Element at position (1,0)

      • m11: number

        Element at position (1,1)

      • m12: number

        Element at position (1,2)

      • m20: number

        Element at position (2,0)

      • m21: number

        Element at position (2,1)

      • m22: number

        Element at position (2,2)

      Returns MutableMatrix33

      This matrix instance for method chaining

    • Converts the matrix to a human-readable string representation.

      Returns string

      A formatted string showing the matrix in 3x3 layout

    • Attempts to invert this matrix in place.

      The matrix is left unchanged when it is numerically singular, which lets callers keep the previous valid value.

      Returns boolean

      True if the inversion succeeded, false if the matrix is singular

    • Gets the matrix element at the specified index in the internal array.

      Parameters

      • i: number

        The index (0-8)

      Returns number

      The matrix element at the specified index

    • Creates a Matrix33 from 9 values in column-major order.

      Parameters

      • m00: number

        Element at row 0, column 0

      • m10: number

        Element at row 1, column 0

      • m20: number

        Element at row 2, column 0

      • m01: number

        Element at row 0, column 1

      • m11: number

        Element at row 1, column 1

      • m21: number

        Element at row 2, column 1

      • m02: number

        Element at row 0, column 2

      • m12: number

        Element at row 1, column 2

      • m22: number

        Element at row 2, column 2

      • type: FloatTypedArrayConstructor

      Returns IMatrix33

      A new Matrix33 instance

    • Creates a Matrix33 from 9 values in row-major order. Values are stored internally in column-major order for WebGL compatibility.

      Parameters

      • m00: number

        Element at row 0, column 0

      • m01: number

        Element at row 0, column 1

      • m02: number

        Element at row 0, column 2

      • m10: number

        Element at row 1, column 0

      • m11: number

        Element at row 1, column 1

      • m12: number

        Element at row 1, column 2

      • m20: number

        Element at row 2, column 0

      • m21: number

        Element at row 2, column 1

      • m22: number

        Element at row 2, column 2

      • type: FloatTypedArrayConstructor

      Returns IMatrix33

      A new Matrix33 instance

    • Calculates the inverse of the given matrix and stores the result in the output matrix.

      If the matrix is numerically singular, the output matrix is set to the identity matrix instead of being filled with Infinity/NaN. Use Matrix33.tryInvertTo when the caller needs to detect the failure.

      Parameters

      Returns IMutableMatrix33

      The output matrix containing the inverted matrix, or the identity matrix if the input is singular

    • Creates a rotation matrix from Euler angles in XYZ order.

      Parameters

      • x: number

        Rotation around X-axis in radians

      • y: number

        Rotation around Y-axis in radians

      • z: number

        Rotation around Z-axis in radians

      • type: FloatTypedArrayConstructor

      Returns IMatrix33

      A new rotation matrix representing the combined rotations

    • Attempts to calculate the inverse of the given matrix and stores the result in the output matrix. The output matrix is left untouched when the input is numerically singular.

      Parameters

      Returns boolean

      True if the inversion succeeded, false if the matrix is singular