mat2d

mat2d

2x3 Matrix

Constructor

# new mat2d()

Source:

A mat2d contains six elements defined as:

[a, c, tx,
 b, d, ty]
This is a short form for the 3x3 matrix:

[a, c, tx,
 b, d, ty,
 0, 0, 1]
The last row is ignored so the array is shorter and operations are faster.

Methods

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

Source:

Creates a new mat2d initialized with values from an existing matrix

Parameters:
Name Type Description
a mat2d

matrix to clone

Returns:

a new 2x3 matrix

Type
mat2d

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

Source:

Copy the values from one mat2d to another

Parameters:
Name Type Description
out mat2d

the receiving matrix

a mat2d

the source matrix

Returns:

out

Type
mat2d

# (static) create() → {mat2d}

Source:

Creates a new identity mat2d

Returns:

a new 2x3 matrix

Type
mat2d

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

Source:

Calculates the determinant of a mat2d

Parameters:
Name Type Description
a mat2d

the source matrix

Returns:

determinant of a

Type
Number

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

Source:

Returns Frobenius norm of a mat2d

Parameters:
Name Type Description
a mat2d

the matrix to calculate Frobenius norm of

Returns:

Frobenius norm

Type
Number

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

Source:

Set a mat2d to the identity matrix

Parameters:
Name Type Description
out mat2d

the receiving matrix

Returns:

out

Type
mat2d

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

Source:

Inverts a mat2d

Parameters:
Name Type Description
out mat2d

the receiving matrix

a mat2d

the source matrix

Returns:

out

Type
mat2d

# (static) mul()

Source:

Alias for mat2d.multiply

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

Source:

Multiplies two mat2d's

Parameters:
Name Type Description
out mat2d

the receiving matrix

a mat2d

the first operand

b mat2d

the second operand

Returns:

out

Type
mat2d

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

Source:

Rotates a mat2d by the given angle

Parameters:
Name Type Description
out mat2d

the receiving matrix

a mat2d

the matrix to rotate

rad Number

the angle to rotate the matrix by

Returns:

out

Type
mat2d

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

Source:

Scales the mat2d by the dimensions in the given vec2

Parameters:
Name Type Description
out mat2d

the receiving matrix

a mat2d

the matrix to translate

v vec2

the vec2 to scale the matrix by

Returns:

out

Type
mat2d

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

Source:

Translates the mat2d by the dimensions in the given vec2

Parameters:
Name Type Description
out mat2d

the receiving matrix

a mat2d

the matrix to translate

v vec2

the vec2 to translate the matrix by

Returns:

out

Type
mat2d