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.
Methods
-
inneradd$1(out, a, b) → mat2d
-
Adds two mat2d's
Name Type Description outmat2d the receiving matrix amat2d the first operand bmat2d the second operand Returns:
out -
innerclone$1(a) → mat2d
-
Creates a new mat2d initialized with values from an existing matrix
Name Type Description amat2d matrix to clone Returns:
a new 2x3 matrix -
innercopy$1(out, a) → mat2d
-
Copy the values from one mat2d to another
Name Type Description outmat2d the receiving matrix amat2d the source matrix Returns:
out -
innercreate$1() → mat2d
-
Creates a new identity mat2d
Returns:
a new 2x3 matrix -
Calculates the determinant of a mat2d
Name Type Description amat2d the source matrix Returns:
determinant of a -
Returns whether or not the matrices have approximately the same elements in the same position.
Name Type Description amat2d The first matrix. bmat2d The second matrix. Returns:
True if the matrices are equal, false otherwise. -
Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
Name Type Description amat2d The first matrix. bmat2d The second matrix. Returns:
True if the matrices are equal, false otherwise. -
Returns Frobenius norm of a mat2d
Name Type Description amat2d the matrix to calculate Frobenius norm of Returns:
Frobenius norm -
innerfromRotation$1(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);
Name Type Description outmat2d mat2d receiving operation result radNumber the angle to rotate the matrix by Returns:
out -
innerfromScaling$1(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);
Name Type Description outmat2d mat2d receiving operation result vvec2 Scaling vector Returns:
out -
innerfromTranslation(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);
Name Type Description outmat2d mat2d receiving operation result vvec2 Translation vector Returns:
out -
innerfromValues$1(a, b, c, d, tx, ty) → mat2d
-
Create a new mat2d with the given values
Name Type Description aNumber Component A (index 0) bNumber Component B (index 1) cNumber Component C (index 2) dNumber Component D (index 3) txNumber Component TX (index 4) tyNumber Component TY (index 5) Returns:
A new mat2d -
inneridentity$1(out) → mat2d
-
Set a mat2d to the identity matrix
Name Type Description outmat2d the receiving matrix Returns:
out -
innerinvert$1(out, a) → mat2d
-
Inverts a mat2d
Name Type Description outmat2d the receiving matrix amat2d the source matrix Returns:
out -
Alias for
mat2d.multiply -
innermultiply$1(out, a, b) → mat2d
-
Multiplies two mat2d's
Name Type Description outmat2d the receiving matrix amat2d the first operand bmat2d the second operand Returns:
out -
innermultiplyScalar$1(out, a, b) → mat2d
-
Multiply each element of the matrix by a scalar.
Name Type Description outmat2d the receiving matrix amat2d the matrix to scale bNumber amount to scale the matrix's elements by Returns:
out -
innermultiplyScalarAndAdd$1(out, a, b, scale) → mat2d
-
Adds two mat2d's after multiplying each element of the second operand by a scalar value.
Name Type Description outmat2d the receiving vector amat2d the first operand bmat2d the second operand scaleNumber the amount to scale b's elements by before adding Returns:
out -
innerrotate$1(out, a, rad) → mat2d
-
Rotates a mat2d by the given angle
Name Type Description outmat2d the receiving matrix amat2d the matrix to rotate radNumber the angle to rotate the matrix by Returns:
out -
innerscale$1(out, a, v) → mat2d
-
Scales the mat2d by the dimensions in the given vec2
Name Type Description outmat2d the receiving matrix amat2d the matrix to translate vvec2 the vec2 to scale the matrix by Returns:
out -
innerset$1(out, a, b, c, d, tx, ty) → mat2d
-
Set the components of a mat2d to the given values
Name Type Description outmat2d the receiving matrix aNumber Component A (index 0) bNumber Component B (index 1) cNumber Component C (index 2) dNumber Component D (index 3) txNumber Component TX (index 4) tyNumber Component TY (index 5) Returns:
out -
Returns a string representation of a mat2d
Name Type Description amat2d matrix to represent as a string Returns:
string representation of the matrix -
Alias for
mat2d.subtract -
innersubtract$1(out, a, b) → mat2d
-
Subtracts matrix b from matrix a
Name Type Description outmat2d the receiving matrix amat2d the first operand bmat2d the second operand Returns:
out -
innertranslate(out, a, v) → mat2d
-
Translates the mat2d by the dimensions in the given vec2
Name Type Description outmat2d the receiving matrix amat2d the matrix to translate vvec2 the vec2 to translate the matrix by Returns:
out
