Theme:

Matrix3

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

Constructor

const m = new Matrix3()  // identity
const m = new Matrix3(n11, n12, n13, n21, n22, n23, n31, n32, n33)

Properties

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

Methods

Setting

  • set(n11..n33) — Set elements (row-major)
  • identity() — Reset to identity
  • copy(m) — Copy from another Matrix3
  • setFromMatrix4(m) — Extract upper 3x3 from Matrix4
  • fromArray(array, offset?) — Set from column-major array
  • clone()

Arithmetic

  • multiply(m) — Post-multiply
  • premultiply(m) — Pre-multiply
  • multiplyMatrices(a, b) — Multiply two matrices, store result
  • multiplyScalar(s) — Scale all elements

Operations

  • determinant() — Compute determinant
  • invert() — Invert in-place (zero matrix if det=0)
  • transpose() — Transpose in-place
  • getNormalMatrix(matrix4) — Compute normal matrix from 4x4 matrix
  • transposeIntoArray(r) — Transpose into external array

Basis & Transforms

  • extractBasis(xAxis, yAxis, zAxis) — Extract basis vectors
  • setUvTransform(tx, ty, sx, sy, rotation, cx, cy) — UV transform
  • scale(sx, sy), rotate(theta), translate(tx, ty) — 2D transforms
  • makeTranslation(x, y), makeRotation(theta), makeScale(x, y) — Create 2D transform matrices

Other

  • equals(matrix) — Equality test
  • toArray(array?, offset?) — Write to column-major array