Options
All
• Public
• Public/Protected
• All

# Module mat4

## Functions

• Calculates the adjugate of a mat4

#### Parameters

• ##### out: IArray

the receiving matrix

• ##### a: IArray

the source matrix

out

### clone

• Creates a new mat4 initialized with values from an existing matrix

#### Parameters

• ##### a: IArray

matrix to clone

#### Returns IArray

a new 4x4 matrix

### copy

• Copy the values from one mat4 to another

#### Parameters

• ##### out: IArray

the receiving matrix

• ##### a: IArray

the source matrix

out

### create

• Creates a new identity mat4

#### Returns IArray

a new 4x4 matrix

### determinant

• determinant(a: IArray): number
• Calculates the determinant of a mat4

#### Parameters

• ##### a: IArray

the source matrix

#### Returns number

determinant of a

### frob

• Returns Frobenius norm of a mat4

#### Parameters

• ##### a: IArray

the matrix to calculate Frobenius norm of

#### Returns number

Frobenius norm

### fromQuat

• Creates a matrix from a quaternion

#### Parameters

• ##### out: IArray

mat4 receiving operation result

• ##### q: IArray

Rotation quaternion

out

### fromRotationTranslation

• 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

• ##### out: IArray

mat4 receiving operation result

• ##### q: IArray

Rotation quaternion

• ##### v: IArray

Translation vector

out

### fromRotationTranslationScale

• 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

• ##### out: IArray

mat4 receiving operation result

• ##### q: IArray

Rotation quaternion

• ##### v: IArray

Translation vector

• ##### s: IArray

Scale vector

out

### frustum

• frustum(out: IArray, left: number, right: number, bottom: number, top: number, near: number, far: number): IArray
• Generates a frustum matrix with the given bounds

#### Parameters

• ##### out: IArray

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

out

### identity

• Set a mat4 to the identity matrix

out

### invert

• Inverts a mat4

#### Parameters

• ##### out: IArray

the receiving matrix

• ##### a: IArray

the source matrix

out

### lookAt

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

#### Parameters

• ##### out: IArray

mat4 frustum matrix will be written into

• ##### eye: IArray

Position of the viewer

• ##### center: IArray

Point the viewer is looking at

• ##### up: IArray

vec3 pointing up

out

### mul

• Multiplies two mat4's

#### Parameters

• ##### out: IArray

the receiving matrix

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### multiply

• Multiplies two mat4's

#### Parameters

• ##### out: IArray

the receiving matrix

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### ortho

• ortho(out: IArray, left: number, right: number, bottom: number, top: number, near: number, far: number): IArray
• Generates a orthogonal projection matrix with the given bounds

#### Parameters

• ##### out: IArray

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

out

### perspective

• perspective(out: IArray, fovy: number, aspect: number, near: number, far: number): IArray
• Generates a perspective projection matrix with the given bounds

#### Parameters

• ##### out: IArray

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

out

### rotate

• Rotates a mat4 by the given angle

#### Parameters

• ##### out: IArray

the receiving matrix

• ##### a: IArray

the matrix to rotate

• ##### rad: number

the angle to rotate the matrix by

• ##### axis: IArray

the axis to rotate around

out

### rotateX

• Rotates a matrix by the given angle around the X axis

#### Parameters

• ##### out: IArray

the receiving matrix

• ##### a: IArray

the matrix to rotate

• ##### rad: number

the angle to rotate the matrix by

out

### rotateY

• Rotates a matrix by the given angle around the Y axis

#### Parameters

• ##### out: IArray

the receiving matrix

• ##### a: IArray

the matrix to rotate

• ##### rad: number

the angle to rotate the matrix by

out

### rotateZ

• Rotates a matrix by the given angle around the Z axis

#### Parameters

• ##### out: IArray

the receiving matrix

• ##### a: IArray

the matrix to rotate

• ##### rad: number

the angle to rotate the matrix by

out

### scale

• Scales the mat4 by the dimensions in the given vec3

#### Parameters

• ##### out: IArray

the receiving matrix

• ##### a: IArray

the matrix to scale

• ##### v: IArray

the vec3 to scale the matrix by

out

### str

• Returns a string representation of a mat4

#### Parameters

• ##### mat: IArray

matrix to represent as a string

#### Returns string

string representation of the matrix

### translate

• Translate a mat4 by the given vector

#### Parameters

• ##### out: IArray

the receiving matrix

• ##### a: IArray

the matrix to translate

• ##### v: IArray

vector to translate by

out

### transpose

• Transpose the values of a mat4

#### Parameters

• ##### out: IArray

the receiving matrix

• ##### a: IArray

the source matrix

#### Returns IArray

out

Generated using TypeDoc