Private
Readonly
_matrixThe function returns a two-dimensional array of numbers.
The getter method is returning the value of the private variable _matrix
, which is a two-dimensional
array of numbers.
Static
emptyThe function returns a 2D array with three empty arrays.
An empty 2-dimensional array with 3 empty arrays inside.
Static
identityThe above function returns a 3x3 identity matrix.
The method is returning a 2-dimensional array of numbers representing the identity matrix.
The function "toVector" returns a new Vector2D object with the values from the first and second elements of the _matrix array.
A new instance of the Vector2D class is being returned. The values of the returned vector are taken from the first column of the matrix.
Static
addStatic
multiplyStatic
multiplyThe function multiplies each element of a 2D matrix by a given value and returns the resulting matrix.
The matrix
parameter is an instance of the Matrix2D
class, which represents a 2D
matrix. It contains a property m
that is a 2D array representing the matrix elements.
The value
parameter is a number that you want to multiply each element of the matrix
by.
a new instance of the Matrix2D class, which is created using the result array.
Static
multiplyStatic
rotateThe function "rotate" takes an angle in radians and returns a 2D transformation matrix for rotating objects.
The "radians" parameter is the angle in radians by which you want to rotate an object.
The code is returning a new instance of a Matrix2D object.
Static
scaleStatic
subtractStatic
translateThe translate function takes a 2D vector and returns a 2D matrix that represents a translation transformation.
The parameter "vector" is of type Vector2D. It represents a 2D vector with components x and y, and an optional w component.
The method is returning a new instance of the Matrix2D class.
Static
viewThe function returns a 2D matrix that scales and flips a vector around the center of a given width and height.
The width parameter represents the width of the view or the canvas. It is a number that specifies the width in pixels or any other unit of measurement.
The height parameter represents the height of the view or the canvas. It is used to calculate the centerY value, which is the vertical center of the view.
a Matrix2D object.
Generated using TypeDoc
The constructor function initializes a Matrix2D object with either a default identity matrix, or a provided matrix or Vector2D object.