# Module: mat3

3x3 Matrix

Source:
  - mat3.js, line 23

### Methods

#### (static) add(out, a, b) → {mat3}

Adds two mat3's

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`a` | mat3 | the first operand
`b` | mat3 | the second operand

Source:
  - mat3.js, line 642

##### Returns:

out

Type
  mat3

#### (static) adjoint(out, a) → {mat3}

Calculates the adjugate of a mat3

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`a` | mat3 | the source matrix

Source:
  - mat3.js, line 257

##### Returns:

out

Type
  mat3

#### (static) clone(a) → {mat3}

Creates a new mat3 initialized with values from an existing matrix

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | mat3 | matrix to clone

Source:
  - mat3.js, line 73

##### Returns:

a new 3x3 matrix

Type
  mat3

#### (static) copy(out, a) → {mat3}

Copy the values from one mat3 to another

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`a` | mat3 | the source matrix

Source:
  - mat3.js, line 94

##### Returns:

out

Type
  mat3

#### (static) create() → {mat3}

Creates a new identity mat3

Source:
  - mat3.js, line 33

##### Returns:

a new 3x3 matrix

Type
  mat3

#### (static) determinant(a) → {Number}

Calculates the determinant of a mat3

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | mat3 | the source matrix

Source:
  - mat3.js, line 280

##### Returns:

determinant of a

Type
  Number

#### (static) equals(a, b) → {Boolean}

Returns whether or not the matrices have approximately the same elements in the same position.

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | mat3 | The first matrix.
`b` | mat3 | The second matrix.

Source:
  - mat3.js, line 741

##### Returns:

True if the matrices are equal, false otherwise.

Type
  Boolean

#### (static) exactEquals(a, b) → {Boolean}

Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | mat3 | The first matrix.
`b` | mat3 | The second matrix.

Source:
  - mat3.js, line 728

##### Returns:

True if the matrices are equal, false otherwise.

Type
  Boolean

#### (static) frob(a) → {Number}

Returns Frobenius norm of a mat3

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | mat3 | the matrix to calculate Frobenius norm of

Source:
  - mat3.js, line 630

##### Returns:

Frobenius norm

Type
  Number

#### (static) fromMat2d(out, a) → {mat3}

Copies the values from a mat2d into a mat3

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`a` | mat2d | the matrix to copy

Source:
  - mat3.js, line 487

##### Returns:

out

Type
  mat3

#### (static) fromMat4(out, a) → {mat3}

Copies the upper-left 3x3 values into the given mat3.

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving 3x3 matrix
`a` | mat4 | the source 4x4 matrix

Source:
  - mat3.js, line 54

##### Returns:

out

Type
  mat3

#### (static) fromQuat(out, q) → {mat3}

Calculates a 3x3 matrix from the given quaternion

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | mat3 receiving operation result
`q` | quat | Quaternion to create matrix from

Source:
  - mat3.js, line 510

##### Returns:

out

Type
  mat3

#### (static) fromRotation(out, rad) → {mat3}

Creates a matrix from a given angle This is equivalent to (but much faster than): mat3.identity(dest); mat3.rotate(dest, dest, rad);

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | mat3 receiving operation result
`rad` | Number | the angle to rotate the matrix by

Source:
  - mat3.js, line 437

##### Returns:

out

Type
  mat3

#### (static) fromScaling(out, v) → {mat3}

Creates a matrix from a vector scaling This is equivalent to (but much faster than): mat3.identity(dest); mat3.scale(dest, dest, vec);

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | mat3 receiving operation result
`v` | vec2 | Scaling vector

Source:
  - mat3.js, line 465

##### Returns:

out

Type
  mat3

#### (static) fromTranslation(out, v) → {mat3}

Creates a matrix from a vector translation This is equivalent to (but much faster than): mat3.identity(dest); mat3.translate(dest, dest, vec);

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | mat3 receiving operation result
`v` | vec2 | Translation vector

Source:
  - mat3.js, line 413

##### Returns:

out

Type
  mat3

#### (static) fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) → {mat3}

Create a new mat3 with the given values

##### Parameters:

Name | Type | Description
--- | --- | ---
`m00` | Number | Component in column 0, row 0 position (index 0)
`m01` | Number | Component in column 0, row 1 position (index 1)
`m02` | Number | Component in column 0, row 2 position (index 2)
`m10` | Number | Component in column 1, row 0 position (index 3)
`m11` | Number | Component in column 1, row 1 position (index 4)
`m12` | Number | Component in column 1, row 2 position (index 5)
`m20` | Number | Component in column 2, row 0 position (index 6)
`m21` | Number | Component in column 2, row 1 position (index 7)
`m22` | Number | Component in column 2, row 2 position (index 8)

