Options
All
• Public
• Public/Protected
• All

# Namespace mat2

## Functions

### LDU

• Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix

#### Parameters

the lower triangular matrix

the diagonal matrix

the upper triangular matrix

the input matrix to factorize

#### Parameters

• ##### out: mat2

the receiving matrix

the first operand

the second operand

#### Returns mat2

out

• Calculates the adjugate of a mat2

#### Parameters

• ##### out: mat2

the receiving matrix

the source matrix

out

### clone

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

#### Parameters

matrix to clone

#### Returns mat2

a new 2x2 matrix

### copy

• copy(out: mat2, a: ReadonlyMat2): mat2
• Copy the values from one mat2 to another

#### Parameters

• ##### out: mat2

the receiving matrix

the source matrix

out

### create

• Creates a new identity mat2

#### Returns mat2

a new 2x2 matrix

### determinant

• Calculates the determinant of a mat2

#### Parameters

the source matrix

#### Returns number

determinant of a

### equals

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

#### Parameters

The first matrix.

The second matrix.

#### Returns boolean

True if the matrices are equal, false otherwise.

### exactEquals

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

#### Parameters

The first matrix.

The second matrix.

#### Returns boolean

True if the matrices are equal, false otherwise.

### frob

• Returns Frobenius norm of a mat2

#### Parameters

the matrix to calculate Frobenius norm of

#### Returns number

Frobenius norm

### fromRotation

• fromRotation(out: mat2, rad: number): mat2
• Creates a matrix from a given angle This is equivalent to (but much faster than):

``````mat2.identity(dest);
``````

#### Parameters

• ##### out: mat2

mat2 receiving operation result

the angle to rotate the matrix by

out

### fromScaling

• fromScaling(out: mat2, v: ReadonlyVec2): mat2
• Creates a matrix from a vector scaling This is equivalent to (but much faster than):

``````mat2.identity(dest);
mat2.scale(dest, dest, vec);
``````

#### Parameters

• ##### out: mat2

mat2 receiving operation result

Scaling vector

out

### fromValues

• fromValues(m00: number, m01: number, m10: number, m11: number): mat2
• Create a new mat2 with the given values

#### Parameters

• ##### m00: number

Component in column 0, row 0 position (index 0)

• ##### m01: number

Component in column 0, row 1 position (index 1)

• ##### m10: number

Component in column 1, row 0 position (index 2)

• ##### m11: number

Component in column 1, row 1 position (index 3)

#### Returns mat2

out A new 2x2 matrix

### identity

• Set a mat2 to the identity matrix

#### Parameters

• ##### out: mat2

the receiving matrix

out

### invert

• invert(out: mat2, a: ReadonlyMat2): mat2
• Inverts a mat2

#### Parameters

• ##### out: mat2

the receiving matrix

the source matrix

out

### mul

• Multiplies two mat2's

#### Parameters

• ##### out: mat2

the receiving matrix

the first operand

the second operand

out

### multiply

• Multiplies two mat2's

#### Parameters

• ##### out: mat2

the receiving matrix

the first operand

the second operand

out

### multiplyScalar

• multiplyScalar(out: mat2, a: ReadonlyMat2, b: number): mat2
• Multiply each element of the matrix by a scalar.

#### Parameters

• ##### out: mat2

the receiving matrix

the matrix to scale

• ##### b: number

amount to scale the matrix's elements by

#### Returns mat2

out

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

#### Parameters

• ##### out: mat2

the receiving vector

the first operand

the second operand

• ##### scale: number

the amount to scale b's elements by before adding

out

### rotate

• Rotates a mat2 by the given angle

#### Parameters

• ##### out: mat2

the receiving matrix

the matrix to rotate

the angle to rotate the matrix by

out

### scale

• Scales the mat2 by the dimensions in the given vec2

#### Parameters

• ##### out: mat2

the receiving matrix

the matrix to rotate

the vec2 to scale the matrix by

out

### set

• set(out: mat2, m00: number, m01: number, m10: number, m11: number): mat2
• Set the components of a mat2 to the given values

#### Parameters

• ##### out: mat2

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)

• ##### m10: number

Component in column 1, row 0 position (index 2)

• ##### m11: number

Component in column 1, row 1 position (index 3)

out

### str

• Returns a string representation of a mat2

#### Parameters

matrix to represent as a string

#### Returns string

string representation of the matrix

### sub

• Subtracts matrix b from matrix a

#### Parameters

• ##### out: mat2

the receiving matrix

the first operand

the second operand

out

### subtract

• Subtracts matrix b from matrix a

#### Parameters

• ##### out: mat2

the receiving matrix

the first operand

the second operand

out

### transpose

• transpose(out: mat2, a: ReadonlyMat2): mat2
• Transpose the values of a mat2

#### Parameters

• ##### out: mat2

the receiving matrix