Skip to content
Matrix3x3

[Basic Type](../groups/Basic Type.Basic Type.md) / Matrix3x3

Matrix3x3 Class

Three-dimensional matrix


Precautions

Column matrix

Table of contents

Properties

m00: number
The element in column 0 and row 0 of the matrix.
m01: number
The element in column 0 and row 1 of the matrix.
m02: number
The elements in column 0 and row 2 of the matrix.
m10: number
The element in column 1, row 0 of the matrix.
m11: number
The elements in the first column and first row of the matrix.
m12: number
The elements in column 1 and row 2 of the matrix.
m20: number
The element in column 2, row 0 of the matrix.
m21: number
The elements in the second column and first row of the matrix.
m22: number
The elements in the second column and second row of the matrix.

Accessors

identity(): void other
Set the current matrix as the identity matrix.

Methods

add(a, b, outer?): Matrix3x3 other
Element wise matrix addition
clone(a: Matrix3x3): Matrix3x3 other
Obtain a copy of the specified matrix
determinant(a: Matrix3x3): number other
Find the determinant of target matrix
equals(a: Matrix3x3, b: Matrix3x3, epsilon?: number): boolean other
Approximate equivalence judgment of matrix to exclude floating-point errors
identity(): void other
Set the current matrix as the identity matrix.
invert(a: Matrix3x3, outer?: Matrix3x3): Matrix3x3 other
Invert the target matrix, note that when the matrix is irreversible, a matrix with all zeros will be returned.
multiply(a: Matrix3x3, b: number, outer?: Matrix3x3): Matrix3x3 other
Matrix multiplication
rotate(a: Matrix3x3, rad: number, outer?: Matrix3x3): Matrix3x3 other
Add a new rotation transformation based on the given matrix transformation
scale(a: Matrix3x3, v: Vector, outer?: Matrix3x3): Matrix3x3 other
Add a new scale transform on the basis of the given matrix transform
set(other: Matrix3x3): Matrix3x3 other
Set the current matrix to be equal to the specified matrix.
strictEquals(a: Matrix3x3, b: Matrix3x3): boolean other
Matrix equivalence judgment
subtract(a: Matrix3x3, b: Matrix3x3, outer?: Matrix3x3): Matrix3x3 other
Element wise matrix subtraction
toString(): string other
Returns the string representation of the current matrix.
transpose(a: Matrix3x3, outer?: Matrix3x3): Matrix3x3 other
Transform the target matrix into a transpose matrix
add(a, b, outer?): Matrix3x3 other
Element wise matrix addition
clone(a: Matrix3x3): Matrix3x3 other
Obtain a copy of the specified matrix
determinant(a: Matrix3x3): number other
Find the determinant of target matrix
equals(a: Matrix3x3, b: Matrix3x3, epsilon?: number): boolean other
Approximate equivalence judgment of matrix to exclude floating-point errors
fromMat4(a: Matrix4x4, outer?: Matrix3x3): Matrix3x3 other
Take the first three orders of a fourth-order matrix
fromRotation(rad: number, outer?: Matrix3x3): Matrix3x3 other
Calculate rotation matrix
fromScaling(v: Vector2, outer?: Matrix3x3): Matrix3x3 other
Calculate the scaling matrix
fromTranslation(v: Vector2, outer?: Matrix3x3): Matrix3x3 other
Calculate displacement matrix
fromViewUp(view: Vector, up?: Vector, outer?: Matrix3x3, epsilon?: number): Matrix3x3 other
Calculates the matrix based on the front and up directions of the viewport
inverseTransposeMat4(a: Matrix4x4, outer?: Matrix3x3): Matrix3x3 other
Calculate the inverse transpose three-dimensional matrix of a specified fourth-order matrix
invert(a: Matrix3x3, outer?: Matrix3x3): Matrix3x3 other
Invert the target matrix, note that when the matrix is irreversible, a matrix with all zeros will be returned.
multiply(a: Matrix3x3, b: number, outer?: Matrix3x3): Matrix3x3 other
Matrix multiplication
rotate(a: Matrix3x3, rad: number, outer?: Matrix3x3): Matrix3x3 other
Add a new rotation transformation based on the given matrix transformation
scale(a: Matrix3x3, v: Vector, outer?: Matrix3x3): Matrix3x3 other
Add a new scale transform on the basis of the given matrix transform
strictEquals(a: Matrix3x3, b: Matrix3x3): boolean other
Matrix equivalence judgment
subtract(a: Matrix3x3, b: Matrix3x3, outer?: Matrix3x3): Matrix3x3 other
Element wise matrix subtraction
transformVector(a: Matrix3x3, b: Vector, outer?: Vector): Vector other
Multiplication of vectors and three-dimensional matrices
transformVector2(a: Matrix3x3, b: Vector2, outer?: Vector2): Vector2 other
Multiplying vectors with three-dimensional matrices, the third digit of the vector is assumed to be 1.
transpose(a: Matrix3x3, outer?: Matrix3x3): Matrix3x3 other
Transform the target matrix into a transpose matrix

