Module: mat3

3x3 Matrix
Source:

Methods

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

Adds two mat3's
Parameters:
Name Type Description
out mat3 the receiving matrix
a ReadonlyMat3 the first operand
b ReadonlyMat3 the second operand
Source:
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 ReadonlyMat3 the source matrix
Source:
Returns:
out
Type
mat3

(static) clone(a) → {mat3}

Creates a new mat3 initialized with values from an existing matrix
Parameters:
Name Type Description
a ReadonlyMat3 matrix to clone
Source:
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 ReadonlyMat3 the source matrix
Source:
Returns:
out
Type
mat3

(static) create() → {mat3}

Creates a new identity mat3
Source:
Returns:
a new 3x3 matrix
Type
mat3

(static) determinant(a) → {Number}

Calculates the determinant of a mat3
Parameters:
Name Type Description
a ReadonlyMat3 the source matrix
Source:
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 ReadonlyMat3 The first matrix.
b ReadonlyMat3 The second matrix.
Source:
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 ReadonlyMat3 The first matrix.
b ReadonlyMat3 The second matrix.
Source:
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 ReadonlyMat3 the matrix to calculate Frobenius norm of
Source:
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 ReadonlyMat2d the matrix to copy
Source:
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 ReadonlyMat4 the source 4x4 matrix
Source:
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 ReadonlyQuat Quaternion to create matrix from
Source:
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:
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 ReadonlyVec2 Scaling vector
Source:
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 ReadonlyVec2 Translation vector
Source:
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:
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:
Returns:
out
Type
mat3

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

Inverts a mat3
Parameters:
Name Type Description
out mat3 the receiving matrix
a ReadonlyMat3 the source matrix
Source:
Returns:
out
Type
mat3

(static) mul()

Alias for mat3.multiply
Source:

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

Multiplies two mat3's
Parameters:
Name Type Description
out mat3 the receiving matrix
a ReadonlyMat3 the first operand
b ReadonlyMat3 the second operand
Source:
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 ReadonlyMat3 the matrix to scale
b Number amount to scale the matrix's elements by
Source:
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 ReadonlyMat3 the first operand
b ReadonlyMat3 the second operand
scale Number the amount to scale b's elements by before adding
Source:
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 ReadonlyMat4 Mat4 to derive the normal matrix from
Source:
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:
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 ReadonlyMat3 the matrix to rotate
rad Number the angle to rotate the matrix by
Source:
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 ReadonlyMat3 the matrix to rotate
v ReadonlyVec2 the vec2 to scale the matrix by
Source:
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:
Returns:
out
Type
mat3

(static) str(a) → {String}

Returns a string representation of a mat3
Parameters:
Name Type Description
a ReadonlyMat3 matrix to represent as a string
Source:
Returns:
string representation of the matrix
Type
String

(static) sub()

Alias for mat3.subtract
Source:

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

Subtracts matrix b from matrix a
Parameters:
Name Type Description
out mat3 the receiving matrix
a ReadonlyMat3 the first operand
b ReadonlyMat3 the second operand
Source:
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 ReadonlyMat3 the matrix to translate
v ReadonlyVec2 vector to translate by
Source:
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 ReadonlyMat3 the source matrix
Source:
Returns:
out
Type
mat3