# SceneScript Class Mat3

Mat3 utility class used for creating a 3x3 matrix which can be used for 2D matrix manipulations.

# Properties

# m: Array

The internal array representing the matrix components.

# Constructors

# constructor(): Mat3

Creates an identity matrix.

# Static Functions

# static identity(): Mat3

Creates an identity matrix.

# static fromTranslation(v: Vec2): Mat3

Creates a 2D translation matrix.

# static fromScale(v: Number|Vec2): Mat3

Creates a uniform or per-axis 2D scale matrix.

# static fromRotation(angle: Number): Mat3

Creates a 2D rotation matrix. Angle is in degrees.

# static fromBasis(right: Vec2, up: Vec2): Mat3

Creates a matrix from two 2D basis vectors (column-wise).

# static fromMat4(m: Mat4): Mat3

Creates a Mat3 from the upper-left 3x3 of a Mat4.

# static compose(translation: Vec2, rotation: Number, scale: Vec2): Mat3

Composes a 2D transform as T * R * S, with rotation as a degree angle.

# Functions

# translation(position?: Vec2): Vec2

If position is specified, it will change the translation vector of the matrix and return nothing. If position is not specified, it will return the current translation vector.

# angle(): Number

Get forward angle of matrix in degrees.

# add(other: Mat3): Mat3

Element-wise matrix addition.

# subtract(other: Mat3): Mat3

Element-wise matrix subtraction.

# multiply(value: Mat3|Vec3|Number): Mat3|Vec3

Multiplies with another matrix, a Vec3, or a scalar.

# translate(v: Vec2): Mat3

Right-multiplies by a translation. Equivalent to this * fromTranslation(v).

# rotate(angle: Number): Mat3

Right-multiplies by a rotation. Angle is in degrees.

# scale(v: Number|Vec2): Mat3

Right-multiplies by a scale (uniform or per-axis).

# transformPoint(v: Vec2): Vec2

Transforms a 2D point (applies translation).

# transformDirection(v: Vec2): Vec2

Transforms a 2D direction (ignores translation).

# transpose(): Mat3

Returns the transposed matrix.

# determinant(): Number

Returns the determinant.

# inverse(): Mat3

Returns the inverse matrix.

# decompose(): Object

Decomposes the matrix into translation, rotation (degrees) and scale. Returns an object of shape { translation: Vec2, rotation: Number, scale: Vec2 }.

# copy(): Mat3

Makes a simple copy of the matrix.

# equals(other: Mat3): Boolean

Checks if one matrix is equal (with epsilon) to another matrix.

# toString(): String

Converts components to a string representation that Wallpaper Engine understands.