Build a new Matrix3x3 using the given Matrix3x3

Parameters

other Matrix3x3Usage: Given Matrix3x3 object

new Matrix3x3(m00?, m01?, m02?, m10?, m11?, m12?, m20?, m21?, m22?)

Build a new Matrix3x3 using the given elements

Parameters

m00? numberUsage: element in column 0, line 0 default: 1 range: no restrictions type: floating point number
m01? numberUsage: Element in column 0, line 1 default: 0 range: No restrictions type: Floating point number
m02? numberUsage: element in column 0, line 2 default: 0 range: no restrictions type: floating point number
m10? numberUsage: element in column 1, line 0 default: 0 range: no restrictions type: floating point number
m11? numberUsage: element in column 1, line 1 default: 1 range: no restrictions type: floating point number
m12? numberUsage: Element in column 1, line 2 default: 0 range: No restrictions type: Floating point number
m20? numberUsage: element in column 2, line 0 default: 0 range: no restrictions type: floating point number
m21? numberUsage: Element in column 2, line 1 default: 0 range: No restrictions type: Floating point number
m22? numberUsage: element in column 2, line 2 default: 1 range: no restrictions type: floating point number

Properties

m00

m00: number

The element in column 0 and row 0 of the matrix.


m01

m01: number

The element in column 0 and row 1 of the matrix.


m02

m02: number

The elements in column 0 and row 2 of the matrix.


m10

m10: number

The element in column 1, row 0 of the matrix.


m11

m11: number

The elements in the first column and first row of the matrix.


m12

m12: number

The elements in column 1 and row 2 of the matrix.


m20

m20: number

The element in column 2, row 0 of the matrix.


m21

m21: number

The elements in the second column and first row of the matrix.


m22

m22: number

The elements in the second column and second row of the matrix.

Accessors

identity

Static get identity(): Matrix3x3

Obtain a default matrix

Methods

add

add(mat): Matrix3x3 other

The matrix is added element by element.

Parameters

a Matrix3x3Usage: matrix a
b Matrix3x3Usage: matrix b
outer? Matrix3x3Usage: matrix for receiving results default: null

Returns

Matrix3x3Calculated matrix

clone

clone(): Matrix3x3 other

Clone the current matrix.

Parameters

a Matrix3x3Usage: Specify matrix

Returns

Matrix3x3A new matrix

determinant

determinant(): number other

Calculate the determinant of the current matrix.

Parameters

a Matrix3x3Usage: target matrix

Returns

numberThe result of determinant

equals

equals(other, epsilon?): boolean other

Determine whether the current matrix is equal to the specified matrix within the error range.

Parameters

a Matrix3x3Usage: matrix a
b Matrix3x3Usage: matrix b
epsilon? numberUsage: Error value
default: 1. e-7
range: It is recommended to pass in a value less than 1. Type: Floating point number

Returns

booleanReturn comparison results

identity

identity(): void other

Set the current matrix as the identity matrix.


invert

invert(): void other

Compute the current matrix as its inverse matrix. Note that when the matrix is irreversible, a matrix with all zeros will be returned.

Parameters

a Matrix3x3Usage: target matrix
outer? Matrix3x3Usage: Matrix for writing data default: null

Returns

Matrix3x3Inverse matrix

multiply

multiply(mat): Matrix3x3 other

Matrix multiplication. Assign the result of left multiplication of the specified matrix to the current matrix.

Parameters

a Matrix3x3Usage: matrix a
b Matrix3x3Usage: matrix b
outer? Matrix3x3Usage: matrix for receiving results default: null

Returns

Matrix3x3Calculated matrix

Static multiply(a, b, outer?): Matrix3x3 other

Take the first three orders of the fourth-order matrix and multiply them with the three-dimensional matrix

Parameters

a Matrix3x3Usage: matrix a
b Matrix4x4Usage: matrix b
outer? Matrix3x3Usage: matrix for receiving results default: null

Returns

Matrix3x3Calculated matrix

Static multiply(a, b, outer?): Matrix3x3 other

Matrix scalar multiplication

Parameters

a Matrix3x3Usage: matrix a
b numberUsage: number b
range: unlimited type: floating-point number
outer? Matrix3x3Usage: matrix for receiving results default: null

Returns

Matrix3x3Calculated matrix

scale

scale(vec): Matrix3x3 other

