rhodonite
    Preparing search index...

    Class IdentityMatrix44

    Represents a 4x4 identity matrix that provides optimized operations for identity transformations. This class implements the identity matrix pattern where all diagonal elements are 1 and all other elements are 0. It extends AbstractMatrix and implements both IMatrix and IMatrix44 interfaces.

    The identity matrix is immutable and provides efficient implementations since the result of many operations can be computed without actual matrix multiplication.

    const identity = new IdentityMatrix44();
    const vector = new Vector4(1, 2, 3, 1);
    const result = identity.multiplyVector(vector); // Returns the same vector

    Hierarchy (View Summary)

    Implements

    Index
    _v: TypedArray = ...

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

    __v: Float32Array<ArrayBuffer> = ...

    Static array representing the identity matrix values in column-major order. This is shared across all instances for memory efficiency.

    • get className(): string

      Gets the class name for debugging and reflection purposes.

      Returns string

      The string 'IdentityMatrix44'

    • get glslStrAsFloat(): string

      Gets the GLSL string representation of the matrix as float values.

      Returns string

      GLSL-formatted string for float values

      Error - Must be implemented by subclasses

    • get glslStrAsInt(): string

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

      Returns string

      GLSL-formatted string for integer values

      Error - Must be implemented by subclasses

    • 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.

      Returns boolean

      Always true for IdentityMatrix44

    • get m00(): number

      Gets the matrix element at row 0, column 0.

      Returns number

      Always 1 for identity matrix

    • get m01(): number

      Gets the matrix element at row 0, column 1.

      Returns number

      Always 0 for identity matrix

    • get m02(): number

      Gets the matrix element at row 0, column 2.

      Returns number

      Always 0 for identity matrix

    • get m03(): number

      Gets the matrix element at row 0, column 3.

      Returns number

      Always 0 for identity matrix

    • get m10(): number

      Gets the matrix element at row 1, column 0.

      Returns number

      Always 0 for identity matrix

    • get m11(): number

      Gets the matrix element at row 1, column 1.

      Returns number

      Always 1 for identity matrix

    • get m12(): number

      Gets the matrix element at row 1, column 2.

      Returns number

      Always 0 for identity matrix

    • get m13(): number

      Gets the matrix element at row 1, column 3.

      Returns number

      Always 0 for identity matrix

    • get m20(): number

      Gets the matrix element at row 2, column 0.

      Returns number

      Always 0 for identity matrix

    • get m21(): number

      Gets the matrix element at row 2, column 1.

      Returns number

      Always 0 for identity matrix

    • get m22(): number

      Gets the matrix element at row 2, column 2.

      Returns number

      Always 1 for identity matrix

    • get m23(): number

      Gets the matrix element at row 2, column 3.

      Returns number

      Always 0 for identity matrix

    • get m30(): number

      Gets the matrix element at row 3, column 0.

      Returns number

      Always 0 for identity matrix

    • get m31(): number

      Gets the matrix element at row 3, column 1.

      Returns number

      Always 0 for identity matrix

    • get m32(): number

      Gets the matrix element at row 3, column 2.

      Returns number

      Always 0 for identity matrix

    • get m33(): number

      Gets the matrix element at row 3, column 3.

      Returns number

      Always 1 for identity matrix

    • get translateX(): number

      Gets the X translation component from the matrix.

      Returns number

      Always 0 for identity matrix

    • get translateY(): number

      Gets the Y translation component from the matrix.

      Returns number

      Always 0 for identity matrix

    • get translateZ(): number

      Gets the Z translation component from the matrix.

      Returns number

      Always 0 for identity matrix

    • get wgslStrAsFloat(): string

      Gets the WGSL string representation of the matrix as float values.

      Returns string

      WGSL-formatted string for float values

      Error - Must be implemented by subclasses

    • get wgslStrAsInt(): string

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

      Returns string

      WGSL-formatted string for integer values

      Error - Must be implemented by subclasses

    • 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(): CompositionTypeEnum

      Gets the composition type for this matrix class.

      Returns CompositionTypeEnum

      CompositionType.Mat4 indicating this is a 4x4 matrix

    • Gets the matrix element at the specified row and column indices. For identity matrix, returns 1 for diagonal elements and 0 for off-diagonal elements.

      Parameters

      • row_i: number

        The row index (0-based)

      • column_i: number

        The column index (0-based)

      Returns number

      1 if row equals column (diagonal), 0 otherwise

    • Creates a copy of this identity matrix. Returns a new IdentityMatrix44 instance.

      Returns IdentityMatrix44

      A new IdentityMatrix44 instance

    • Calculates the determinant of this identity matrix. The determinant of an identity matrix is always 1.

      Returns number

      Always returns 1

    • Returns the matrix elements as a flat array in column-major order.

      Returns number[]

      An array of 16 numbers representing the identity matrix

    • Extracts the rotation part of this transformation matrix. For identity matrix, the rotation is also an identity matrix.

      Returns IdentityMatrix44

      A new IdentityMatrix44 representing no rotation

    • Extracts the scale components from this transformation matrix. For identity matrix, the scale is (1, 1, 1).

      Returns Vector3

      A Vector3 with all components set to 1

    • Extracts the scale components and stores them in an output vector. For identity matrix, sets all scale components to 1.

      Parameters

      Returns MutableVector3

      The output vector with scale components set to 1

    • Extracts the translation components from this transformation matrix. For identity matrix, the translation is (0, 0, 0).

      Returns Vector3

      A Vector3 with all components set to 0

    • Extracts the translation components from this transformation matrix and stores them in the output vector. For identity matrix, the translation is (0, 0, 0).

      Parameters

      Returns MutableVector3

      The output vector with all components set to 0

    • Indicates whether this matrix is a dummy/placeholder matrix. Identity matrix is not considered a dummy matrix.

      Returns boolean

      Always false for identity matrix

    • Checks if the given matrix is approximately equal to this identity matrix within a tolerance. Compares each element of the input matrix against the corresponding identity matrix element.

      Parameters

      • mat: IMatrix44

        The matrix to compare against this identity matrix

      • delta: number = Number.EPSILON

        The tolerance for floating-point comparison (default: Number.EPSILON)

      Returns boolean

      True if the matrix is approximately an identity matrix, false otherwise

    • Performs a strict equality check against another matrix. Uses exact floating-point comparison without tolerance.

      Parameters

      • mat: IMatrix

        The matrix to compare for strict equality

      Returns boolean

      True if the matrix is exactly an identity matrix, 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 identity matrix with a 4D vector. Since this is an identity matrix, the result is the input vector unchanged.

      Parameters

      • vec: IVector4

        The 4D vector to multiply

      Returns IVector4

      The same vector (identity transformation)

    • Multiplies this identity matrix with a 3D vector. Since this is an identity matrix, the result is the input vector unchanged.

      Parameters

      • vec: IVector3

        The 3D vector to multiply

      Returns IVector3

      The same vector (identity transformation)

    • Multiplies this identity matrix with a vector and stores the result in an output vector. Since this is an identity matrix, copies the input vector to the output vector.

      Parameters

      • vec: IVector

        The input vector to multiply

      • outVec: MutableVector4

        The mutable vector to store the result

      Returns MutableVector4

      The output vector containing the copied values

    • Returns a string representation of the identity matrix in a readable format. Each row is separated by newlines for visual clarity.

      Returns string

      A formatted string showing the 4x4 identity matrix

    • Returns an approximate string representation of the matrix. For identity matrix, this is identical to toString() since all values are exact.

      Returns string

      A formatted string showing the 4x4 identity matrix

    • Gets the matrix element at the specified linear index in column-major order. For identity matrix, returns 1 for diagonal positions and 0 elsewhere.

      Parameters

      • i: number

        The linear index (0-15) in column-major order

      Returns number

      1 for diagonal elements (indices 0, 5, 10, 15), 0 otherwise