Your browser does not support HTML5 canvas. Fork me on GitHub

Available Packages:

Matrices

Source

mat2 IDENTITY22

Source

mat3 IDENTITY33

Source

mat4 IDENTITY44

Source

mat2 ZERO22

Source

mat3 ZERO33

Source

mat4 ZERO44

Source

mat4 tmp_mat

Source

function mat2.assertEquals(mat2 expected)

Source

function mat3.assertEquals(mat3 expected)

Source

function mat2.col(int index) returns vec2

Source

Returns matrix' column by index as a vector or rises an error if doesn't exist.

function mat3.col(int index) returns vec3

Source

Returns matrix' column by index as a vector or rises an error if doesn't exist.

function mat2.determinant() returns real

Source

function mat3.determinant() returns real

Source

function mat4.determinant() returns real

Source

function getProjection(real near, real far, real fovy, real aspectRatio) returns mat4

Source

Sets the matrix to a projection matrix with a near- and far plane, a field of view in degrees and an aspect ratio. Note that the field of view specified is the angle in degrees for the height, the field of view for the width will be calculated according to the aspect ratio.

function mat2.inverse() returns inverseresult22

Source

Finds 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.

function mat3.inverse() returns inverseresult33

Source

Finds 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.

function mat4.inverse() returns inverseresult44

Source

Finds inverse matrix. Returns tuple inverseresult44(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.

function mat2(real m00, real m01, real m10, real m11) returns mat2

Source

Matrix 2x2 00 01 10 11 Each column represents an axis in a rotation matrix.

function mat3(real m00, real m01, real m02, real m10, real m11, real m12, real m20, real m21, real m22) returns mat3

Source

Matrix 3x3 00 01 02 10 11 12 20 21 22 Each column represents an axis in a rotation matrix.

function mat4(real m00, real m01, real m02, real m03, real m10, real m11, real m12, real m13, real m20, real m21, real m22, real m23, real m30, real m31, real m32, real m33) returns mat4

Source

Matrix 4x4 00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33

function mult(mat4 m) returns mat4

Source

Due to parameter restriction you need to set `tmp_mat` as one matrix before multiplying.

function mat2.op_minus(mat2 m) returns mat2

Source

function mat2.op_minus(real scalar) returns mat2

Source

function mat3.op_minus(mat3 m) returns mat3

Source

function mat3.op_minus(real scalar) returns mat3

Source

function mat2.op_mult(real scalar) returns mat2

Source

function real.op_mult(mat2 m) returns mat2

Source

function mat2.op_mult(vec2 v) returns vec2

Source

Matrix multiplication is not commutative that means matrix * vect is not the same as vec * matrix.

function vec2.op_mult(mat2 m) returns vec2

Source

Matrix multiplication is not commutative that means matrix * vect is not the same as vec * matrix.

function mat2.op_mult(mat2 m) returns mat2

Source

function mat3.op_mult(real scalar) returns mat3

Source

function real.op_mult(mat3 m) returns mat3

Source

function mat3.op_mult(vec3 v) returns vec3

Source

Matrix multiplication is not commutative that means matrix * vect is not the same as vec * matrix.

function vec3.op_mult(mat3 m) returns vec3

Source

function mat3.op_mult(mat3 m) returns mat3

Source

function mat2.op_plus(mat2 m) returns mat2

Source

function mat2.op_plus(real scalar) returns mat2

Source

function mat3.op_plus(mat3 m) returns mat3

Source

function mat3.op_plus(real scalar) returns mat3

Source

function vec3.project(mat4 matrix) returns vec3

Source

Multiplies 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.

function mat2.row(int index) returns vec2

Source

Returns matrix' row by index as a vector or rises an error if doesn't exist.

function mat3.row(int index) returns vec3

Source

Returns matrix' row by index as a vector or rises an error if doesn't exist.

function setToLookAt(vec3 position, vec3 target, vec3 up) returns mat4

Source

Sets this matrix to a look at matrix with the given position, target and up vector.

function setToLookAt(vec3 direction, vec3 up) returns mat4

Source

Sets 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.

function setToTranslation(real x, real y, real z) returns mat4

Source

Sets this matrix to a translation matrix, overwriting it first by an identity matrix and then setting the 4th column to the translation vector.

function mat3.toEuler() returns vec3

Source

Extracts Euler-angles (Tait-Bryan) in radians from a rotation matrix. Order of the result is Z-Y-X (Yaw-Pitch-Roll).

function angle.toRotation() returns mat2

Source

Creates rotation matrix from angle.

function vec3.toRotation(angle angl) returns mat3

Source

Creates 3x3 rotation matrix from axis and angle.

function angle.toRotation(vec3 axis) returns mat3

Source

Creates 3x3 rotation matrix from axis and angle.

function angle.toRotationX() returns mat3

Source

Creates 3x3 rotation matrix around X-axis from angle.

function angle.toRotationY() returns mat3

Source

Creates 3x3 rotation matrix around Y-axis from angle.

function angle.toRotationZ() returns mat3

Source

Creates 3x3 rotation matrix around Z-axis from angle.

function vec2.toScaling() returns mat2

Source

Creates scaling 2x2 matrix from a vector.

function vec3.toScaling() returns mat3

Source

Creates 3x3 scaling matrix from a vector.

function mat2.toString() returns string

Source

function mat3.toString() returns string

Source

function mat4.toString() returns string

Source

function vec2.toTranslation() returns mat3

Source

Creates translation 3x3 matrix from a vector that represents an offset. Use it with vec3 that represents 2D point.

function mat3.trace() returns real

Source

The sum of the main diagonal terms.

function mat2.transpose() returns mat2

Source

Flips the matrix over its main diagonale. Result of transposing for rotation matrix is its inverse matrix.

function mat3.transpose() returns mat3

Source

Flips the matrix over its main diagonale. Result of transposing for rotation matrix is its inverse matrix.