Skip to content

Documentation / base / Matrix3x3

Class: Matrix3x3

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

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:2732

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:2747

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:2752

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:2758

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:2762

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:2817

Get the element at row 0, column 0

Returns

number

Set Signature

set m00(v): void

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

Parameters
v

number

Returns

void


m10

Get Signature

get m10(): number

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

Get the element at row 0, column 1

Returns

number

Set Signature

set m10(v): void

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

Parameters
v

number

Returns

void


m20

Get Signature

get m20(): number

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

Get the element at row 0, column 2

Returns

number

Set Signature

set m20(v): void

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

Parameters
v

number

Returns

void


m01

Get Signature

get m01(): number

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

Get the element at row 1, column 0

Returns

number

Set Signature

set m01(v): void

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

Parameters
v

number

Returns

void


m11

Get Signature

get m11(): number

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

Get the element at row 1, column 1

Returns

number

Set Signature

set m11(v): void

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

Parameters
v

number

Returns

void


m21

Get Signature

get m21(): number

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

Get the element at row 1, column 2

Returns

number

Set Signature

set m21(v): void

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

Parameters
v

number

Returns

void


m02

Get Signature

get m02(): number

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

Get the element at row 2, column 0

Returns

number

Set Signature

set m02(v): void

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

Parameters
v

number

Returns

void


m12

Get Signature

get m12(): number

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

Get the element at row 2, column 1

Returns

number

Set Signature

set m12(v): void

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

Parameters
v

number

Returns

void


m22

Get Signature

get m22(): number

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

Get the element at row 2, column 2

Returns

number

Set Signature

set m22(v): void

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

Parameters
v

number

Returns

void

Methods

equalsTo()

equalsTo(other, epsl?): boolean

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

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:51

Convert this to string object.

Returns

string

Inherited from

VectorBase.toString


isNaN()

isNaN(): boolean

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

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:74

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:2813

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:2885

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:2894

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:2908

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:2920

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:2929

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:2943

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:2956

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:2970

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:2984

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:2998

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:3012

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:3024

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:3035

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:3060

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:3092

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:3113

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:3134

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:3156

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:3189

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:3227

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:3236

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:3245

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:3254

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:3263

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:3271

Make this matrix identity.

Returns

Matrix3x3

self


inplaceInvert()

inplaceInvert(): Matrix3x3

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

Calculate the inverse of this matrix inplace.

Returns

Matrix3x3

self


transpose()

transpose(): Matrix3x3

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

Calculate the transpose of this matrix inplace.

Returns

Matrix3x3

self


multiplyRight()

multiplyRight(other): Matrix3x3

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

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:3313

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:3322

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:3331

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:3340

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:3350

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:3360

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:3371

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:3377

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.