Assign the result of the left multiplication scaling matrix of the current matrix to the current matrix, where the scaling matrix is given by the scaling of each axis.

Parameters

a Matrix3x3Usage: 3D matrix
v VectorUsage: Three dimensional vector of scaling matrix
outer? Matrix3x3Usage: Receive result 3D matrix object default: null

Returns

Matrix3x33D matrix after scale

set

set(other): Matrix3x3 other

Set the current matrix to be equal to the specified matrix.

Parameters

other Matrix3x3Usage: Specify matrix

Returns

Matrix3x3this

set(m00?, m01?, m02?, m10?, m11?, m12?, m20?, m21?, m22?): Matrix3x3 other

Set the current matrix to specify element values.

Parameters

m00? numberUsage: element in row 0, column 0 default: 1 range: no restrictions type: floating point number
m01? numberUsage: element in row 0, column 1 default: 0 range: no restrictions type: floating point number
m02? numberUsage: element in row 0, column 2 default: 0 range: no restrictions type: floating point number
m10? numberUsage: element in line 1, column 0 default: 0 range: no restrictions type: floating point number
m11? numberUsage: element in line 1, column 1 default: 1 range: no restrictions type: floating point number
m12? numberUsage: element in line 1, column 2 default: 0 range: no restrictions type: floating point number
m20? numberUsage: element in line 2, column 0 default: 0 range: no restrictions type: floating point number
m21? numberUsage: element in line 2, column 1 default: 0 range: no restrictions type: floating point number
m22? numberUsage: element in line 2, column 2 default: 1 range: no restrictions type: floating point number

Returns

Matrix3x3this

strictEquals

strictEquals(other): boolean other

Determine whether the current matrix is equal to the specified matrix.

Parameters

a Matrix3x3Usage: matrix a
b Matrix3x3Usage: matrix b

Returns

booleanReturn comparison results

subtract

subtract(mat): Matrix3x3 other

Subtract the parameter matrix element by element from the current matrix

Parameters

a Matrix3x3Usage: matrix a
b Matrix3x3Usage: matrix b
outer? Matrix3x3Usage: matrix for receiving results default: null

Returns

Matrix3x3Calculated matrix

toString

toString(): string other

Returns the string representation of the current matrix.

Returns

stringReturns the string information of the matrix

transpose

transpose(): void other

Compute the current matrix as its transpose matrix.

Parameters

a Matrix3x3Usage: target matrix
outer? Matrix3x3Usage: Matrix for writing data default: null

Returns

Matrix3x3Transposed matrix

add

Static add(a, b, outer?): Matrix3x3 other

Element wise matrix addition

Parameters

a Matrix3x3Usage: matrix a
b Matrix3x3Usage: matrix b
outer? Matrix3x3Usage: matrix for receiving results default: null

Returns

Matrix3x3Calculated matrix

clone

Static clone(a): Matrix3x3 other

Obtain a copy of the specified matrix

Parameters

a Matrix3x3Usage: Specify matrix

Returns

Matrix3x3A new matrix

determinant

Static determinant(a): number other

Find the determinant of target matrix

Parameters

a Matrix3x3Usage: target matrix

Returns

numberThe result of determinant

equals

Static equals(a, b, epsilon?): boolean other

Approximate equivalence judgment of matrix to exclude floating-point errors

Parameters

a Matrix3x3Usage: matrix a
b Matrix3x3Usage: matrix b
epsilon? numberUsage: Error value
default: 1. e-7
range: It is recommended to pass in a value less than 1. Type: Floating point number

Returns

booleanReturn comparison results

fromMat4

Static fromMat4(a, outer?): Matrix3x3 other

Take the first three orders of a fourth-order matrix

Parameters

a Matrix4x4Usage: Source fourth-order matrix
outer? Matrix3x3Usage: Receive result 3D matrix object default: null

Returns

Matrix3x3Extracted 3D matrix

fromRotation

Static fromRotation(rad, outer?): Matrix3x3 other

Calculate rotation matrix

Parameters

rad numberUsage: Rotation radians
range: Unlimited type: Floating point number
outer? Matrix3x3Usage: Receive result 3D matrix object default: null

Returns

Matrix3x3A three-dimensional matrix containing rotation information

fromScaling

Static fromScaling(v, outer?): Matrix3x3 other

Calculate the scaling matrix

Parameters

v Vector2Usage: 2D vector of scale information
outer? Matrix3x3Usage: Receive result 3D matrix object default: null

Returns

Matrix3x3Three dimensional matrix with scale information

fromTranslation

Static fromTranslation(v, outer?): Matrix3x3 other

Calculate displacement matrix

Parameters

