Skip to main content

Matrices

A global API which provides functions dedicated to creating and otherwise manipulating matrices

warning

This page is a WIP. It contains all the information in Figura's documentation but we're working on adding more helpful descriptions.

Accessed using the name "matrices"


Matrix2​

mat2()​

Creates a Matrix2 using the given parameters as columns

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

mat2()

Returns:

TypeDescription
Matrix2-

Example:

matrices.mat2()

rotation2()​

Creates a new Matrix2 that rotates by the specified angle

Angle is given in degrees

rotation2(angle)

Parameters:

NameTypeDescriptionDefault
angleNumber--

Returns:

TypeDescription
Matrix2-

Example:

matrices.rotation2(90)

scale2()​

Creates a new Matrix2 that scales by the specified factors

scale2(vec)

Parameters:

NameTypeDescriptionDefault
vecVector2--

Returns:

TypeDescription
Matrix2-

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

mat3()

Returns:

TypeDescription
Matrix3-

Example:

matrices.mat3()

rotation3()​

Creates a new Matrix3 that rotates by the specified angles

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

rotation3(vec)

Parameters:

NameTypeDescriptionDefault
vecVector3--

Returns:

TypeDescription
Matrix3-

Example:

matrices.rotation3(90, 90, 90)

scale3()​

Creates a new Matrix3 that scales by the specified factors

scale3(vec)

Parameters:

NameTypeDescriptionDefault
vecVector3--

Returns:

TypeDescription
Matrix3-

Example:

matrices.scale3(2, 2, 2)

translate3()​

Creates a new Matrix3 that translates by the specified offset

translate3(vec)

Parameters:

NameTypeDescriptionDefault
vecVector2--

Returns:

TypeDescription
Matrix3-

Example:

matrices.translate3(90, 90)

xRotation3()​

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

Angle is given in degrees

xRotation3(angle)

Parameters:

NameTypeDescriptionDefault
angleNumber--

Returns:

TypeDescription
Matrix3-

Example:

matrices.xRotation3(90)

yRotation3()​

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

Angle is given in degrees

yRotation3(angle)

Parameters:

NameTypeDescriptionDefault
angleNumber--

Returns:

TypeDescription
Matrix3-

Example:

matrices.yRotation3(90)

zRotation3()​

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

Angle is given in degrees

zRotation3(angle)

Parameters:

NameTypeDescriptionDefault
angleNumber--

Returns:

TypeDescription
Matrix3-

Example:

matrices.zRotation3(90)

Matrix4​

mat4()​

Creates a Matrix4 using the given parameters as columns

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

mat4()

Returns:

TypeDescription
Matrix4-

Example:

matrices.mat4()

rotation4()​

Creates a new Matrix4 that rotates by the specified angles

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

rotation4(vec)

Parameters:

NameTypeDescriptionDefault
vecVector3--

Returns:

TypeDescription
Matrix4-

Example:

matrices.rotation4(90, 90, 90)

scale4()​

Creates a new Matrix4 that scales by the specified factors

scale4(vec)

Parameters:

NameTypeDescriptionDefault
vecVector3--

Returns:

TypeDescription
Matrix4-

Example:

matrices.scale4(2, 2, 2)

translate4()​

Creates a new Matrix4 that translates by the specified offset

translate4(vec)

Parameters:

NameTypeDescriptionDefault
vecVector3--

Returns:

TypeDescription
Matrix4-

Example:

matrices.translate4(90, 90, 90)

xRotation4()​

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

Angle is given in degrees

xRotation4(angle)

Parameters:

NameTypeDescriptionDefault
angleNumber--

Returns:

TypeDescription
Matrix4-

Example:

matrices.xRotation4(90)

yRotation4()​

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

Angle is given in degrees

yRotation4(angle)

Parameters:

NameTypeDescriptionDefault
angleNumber--

Returns:

TypeDescription
Matrix4-

Example:

matrices.yRotation4(90)

zRotation4()​

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

Angle is given in degrees

zRotation4(angle)

Parameters:

NameTypeDescriptionDefault
angleNumber--

Returns:

TypeDescription
Matrix4-

Example:

matrices.zRotation4(90)