# Module: mat2d

A mat2d contains six elements defined as:
```[a, b,
c, d,
tx, ty]
```
This is a short form for the 3x3 matrix:
```[a, b, 0,
c, d, 0,
tx, ty, 1]
```
The last column is ignored so the array is shorter and operations are faster.
Source:

### Methods

#### (static) add(out, a, b) → {mat2d}

##### Parameters:
Name Type Description
`out` mat2d the receiving matrix
`a` ReadonlyMat2d the first operand
`b` ReadonlyMat2d the second operand
Source:
out
Type
mat2d

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

Creates a new mat2d initialized with values from an existing matrix
##### Parameters:
Name Type Description
`a` ReadonlyMat2d matrix to clone
Source:
a new 2x3 matrix
Type
mat2d

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

Copy the values from one mat2d to another
##### Parameters:
Name Type Description
`out` mat2d the receiving matrix
`a` ReadonlyMat2d the source matrix
Source:
out
Type
mat2d

#### (static) create() → {mat2d}

Creates a new identity mat2d
Source:
a new 2x3 matrix
Type
mat2d

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

Calculates the determinant of a mat2d
##### Parameters:
Name Type Description
`a` ReadonlyMat2d the source matrix
Source:
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` ReadonlyMat2d The first matrix.
`b` ReadonlyMat2d 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` ReadonlyMat2d The first matrix.
`b` ReadonlyMat2d The second matrix.
Source:
##### Returns:
True if the matrices are equal, false otherwise.
Type
Boolean

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

Returns Frobenius norm of a mat2d
##### Parameters:
Name Type Description
`a` ReadonlyMat2d the matrix to calculate Frobenius norm of
Source:
Frobenius norm
Type
Number

#### (static) fromRotation(out, rad) → {mat2d}

Creates a matrix from a given angle This is equivalent to (but much faster than): mat2d.identity(dest); mat2d.rotate(dest, dest, rad);
##### Parameters:
Name Type Description
`out` mat2d mat2d receiving operation result
`rad` Number the angle to rotate the matrix by
Source:
out
Type
mat2d

#### (static) fromScaling(out, v) → {mat2d}

Creates a matrix from a vector scaling This is equivalent to (but much faster than): mat2d.identity(dest); mat2d.scale(dest, dest, vec);
##### Parameters:
Name Type Description
`out` mat2d mat2d receiving operation result
`v` ReadonlyVec2 Scaling vector
Source:
out
Type
mat2d

#### (static) fromTranslation(out, v) → {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:
Name Type Description
`out` mat2d mat2d receiving operation result
`v` ReadonlyVec2 Translation vector
Source:
out
Type
mat2d

#### (static) fromValues(a, b, c, d, tx, ty) → {mat2d}

Create a new mat2d with the given values
##### Parameters:
Name Type Description
`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)
Source:
A new mat2d
Type
mat2d

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

Set a mat2d to the identity matrix
##### Parameters:
Name Type Description
`out` mat2d the receiving matrix
Source:
out
Type
mat2d

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

Inverts a mat2d
##### Parameters:
Name Type Description
`out` mat2d the receiving matrix
`a` ReadonlyMat2d the source matrix
Source:
out
Type
mat2d

#### (static) mul()

Alias for mat2d.multiply
Source:

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

Multiplies two mat2d's
##### Parameters:
Name Type Description
`out` mat2d the receiving matrix
`a` ReadonlyMat2d the first operand
`b` ReadonlyMat2d the second operand
Source:
out
Type
mat2d

#### (static) multiplyScalar(out, a, b) → {mat2d}

Multiply each element of the matrix by a scalar.
##### Parameters:
Name Type Description
`out` mat2d the receiving matrix
`a` ReadonlyMat2d the matrix to scale
`b` Number amount to scale the matrix's elements by
Source:
out
Type
mat2d

#### (static) multiplyScalarAndAdd(out, a, b, scale) → {mat2d}

Adds two mat2d's after multiplying each element of the second operand by a scalar value.
##### Parameters:
Name Type Description
`out` mat2d the receiving vector
`a` ReadonlyMat2d the first operand
`b` ReadonlyMat2d the second operand
`scale` Number the amount to scale b's elements by before adding
Source:
out
Type
mat2d

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

Rotates a mat2d by the given angle
##### Parameters:
Name Type Description
`out` mat2d the receiving matrix
`a` ReadonlyMat2d the matrix to rotate
`rad` Number the angle to rotate the matrix by
Source:
out
Type
mat2d

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

Scales the mat2d by the dimensions in the given vec2
##### Parameters:
Name Type Description
`out` mat2d the receiving matrix
`a` ReadonlyMat2d the matrix to translate
`v` ReadonlyVec2 the vec2 to scale the matrix by
Source:
out
Type
mat2d

#### (static) set(out, a, b, c, d, tx, ty) → {mat2d}

Set the components of a mat2d to the given values
##### Parameters:
Name Type Description
`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)
Source:
out
Type
mat2d

#### (static) str(a) → {String}

Returns a string representation of a mat2d
##### Parameters:
Name Type Description
`a` ReadonlyMat2d matrix to represent as a string
Source:
##### Returns:
string representation of the matrix
Type
String

#### (static) sub()

Alias for mat2d.subtract
Source:

#### (static) subtract(out, a, b) → {mat2d}

Subtracts matrix b from matrix a
##### Parameters:
Name Type Description
`out` mat2d the receiving matrix
`a` ReadonlyMat2d the first operand
`b` ReadonlyMat2d the second operand
Source:
out
Type
mat2d

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

Translates the mat2d by the dimensions in the given vec2
##### Parameters:
Name Type Description
`out` mat2d the receiving matrix
`a` ReadonlyMat2d the matrix to translate
`v` ReadonlyVec2 the vec2 to translate the matrix by
Source:
out
Type
mat2d