# Module: mat4

## Detailed Description

### Methods

Calculates the adjugate of a mat4
##### Parameters:
Name Type Description
`a` Mat4 the source matrix
`out` Mat4 the receiving matrix
out
Type
Mat4
Source:

#### clone(a) → {Mat4}

Creates a new mat4 initialized with values from an existing matrix
##### Parameters:
Name Type Description
`a` Mat4 matrix to clone
a new 4x4 matrix
Type
Mat4
Source:

#### copy(a, out) → {Mat4}

Copy the values from one mat4 to another
##### Parameters:
Name Type Description
`a` Mat4 the source matrix
`out` Mat4 the receiving matrix
out
Type
Mat4
Source:

#### create() → {Mat4}

Creates a new identity mat4
a new 4x4 matrix
Type
Mat4
Source:

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

Calculates the determinant of a mat4
##### Parameters:
Name Type Description
`a` Mat4 the source matrix
determinant of a
Type
Number
Source:

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

Returns Frobenius norm of a mat4
##### Parameters:
Name Type Description
`a` Mat4 the matrix to calculate Frobenius norm of
Frobenius norm
Type
Number
Source:

#### fromRotation(rad, axis, out) → {Mat4}

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
`rad` Number the angle to rotate the matrix by
`axis` Vec3 the axis to rotate around
`out` Mat4 mat4 receiving operation result
out
Type
Mat4
Source:

#### fromRotationTranslation(q, v, out) → {Mat4}

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(); quat4.toMat4(quat, quatMat); mat4.multiply(dest, quatMat);
##### Parameters:
Name Type Description
`q` quat4 Rotation quaternion
`v` Vec3 Translation vector
`out` Mat4 mat4 receiving operation result
out
Type
Mat4
Source:

#### fromRotationTranslationScale(q, v, s, out) → {Mat4}

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
`q` quat4 Rotation quaternion
`v` Vec3 Translation vector
`s` Vec3 Scaling vector
`out` Mat4 mat4 receiving operation result
out
Type
Mat4
Source:

#### fromRotationTranslationScaleOrigin(q, v, s, o, out) → {Mat4}

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
`q` quat4 Rotation quaternion
`v` Vec3 Translation vector
`s` Vec3 Scaling vector
`o` Vec3 The origin vector around which to scale and rotate
`out` Mat4 mat4 receiving operation result
out
Type
Mat4
Source:

#### fromScaling(v, out) → {Mat4}

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
`v` Vec3 Scaling vector
`out` Mat4 mat4 receiving operation result
out
Type
Mat4
Source:

#### fromTranslation(v, out) → {Mat4}

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
`v` Vec3 Translation vector
`out` Mat4 mat4 receiving operation result
##### Returns:
out
Type
Mat4
Source:

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
`rad` Number the angle to rotate the matrix by
`out` Mat4 mat4 receiving operation result
##### Returns:
out
Type
Mat4
Source:

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
`rad` Number the angle to rotate the matrix by
`out` Mat4 mat4 receiving operation result
##### Returns:
out
Type
Mat4
Source:

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
`rad` Number the angle to rotate the matrix by
`out` Mat4 mat4 receiving operation result
out
Type
Mat4
Source:

#### frustum(left, right, bottom, top, near, far, out) → {Mat4}

Generates a frustum matrix with the given bounds
##### Parameters:
Name Type Description
`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
`out` Mat4 mat4 frustum matrix will be written into
out
Type
Mat4
Source:

#### identity(out) → {Mat4}

Set a mat4 to the identity matrix
##### Parameters:
Name Type Description
`out` Mat4 the receiving matrix
out
Type
Mat4
Source:

#### invert(a, out) → {Mat4}

Inverts a mat4
##### Parameters:
Name Type Description
`a` Mat4 the source matrix
`out` Mat4 the receiving matrix
out
Type
Mat4
Source:

#### lookAt(eye, center, up, out) → {Mat4}

Generates a look-at matrix with the given eye position, focal point, and up axis
##### Parameters:
Name Type Description
`eye` Vec3 Position of the viewer
`center` Vec3 Point the viewer is looking at
`up` Vec3 vec3 pointing up
`out` Mat4 mat4 frustum matrix will be written into
out
Type
Mat4
Source:

#### mul()

Alias for mat4.multiply
Source:

#### multiply(a, b, out) → {Mat4}

Multiplies two mat4's
##### Parameters:
Name Type Description
`a` Mat4 the first operand
`b` Mat4 the second operand
`out` Mat4 the receiving matrix
out
Type
Mat4
Source:

#### ortho(left, right, bottom, top, near, far, out) → {Mat4}

Generates a orthogonal projection matrix with the given bounds
##### Parameters:
Name Type Description
`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
`out` Mat4 mat4 frustum matrix will be written into
out
Type
Mat4
Source:

#### perspective(fovy, aspect, near, far, out) → {Mat4}

Generates a perspective projection matrix with the given bounds
##### Parameters:
Name Type Description
`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
`out` Mat4 mat4 frustum matrix will be written into
out
Type
Mat4
Source:

#### perspectiveFromFieldOfView(fov, near, far, out) → {Mat4}

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
`fov` number Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
`near` number Near bound of the frustum
`far` number Far bound of the frustum
`out` Mat4 mat4 frustum matrix will be written into
out
Type
Mat4
Source:

#### rotate(a, rad, axis, out) → {Mat4}

Rotates a mat4 by the given angle around the given axis
##### Parameters:
Name Type Description
`a` Mat4 the matrix to rotate
`rad` Number the angle to rotate the matrix by
`axis` Vec3 the axis to rotate around
`out` Mat4 the receiving matrix
out
Type
Mat4
Source:

#### rotateX(a, rad, out) → {Mat4}

Rotates a matrix by the given angle around the X axis
##### Parameters:
Name Type Description
`a` Mat4 the matrix to rotate
`rad` Number the angle to rotate the matrix by
`out` Mat4 the receiving matrix
out
Type
Mat4
Source:

#### rotateY(a, rad, out) → {Mat4}

Rotates a matrix by the given angle around the Y axis
##### Parameters:
Name Type Description
`a` Mat4 the matrix to rotate
`rad` Number the angle to rotate the matrix by
`out` Mat4 the receiving matrix
out
Type
Mat4
Source:

#### rotateZ(a, rad, out) → {Mat4}

Rotates a matrix by the given angle around the Z axis
##### Parameters:
Name Type Description
`a` Mat4 the matrix to rotate
`rad` Number the angle to rotate the matrix by
`out` Mat4 the receiving matrix
out
Type
Mat4
Source:

#### scale(a, v, out) → {Mat4}

Scales the mat4 by the dimensions in the given vec3
##### Parameters:
Name Type Description
`a` Mat4 the matrix to scale
`v` Vec3 the vec3 to scale the matrix by
`out` Mat4 the receiving matrix
out
Type
Mat4
Source:

#### str(mat) → {String}

Returns a string representation of a mat4
##### Parameters:
Name Type Description
`mat` Mat4 matrix to represent as a string
##### Returns:
string representation of the matrix
Type
String
Source:

#### translate(a, v, out) → {Mat4}

Translate a mat4 by the given vector
##### Parameters:
Name Type Description
`a` Mat4 the matrix to translate
`v` Vec3 vector to translate by
`out` Mat4 the receiving matrix
out
Type
Mat4
Source:

#### transpose(a, out) → {Mat4}

Transpose the values of a mat4
##### Parameters:
Name Type Description
`a` Mat4 the source matrix
`out` Mat4 the receiving matrix
out
Type
Mat4
Source: