rhodonite
    Preparing search index...

    Class Matrix33

    Immutable 3x3 matrix class for 3D transformations. Matrix values are stored in column-major order for WebGL compatibility. Provides various matrix operations including rotation, scaling, and multiplication.

    // Create identity matrix
    const identity = Matrix33.identity();

    // Create rotation matrix
    const rotation = Matrix33.rotateZ(Math.PI / 4);

    // Create scale matrix
    const scale = Matrix33.scale(Vector3.fromCopyArray([2, 2, 2]));

    // Matrix multiplication
    const result = Matrix33.multiply(rotation, scale);

    Hierarchy (View Summary)

    Implements

    Index

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

    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

    • 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

      Returns Matrix33

      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

      Returns Matrix33

      A new Matrix33 instance

    • Creates a Matrix33 from a regular array in column-major order.

      Parameters

      • array: number[]

        The array containing at least 9 numbers

      Returns Matrix33

      A new Matrix33 instance

    • Creates a Matrix33 from a regular array in row-major order.

      Parameters

      • array: number[]

        The array containing at least 9 numbers in row-major order

      Returns Matrix33

      A new Matrix33 instance

    • Creates a Matrix33 by copying from a Float32Array in column-major order.

      Parameters

      • float32Array: Float32Array

        The Float32Array to copy from

      Returns Matrix33

      A new Matrix33 instance

    • Creates a Matrix33 by copying from a Float32Array in row-major order.

      Parameters

      • array: Float32Array

        The Float32Array in row-major order

      Returns Matrix33

      A new Matrix33 instance

    • Creates a Matrix33 using the provided Float32Array directly (no copy).

      Parameters

      • float32Array: Float32Array

        The Float32Array in column-major order

      Returns Matrix33

      A new Matrix33 instance

    • 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

      Returns Matrix33

      A new rotation matrix representing the combined rotations