Skip to content

Documentation / base / Matrix3x3

Class: Matrix3x3 ​

Defined in: libs/base/src/math/vector.ts:2720

3x3 Matrix

Remarks ​

The matrix is column-major: | m00, m10, m20 | | m01, m11, m21 | | m02, m12, m22 |

Extends ​

Indexable ​

[index: number]: number

Constructors ​

Constructor ​

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

Defined in: libs/base/src/math/vector.ts:2733

Creates a Matrix3x3 initialized with values.

Parameters ​

m00 ​

number

element at row 0, column 0

m10 ​

number

element at row 0, column 1

m20 ​

number

element at row 0, column 2

m01 ​

number

element at row 1, column 0

m11 ​

number

element at row 1, column 1

m21 ​

number

element at row 1, column 2

m02 ​

number

element at row 2, column 0

m12 ​

number

element at row 2, column 1

m22 ​

number

element at row 2, column 2

Returns ​

Matrix3x3

Overrides ​

VectorBase.constructor

Constructor ​

new Matrix3x3(elements): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2748

Creates a Matrix3x3 initialized with values in an array.

Parameters ​

elements ​

number[]

Array that contains the values.

Returns ​

Matrix3x3

Overrides ​

VectorBase.constructor

Constructor ​

new Matrix3x3(array): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2753

Cerates a Matrix3x3 initialized with values in a Float32Array.

Parameters ​

array ​

Float32Array

Float32Array object that contains the values.

Returns ​

Matrix3x3

Overrides ​

VectorBase.constructor

Constructor ​

new Matrix3x3(buffer, offset): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2759

Creates a new Matrix3x3 placed on a given ArrayBuffer object.

Parameters ​

buffer ​

ArrayBuffer

The array buffer object.

offset ​

number

The byte offset of the buffer where the matrix placed at.

Returns ​

Matrix3x3

Overrides ​

VectorBase.constructor

Constructor ​

new Matrix3x3(): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2763

Creates a new identity Matrix3x3.

Returns ​

Matrix3x3

Overrides ​

VectorBase.constructor

Accessors ​

m00 ​

Get Signature ​

get m00(): number

Defined in: libs/base/src/math/vector.ts:2818

Get the element at row 0, column 0

Returns ​

number

Set Signature ​

set m00(v): void

Defined in: libs/base/src/math/vector.ts:2821

Parameters ​
v ​

number

Returns ​

void


m10 ​

Get Signature ​

get m10(): number

Defined in: libs/base/src/math/vector.ts:2825

Get the element at row 0, column 1

Returns ​

number

Set Signature ​

set m10(v): void

Defined in: libs/base/src/math/vector.ts:2828

Parameters ​
v ​

number

Returns ​

void


m20 ​

Get Signature ​

get m20(): number

Defined in: libs/base/src/math/vector.ts:2832

Get the element at row 0, column 2

Returns ​

number

Set Signature ​

set m20(v): void

Defined in: libs/base/src/math/vector.ts:2835

Parameters ​
v ​

number

Returns ​

void


m01 ​

Get Signature ​

get m01(): number

Defined in: libs/base/src/math/vector.ts:2839

Get the element at row 1, column 0

Returns ​

number

Set Signature ​

set m01(v): void

Defined in: libs/base/src/math/vector.ts:2842

Parameters ​
v ​

number

Returns ​

void


m11 ​

Get Signature ​

get m11(): number

Defined in: libs/base/src/math/vector.ts:2846

Get the element at row 1, column 1

Returns ​

number

Set Signature ​

set m11(v): void

Defined in: libs/base/src/math/vector.ts:2849

Parameters ​
v ​

number

Returns ​

void


m21 ​

Get Signature ​

get m21(): number

Defined in: libs/base/src/math/vector.ts:2853

Get the element at row 1, column 2

Returns ​

number

Set Signature ​

set m21(v): void

Defined in: libs/base/src/math/vector.ts:2856

Parameters ​
v ​

number

Returns ​

void


m02 ​

Get Signature ​

get m02(): number

Defined in: libs/base/src/math/vector.ts:2860

Get the element at row 2, column 0

Returns ​

number

Set Signature ​

set m02(v): void

Defined in: libs/base/src/math/vector.ts:2863

Parameters ​
v ​

number

Returns ​

void


m12 ​

Get Signature ​

get m12(): number

Defined in: libs/base/src/math/vector.ts:2867

Get the element at row 2, column 1

Returns ​

number

Set Signature ​

set m12(v): void

Defined in: libs/base/src/math/vector.ts:2870

Parameters ​
v ​

number

Returns ​

void


m22 ​

Get Signature ​

get m22(): number

Defined in: libs/base/src/math/vector.ts:2874

Get the element at row 2, column 2

Returns ​

number

Set Signature ​

set m22(v): void

Defined in: libs/base/src/math/vector.ts:2877

Parameters ​
v ​

number

Returns ​

void

Methods ​

equalsTo() ​

equalsTo(other, epsl?): boolean

Defined in: libs/base/src/math/vector.ts:32

Check if all data is close enough to another

Parameters ​

other ​

