Matrix3
A matrix with 3 rows and 3 columns
For this page assume:
local myMat = matrices.mat3()
add(Matrix3)
Adds the other matrix to this one
Returns self for chaining
scale(Vector3)
Adds the other matrix to this one
Returns self for chaining
Example:
myMat:scale(2, 2, 2)
apply(Vector2)
Treats the given values as a vector, augments this vector with a 1, multiplies it against the matrix, and returns a deaugmented vector of the first values
Example:
myMat:apply()
set(Matrix3)
Sets this matrix to have the same values as the matrix passed in
Returns self for chaining
Example:
myMat:set()
copy()
Creates and returns a new copy of this matrix
Example:
myMat:copy()
reset()
Resets this matrix back to the identity matrix
Returns self for chaining
Example:
myMat:reset()
multiply(Matrix3)
Multiplies this matrix by the other matrix, with the other matrix on the left
Returns self for chaining
rotate(Vector3)
Rotates this matrix by the specified amount, changing the values inside
Angles are given in degrees
Returns self for chaining
Example:
myMat:rotate(90, 90, 90)
sub(Matrix3)
Subtracts the other matrix from this one
Returns self for chaining
augmented()
Augments this matrix, adding an additional row and column
Puts a 1 along the diagonal in the new spot, and the rest are zero
Example:
myMat:augmented()
inverted()
Returns a copy of this matrix, but inverted
Example:
myMat:inverted()
translate(Vector2)
Translates this matrix by the specified amount, changing the values inside
Returns self for chaining
Example:
myMat:translate(2, 2, 2)
transposed()
Returns a copy of this matrix, but transposed
Transposing means to swap the rows and the columns
Example:
myMat:transposed()
rightMultiplty(Matrix3)
Multiplies this matrix by the other matrix, with the other matrix on the right
Returns self for chaining
applyDir(Vector2)
Treats the given values as a vector, augments this vector with a 0, multiplies it against the matrix, and returns a deaugmented vector of the first values
Example:
myMat:applyDir()
deaugmented()
Deaugments this matrix, removing a row and column
Example:
myMat:deaugmented()
det()
Calculates and returns the determinant of this matrix
Example:
myMat:det()
transpose()
Transposes this matrix, changing the values inside
Transposing means to swap the rows and the columns
Returns self for chaining
Example:
myMat:transpose()
getColumn(int)
Gets the given column of this matrix, as a vector
Indexing starts at 1, as usual
Example:
myMat:getColumn(1)
getRow(int)
Gets the given row of this matrix, as a vector
Indexing starts at 1, as usual
Example:
myMat:getRow(1)
rotateX(number)
Rotates this matrix around the X axis by the specified number of degrees
Returns self for chaining
Example:
myMat:rotateX(90)
rotateY(number)
Rotates this matrix around the Y axis by the specified number of degrees
Returns self for chaining
Example:
myMat:rotateY(90)
rotateZ(number)
Rotates this matrix around the Z axis by the specified number of degrees
Returns self for chaining
Example:
myMat:rotateZ(90)
invert()
Inverts this matrix, changing the values inside
Returns self for chaining
Example:
myMat:invert()