---
title: Namespace: mat4
source: https://vjmap.com/en/doc/Namespace_mat4.html
---

# Namespace: mat4

### Table of contents

#### Type aliases

- [valueType](#valuetype)

#### Functions

- [add](#add)
- [adjoint](#adjoint)
- [clone](#clone)
- [copy](#copy)
- [create](#create)
- [determinant](#determinant)
- [equals](#equals)
- [exactEquals](#exactequals)
- [frob](#frob)
- [fromQuat](#fromquat)
- [fromRotation](#fromrotation)
- [fromRotationTranslation](#fromrotationtranslation)
- [fromRotationTranslationScale](#fromrotationtranslationscale)
- [fromRotationTranslationScaleOrigin](#fromrotationtranslationscaleorigin)
- [fromScaling](#fromscaling)
- [fromTranslation](#fromtranslation)
- [fromValues](#fromvalues)
- [fromXRotation](#fromxrotation)
- [fromYRotation](#fromyrotation)
- [fromZRotation](#fromzrotation)
- [frustum](#frustum)
- [getRotation](#getrotation)
- [getScaling](#getscaling)
- [getTranslation](#gettranslation)
- [identity](#identity)
- [invert](#invert)
- [lookAt](#lookat)
- [multiply](#multiply)
- [multiplyScalar](#multiplyscalar)
- [multiplyScalarAndAdd](#multiplyscalarandadd)
- [ortho](#ortho)
- [perspective](#perspective)
- [perspectiveFromFieldOfView](#perspectivefromfieldofview)
- [rotate](#rotate)
- [rotateX](#rotatex)
- [rotateY](#rotatey)
- [rotateZ](#rotatez)
- [scale](#scale)
- [set](#set)
- [str](#str)
- [subtract](#subtract)
- [translate](#translate)
- [transpose](#transpose)

### Type aliases

#### valueType

Ƭ **valueType**: [*mat4type*](#mat4type)

### Functions

#### add

▸ **add**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type), `b`: [*mat4type*](#mat4type)): [*mat4type*](#mat4type)

Adds two mat4's

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the first operand |
| `b` | [*mat4type*](#mat4type) | the second operand |

**Returns:** [*mat4type*](#mat4type)

out

___

#### adjoint

▸ **adjoint**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type)): [*mat4type*](#mat4type)

Calculates the adjugate of a mat4

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the source matrix |

**Returns:** [*mat4type*](#mat4type)

out

___

#### clone

▸ **clone**(`a`: [*mat4type*](#mat4type)): [*mat4type*](#mat4type)

Creates a new mat4 initialized with values from an existing matrix

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `a` | [*mat4type*](#mat4type) | matrix to clone |

**Returns:** [*mat4type*](#mat4type)

a new 4x4 matrix

___

#### copy

▸ **copy**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type)): [*mat4type*](#mat4type)

Copy the values from one mat4 to another

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the source matrix |

**Returns:** [*mat4type*](#mat4type)

out

___

#### create

▸ **create**(): [*mat4type*](#mat4type)

Creates a new identity mat4

**Returns:** [*mat4type*](#mat4type)

a new 4x4 matrix

___

#### determinant

▸ **determinant**(`a`: [*mat4type*](#mat4type)): *number*

Calculates the determinant of a mat4

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `a` | [*mat4type*](#mat4type) | the source matrix |

**Returns:** *number*

determinant of a

___

#### equals

▸ **equals**(`a`: [*mat4type*](#mat4type), `b`: [*mat4type*](#mat4type)): *boolean*

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

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `a` | [*mat4type*](#mat4type) | The first matrix. |
| `b` | [*mat4type*](#mat4type) | The second matrix. |

**Returns:** *boolean*

True if the matrices are equal, false otherwise.

___

#### exactEquals

▸ **exactEquals**(`a`: [*mat4type*](#mat4type), `b`: [*mat4type*](#mat4type)): *boolean*

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

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `a` | [*mat4type*](#mat4type) | The first matrix. |
| `b` | [*mat4type*](#mat4type) | The second matrix. |

**Returns:** *boolean*

True if the matrices are equal, false otherwise.

___

#### frob

▸ **frob**(`a`: [*mat4type*](#mat4type)): *number*

Returns Frobenius norm of a mat4

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `a` | [*mat4type*](#mat4type) | the matrix to calculate Frobenius norm of |

**Returns:** *number*

Frobenius norm

___

#### fromQuat

▸ **fromQuat**(`out`: [*mat4type*](#mat4type), `q`: [*quattype*](#quattype)): [*mat4type*](#mat4type)

Calculates a 4x4 matrix from the given quaternion

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 receiving operation result |
| `q` | [*quattype*](#quattype) | Quaternion to create matrix from |

**Returns:** [*mat4type*](#mat4type)

out

___

#### fromRotation

▸ **fromRotation**(`out`: [*mat4type*](#mat4type), `rad`: *number*, `axis`: [*vec3type*](#vec3type)): [*mat4type*](#mat4type) \| ``null``

Creates a matrix from a given angle around a given axis
This is equivalent to (but much faster than):

    mat4.identity(dest);
    mat4.rotate(dest, dest, rad, axis);

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 receiving operation result |
| `rad` | *number* | the angle to rotate the matrix by |
| `axis` | [*vec3type*](#vec3type) | the axis to rotate around |

**Returns:** [*mat4type*](#mat4type) \| ``null``

out

___

#### fromRotationTranslation

▸ **fromRotationTranslation**(`out`: [*mat4type*](#mat4type), `q`: [*quattype*](#quattype), `v`: [*vec3type*](#vec3type)): [*mat4type*](#mat4type)

Creates a matrix from a quaternion rotation and vector translation
This is equivalent to (but much faster than):

    mat4.identity(dest);
    mat4.translate(dest, vec);
    var quatMat = mat4.create();
    quat.toMat4(quat, quatMat);
    mat4.multiply(dest, quatMat);

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 receiving operation result |
| `q` | [*quattype*](#quattype) | Rotation quaternion |
| `v` | [*vec3type*](#vec3type) | Translation vector |

**Returns:** [*mat4type*](#mat4type)

out

___

#### fromRotationTranslationScale

▸ **fromRotationTranslationScale**(`out`: [*mat4type*](#mat4type), `q`: [*quattype*](#quattype), `v`: [*vec3type*](#vec3type), `s`: [*vec3type*](#vec3type)): [*mat4type*](#mat4type)

Creates a matrix from a quaternion rotation, vector translation and vector scale
This is equivalent to (but much faster than):

    mat4.identity(dest);
    mat4.translate(dest, vec);
    var quatMat = mat4.create();
    quat4.toMat4(quat, quatMat);
    mat4.multiply(dest, quatMat);
    mat4.scale(dest, scale)

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 receiving operation result |
| `q` | [*quattype*](#quattype) | Rotation quaternion |
| `v` | [*vec3type*](#vec3type) | Translation vector |
| `s` | [*vec3type*](#vec3type) | Scaling vector |

**Returns:** [*mat4type*](#mat4type)

out

___

#### fromRotationTranslationScaleOrigin

▸ **fromRotationTranslationScaleOrigin**(`out`: [*mat4type*](#mat4type), `q`: [*quattype*](#quattype), `v`: [*vec3type*](#vec3type), `s`: [*vec3type*](#vec3type), `o`: [*vec3type*](#vec3type)): [*mat4type*](#mat4type)

Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
This is equivalent to (but much faster than):

    mat4.identity(dest);
    mat4.translate(dest, vec);
    mat4.translate(dest, origin);
    var quatMat = mat4.create();
    quat4.toMat4(quat, quatMat);
    mat4.multiply(dest, quatMat);
    mat4.scale(dest, scale)
    mat4.translate(dest, negativeOrigin);

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 receiving operation result |
| `q` | [*quattype*](#quattype) | Rotation quaternion |
| `v` | [*vec3type*](#vec3type) | Translation vector |
| `s` | [*vec3type*](#vec3type) | Scaling vector |
| `o` | [*vec3type*](#vec3type) | The origin vector around which to scale and rotate |

**Returns:** [*mat4type*](#mat4type)

out

___

#### fromScaling

▸ **fromScaling**(`out`: [*mat4type*](#mat4type), `v`: [*vec3type*](#vec3type)): [*mat4type*](#mat4type)

Creates a matrix from a vector scaling
This is equivalent to (but much faster than):

    mat4.identity(dest);
    mat4.scale(dest, dest, vec);

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 receiving operation result |
| `v` | [*vec3type*](#vec3type) | Scaling vector |

**Returns:** [*mat4type*](#mat4type)

out

___

#### fromTranslation

▸ **fromTranslation**(`out`: [*mat4type*](#mat4type), `v`: [*vec3type*](#vec3type)): [*mat4type*](#mat4type)

Creates a matrix from a vector translation
This is equivalent to (but much faster than):

    mat4.identity(dest);
    mat4.translate(dest, dest, vec);

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 receiving operation result |
| `v` | [*vec3type*](#vec3type) | Translation vector |

**Returns:** [*mat4type*](#mat4type)

out

___

#### fromValues

▸ **fromValues**(`m00`: *number*, `m01`: *number*, `m02`: *number*, `m03`: *number*, `m10`: *number*, `m11`: *number*, `m12`: *number*, `m13`: *number*, `m20`: *number*, `m21`: *number*, `m22`: *number*, `m23`: *number*, `m30`: *number*, `m31`: *number*, `m32`: *number*, `m33`: *number*): [*mat4type*](#mat4type)

Create a new mat4 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) |
| `m03` | *number* | Component in column 0, row 3 position (index 3) |
| `m10` | *number* | Component in column 1, row 0 position (index 4) |
| `m11` | *number* | Component in column 1, row 1 position (index 5) |
| `m12` | *number* | Component in column 1, row 2 position (index 6) |
| `m13` | *number* | Component in column 1, row 3 position (index 7) |
| `m20` | *number* | Component in column 2, row 0 position (index 8) |
| `m21` | *number* | Component in column 2, row 1 position (index 9) |
| `m22` | *number* | Component in column 2, row 2 position (index 10) |
| `m23` | *number* | Component in column 2, row 3 position (index 11) |
| `m30` | *number* | Component in column 3, row 0 position (index 12) |
| `m31` | *number* | Component in column 3, row 1 position (index 13) |
| `m32` | *number* | Component in column 3, row 2 position (index 14) |
| `m33` | *number* | Component in column 3, row 3 position (index 15) |

**Returns:** [*mat4type*](#mat4type)

A new mat4

___

#### fromXRotation

▸ **fromXRotation**(`out`: [*mat4type*](#mat4type), `rad`: *number*): [*mat4type*](#mat4type)

Creates a matrix from the given angle around the X axis
This is equivalent to (but much faster than):

    mat4.identity(dest);
    mat4.rotateX(dest, dest, rad);

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 receiving operation result |
| `rad` | *number* | the angle to rotate the matrix by |

**Returns:** [*mat4type*](#mat4type)

out

___

#### fromYRotation

▸ **fromYRotation**(`out`: [*mat4type*](#mat4type), `rad`: *number*): [*mat4type*](#mat4type)

Creates a matrix from the given angle around the Y axis
This is equivalent to (but much faster than):

    mat4.identity(dest);
    mat4.rotateY(dest, dest, rad);

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 receiving operation result |
| `rad` | *number* | the angle to rotate the matrix by |

**Returns:** [*mat4type*](#mat4type)

out

___

#### fromZRotation

▸ **fromZRotation**(`out`: [*mat4type*](#mat4type), `rad`: *number*): [*mat4type*](#mat4type)

Creates a matrix from the given angle around the Z axis
This is equivalent to (but much faster than):

    mat4.identity(dest);
    mat4.rotateZ(dest, dest, rad);

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 receiving operation result |
| `rad` | *number* | the angle to rotate the matrix by |

**Returns:** [*mat4type*](#mat4type)

out

___

#### frustum

▸ **frustum**(`out`: [*mat4type*](#mat4type), `left`: *number*, `right`: *number*, `bottom`: *number*, `top`: *number*, `near`: *number*, `far`: *number*): [*mat4type*](#mat4type)

Generates a frustum matrix with the given bounds

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 frustum matrix will be written into |
| `left` | *number* | Left bound of the frustum |
| `right` | *number* | Right bound of the frustum |
| `bottom` | *number* | Bottom bound of the frustum |
| `top` | *number* | Top bound of the frustum |
| `near` | *number* | Near bound of the frustum |
| `far` | *number* | Far bound of the frustum |

**Returns:** [*mat4type*](#mat4type)

out

___

#### getRotation

▸ **getRotation**(`out`: [*vec4type*](#vec4type), `mat`: [*mat4type*](#mat4type)): [*quattype*](#quattype)

Returns a quaternion representing the rotational component
 of a transformation matrix. If a matrix is built with
 fromRotationTranslation, the returned quaternion will be the
 same as the quaternion originally supplied.

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*vec4type*](#vec4type) | Quaternion to receive the rotation component |
| `mat` | [*mat4type*](#mat4type) | Matrix to be decomposed (input) |

**Returns:** [*quattype*](#quattype)

out

___

#### getScaling

▸ **getScaling**(`out`: [*vec3type*](#vec3type), `mat`: [*mat4type*](#mat4type)): [*vec3type*](#vec3type)

Returns the scaling factor component of a transformation
 matrix. If a matrix is built with fromRotationTranslationScale
 with a normalized Quaternion paramter, the returned vector will be
 the same as the scaling vector
 originally supplied.

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*vec3type*](#vec3type) | Vector to receive scaling factor component |
| `mat` | [*mat4type*](#mat4type) | Matrix to be decomposed (input) |

**Returns:** [*vec3type*](#vec3type)

out

___

#### getTranslation

▸ **getTranslation**(`out`: [*vec3type*](#vec3type), `mat`: [*mat4type*](#mat4type)): [*vec3type*](#vec3type)

Returns the translation vector component of a transformation
 matrix. If a matrix is built with fromRotationTranslation,
 the returned vector will be the same as the translation vector
 originally supplied.

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*vec3type*](#vec3type) | Vector to receive translation component |
| `mat` | [*mat4type*](#mat4type) | Matrix to be decomposed (input) |

**Returns:** [*vec3type*](#vec3type)

out

___

#### identity

▸ **identity**(`out`: [*mat4type*](#mat4type)): [*mat4type*](#mat4type)

Set a mat4 to the identity matrix

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |

**Returns:** [*mat4type*](#mat4type)

out

___

#### invert

▸ **invert**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type)): [*mat4type*](#mat4type) \| ``null``

Inverts a mat4

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the source matrix |

**Returns:** [*mat4type*](#mat4type) \| ``null``

out

___

#### lookAt

▸ **lookAt**(`out`: [*mat4type*](#mat4type), `eye`: [*vec3type*](#vec3type), `center`: [*vec3type*](#vec3type), `up`: [*vec3type*](#vec3type)): [*mat4type*](#mat4type)

Generates a look-at matrix with the given eye position, focal point, and up axis

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 frustum matrix will be written into |
| `eye` | [*vec3type*](#vec3type) | Position of the viewer |
| `center` | [*vec3type*](#vec3type) | Point the viewer is looking at |
| `up` | [*vec3type*](#vec3type) | vec3 pointing up |

**Returns:** [*mat4type*](#mat4type)

out

___

#### multiply

▸ **multiply**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type), `b`: [*mat4type*](#mat4type)): [*mat4type*](#mat4type)

Multiplies two mat4s

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the first operand |
| `b` | [*mat4type*](#mat4type) | the second operand |

**Returns:** [*mat4type*](#mat4type)

out

___

#### multiplyScalar

▸ **multiplyScalar**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type), `b`: *number*): [*mat4type*](#mat4type)

Multiply each element of the matrix by a scalar.

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the matrix to scale |
| `b` | *number* | amount to scale the matrix's elements by |

**Returns:** [*mat4type*](#mat4type)

out

___

#### multiplyScalarAndAdd

▸ **multiplyScalarAndAdd**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type), `b`: [*mat4type*](#mat4type), `s`: *number*): [*mat4type*](#mat4type)

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

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving vector |
| `a` | [*mat4type*](#mat4type) | the first operand |
| `b` | [*mat4type*](#mat4type) | the second operand |
| `s` | *number* | the amount to scale b's elements by before adding |

**Returns:** [*mat4type*](#mat4type)

out

___

#### ortho

▸ **ortho**(`out`: [*mat4type*](#mat4type), `left`: *number*, `right`: *number*, `bottom`: *number*, `top`: *number*, `near`: *number*, `far`: *number*): [*mat4type*](#mat4type)

Generates a orthogonal projection matrix with the given bounds

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 frustum matrix will be written into |
| `left` | *number* | Left bound of the frustum |
| `right` | *number* | Right bound of the frustum |
| `bottom` | *number* | Bottom bound of the frustum |
| `top` | *number* | Top bound of the frustum |
| `near` | *number* | Near bound of the frustum |
| `far` | *number* | Far bound of the frustum |

**Returns:** [*mat4type*](#mat4type)

out

___

#### perspective

▸ **perspective**(`out`: [*mat4type*](#mat4type), `fovy`: *number*, `aspect`: *number*, `near`: *number*, `far`: *number*): [*mat4type*](#mat4type)

Generates a perspective projection matrix with the given bounds

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 frustum matrix will be written into |
| `fovy` | *number* | Vertical field of view in radians |
| `aspect` | *number* | Aspect ratio. typically viewport width/height |
| `near` | *number* | Near bound of the frustum |
| `far` | *number* | Far bound of the frustum |

**Returns:** [*mat4type*](#mat4type)

out

___

#### perspectiveFromFieldOfView

▸ **perspectiveFromFieldOfView**(`out`: [*mat4type*](#mat4type), `fov`: { `downDegrees`: *number* ; `leftDegrees`: *number* ; `rightDegrees`: *number* ; `upDegrees`: *number*  }, `near`: *number*, `far`: *number*): [*mat4type*](#mat4type)

Generates a perspective projection matrix with the given field of view.
This is primarily useful for generating projection matrices to be used
with the still experiemental WebVR API.

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | mat4 frustum matrix will be written into |
| `fov` | *object* | Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees |
| `fov.downDegrees` | *number* | - |
| `fov.leftDegrees` | *number* | - |
| `fov.rightDegrees` | *number* | - |
| `fov.upDegrees` | *number* | - |
| `near` | *number* | Near bound of the frustum |
| `far` | *number* | Far bound of the frustum |

**Returns:** [*mat4type*](#mat4type)

out

___

#### rotate

▸ **rotate**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type), `rad`: *number*, `axis`: [*vec3type*](#vec3type)): [*mat4type*](#mat4type) \| ``null``

Rotates a mat4 by the given angle around the given axis

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the matrix to rotate |
| `rad` | *number* | the angle to rotate the matrix by |
| `axis` | [*vec3type*](#vec3type) | the axis to rotate around |

**Returns:** [*mat4type*](#mat4type) \| ``null``

out

___

#### rotateX

▸ **rotateX**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type), `rad`: *number*): [*mat4type*](#mat4type)

Rotates a matrix by the given angle around the X axis

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the matrix to rotate |
| `rad` | *number* | the angle to rotate the matrix by |

**Returns:** [*mat4type*](#mat4type)

out

___

#### rotateY

▸ **rotateY**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type), `rad`: *number*): [*mat4type*](#mat4type)

Rotates a matrix by the given angle around the Y axis

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the matrix to rotate |
| `rad` | *number* | the angle to rotate the matrix by |

**Returns:** [*mat4type*](#mat4type)

out

___

#### rotateZ

▸ **rotateZ**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type), `rad`: *number*): [*mat4type*](#mat4type)

Rotates a matrix by the given angle around the Z axis

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the matrix to rotate |
| `rad` | *number* | the angle to rotate the matrix by |

**Returns:** [*mat4type*](#mat4type)

out

___

#### scale

▸ **scale**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type), `v`: [*vec3type*](#vec3type)): [*mat4type*](#mat4type)

Scales the mat4 by the dimensions in the given vec3 not using vectorization

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the matrix to scale |
| `v` | [*vec3type*](#vec3type) | the vec3 to scale the matrix by |

**Returns:** [*mat4type*](#mat4type)

out

___

#### set

▸ **set**(`out`: [*mat4type*](#mat4type), `m00`: *number*, `m01`: *number*, `m02`: *number*, `m03`: *number*, `m10`: *number*, `m11`: *number*, `m12`: *number*, `m13`: *number*, `m20`: *number*, `m21`: *number*, `m22`: *number*, `m23`: *number*, `m30`: *number*, `m31`: *number*, `m32`: *number*, `m33`: *number*): [*mat4type*](#mat4type)

Set the components of a mat4 to the given values

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | 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) |
| `m03` | *number* | Component in column 0, row 3 position (index 3) |
| `m10` | *number* | Component in column 1, row 0 position (index 4) |
| `m11` | *number* | Component in column 1, row 1 position (index 5) |
| `m12` | *number* | Component in column 1, row 2 position (index 6) |
| `m13` | *number* | Component in column 1, row 3 position (index 7) |
| `m20` | *number* | Component in column 2, row 0 position (index 8) |
| `m21` | *number* | Component in column 2, row 1 position (index 9) |
| `m22` | *number* | Component in column 2, row 2 position (index 10) |
| `m23` | *number* | Component in column 2, row 3 position (index 11) |
| `m30` | *number* | Component in column 3, row 0 position (index 12) |
| `m31` | *number* | Component in column 3, row 1 position (index 13) |
| `m32` | *number* | Component in column 3, row 2 position (index 14) |
| `m33` | *number* | Component in column 3, row 3 position (index 15) |

**Returns:** [*mat4type*](#mat4type)

out

___

#### str

▸ **str**(`a`: [*mat4type*](#mat4type)): *string*

Returns a string representation of a mat4

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `a` | [*mat4type*](#mat4type) | matrix to represent as a string |

**Returns:** *string*

string representation of the matrix

___

#### subtract

▸ **subtract**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type), `b`: [*mat4type*](#mat4type)): [*mat4type*](#mat4type)

Subtracts matrix b from matrix a

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the first operand |
| `b` | [*mat4type*](#mat4type) | the second operand |

**Returns:** [*mat4type*](#mat4type)

out

___

#### translate

▸ **translate**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type), `v`: [*vec3type*](#vec3type)): [*mat4type*](#mat4type)

Translate a mat4 by the given vector

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the matrix to translate |
| `v` | [*vec3type*](#vec3type) | vector to translate by |

**Returns:** [*mat4type*](#mat4type)

out

___

#### transpose

▸ **transpose**(`out`: [*mat4type*](#mat4type), `a`: [*mat4type*](#mat4type)): [*mat4type*](#mat4type)

Transpose the values of a mat4

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `out` | [*mat4type*](#mat4type) | the receiving matrix |
| `a` | [*mat4type*](#mat4type) | the source matrix |

**Returns:** [*mat4type*](#mat4type)

out


<a name="modulesmath2dmd"></a>

[vjmap](#readmemd) / [Exports](#modulesmd) / Math2D