Float32Array<ArrayBuffer>

The data to be compared with.

epsl? ​

number

Returns ​

boolean

true if close enough, otherwise false.

Inherited from ​

VectorBase.equalsTo


toString() ​

toString(): string

Defined in: libs/base/src/math/vector.ts:52

Convert this to string object.

Returns ​

string

Inherited from ​

VectorBase.toString


isNaN() ​

isNaN(): boolean

Defined in: libs/base/src/math/vector.ts:61

Check the data for the presence of NaN.

Returns ​

boolean

true if NaN is present, otherwise false.

Inherited from ​

VectorBase.isNaN


setRandom() ​

setRandom(minValue, maxValue): void

Defined in: libs/base/src/math/vector.ts:75

Generate random vector

Parameters ​

minValue ​

number

Minimum value of any component of the vector

maxValue ​

number

Maximum value of any component of the vector

Returns ​

void

Inherited from ​

VectorBase.setRandom


clone() ​

clone(): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2814

Creates a new Matrix3x3 initialized with values from this matrix.

Returns ​

Matrix3x3

The new matrix.


getRow() ​

getRow(row, result?): Vector3

Defined in: libs/base/src/math/vector.ts:2886

Get the values in a row as a Vector3

Parameters ​

row ​

number

The row index

result? ​

Vector3

The output vector, if not specified, a new vector will be created.

Returns ​

Vector3

The output vector


setRow() ​

setRow(row, v): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2895

Set values to a row in the matrix.

Parameters ​

row ​

number

The row index

v ​

Vector3

The values to be set

Returns ​

Matrix3x3

  • self

setRowXYZ() ​

setRowXYZ(row, x, y, z): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2909

Set values to a row in the matrix.

Parameters ​

row ​

number

The row index

x ​

number

The first value of the row to be set

y ​

number

The second value of the row to be set

z ​

number

The third value of the row to be set

Returns ​

Matrix3x3

  • self

getCol() ​

getCol(col, result?): Vector3

Defined in: libs/base/src/math/vector.ts:2921

Get the values in a column as a Vector3

Parameters ​

col ​

number

The column index

result? ​

Vector3

The output vector, if not specified, a new vector will be created.

Returns ​

Vector3

The output vector


setCol() ​

setCol(col, v): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2930

Set values to a column in the matrix.

Parameters ​

col ​

number

The column index.

v ​

Vector3

The values to be set.

Returns ​

Matrix3x3

self


setColXYZ() ​

setColXYZ(col, x, y, z): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2944

Set values to a column in the matrix.

Parameters ​

col ​

number

The column index.

x ​

number

The first value of the column to be set.

y ​

number

The second value of the column to be set.

z ​

number

The third value of the column to be set.

Returns ​

Matrix3x3

self


add() ​

