# Namespace: mat3

# Table of contents

# Type aliases

# Functions

# Type aliases

# valueType

Ƭ valueType: mat3type

# Functions

# add

add(out: mat3type, a: mat3type, b: mat3type): mat3type

Adds two mat3's

# Parameters
Name Type Description
out mat3type the receiving matrix
a mat3type the first operand
b mat3type the second operand

Returns: mat3type

out


# adjoint

adjoint(out: mat3type, a: mat3type): mat3type

Calculates the adjugate of a mat3

# Parameters
Name Type Description
out mat3type the receiving matrix
a mat3type the source matrix

Returns: mat3type

out


# clone

clone(a: mat3type): mat3type

Creates a new mat3 initialized with values from an existing matrix

# Parameters
Name Type Description
a mat3type matrix to clone

Returns: mat3type

a new 3x3 matrix


# copy

copy(out: mat3type, a: mat3type): mat3type

Copy the values from one mat3 to another

# Parameters
Name Type Description
out mat3type the receiving matrix
a mat3type the source matrix

Returns: mat3type

out


# create

create(): mat3type

Creates a new identity mat3

Returns: mat3type

a new 3x3 matrix


# determinant

determinant(a: mat3type): number

Calculates the determinant of a mat3

# Parameters
Name Type Description
a mat3type the source matrix

Returns: number

determinant of a


# equals

equals(a: mat3type, b: mat3type): boolean

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

# Parameters
Name Type Description
a mat3type The first matrix.
b mat3type The second matrix.

Returns: boolean

True if the matrices are equal, false otherwise.


# exactEquals

exactEquals(a: mat3type, b: mat3type): boolean

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

# Parameters
Name Type Description
a mat3type The first matrix.
b mat3type The second matrix.

Returns: boolean

True if the matrices are equal, false otherwise.


# frob

frob(a: mat3type): number

Returns Frobenius norm of a mat3

# Parameters
Name Type Description
a mat3type the matrix to calculate Frobenius norm of

Returns: number

Frobenius norm


# fromMat2d

fromMat2d(out: mat3type, a: mat2dtype): mat3type

Copies the values from a mat2d into a mat3

# Parameters
Name Type Description
out mat3type the receiving matrix
a mat2dtype the matrix to copy

Returns: mat3type

out


# fromMat4

fromMat4(out: mat3type, a: mat3type): mat3type

Copies the upper-left 3x3 values into the given mat3.

# Parameters
Name Type Description
out mat3type the receiving 3x3 matrix
a mat3type the source 4x4 matrix

Returns: mat3type

out


# fromQuat

fromQuat(out: mat3type, q: quattype): mat3type

Calculates a 3x3 matrix from the given quaternion

# Parameters
Name Type Description
out mat3type mat3 receiving operation result
q quattype Quaternion to create matrix from

Returns: mat3type

out


# fromRotation

fromRotation(out: mat3type, rad: number): mat3type

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 mat3type mat3 receiving operation result
rad number the angle to rotate the matrix by

Returns: mat3type

out


# fromScaling

fromScaling(out: mat3type, v: vec2type): mat3type

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 mat3type mat3 receiving operation result
v vec2type Scaling vector

Returns: mat3type

out


# fromTranslation

fromTranslation(out: mat3type, v: vec2type): mat3type

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 mat3type mat3 receiving operation result
v vec2type Translation vector

Returns: mat3type

out


# fromValues

fromValues(m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3type

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)

Returns: mat3type

A new mat3


# identity

identity(out: mat3type): mat3type

Set a mat3 to the identity matrix

# Parameters
Name Type Description
out mat3type the receiving matrix

Returns: mat3type

out


# invert

invert(out: mat3type, a: mat3type): mat3type | null

Inverts a mat3

# Parameters
Name Type Description
out mat3type the receiving matrix
a mat3type the source matrix

Returns: mat3type | null

out


# multiply

multiply(out: mat3type, a: mat3type, b: mat3type): mat3type

Multiplies two mat3's

# Parameters
Name Type Description
out mat3type the receiving matrix
a mat3type the first operand
b mat3type the second operand

Returns: mat3type

out


# multiplyScalar

multiplyScalar(out: mat3type, a: mat3type, b: number): mat3type

Multiply each element of the matrix by a scalar.

# Parameters
Name Type Description
out mat3type the receiving matrix
a mat3type the matrix to scale
b number amount to scale the matrix's elements by

Returns: mat3type

out


# multiplyScalarAndAdd

multiplyScalarAndAdd(out: mat3type, a: mat3type, b: mat3type, s: number): mat3type

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

# Parameters
Name Type Description
out mat3type the receiving vector
a mat3type the first operand
b mat3type the second operand
s number the amount to scale b's elements by before adding

Returns: mat3type

out


# normalFromMat4

normalFromMat4(out: mat3type, a: mat4type): mat3type | null

Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix

# Parameters
Name Type Description
out mat3type mat3 receiving operation result
a mat4type Mat4 to derive the normal matrix from

Returns: mat3type | null

out


# rotate

rotate(out: mat3type, a: mat3type, rad: number): mat3type

Rotates a mat3 by the given angle

# Parameters
Name Type Description
out mat3type the receiving matrix
a mat3type the matrix to rotate
rad number the angle to rotate the matrix by

Returns: mat3type

out


# scale

scale(out: mat3type, a: mat3type, v: vec2type): mat3type

Scales the mat3 by the dimensions in the given vec2

# Parameters
Name Type Description
out mat3type the receiving matrix
a mat3type the matrix to rotate
v vec2type the vec2 to scale the matrix by

Returns: mat3type

out


# set

set(out: mat3type, m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3type

Set the components of a mat3 to the given values

# Parameters
Name Type Description
out mat3type 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)

Returns: mat3type

out


# str

str(a: mat3type): string

Returns a string representation of a mat3

# Parameters
Name Type Description
a mat3type matrix to represent as a string

Returns: string

string representation of the matrix


# subtract

subtract(out: mat3type, a: mat3type, b: mat3type): mat3type

Subtracts matrix b from matrix a

# Parameters
Name Type Description
out mat3type the receiving matrix
a mat3type the first operand
b mat3type the second operand

Returns: mat3type

out


# translate

translate(out: mat3type, a: mat3type, v: vec2type): mat3type

Translate a mat3 by the given vector

# Parameters
Name Type Description
out mat3type the receiving matrix
a mat3type the matrix to translate
v vec2type vector to translate by

Returns: mat3type

out


# transpose

transpose(out: mat3type, a: mat3type): mat3type

Transpose the values of a mat3

# Parameters
Name Type Description
out mat3type the receiving matrix
a mat3type the source matrix

Returns: mat3type

out

vjmap / Exports / mat4