A class representing a 2x2 matrix.

const m = new Matrix2();

Constructors

Properties

Methods

Constructors

  • Creates a 2x2 identity matrix.

    Returns Matrix2

  • Creates a 2x2 matrix with the given arguments in row-major order.

    Parameters

    • n11: number
    • n12: number
    • n21: number
    • n22: number

    Returns Matrix2

Properties

elements: Matrix2Tuple

A column-major list of matrix values.

isMatrix2

Methods

  • Sets the elements of this matrix based on an array in column-major format.

    Parameters

    • array: ArrayLike<number>

      the array to read the elements from

    • Optionaloffset: number

      (optional) index of first element in the array. Default is 0.

    Returns this

  • Resets this matrix to the 2x2 identity matrix:

    Returns this

  • Sets the 2x2 matrix values to the given row-major sequence of values: [n11, n12, n21, n22]

    Parameters

    • n11: number
    • n12: number
    • n21: number
    • n22: number

    Returns this