Matrix 2x2 00 01 10 11 Each column represents an axis in a rotation matrix.
Re-exports: Vectors
public constant ZERO22 = mat2(0, 0, 0, 0)public constant IDENTITY22 = mat2( 1, 0,public constant ZERO33 = mat3(0, 0, 0, 0, 0, 0, 0, 0, 0)public constant IDENTITY33 = mat3( 1, 0, 0,public constant ZERO44 = mat4( 0, 0, 0, 0,public constant IDENTITY44 = mat4( 1, 0, 0, 0,public function mat2.op_plus(mat2 m) returns mat2public function mat2.op_minus(mat2 m) returns mat2public function mat2.op_minus(real scalar) returns mat2public function mat2.op_plus(real scalar) returns mat2public function mat2.op_mult(real scalar) returns mat2public function real.op_mult(mat2 m) returns mat2public function mat2.op_mult(vec2 v) returns vec2Matrix multiplication is not commutative that means matrix * vect is not the same as vec * matrix.
public function vec2.op_mult(mat2 m) returns vec2Matrix multiplication is not commutative that means matrix * vect is not the same as vec * matrix.
public function mat2.op_mult(mat2 m) returns mat2public function mat2.col(int index) returns vec2Returns matrix’ column by index as a vector or raises an error if it doesn’t exist.
public function mat2.row(int index) returns vec2Returns matrix’ row by index as a vector or raises an error if it doesn’t exist.
public function mat2.determinant() returns realpublic function mat2.transpose() returns mat2Flips the matrix over its main diagonal. Result of transposing for rotation matrix is its inverse matrix.
public function mat2.inverse() returns inverseresult22Finds inverse matrix. Returns tuple inverseresult22(bool success, mat2 matrix) where ‘success’ is true if the inverse matrix exists and ‘matrix’ is the inverse matrix. If there’s no inverse matrix ‘success’ is false and ‘matrix’ is zero matrix.
public function mat2.toString() returns stringpublic function angle.toRotation() returns mat2Creates rotation matrix from angle.
public function vec2.toScaling() returns mat2Creates scaling 2x2 matrix from a vector.
public function mat3.op_plus(mat3 m) returns mat3public function mat3.op_plus(real scalar) returns mat3public function mat3.op_minus(mat3 m) returns mat3public function mat3.op_minus(real scalar) returns mat3public function mat3.op_mult(real scalar) returns mat3public function real.op_mult(mat3 m) returns mat3public function mat3.op_mult(vec3 v) returns vec3Matrix multiplication is not commutative that means matrix * vect is not the same as vec * matrix.
public function vec3.op_mult(mat3 m) returns vec3public function mat3.op_mult(mat3 m) returns mat3public function mult(mat4 m) returns mat4Due to parameter restriction you need to set tmp_mat as one matrix before multiplying. *
public function mat3.col(int index) returns vec3Returns matrix’ column by index as a vector or raises an error if it doesn’t exist.
public function mat3.row(int index) returns vec3Returns matrix’ row by index as a vector or raises an error if it doesn’t exist.
public function mat3.trace() returns realThe sum of the main diagonal terms.
public function mat3.determinant() returns realpublic function mat3.transpose() returns mat3Flips the matrix over its main diagonal. Result of transposing for rotation matrix is its inverse matrix.
public function mat3.inverse() returns inverseresult33Finds inverse matrix. Returns tuple inverseresult33(bool success, mat3 matrix) where ‘success’ is true if the inverse matrix exists and ‘matrix’ is the inverse matrix. If there’s no inverse matrix ‘success’ is false and ‘matrix’ is zero matrix.
public function mat3.toEuler() returns vec3Extracts Euler-angles (Tait-Bryan) in radians from a rotation matrix. Order of the result is Z-Y-X (Yaw-Pitch-Roll).
public function mat3.toString() returns stringpublic function vec3.toRotation(angle angl) returns mat3Creates 3x3 rotation matrix from axis and angle.
public function angle.toRotation(vec3 axis) returns mat3Creates 3x3 rotation matrix from axis and angle.
public function angle.toRotationX() returns mat3Creates 3x3 rotation matrix around X-axis from angle.
public function angle.toRotationY() returns mat3Creates 3x3 rotation matrix around Y-axis from angle.
public function angle.toRotationZ() returns mat3Creates 3x3 rotation matrix around Z-axis from angle.
public function vec3.toScaling() returns mat3Creates 3x3 scaling matrix from a vector.
public function vec2.toTranslation() returns mat3Creates translation 3x3 matrix from a vector that represents an offset. Use it with vec3 that represents 2D point.
public function vec3.project(mat4 matrix) returns vec3Multiplies this vector by the given matrix dividing by w, assuming the fourth (w) component of the vector is 1. This is * mostly used to project/unproject vectors via a perspective projection matrix. *
public function getProjection(real near, real far, real fovy, real aspectRatio) returns mat4Sets the matrix to a projection matrix with a near- and far plane, a field of view in degrees and an aspect ratio. Note that
public function setToTranslation(real x, real y, real z) returns mat4Sets this matrix to a translation matrix, overwriting it first by an identity matrix and then setting the 4th column to the * translation vector.
public function setToLookAt(vec3 position, vec3 target, vec3 up) returns mat4Sets this matrix to a look at matrix with the given position, target and up vector.
public function setToLookAt(vec3 direction, vec3 up) returns mat4Sets the matrix to a look at matrix with a direction and an up vector. Multiply with a translation matrix to get a camera * model view matrix.
public function mat4.determinant() returns realpublic function mat4.inverse() returns inverseresult44Finds inverse matrix. Returns tuple inverseresult44(bool success, mat4 matrix) where ‘success’ is true if the inverse matrix exists and ‘matrix’ is the inverse matrix. If there’s no inverse matrix ‘success’ is false and ‘matrix’ is zero matrix.
public function mat4.toString() returns stringpublic function mat2.assertEquals(mat2 expected)public function mat3.assertEquals(mat3 expected)