static add(a, b, result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2957

Adds two Matrix3x3's component-wise.

Parameters ​

a ​

Matrix3x3

The first operand.

b ​

Matrix3x3

The second operand.

result? ​

Matrix3x3

The output matrix (can be the same as a or b), if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The result matrix


sub() ​

static sub(a, b, result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2971

Subtracts two Matrix3x3's component-wise.

Parameters ​

a ​

Matrix3x3

The first operand.

b ​

Matrix3x3

The second operand.

result? ​

Matrix3x3

The output matrix (can be the same as a or b), if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The result matrix


mul() ​

static mul(a, b, result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2985

Multiplys two Matrix3x3's component-wise.

Parameters ​

a ​

Matrix3x3

The first operand.

b ​

Matrix3x3

The second operand.

result? ​

Matrix3x3

The output matrix (can be the same as a or b), if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The output matrix


div() ​

static div(a, b, result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:2999

Divides two Matrix3x3's component-wise.

Parameters ​

a ​

Matrix3x3

The first operand.

b ​

Matrix3x3

The second operand.

result? ​

Matrix3x3

The output matrix (can be the same as a or b), if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The result matrix


scale() ​

static scale(a, f, result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3013

Scales a Matrix3x3 by a scalar number component-wise.

Parameters ​

a ​

Matrix3x3

The matrix to be scaled.

f ​

number

The scalar number.

result? ​

Matrix3x3

The output matrix (can be the same as a), if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The result matrix


identity() ​

static identity(result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3025

Creates an identity Matrix3x3.

Parameters ​

result? ​

Matrix3x3

The output matrix, if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The output matrix


transpose() ​

static transpose(matrix, result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3036

Transpose a Matrix3x3.

Parameters ​

matrix ​

Matrix3x3

The matrix to be transposed.

result? ​

Matrix3x3

The output matrix (can be the same as matrix), if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The output matrix


invert() ​

static invert(matrix, result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3061

Inverts a Matrix3x3

Parameters ​

matrix ​

Matrix3x3

The matrix to be inverted.

result? ​

Matrix3x3

The output matrix (can be the same as matrix). if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The output matrix


rotationX() ​

static rotationX(angle, result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3093

Creates a Matrix3x3 that presents a rotation around x axis.

Parameters ​

angle ​

number

The rotate angle in radians.

result? ​

Matrix3x3

The output matrix, if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The output matrix


rotationY() ​

static rotationY(angle, result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3114

Creates a Matrix3x3 that presents a rotation around y axis.

Parameters ​

angle ​

number

The rotate angle in radians.

result? ​

Matrix3x3

The output matrix, if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The output matrix


rotationZ() ​

static rotationZ(angle, result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3135

Creates a Matrix3x3 that presents a rotation around z axis.

Parameters ​

angle ​

number

The rotate angle in radians.

result? ​

Matrix3x3

The output matrix, if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The output matrix


rotation() ​

static rotation(axis, angle, result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3157

Creates a Matrix3x3 that presents a rotation around a given axis.

Parameters ​

axis ​

Vector3

The rotation axis.

angle ​

number

The rotate angle in radians.

result? ​

Matrix3x3

The output matrix, if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The output matrix


multiply() ​

static multiply(m1, m2, result?): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3190

Multiplies two Matrix3x3's

Parameters ​

m1 ​

Matrix3x3

The first operand.

m2 ​

Matrix3x3

The second operand.

result? ​

Matrix3x3

The output matrix (can be the same as m1 or m2), if not specified, a new matrix will be created.

Returns ​

Matrix3x3

The output matrix


subBy() ​

subBy(other): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3228

Subtract a matrix from this matrix component-wise.

Parameters ​

other ​

Matrix3x3

The matrix that will be subtract.

Returns ​

Matrix3x3

self


addBy() ​

addBy(other): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3237

Add a matrix to this matrix component-wise.

Parameters ​

other ​

Matrix3x3

The matrix that will be added.

Returns ​

Matrix3x3

self


mulBy() ​

mulBy(other): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3246

Multiplies this matrix by a matrix component-wise.

Parameters ​

other ​

Matrix3x3

The matrix that will be multiplied by.

Returns ​

Matrix3x3

self


divBy() ​

divBy(other): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3255

Divide this matrix by a matrix component-wise.

Parameters ​

other ​

Matrix3x3

The matrix that will be divide by.

Returns ​

Matrix3x3

self


scaleBy() ​

scaleBy(f): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3264

Scale this matrix by a scalar number component-wise.

Parameters ​

f ​

number

amount to scale this matrix by.

Returns ​

Matrix3x3

self


identity() ​

identity(): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3272

Make this matrix identity.

Returns ​

Matrix3x3

self


inplaceInvert() ​

inplaceInvert(): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3280

Calculate the inverse of this matrix inplace.

Returns ​

Matrix3x3

self


transpose() ​

transpose(): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3288

Calculate the transpose of this matrix inplace.

Returns ​

Matrix3x3

self


multiplyRight() ​

multiplyRight(other): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3301

Post-multiply by a matrix inplace.

Parameters ​

other ​

Matrix3x3

The matrix that will be multiplied by.

Returns ​

Matrix3x3

self

Remarks ​

this = this * other


multiplyLeft() ​

multiplyLeft(other): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3314

Pre-multiply by a matrix inplace.

Parameters ​

other ​

Matrix3x3

The matrix that will be multiplied by.

Returns ​

Matrix3x3

self

Remarks ​

this = other * this


rotationX() ​

rotationX(angle): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3323

Calculates a rotation around x axis inplace.

Parameters ​

angle ​

number

The rotate angle in radians.

Returns ​

Matrix3x3

self


rotationY() ​

rotationY(angle): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3332

Calculates a rotation around y axis inplace.

Parameters ​

angle ​

number

The rotate angle in radians.

Returns ​

Matrix3x3

self


rotationZ() ​

rotationZ(angle): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3341

Calculates a rotation around z axis inplace.

Parameters ​

angle ​

number

The rotate angle in radians.

Returns ​

Matrix3x3

self


rotation() ​

rotation(axis, angle): Matrix3x3

Defined in: libs/base/src/math/vector.ts:3351

Calculates a rotation around a given axis.

Parameters ​

axis ​

Vector3

The rotation axis.

angle ​

number

The rotate angle in radians.

Returns ​

Matrix3x3

self


transform() ​

transform(vec, result?): Vector3

Defined in: libs/base/src/math/vector.ts:3361

Transform a vector by this matrix.

Parameters ​

vec ​

Vector3

The vector to be transformed.

result? ​

Vector3

The output vector (can be the same as vec), if not specified, a new vector will be created.

Returns ​

Vector3

The output vector


transformPoint() ​

transformPoint(vec, result?): Vector3

Defined in: libs/base/src/math/vector.ts:3372

Transform a vector by this matrix.

Parameters ​

vec ​

Vector3

The vector to be transformed.

result? ​

Vector3

The output vector (can be the same as vec), if not specified, a new vector will be created.

Returns ​

Vector3

The output vector


transformVector() ​

transformVector(vec, result?): Vector3

Defined in: libs/base/src/math/vector.ts:3378

Transform a vector by this matrix.

Parameters ​

vec ​

Vector3

The vector to be transformed.

result? ​

Vector3

The output vector (can be the same as vec), if not specified, a new vector will be created.

Returns ​

Vector3

The output vector

Released under the MIT License.