mat4

mat4

4x4 Matrix

Constructor

# new mat4()

Source:

Methods

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

Source:

Calculates the adjugate of a mat4

Parameters:
Name Type Description
out mat4

the receiving matrix

a mat4

the source matrix

Returns:

out

Type
mat4

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

Source:

Creates a new mat4 initialized with values from an existing matrix

Parameters:
Name Type Description
a mat4

matrix to clone

Returns:

a new 4x4 matrix

Type
mat4

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

Source:

Copy the values from one mat4 to another

Parameters:
Name Type Description
out mat4

the receiving matrix

a mat4

the source matrix

Returns:

out

Type
mat4

# (static) create() → {mat4}

Source:

Creates a new identity mat4

Returns:

a new 4x4 matrix

Type
mat4

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

Source:

Calculates the determinant of a mat4

Parameters:
Name Type Description
a mat4

the source matrix

Returns:

determinant of a

Type
Number

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

Source:

Returns Frobenius norm of a mat4

Parameters:
Name Type Description
a mat4

the matrix to calculate Frobenius norm of

Returns:

Frobenius norm

Type
Number

# (static) fromRotationTranslation(out, q, v) → {mat4}

Source:

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
out mat4

mat4 receiving operation result

q quat4

Rotation quaternion

v vec3

Translation vector

Returns:

out

Type
mat4

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

Source:

Generates a frustum matrix with the given bounds

Parameters:
Name Type Description
out mat4

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:

out

Type
mat4

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

Source:

Set a mat4 to the identity matrix

Parameters:
Name Type Description
out mat4

the receiving matrix

Returns:

out

Type
mat4

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

Source:

Inverts a mat4

Parameters:
Name Type Description
out mat4

the receiving matrix

a mat4

the source matrix

Returns:

out

Type
mat4

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

Source:

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

Parameters:
Name Type Description
out mat4

mat4 frustum matrix will be written into

eye vec3

Position of the viewer

center vec3

Point the viewer is looking at

up vec3

vec3 pointing up

Returns:

out

Type
mat4

# (static) mul()

Source:

Alias for mat4.multiply

# (static) mulAffine()

Source:

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

Source:

Multiplies two mat4's

Parameters:
Name Type Description
out mat4

the receiving matrix

a mat4

the first operand

b mat4

the second operand

Returns:

out

Type
mat4

# (static) multiplyAffine(out, a, b) → {mat4}

Source:

Multiplies two affine mat4's Add by https://github.com/pissang

Parameters:
Name Type Description
out mat4

the receiving matrix

a mat4

the first operand

b mat4

the second operand

Returns:

out

Type
mat4

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

Source:

Generates a orthogonal projection matrix with the given bounds

Parameters:
Name Type Description
out mat4

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:

out

Type
mat4

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

Source:

Generates a perspective projection matrix with the given bounds

Parameters:
Name Type Description
out mat4

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:

out

Type
mat4

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

Source:

Rotates a mat4 by the given angle

Parameters:
Name Type Description
out mat4

the receiving matrix

a mat4

the matrix to rotate

rad Number

the angle to rotate the matrix by

axis vec3

the axis to rotate around

Returns:

out

Type
mat4

# (static) rotateX(out, a, rad) → {mat4}

Source:

Rotates a matrix by the given angle around the X axis

Parameters:
Name Type Description
out mat4

the receiving matrix

a mat4

the matrix to rotate

rad Number

the angle to rotate the matrix by

Returns:

out

Type
mat4

# (static) rotateY(out, a, rad) → {mat4}

Source:

Rotates a matrix by the given angle around the Y axis

Parameters:
Name Type Description
out mat4

the receiving matrix

a mat4

the matrix to rotate

rad Number

the angle to rotate the matrix by

Returns:

out

Type
mat4

# (static) rotateZ(out, a, rad) → {mat4}

Source:

Rotates a matrix by the given angle around the Z axis

Parameters:
Name Type Description
out mat4

the receiving matrix

a mat4

the matrix to rotate

rad Number

the angle to rotate the matrix by

Returns:

out

Type
mat4

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

Source:

Scales the mat4 by the dimensions in the given vec3

Parameters:
Name Type Description
out mat4

the receiving matrix

a mat4

the matrix to scale

v vec3

the vec3 to scale the matrix by

Returns:

out

Type
mat4

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

Source:

Translate a mat4 by the given vector

Parameters:
Name Type Description
out mat4

the receiving matrix

a mat4

the matrix to translate

v vec3

vector to translate by

Returns:

out

Type
mat4

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

Source:

Transpose the values of a mat4

Parameters:
Name Type Description
out mat4

the receiving matrix

a mat4

the source matrix

Returns:

out

Type
mat4