Options
All
• Public
• Public/Protected
• All

# Class Mat3

Mathematical 3x3 matrix.

## Constructors

### constructor

• newMat3(other: Mat3): Mat3
• newMat3(m00?: undefined | number, m01?: undefined | number, m02?: undefined | number, m03?: undefined | number, m04?: undefined | number, m05?: undefined | number, m06?: undefined | number, m07?: undefined | number, m08?: undefined | number): Mat3

## Properties

### m00

m00: number

Value at column 0 row 0 of the matrix.

### m01

m01: number

Value at column 0 row 1 of the matrix.

### m02

m02: number

Value at column 0 row 2 of the matrix.

### m03

m03: number

Value at column 1 row 0 of the matrix.

### m04

m04: number

Value at column 1 row 1 of the matrix.

### m05

m05: number

Value at column 1 row 2 of the matrix.

### m06

m06: number

Value at column 2 row 0 of the matrix.

### m07

m07: number

Value at column 2 row 1 of the matrix.

### m08

m08: number

Value at column 2 row 2 of the matrix.

### Static IDENTITY

IDENTITY: {} = Object.freeze(new Mat3())

## Methods

• Adds the current matrix and another matrix to the current matrix.

#### Parameters

• ##### mat: Mat3

the second operand

### determinant

• determinant(): number
• Calculates the determinant of the current matrix.

当前矩阵的行列式。

### equals

• equals(other: Mat3, epsilon?: number): boolean
• Returns whether the specified matrices are approximately equal.

#### Parameters

• ##### other: Mat3

Comparative matrix

• ##### Default value epsilon: number = EPSILON

The error allowed. It`s should be a non-negative number.

#### Returns boolean

Returns `true' when the elements of both matrices are equal; otherwise returns`false'.

### fromQuat

• fromQuat(q: Quat): this
• Resets the current matrix from the given quaternion.

#### Parameters

• ##### q: Quat

The quaternion.

this

### identity

• identity(): this
• set the current matrix to an identity matrix.

#### Returns this

`this`

### invert

• invert(): this
• Inverts the current matrix. When matrix is not invertible the matrix will be set to zeros.

### multiply

• multiply(mat: Mat3): this
• Multiply the current matrix with another matrix.

#### Parameters

• ##### mat: Mat3

the second operand

### multiplyScalar

• multiplyScalar(scalar: number): this
• Multiply each element of the current matrix by a scalar number.

#### Parameters

• ##### scalar: number

amount to scale the matrix's elements by

### rotate

• Rotates the current matrix by the given angle.

### scale

• scale(vec: Vec3): this
• Multiply the current matrix with a scale matrix given by a scale vector.

#### Parameters

• ##### vec: Vec3

vector to scale by

### set

• set(other: Mat3): any
• set(m00?: undefined | number, m01?: undefined | number, m02?: undefined | number, m03?: undefined | number, m04?: undefined | number, m05?: undefined | number, m06?: undefined | number, m07?: undefined | number, m08?: undefined | number): any
• Sets the matrix with another one's value.

#### Parameters

• ##### other: Mat3

Specified matrix

#### Returns any

this

• Set the matrix with values of all elements

this

### strictEquals

• strictEquals(other: Mat3): boolean
• Returns whether the specified matrices are equal.

#### Parameters

• ##### other: Mat3

Comparative matrix

#### Returns boolean

Returns `true' when the elements of both matrices are equal; otherwise returns`false'.

### subtract

• subtract(mat: Mat3): this
• Subtracts another matrix from the current matrix.

#### Parameters

• ##### mat: Mat3

the second operand

### toString

• toString(): string

### transpose

• transpose(): this

• add<Out>(out: Out, a: Out, b: Out): Out
• Adds two matrices and save the results to out matrix

### Static clone

• clone<Out>(a: Out): Mat3
• Clone a matrix and save the results to out matrix

### Static copy

• copy<Out>(out: Out, a: Out): Out
• Copy content of a matrix into another and save the results to out matrix

