Options
All
• Public
• Public/Protected
• All

# Namespace mat2d

## Functions

#### Parameters

• ##### out: mat2d

the receiving matrix

the first operand

the second operand

out

### clone

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

#### Parameters

matrix to clone

#### Returns mat2d

a new 2x3 matrix

### copy

• Copy the values from one mat2d to another

#### Parameters

• ##### out: mat2d

the receiving matrix

the source matrix

out

### create

• Creates a new identity mat2d

#### Returns mat2d

a new 2x3 matrix

### determinant

• Calculates the determinant of a mat2d

#### 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 mat2d

#### Parameters

the matrix to calculate Frobenius norm of

#### Returns number

Frobenius norm

### fromRotation

• Creates a matrix from a given angle This is equivalent to (but much faster than):

``````mat2d.identity(dest);
``````

#### Parameters

• ##### out: mat2d

mat2d receiving operation result

the angle to rotate the matrix by

out

### fromScaling

• Creates a matrix from a vector scaling This is equivalent to (but much faster than):

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

#### Parameters

• ##### out: mat2d

mat2d receiving operation result

Scaling vector

out

### fromTranslation

• fromTranslation(out: mat2d, v: ReadonlyVec2): mat2d
• Creates a matrix from a vector translation This is equivalent to (but much faster than):

``````mat2d.identity(dest);
mat2d.translate(dest, dest, vec);
``````

#### Parameters

• ##### out: mat2d

mat2d receiving operation result

Translation vector

out

### fromValues

• fromValues(a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d
• Create a new mat2d with the given values

#### Parameters

• ##### a: number

Component A (index 0)

• ##### b: number

Component B (index 1)

• ##### c: number

Component C (index 2)

• ##### d: number

Component D (index 3)

• ##### tx: number

Component TX (index 4)

• ##### ty: number

Component TY (index 5)

A new mat2d

### identity

• Set a mat2d to the identity matrix

#### Parameters

• ##### out: mat2d

the receiving matrix

out

### invert

• Inverts a mat2d

#### Parameters

• ##### out: mat2d

the receiving matrix

the source matrix

out

### mul

• Multiplies two mat2d's

#### Parameters

• ##### out: mat2d

the receiving matrix

the first operand

the second operand

out

### multiply

• Multiplies two mat2d's

#### Parameters

• ##### out: mat2d

the receiving matrix

the first operand

the second operand

out

### multiplyScalar

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

#### Parameters

• ##### out: mat2d

the receiving matrix

the matrix to scale

• ##### b: number

amount to scale the matrix's elements by

#### Returns mat2d

out

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

#### Parameters

• ##### out: mat2d

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 mat2d by the given angle

#### Parameters

• ##### out: mat2d

the receiving matrix

the matrix to rotate

the angle to rotate the matrix by

out

### scale

• Scales the mat2d by the dimensions in the given vec2

#### Parameters

• ##### out: mat2d

the receiving matrix

the matrix to translate

the vec2 to scale the matrix by

out

### set

• set(out: mat2d, a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d
• Set the components of a mat2d to the given values

#### Parameters

• ##### out: mat2d

the receiving matrix

• ##### a: number

Component A (index 0)

• ##### b: number

Component B (index 1)

• ##### c: number

Component C (index 2)

• ##### d: number

Component D (index 3)

• ##### tx: number

Component TX (index 4)

• ##### ty: number

Component TY (index 5)

out

### str

• Returns a string representation of a mat2d

#### Parameters

matrix to represent as a string

#### Returns string

string representation of the matrix

### sub

• Subtracts matrix b from matrix a

#### Parameters

• ##### out: mat2d

the receiving matrix

the first operand

the second operand

out

### subtract

• Subtracts matrix b from matrix a

#### Parameters

• ##### out: mat2d

the receiving matrix

the first operand

the second operand

out

### translate

• Translates the mat2d by the dimensions in the given vec2

#### Parameters

• ##### out: mat2d

the receiving matrix