Matrix3

The 3x3 matrix class.

Constructor

new Matrix3()

Create a 3x3 matrix.

Methods

clone() → {Matrix3}

Creates a new Matrix3 and with identical elements to this one.

Returns:
Type: 
Matrix3

copy(m) → {Matrix3}

Copies the elements of matrix m into this matrix.

Parameters:
NameTypeDescription
mMatrix3
Returns:
Type: 
Matrix3

equals(matrix) → {boolean}

Return true if this matrix and m are equal.

Parameters:
NameTypeDescription
matrixMatrix3
Returns:
Type: 
boolean

extractBasis(xAxis, yAxis, zAxis) → {Matrix3}

Extracts the basis vectors from the matrix.

Parameters:
NameTypeDescription
xAxisVector3
yAxisVector3
zAxisVector3
Returns:
Type: 
Matrix3

fromArray(array, offsetopt) → {Matrix3}

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

Parameters:
NameTypeAttributesDefaultDescription
arrayArray.<number>
offsetnumber<optional>
0
Returns:
Type: 
Matrix3

getInverse(matrix) → {Matrix3}

Take the inverse of the matrix

Parameters:
NameTypeDescription
matrixMatrix3

The matrix to take the inverse of.

Returns:
Type: 
Matrix3

identity() → {Matrix3}

Resets this matrix to the 3x3 identity matrix

Returns:
Type: 
Matrix3

inverse() → {Matrix3}

Take the inverse of this matrix

Returns:
Type: 
Matrix3

isIdentity() → {boolean}

Checks if the matrix is an identity matrix.

Returns:
  • True if the matrix is an identity matrix, false otherwise.
Type: 
boolean

multiply(m) → {Matrix3}

Post-multiplies this matrix by m.

Parameters:
NameTypeDescription
mMatrix3
Returns:
Type: 
Matrix3

multiplyMatrices(a, b) → {Matrix3}

Sets this matrix to a x b.

Parameters:
NameTypeDescription
aMatrix3
bMatrix3
Returns:
Type: 
Matrix3

premultiply(m) → {Matrix3}

Pre-multiplies this matrix by m.

Parameters:
NameTypeDescription
mMatrix3
Returns:
Type: 
Matrix3

set(n11, n12, n13, n21, n22, n23, n31, n32, n33) → {Matrix3}

Sets the 3x3 matrix values to the given row-major sequence of values.

Parameters:
NameTypeDescription
n11number

value to put in row 1, col 1.

n12number

value to put in row 1, col 2.

n13number

value to put in row 1, col 3.

n21number

value to put in row 2, col 1.

n22number

value to put in row 2, col 2.

n23number

value to put in row 2, col 3.

n31number

value to put in row 3, col 1.

n32number

value to put in row 3, col 2.

n33number

value to put in row 3, col 3.

Returns:
Type: 
Matrix3

setFromMatrix4(m) → {Matrix3}

Sets the matri3 planes from the matrix4.

Parameters:
NameTypeDescription
mMatrix4
Returns:
Type: 
Matrix3

setUvTransform(tx, ty, sx, sy, rotation, cx, cy) → {Matrix3}

Set the transformation matrix of uv coordinates

Parameters:
NameTypeDescription
txnumber
tynumber
sxnumber
synumber
rotationnumber
cxnumber
cynumber
Returns:
Type: 
Matrix3

toArray(arrayopt, offsetopt) → {Array.<number>}

Writes the elements of this matrix to an array in column-major format.

Parameters:
NameTypeAttributesDefaultDescription
arrayArray.<number><optional>
offsetnumber<optional>
0
Returns:
Type: 
Array.<number>

transform(x, y, scaleX, scaleY, rotation, anchorX, anchorY) → {Matrix3}

Transform 2D

Parameters:
NameTypeDescription
xnumber

position.x

ynumber

position.y

scaleXnumber

scale.x

scaleYnumber

scale.y

rotationnumber

rotation

anchorXnumber

anchor.x

anchorYnumber

anchor.y

Returns:
Type: 
Matrix3

transpose() → {Matrix3}

Transposes this matrix in place.

Returns:
Type: 
Matrix3