Theme:

Matrix2

A 2x2 matrix. Arguments to set() and the constructor are in row-major order; elements is stored in column-major order.

Constructor

const m = new Matrix2()              // identity
const m = new Matrix2(n11, n12, n21, n22) // row-major

Properties

  • elements — Column-major Array<number> (length 4)
  • isMatrix2 — Type flag (true)

Methods

  • set(n11, n12, n21, n22) — Set elements (row-major)
  • identity() — Reset to identity
  • fromArray(array, offset?) — Set from column-major array