Class MutableMatrix33

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 |

Hierarchy (view full)

Implements

Constructors

Properties

_v: Float32Array = ...

Internal Float32Array storage for matrix elements

Accessors

  • 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 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 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 compositionType(): CompositionTypeClass<"MAT3">
  • Gets the composition type for this matrix.

    Returns CompositionTypeClass<"MAT3">

    CompositionType.Mat3

Methods

  • 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

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

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

  • Creates a new matrix from 9 values specified in column-major order. This matches the internal storage format of WebGL matrices.

    Parameters

    • m00: number

      Element at position (0,0)

    • m10: number

      Element at position (1,0)

    • m20: number

      Element at position (2,0)

    • m01: number

      Element at position (0,1)

    • m11: number

      Element at position (1,1)

    • m21: number

      Element at position (2,1)

    • m02: number

      Element at position (0,2)

    • m12: number

      Element at position (1,2)

    • m22: number

      Element at position (2,2)

    Returns MutableMatrix33

    A new MutableMatrix33 instance

  • Creates a new matrix from 9 values specified in row-major order. This is more intuitive when writing matrix values as they appear visually.

    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

    A new MutableMatrix33 instance

  • Creates a rotation matrix for combined X, Y, and Z axis rotations applied in that order.

    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

    A new MutableMatrix33 instance representing the combined rotation