Matrix3x3
¶
Matrix with 3x3 elements.
Functions which can be used to create new instances of Matrix3x3.
| Matrix3x3() | Default constructor, initializes the matrix to identity matrix |
| Matrix3x3() | Constructs the matrix from elements in column-major order |
| Matrix3x3() | Constructs the matrix from three column vectors |
Default constructor, initializes the matrix to identity matrix.
local matrix3x3 = Matrix3x3()
Constructs the matrix from elements in column-major order.
local matrix3x3 = Matrix3x3(x0, x1, x2, x3, x4, x5, x6, x7, x8)
Constructs the matrix from three column vectors.
local matrix3x3 = Matrix3x3(x, y, translation)
Methods of Matrix3x3 class.
| Matrix3x3:getRow() | Gets the row of a matrix |
| Matrix3x3:getColumn() | Gets the column of a matrix |
| Matrix3x3:setRow() | Sets the row of a matrix |
| Matrix3x3:setColumn() | Sets the column of a matrix |
| Matrix3x3:getXAxis() | Get X axis |
| Matrix3x3:getYAxis() | Get Y axis |
| Matrix3x3:getScaleX() | Get X scale component |
| Matrix3x3:getScaleY() | Get Y scale component |
| Matrix3x3:getScale() | Get scale as a vector |
| Matrix3x3:scale() | Scales this matrix |
| Matrix3x3:translate() | Translates this matrix |
| Matrix3x3:setXAxis() | Set X axis |
| Matrix3x3:setYAxis() | Set Y axis |
| Matrix3x3:setTranslation() | Set translation |
| Matrix3x3:setTranslation() | Set translation |
| Matrix3x3:getTranslation() | Get translation |
| Matrix3x3:getTranslationX() | Get translation on X axis |
| Matrix3x3:setTranslationX() | Set translation on X axis |
| Matrix3x3:getTranslationY() | Get translation on Y axis |
| Matrix3x3:setTranslationY() | Set translation on Y axis |
| Matrix3x3:getRotationAngle() | Get rotation angle of the matrix |
| Matrix3x3.createTranslation() | Creates translation matrix |
| Matrix3x3.createTranslation() | Creates translation matrix |
| Matrix3x3.createScale() | Creates a scaled matrix |
| Matrix3x3.createIdentity() | Creates identity matrix |
| Matrix3x3.createRotationInDegrees() | Creates a rotation matrix |
| Matrix3x3.createRotationInRadians() | Creates a rotation matrix |
| Matrix3x3.createSRT() | Create an SRT matrix |
| Matrix3x3.createFilled() | Creates a matrix with all elements set to \p value |
| Matrix3x3:transposed() | Applies a transpose to a matrix |
Gets the row of a matrix.
| index | (size_t) | Index of the accessed row. |
| (Vector3) | The row. |
Gets the column of a matrix.
| index | (size_t) | Index of the accessed column. |
| (Vector3) | The column. |
Sets the row of a matrix.
| index | (size_t) | Index of the accessed row. |
| row | (Vector3) | The value to set to the row. |
Sets the column of a matrix.
| index | (size_t) | Index of the accessed column. |
| column | (Vector3) | The value to set to the column. |
Get X axis.
Get Y axis.
Get X scale component.
Get Y scale component.
Get scale as a vector.
Scales this matrix.
| v | (Vector2) | Scaling vector. |
Translates this matrix.
| v | (Vector2) | Translation vector. |
Set X axis.
| v | (Vector2) | X axis vector. |
Set Y axis.
| v | (Vector2) | Y axis vector. |
Set translation.
| translation | (Vector2) | Translation vector. |
Set translation.
| translationX | (float) | Translation X component. |
| translationY | (float) | Translation Y component. |
Get translation.
| (Vector2) | Translation vector. |
Get translation on X axis.
| (float) | Translation X component. |
Set translation on X axis.
| translationX | (float) | Translation X component. |
Get translation on Y axis.
| (float) | Translation Y component. |
Set translation on Y axis.
| translationY | (float) | Translation Y component. |
Get rotation angle of the matrix.
| (float) | Rotation angle of the matrix. |
Creates translation matrix.
| translation | (Vector2) | Translation vector. |
| (Matrix3x3) | Translation matrix. |
Creates translation matrix.
| x | (float) | X component of the Translation vector. |
| y | (float) | Y component of the Translation vector. |
| (Matrix3x3) | Translation matrix. |
Creates a scaled matrix.
| scale | (Vector2) | Scaling vector. |
| (Matrix3x3) | Scaled matrix. |
Creates identity matrix.
| (Matrix3x3) | Identity matrix. |
Creates a rotation matrix.
| angleInDegrees | (float) | Rotation angle in degrees. |
| (Matrix3x3) | Rotation matrix. |
Creates a rotation matrix.
| angleInRadians | (float) | Rotation angle in radians. |
| (Matrix3x3) | Rotation matrix. |
Create an SRT matrix.
| scale | (Vector2) | Scales by axises. |
| rotationInRadians | (float) | Rotation component in radians. |
| translation | (Vector2) | Translation component. |
| (Matrix3x3) | Newly constructed matrix. |
Creates a matrix with all elements set to \p value.
| value | (float) | Value to set to all elements. |
| (Matrix3x3) | The constructed matrix. |
Applies a transpose to a matrix.
| (Matrix3x3) | Newly constructed transpose matrix. |
Matrix3x3 specific standalone functions, which are not a part of the Matrix3x3 class.
| inverse() | Applies an inversion to a matrix |
| inverseAffine() | Applies an inversion to an affine matrix |
| isTranslationOnly() | Determines whether a matrix is translation-only |
| isScalingOnly() | Determines whether a matrix is scaling-only |
| extractSRT() | Extracts scale, rotation and translation information from a matrix |
| normalized() | Normalizes the input matrix |
| matrixMultiplyVectorBy2x2() | Multiply a 2D vector with the top 2x2 part of a given matrix |
| getDeterminant() | Calculates the determinant of the matrix |
| getDeterminant2x2() | Calculates the determinant of the 2X2 part of a matrix |
| getTrace() | Calculates the trace of a matrix |
| componentWiseMultiply() | Multiplies matrix components component-wise and returns the resulting matrix |
| componentWiseDivide() | Divides matrix components component-wise and returns the resulting matrix |
| componentWiseMax() | Calculates the component-wise maximum for all matrix elements and returns the resulting matrix |
| componentWiseMin() | Calculates the component-wise minimum for all matrix elements and returns the resulting matrix |
Applies an inversion to a matrix.
| matrix | (Matrix3x3) | Input matrix. |
| (Matrix3x3 or nil) | Inverted matrix if the input matrix is invertible, nil otherwise. |
Applies an inversion to an affine matrix.
| matrix | (Matrix3x3) | Input matrix. |
| (Matrix3x3 or nil) | Inverted matrix if the input matrix is invertible, nil otherwise. |
Determines whether a matrix is translation-only.
| matrix | (Matrix3x3) | Input matrix. |
| (bool) | If the input matrix is translation-only, true, otherwise false. |
Determines whether a matrix is scaling-only. Note: This function allows translation.
| matrix | (Matrix3x3) | Input matrix. |
| (bool) | If the input matrix is scaling-only, true, otherwise false. |
Extracts scale, rotation and translation information from a matrix.
local result, scale, rotationInRadians, translation = extractSRT(matrix)
| matrix | (Matrix3x3) | Input matrix. |
| 1. | (boolean) | True if the matrix could be decomposed and the extraction of SRT components succeeded, false otherwise. |
| 2. | (Vector2) | Scale vector. |
| 3. | (float) | Rotation angle, in radians. |
| 4. | (Vector2) | Translation vector. |
Normalizes the input matrix. The matrix must be an affine transformation.
| (Matrix3x3 or nil) | A normalized Matrix3x3. |
Multiply a 2D vector with the top 2x2 part of a given matrix.
| matrix | (Matrix3x3) | The matrix that you want to multiply with a 2D vector. |
| vector | (Vector2) | The 2D vector that you want to multiply with a matrix. |
| (Vector2) | The result of the multiplication. |
Calculates the determinant of the matrix.
| (float) | Determinant of the matrix. |
Calculates the determinant of the 2X2 part of a matrix.
| (float) | Determinant of the matrix. |
Calculates the trace of a matrix.
| (float) | Trace of the matrix |
Multiplies matrix components component-wise and returns the resulting matrix.
| m1 | (Matrix3x3) | The first matrix. |
| m2 | (Matrix3x3) | The second matrix. |
| (Matrix3x3) | The result matrix. |
Divides matrix components component-wise and returns the resulting matrix.
| m1 | (Matrix3x3) | The first matrix. |
| m2 | (Matrix3x3) | The second matrix. |
| (Matrix3x3) | The result matrix. |
Calculates the component-wise maximum for all matrix elements and returns the resulting matrix.
| v1 | (Matrix3x3) | The first matrix. |
| v2 | (Matrix3x3) | The second matrix. |
| (Matrix3x3) | The result matrix. |
Calculates the component-wise minimum for all matrix elements and returns the resulting matrix.
| v1 | (Matrix3x3) | The first matrix. |
| v2 | (Matrix3x3) | The second matrix. |
| (Matrix3x3) | The result matrix. |