Skip to main content

Matrices

The global instance of the MatricesAPI and its subtypes

Matrix2

mat2()

Creates a Matrix2 using the given parameters as columns

If you call the function with no parameters, returns the 2x2 identity matrix

Example:

matrices.mat2()

rotation2(number)

Creates a new Matrix2 that rotates by the specified angle

Angle is given in degrees

Example:

matrices.rotation2(90)

scale2(Vector2)

Creates a new Matrix2 that scales by the specified factors

Example:

matrices.scale2(2, 2)

Matrix3

mat3()

Creates a Matrix3 using the given parameters as columns

If you call the function with no parameters, returns the 3x3 identity matrix

Example:

matrices.mat3()

rotation3(Vector3)

Creates a new Matrix3 that rotates by the specified angles

Angles are given in degrees, and the rotation order is ZYX

Example:

matrices.rotation3(90, 90, 90)

xRotation3(number)

Creates a new Matrix3 that rotates by the specified angle around the X axis

Angle is given in degrees

Example:

matrices.xRotation3(90)

yRotation3(number)

Creates a new Matrix3 that rotates by the specified angle around the Y axis

Angle is given in degrees

Example:

matrices.yRotation3(90)

zRotation3(number)

Creates a new Matrix3 that rotates by the specified angle around the Z axis

Angle is given in degrees

Example:

matrices.zRotation3(90)

translate3(Vector2)

Creates a new Matrix3 that translates by the specified offset

Example:

matrices.translate3(90, 90)

scale3(Vector3)

Creates a new Matrix3 that scales by the specified factors

Example:

matrices.scale3(2, 2, 2)

Matrix4

mat4()

Creates a Matrix4 using the given parameters as columns

If you call the function with no parameters, returns the 4x4 identity matrix

Example:

matrices.mat4()

rotation4(Vector3)

Creates a new Matrix4 that rotates by the specified angles

Angles are given in degrees, and the rotation order is ZYX

Example:

matrices.rotation4(90, 90, 90)

xRotation4(number)

Creates a new Matrix4 that rotates by the specified angle around the X axis

Angle is given in degrees

Example:

matrices.xRotation4(90)

yRotation4(number)

Creates a new Matrix4 that rotates by the specified angle around the Y axis

Angle is given in degrees

Example:

matrices.yRotation4(90)

zRotation4(number)

Creates a new Matrix4 that rotates by the specified angle around the Z axis

Angle is given in degrees

Example:

matrices.zRotation4(90)

translate4(Vector3)

Creates a new Matrix4 that translates by the specified offset

Example:

matrices.translate4(90, 90, 90)

scale4(Vector3)

Creates a new Matrix4 that scales by the specified factors

Example:

matrices.scale4(2, 2, 2)