API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classMatrix

@codexo/exojs / math / stable

Mutable 3×3 row-major affine transformation matrix used throughout the rendering and physics pipeline. Layout (row, column): ``` | a b x | | c d y | | e f z | ``` `a`/`d` are the X/Y scale + rotation cosines, `b`/`c` are the shear/rotation sines, `x`/`y` are the translation components, and `e`/`f`/`z` are the homogeneous row (typically `0, 0, 1`). All mutating methods return `this` for chaining. `Matrix.temp` is a shared scratch instance. `Matrix.identity` is a read-only identity constant.

11
props
11
methods
0
events
Import
import { Matrix } from '@codexo/exojs'

Mutable 3×3 row-major affine transformation matrix used throughout the rendering and physics pipeline.

Layout (row, column): ``` | a b x | | c d y | | e f z | ``` `a`/`d` are the X/Y scale + rotation cosines, `b`/`c` are the shear/rotation sines, `x`/`y` are the translation components, and `e`/`f`/`z` are the homogeneous row (typically `0, 0, 1`).

All mutating methods return `this` for chaining. `Matrix.temp` is a shared scratch instance. `Matrix.identity` is a read-only identity constant.

Constructors1
new(a: number, b: number, x: number, c: number, d: number, y: number, e: number, f: number, z: number): Matrix
Methods11
clone(): this
combine(matrix: Matrix): this
Post-multiply this matrix by matrix (i.e. this = this × matrix). Applies matrix's transform after this matrix's transform. Mutates in place and returns this for chaining.
copy(matrix: Matrix): this
destroy(): void
equals(__namedParameters: Partial<Matrix>): boolean
getInverse(result: Matrix): Matrix
Compute the inverse of this matrix and write it into result. Defaults to this (in-place inversion). When the matrix is singular (determinant = 0) result is set to the identity. Returns result.
rotate(angle: number, centerX: number, centerY: number): this
Apply a rotation of angle **degrees** around (centerX, centerY) to this matrix. Mutates in place and returns this for chaining.
scale(scaleX: number, scaleY: number, centerX: number, centerY: number): this
Apply a scale of (scaleX, scaleY) around (centerX, centerY) to this matrix. Mutates in place and returns this for chaining.
set(a: number, b: number, x: number, c: number, d: number, y: number, e: number, f: number, z: number): this
toArray(transpose: boolean): Float32Array
Serialise this matrix into a Float32Array suitable for a WebGL uniform. The internal Float32Array is lazily allocated and reused across calls. When transpose is false (default) the array is in column-major order (as OpenGL expects). When true it is row-major.
translate(x: number, y: number): this
Apply a translation of (x, y) to this matrix. Mutates in place and returns this for chaining.
Properties11
a: number
b: number
c: number
d: number
e: number
f: number
x: number
y: number
z: number
identity: Matrix
temp: Matrix
Source