Matrices
A global API which provides functions dedicated to creating and otherwise manipulating matrices
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
- Overload 1
- Overload 2
Example:
matrices.mat2()
rotation2()
Creates a new Matrix2 that rotates by the specified angle
Angle is given in degrees
rotation2(angle)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle | Number | - | - |
Returns:
Type | Description |
---|---|
Matrix2 | - |
Example:
matrices.rotation2(90)
scale2()
Creates a new Matrix2 that scales by the specified factors
- Overload 1
- Overload 2
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
- Overload 1
- Overload 2
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
- Overload 1
- Overload 2
Example:
matrices.rotation3(90, 90, 90)
scale3()
Creates a new Matrix3 that scales by the specified factors
- Overload 1
- Overload 2
Example:
matrices.scale3(2, 2, 2)
translate3()
Creates a new Matrix3 that translates by the specified offset
- Overload 1
- Overload 2
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:
Name | Type | Description | Default |
---|---|---|---|
angle | Number | - | - |
Returns:
Type | Description |
---|---|
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:
Name | Type | Description | Default |
---|---|---|---|
angle | Number | - | - |
Returns:
Type | Description |
---|---|
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:
Name | Type | Description | Default |
---|---|---|---|
angle | Number | - | - |
Returns:
Type | Description |
---|---|
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
- Overload 1
- Overload 2
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
- Overload 1
- Overload 2
Example:
matrices.rotation4(90, 90, 90)
scale4()
Creates a new Matrix4 that scales by the specified factors
- Overload 1
- Overload 2
Example:
matrices.scale4(2, 2, 2)
translate4()
Creates a new Matrix4 that translates by the specified offset
- Overload 1
- Overload 2
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:
Name | Type | Description | Default |
---|---|---|---|
angle | Number | - | - |
Returns:
Type | Description |
---|---|
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:
Name | Type | Description | Default |
---|---|---|---|
angle | Number | - | - |
Returns:
Type | Description |
---|---|
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:
Name | Type | Description | Default |
---|---|---|---|
angle | Number | - | - |
Returns:
Type | Description |
---|---|
Matrix4 | - |
Example:
matrices.zRotation4(90)