Class IdentityMatrix33

A 3x3 identity matrix implementation that represents the multiplicative identity for 3x3 matrices. This matrix has 1s on the main diagonal and 0s elsewhere:

[1 0 0]
[0 1 0]
[0 0 1]

This class is optimized for identity matrix operations and provides constant-time access to matrix elements without storing the actual matrix data.

Hierarchy (view full)

Implements

Constructors

Properties

_v: Float32Array = ...

Internal Float32Array storage for matrix elements

__v: Float32Array = ...

Shared Float32Array containing the identity matrix values [1,0,0,0,1,0,0,0,1]

Accessors

Methods

  • Gets the matrix element at the specified row and column. For identity matrix: returns 1 if row equals column, 0 otherwise.

    Parameters

    • row_i: number

      The row index (0-2)

    • column_i: number

      The column index (0-2)

    Returns number

    The matrix element value

  • Checks if another matrix is approximately equal to this identity matrix within a tolerance.

    Parameters

    • mat: IMatrix33

      The matrix to compare against

    • delta: number = Number.EPSILON

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

    Returns boolean

    True if the matrix is approximately an identity matrix

  • Checks if another matrix is strictly equal to this identity matrix (exact comparison). Note: This method appears to have a bug - it checks 16 elements instead of 9 for a 3x3 matrix.

    Parameters

    Returns boolean

    True if the matrix is exactly an identity matrix

  • 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 vector. Since this is an identity matrix, the result is the original vector unchanged.

    Parameters

    • vec: IVector

      The vector to multiply

    Returns IVector

    The same vector (identity operation)

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

    Parameters

    Returns IMutableVector

    The output vector containing the result

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

    Parameters

    • i: number

      The zero-based flat index into the matrix storage

    Returns number

    The matrix element value at the specified index