Source:
  - mat3.js, line 121

##### Returns:

A new mat3

Type
  mat3

#### (static) identity(out) → {mat3}

Set a mat3 to the identity matrix

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix

Source:
  - mat3.js, line 169

##### Returns:

out

Type
  mat3

#### (static) invert(out, a) → {mat3}

Inverts a mat3

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`a` | mat3 | the source matrix

Source:
  - mat3.js, line 221

##### Returns:

out

Type
  mat3

#### (static) mul()

Alias for mat3.multiply

Source:
  - mat3.js, line 759

#### (static) multiply(out, a, b) → {mat3}

Multiplies two mat3's

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`a` | mat3 | the first operand
`b` | mat3 | the second operand

Source:
  - mat3.js, line 296

##### Returns:

out

Type
  mat3

#### (static) multiplyScalar(out, a, b) → {mat3}

Multiply each element of the matrix by a scalar.

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`a` | mat3 | the matrix to scale
`b` | Number | amount to scale the matrix's elements by

Source:
  - mat3.js, line 686

##### Returns:

out

Type
  mat3

#### (static) multiplyScalarAndAdd(out, a, b, scale) → {mat3}

Adds two mat3's after multiplying each element of the second operand by a scalar value.

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving vector
`a` | mat3 | the first operand
`b` | mat3 | the second operand
`scale` | Number | the amount to scale b's elements by before adding

Source:
  - mat3.js, line 708

##### Returns:

out

Type
  mat3

#### (static) normalFromMat4(out, a) → {mat3}

Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | mat3 receiving operation result
`a` | mat4 | Mat4 to derive the normal matrix from

Source:
  - mat3.js, line 549

##### Returns:

out

Type
  mat3

#### (static) projection(out, width, height) → {mat3}

Generates a 2D projection matrix with the given bounds

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | mat3 frustum matrix will be written into
`width` | number | Width of your gl context
`height` | number | Height of gl context

Source:
  - mat3.js, line 599

##### Returns:

out

Type
  mat3

#### (static) rotate(out, a, rad) → {mat3}

Rotates a mat3 by the given angle

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`a` | mat3 | the matrix to rotate
`rad` | Number | the angle to rotate the matrix by

Source:
  - mat3.js, line 355

##### Returns:

out

Type
  mat3

#### (static) scale(out, a, v) → {mat3}

Scales the mat3 by the dimensions in the given vec2

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`a` | mat3 | the matrix to rotate
`v` | vec2 | the vec2 to scale the matrix by

Source:
  - mat3.js, line 385

##### Returns:

out

Type
  mat3

#### (static) set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) → {mat3}

Set the components of a mat3 to the given values

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`m00` | Number | Component in column 0, row 0 position (index 0)
`m01` | Number | Component in column 0, row 1 position (index 1)
`m02` | Number | Component in column 0, row 2 position (index 2)
`m10` | Number | Component in column 1, row 0 position (index 3)
`m11` | Number | Component in column 1, row 1 position (index 4)
`m12` | Number | Component in column 1, row 2 position (index 5)
`m20` | Number | Component in column 2, row 0 position (index 6)
`m21` | Number | Component in column 2, row 1 position (index 7)
`m22` | Number | Component in column 2, row 2 position (index 8)

Source:
  - mat3.js, line 150

##### Returns:

out

Type
  mat3

#### (static) str(a) → {String}

Returns a string representation of a mat3

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | mat3 | matrix to represent as a string

Source:
  - mat3.js, line 618

##### Returns:

string representation of the matrix

Type
  String

#### (static) sub()

Alias for mat3.subtract

Source:
  - mat3.js, line 765

#### (static) subtract(out, a, b) → {mat3}

Subtracts matrix b from matrix a

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`a` | mat3 | the first operand
`b` | mat3 | the second operand

Source:
  - mat3.js, line 663

##### Returns:

out

Type
  mat3

#### (static) translate(out, a, v) → {mat3}

Translate a mat3 by the given vector

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`a` | mat3 | the matrix to translate
`v` | vec2 | vector to translate by

Source:
  - mat3.js, line 327

##### Returns:

out

Type
  mat3

#### (static) transpose(out, a) → {mat3}

Transpose the values of a mat3

##### Parameters:

Name | Type | Description
--- | --- | ---
`out` | mat3 | the receiving matrix
`a` | mat3 | the source matrix

Source:
  - mat3.js, line 189

##### Returns:

out

Type
  mat3