### Static determinant

• determinant<Out>(a: Out): number
• Calculates the determinant of a matrix

### Static equals

• equals<Out>(a: Out, b: Out, epsilon?: number): boolean
• Returns whether the specified matrices are approximately equal.

### Static fromArray

• fromArray<Out>(out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out
• Generates or sets a matrix with a flat array

#### Parameters

• ##### Default value ofs: number = 0

Array Start Offset

### Static fromMat4

• Copies the first third order matrix of a fourth order matrix to the out third order matrix

### Static fromQuat

• Sets the given matrix with the given quaternion and save the results to out matrix

### Static fromRotation

• fromRotation<Out>(out: Out, rad: number): Out
• Sets the given matrix with a given angle and save the results to out matrix

### Static fromScaling

• fromScaling<Out, VecLike>(out: Out, v: VecLike): Out
• Sets the given matrix with a scale vector and save the results to out matrix

### Static fromTranslation

• fromTranslation<Out, VecLike>(out: Out, v: VecLike): Out
• Sets the given matrix with a translation vector and save the results to out matrix

### Static fromViewUp

• fromViewUp<Out, VecLike>(out: Out, view: VecLike, up?: Vec3): Out
• Sets a third order matrix with view direction and up direction. Then save the results to out matrix

#### Parameters

• ##### view: VecLike

The view direction, it`s must be normalized.

• ##### Optional up: Vec3

The view up direction, it`s must be normalized, default value is (0, 1, 0).

### Static identity

• identity<Out>(out: Out): Out
• Reset the out matrix to an identity matrix

### Static inverseTransposeMat4

• inverseTransposeMat4<Out>(out: Out, a: IMat4Like): null | Out
• Calculates the upper-left 3x3 matrix of a 4x4 matrix's inverse transpose

### Static invert

• invert<Out>(out: Out, a: Out): Out
• Inverts a matrix. When matrix is not invertible the matrix will be set to zeros.

### Static multiply

• multiply<Out>(out: Out, a: Out, b: Out): Out
• Multiply two matrices explicitly and save the results to out matrix

### Static multiplyMat4

• multiplyMat4<Out>(out: Out, a: Out, b: IMat4Like): Out
• Take the first third order of the fourth order matrix and multiply by the third order matrix

### Static multiplyScalar

• multiplyScalar<Out>(out: Out, a: Out, b: number): Out
• Multiply each element of a matrix by a scalar number and save the results to out matrix

#### Returns Out

• multiplyScalarAndAdd<Out>(out: Out, a: Out, b: Out, scale: number): Out
• Adds two matrices after multiplying each element of the second operand by a scalar number. And save the results to out matrix.

### Static rotate

• rotate<Out>(out: Out, a: Out, rad: number): Out
• Rotates the transform by the given angle and save the results into the out matrix

### Static scale

• scale<Out, VecLike>(out: Out, a: Out, v: VecLike): Out
• Multiply a matrix with a scale matrix given by a scale vector and save the results to out matrix

### Static set

• set<Out>(out: Out, m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): Out
• Sets the elements of a matrix with the given values and save the results to out matrix

### Static strictEquals

• strictEquals<Out>(a: Out, b: Out): boolean
• Returns whether the specified matrices are equal.

### Static subtract

• subtract<Out>(out: Out, a: Out, b: Out): Out
• Subtracts matrix b from matrix a and save the results to out matrix

### Static toArray

• toArray<Out>(out: Out, m: IMat3Like, ofs?: number): Out
• Transform a matrix object to a flat array

#### Parameters

• ##### Default value ofs: number = 0

Array Start Offset

### Static transform

• transform<Out, VecLike>(out: Out, a: Out, v: VecLike): Out
• Multiply a matrix with a translation vector given by a translation offset.

### Static transpose

• transpose<Out>(out: Out, a: Out): Out
• Transposes a matrix and save the results to out matrix

#### Returns Out

Generated using TypeDoc