v Vector2Usage: Two dimensional vector of displacement
outer? Matrix3x3Usage: Receive result 3D matrix object default: null

Returns

Matrix3x3Three dimensional matrix containing displacement information

fromViewUp

Static fromViewUp(view, up?, outer?, epsilon?): Matrix3x3 other

Calculates the matrix based on the front and up directions of the viewport

Parameters

view VectorUsage: viewport vector
up? VectorUsage: upward vector of viewport default: null
outer? Matrix3x3Usage: Receive result 3D matrix object default: null
epsilon? numberUsage: Minimum error count default: MathDefine EPSILON
range: It is recommended to pass in a value less than 1. Type: Floating point number

Returns

Matrix3x3Calculated three-dimensional matrix

inverseTransposeMat4

Static inverseTransposeMat4(a, outer?): Matrix3x3 other

Calculate the inverse transpose three-dimensional matrix of a specified fourth-order matrix

Parameters

a Matrix4x4Usage: Fourth order matrix
outer? Matrix3x3Usage: Receive result 3D matrix object default: null

Returns

Matrix3x3Inverse transposed three-dimensional matrix

invert

Static invert(a, outer?): Matrix3x3 other

Invert the target matrix, note that when the matrix is irreversible, a matrix with all zeros will be returned.

Parameters

a Matrix3x3Usage: target matrix
outer? Matrix3x3Usage: Matrix for writing data default: null

Returns

Matrix3x3Inverse matrix

multiply

Static multiply(a, b, outer?): Matrix3x3 other

Matrix multiplication

Parameters

a Matrix3x3Usage: matrix a
b Matrix3x3Usage: matrix b
outer? Matrix3x3Usage: matrix for receiving results default: null

Returns

Matrix3x3Calculated matrix

Static multiply(a, b, outer?): Matrix3x3 other

Take the first three orders of the fourth-order matrix and multiply them with the three-dimensional matrix

Parameters

a Matrix3x3Usage: matrix a
b Matrix4x4Usage: matrix b
outer? Matrix3x3Usage: matrix for receiving results default: null

Returns

Matrix3x3Calculated matrix

Static multiply(a, b, outer?): Matrix3x3 other

Matrix scalar multiplication

Parameters

a Matrix3x3Usage: matrix a
b numberUsage: number b
range: unlimited type: floating-point number
outer? Matrix3x3Usage: matrix for receiving results default: null

Returns

Matrix3x3Calculated matrix

rotate

Static rotate(a, rad, outer?): Matrix3x3 other

Add a new rotation transformation based on the given matrix transformation

Parameters

a Matrix3x3Usage: Matrix that needs to be transformed
rad numberUsage: Rotation radians
range: Unlimited type: Floating point number
outer? Matrix3x3Usage: Receive result 3D matrix object default: null

Returns

Matrix3x3Rotating three-dimensional matrix

scale

Static scale(a, v, outer?): Matrix3x3 other

Add a new scale transform on the basis of the given matrix transform

Parameters

a Matrix3x3Usage: 3D matrix
v VectorUsage: Three dimensional vector of scaling matrix
outer? Matrix3x3Usage: Receive result 3D matrix object default: null

Returns

Matrix3x33D matrix after scale

strictEquals

Static strictEquals(a, b): boolean other

Matrix equivalence judgment

Parameters

a Matrix3x3Usage: matrix a
b Matrix3x3Usage: matrix b

Returns

booleanReturn comparison results

subtract

Static subtract(a, b, outer?): Matrix3x3 other

Element wise matrix subtraction

Parameters

a Matrix3x3Usage: matrix a
b Matrix3x3Usage: matrix b
outer? Matrix3x3Usage: matrix for receiving results default: null

Returns

Matrix3x3Calculated matrix

transformVector

Static transformVector(a, b, outer?): Vector other

Multiplication of vectors and three-dimensional matrices

Parameters

a Matrix3x3Usage: 3D matrix
b VectorUsage: 3D vectors
outer? VectorUsage: 3D vector written default: null

Returns

VectorThe transformed three-dimensional vector

transformVector2

Static transformVector2(a, b, outer?): Vector2 other

Multiplying vectors with three-dimensional matrices, the third digit of the vector is assumed to be 1.

Parameters

a Matrix3x3Usage: 3D matrix
b Vector2Usage: Two dimensional vectors
outer? Vector2Usage: 2D vector written default: null

Returns

Vector2The transformed two-dimensional vector

transpose

Static transpose(a, outer?): Matrix3x3 other

Transform the target matrix into a transpose matrix

Parameters

a Matrix3x3Usage: target matrix
outer? Matrix3x3Usage: Matrix for writing data default: null

Returns

Matrix3x3Transposed matrix