#

API Docs for: 0.6.1
Show: Inherited Protected Private Deprecated

# Mat3 Class

Defined in: `src/math/Mat3.js:5`

A 3x3 matrix.

## Constructor

### `Mat3`

(

- `array`

)

Defined in `src/math/Mat3.js:5`

#### Parameters:

- `array` Object

  elements Array of nine elements. Optional.

- Index
- Methods
- Properties

## Item Index

### Methods

- copy
- e
- getTrace
- identity
- mmult
- reverse
- scale
- setRotationFromQuaternion
- setTrace
- setZero
- smult
- solve
- toString
- transpose
- vmult

### Properties

- elements

## Methods

### `copy`

(

- `source`

)
Mat3

Defined in `src/math/Mat3.js:244`

Copy another matrix into this matrix object.

#### Parameters:

- `source` Mat3

#### Returns:

Mat3:

this

### `e`

(

- `row`
- `column`
- `value`

)
Number

Defined in `src/math/Mat3.js:227`

Get an element in the matrix by index. Index starts at 0, not 1!!!

#### Parameters:

- `row` Number
- `column` Number
- `value` Number

  Optional. If provided, the matrix element will be set to this value.

#### Returns:

Number:

### `getTrace`

() Vec3

Defined in `src/math/Mat3.js:74`

Gets the matrix diagonal elements

#### Returns:

Vec3:

### `identity`

()

Defined in `src/math/Mat3.js:24`

Sets the matrix to identity

### `mmult`

(

- `m`

)
Mat3

Defined in `src/math/Mat3.js:118`

Matrix multiplication

#### Parameters:

- `m` Mat3

  Matrix to multiply with from left side.

#### Returns:

Mat3:

The result.

### `reverse`

(

- `target`

)
Mat3

Defined in `src/math/Mat3.js:271`

reverse the matrix

#### Parameters:

- `target` Mat3

  Optional. Target matrix to save in.

#### Returns:

Mat3:

The solution x

### `scale`

(

- `v`

)
Mat3

Defined in `src/math/Mat3.js:138`

Scale each column of the matrix

#### Parameters:

- `v` Vec3

#### Returns:

Mat3:

The result.

### `setRotationFromQuaternion`

(

- `q`

)

Defined in `src/math/Mat3.js:375`

Set the matrix from a quaterion

#### Parameters:

- `q` Quaternion

### `setTrace`

(

- `vec3`

)

Defined in `src/math/Mat3.js:62`

Sets the matrix diagonal elements from a Vec3

#### Parameters:

- `vec3` Vec3

### `setZero`

()

Defined in `src/math/Mat3.js:45`

Set all elements to zero

### `smult`

(

- `s`

)

Defined in `src/math/Mat3.js:107`

Matrix-scalar multiplication

#### Parameters:

- `s` Number

### `solve`

(

- `b`
- `target`

)
Vec3

Defined in `src/math/Mat3.js:156`

Solve Ax=b

#### Parameters:

- `b` Vec3

  The right hand side

- `target` Vec3

  Optional. Target vector to save in.

#### Returns:

Vec3:

The solution x

### `toString`

()

Defined in `src/math/Mat3.js:257`

Returns a string representation of the matrix.

#### Returns:

string

### `transpose`

(

- `target`

)
Mat3

Defined in `src/math/Mat3.js:403`

Transpose the matrix

#### Parameters:

- `target` Mat3

  Where to store the result.

#### Returns:

Mat3:

The target Mat3, or a new Mat3 if target was omitted.

### `vmult`

(

- `v`
- `target`

)

Defined in `src/math/Mat3.js:87`

Matrix-Vector multiplication

#### Parameters:

- `v` Vec3

  The vector to multiply with

- `target` Vec3

  Optional, target to save the result in.

## Properties

### `elements`

Array

Defined in `src/math/Mat3.js:13`

A vector of length 9, containing all matrix elements