new Matrix(aa, ab, ac, ba, bb, bc, ca, cb, cc)
Matrix defines a 3x3 matrix indicated to deal with 2D operations.
If it's instantiated with no arguments then, it becomes the
identity matrix.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
aa |
number |
<optional> |
Element of the first row and first line. |
ab |
number |
<optional> |
Element of the second row and first line. |
ac |
number |
<optional> |
Element of the third row and first line. |
ba |
number |
<optional> |
Element of the first row and second line. |
bb |
number |
<optional> |
Element of the second row and second line. |
bc |
number |
<optional> |
Element of the third row and second line. |
ca |
number |
<optional> |
Element of the first row and third line. |
cb |
number |
<optional> |
Element of the second row and third line. |
cc |
number |
<optional> |
Element of the third row and third line. |
- Source:
Members
-
v :!Array.<number>
-
Matrix elements.
Type:
- !Array.<number>
- Source:
Methods
-
add(matrix) → {Grape2D.Matrix}
-
Adds to this matrix another one.
Parameters:
Name Type Description matrix
Grape2D.Matrix Matrix to add. - Source:
Returns:
This matrix.- Type
- Grape2D.Matrix
-
clone() → {Grape2D.Matrix}
-
Clones the matrix. Instantiating another one with the same elements.
- Source:
Returns:
Equivalent matrix.- Type
- Grape2D.Matrix
-
determinant() → {number}
-
Computes the determinant of the matrix.
- Source:
Returns:
Determinant.- Type
- number
-
identity() → {Grape2D.Matrix}
-
Sets this matrix as the identity matrix.
- Source:
Returns:
This matrix.- Type
- Grape2D.Matrix
-
invert() → {Grape2D.Matrix}
-
Inverts the matrix.
- Source:
Returns:
This matrix.- Type
- Grape2D.Matrix
-
multiplyByMatrix(matrix) → {Grape2D.Matrix}
-
Multiplies by other matrix.
Parameters:
Name Type Description matrix
Grape2D.Matrix Matrix to multiply by. - Source:
Returns:
The new matrix, result of the multiplication.- Type
- Grape2D.Matrix
-
multiplyByScalar(scalar) → {Grape2D.Matrix}
-
Multiplies by a scalar number.
Parameters:
Name Type Description scalar
number Scalar to multiply by. - Source:
Returns:
This matrix.- Type
- Grape2D.Matrix
-
multiplyByVector(v) → {Grape2D.Vector}
-
Multiplies by a vector. Since Grape2D doesn't support 3D vectors the third element of the vector is 1.
Parameters:
Name Type Description v
Grape2D.Vector Vector to multiply by. - Source:
Returns:
A new vector, result of the multiplication.- Type
- Grape2D.Vector
-
set(aa, ab, ac, ba, bb, bc, ca, cb, cc) → {Grape2D.Matrix}
-
Sets the matrix with new elements.
Parameters:
Name Type Argument Description aa
number <optional>
Element of the first row and first line. ab
number <optional>
Element of the second row and first line. ac
number <optional>
Element of the third row and first line. ba
number <optional>
Element of the first row and second line. bb
number <optional>
Element of the second row and second line. bc
number <optional>
Element of the third row and second line. ca
number <optional>
Element of the first row and third line. cb
number <optional>
Element of the second row and third line. cc
number <optional>
Element of the third row and third line. - Source:
Returns:
This matrix.- Type
- Grape2D.Matrix
-
toString() → {string}
-
Represents the matrix as a string.
- Source:
Returns:
Matrix as a string.- Type
- string
-
transpose() → {Grape2D.Matrix}
-
Transposes the matrix.
- Source:
Returns:
This matrix.- Type
- Grape2D.Matrix