This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Math Matrix Functions

This class represents a collection of matrix functions.

Notice
Math matrix functions are the members of the Unigine.MathLib namespace.

int AXIS_X

Description

Y axis.

int AXIS_Y

Description

Y axis.

int AXIS_Z

Description

Z axis.

int AXIS_NX

Description

Negative X axis.

int AXIS_NY

Description

Negative Y axis.

int AXIS_NZ

Description

Negative Z axis.

mat4 composeRotationXYZ ( vec3 r ) #

Composes a rotation matrix from the corresponding Euler angles. The Euler angles are specified in the axis rotation sequence - XYZ. It is an order of the rings in the three-axis gimbal set: X axis used as the outer ring (independent ring), while Z axis as the inner one (its rotation depends on other 2 rings).

When we talk about axes in UNIGINE we assume that:

  • X axis points to the right giving us a pitch angle.
  • Y axis points forward giving us a roll angle.
  • Z axis points up giving us a yaw (heading) angle.
Notice
Players have a different coordinate system:
  • X axis points to the right giving us a pitch angle.
  • Y axis points up giving us a yaw (heading) angle.
  • Z axis points backward giving us a -roll angle.

Arguments

  • vec3 r - Vector, containing Euler angles, in degrees - (yaw, roll, pitch).

Return value

Composed rotation matrix.

mat4 composeRotationXZY ( vec3 r ) #

Composes a rotation matrix from the corresponding Euler angles. The Euler angles are specified in the axis rotation sequence - XZY. It is an order of the rings in the three-axis gimbal set: X axis used as the outer ring (independent ring), while Y axis as the inner one (its rotation depends on other 2 rings).

When we talk about axes in UNIGINE we assume that:

  • X axis points to the right giving us a pitch angle.
  • Y axis points forward giving us a roll angle.
  • Z axis points up giving us a yaw (heading) angle.
Notice
Players have a different coordinate system:
  • X axis points to the right giving us a pitch angle.
  • Y axis points up giving us a yaw (heading) angle.
  • Z axis points backward giving us a -roll angle.

Arguments

  • vec3 r - Vector, containing Euler angles, in degrees - (yaw, roll, pitch).

Return value

Composed rotation matrix.

mat4 composeRotationYXZ ( vec3 r ) #

Composes a rotation matrix from the corresponding Euler angles. The Euler angles are specified in the axis rotation sequence - YXZ. It is an order of the rings in the three-axis gimbal set: Y axis used as the outer ring (independent ring), while Z axis as the inner one (its rotation depends on other 2 rings).

When we talk about axes in UNIGINE we assume that:

  • X axis points to the right giving us a pitch angle.
  • Y axis points forward giving us a roll angle.
  • Z axis points up giving us a yaw (heading) angle.
Notice
Players have a different coordinate system:
  • X axis points to the right giving us a pitch angle.
  • Y axis points up giving us a yaw (heading) angle.
  • Z axis points backward giving us a -roll angle.

Arguments

  • vec3 r - Vector, containing Euler angles, in degrees - (yaw, roll, pitch).

Return value

Composed rotation matrix.

mat4 composeRotationYZX ( vec3 r ) #

Composes a rotation matrix from the corresponding Euler angles. The Euler angles are specified in the axis rotation sequence - YZX. It is an order of the rings in the three-axis gimbal set: Y axis used as the outer ring (independent ring), while X axis as the inner one (its rotation depends on other 2 rings).

When we talk about axes in UNIGINE we assume that:

  • X axis points to the right giving us a pitch angle.
  • Y axis points forward giving us a roll angle.
  • Z axis points up giving us a yaw (heading) angle.
Notice
Players have a different coordinate system:
  • X axis points to the right giving us a pitch angle.
  • Y axis points up giving us a yaw (heading) angle.
  • Z axis points backward giving us a -roll angle.

Arguments

  • vec3 r - Vector, containing Euler angles, in degrees - (yaw, roll, pitch).

Return value

Composed rotation matrix.

mat4 composeRotationZXY ( vec3 r ) #

Composes a rotation matrix from the corresponding Euler angles. The Euler angles are specified in the axis rotation sequence - ZXY. It is an order of the rings in the three-axis gimbal set: Z axis used as the outer ring (independent ring), while Y axis as the inner one (its rotation depends on other 2 rings).

When we talk about axes in UNIGINE we assume that:

  • X axis points to the right giving us a pitch angle.
  • Y axis points forward giving us a roll angle.
  • Z axis points up giving us a yaw (heading) angle.
Notice
Players have a different coordinate system:
  • X axis points to the right giving us a pitch angle.
  • Y axis points up giving us a yaw (heading) angle.
  • Z axis points backward giving us a -roll angle.

Arguments

  • vec3 r - Vector, containing Euler angles, in degrees - (yaw, roll, pitch).

Return value

Composed rotation matrix.

mat4 composeRotationZYX ( vec3 r ) #

Composes a rotation matrix from the corresponding Euler angles. The Euler angles are specified in the axis rotation sequence - ZYX. It is an order of the rings in the three-axis gimbal set: Z axis used as the outer ring (independent ring), while X axis as the inner one (its rotation depends on other 2 rings).

When we talk about axes in UNIGINE we assume that:

  • X axis points to the right giving us a pitch angle.
  • Y axis points forward giving us a roll angle.
  • Z axis points up giving us a yaw (heading) angle.
Notice
Players have a different coordinate system:
  • X axis points to the right giving us a pitch angle.
  • Y axis points up giving us a yaw (heading) angle.
  • Z axis points backward giving us a -roll angle.

Arguments

  • vec3 r - Vector, containing Euler angles, in degrees - (yaw, roll, pitch).

Return value

Composed rotation matrix.

void composeTransform ( out mat4 ret, vec4 position, quat rot ) #

Returns the transformation matrix for the specified position and rotation.

Arguments

  • out mat4 ret - Output matrix, to which the resulting transformation matrix will be put.
  • vec4 position
  • quat rot - Rotation quaternion.

Return value

void composeTransform ( out mat4 ret, vec3 position, quat rot, vec3 scale ) #

Returns the transformation matrix for the specified position, rotation and scale. For more information see Matrix Transformations.

Arguments

  • out mat4 ret - Output matrix, to which the resulting transformation matrix will be put.
  • vec3 position - Position coordinates (world).
  • quat rot - Rotation quaternion.
  • vec3 scale - Scaling vector (scale.x, scale.y, scale.z).

Return value

void composeTransform ( out dmat4 ret, dvec3 position, quat rot, vec3 scale ) #

Returns the transformation matrix for the specified position, rotation and scale. For more information see Matrix Transformations.

Arguments

  • out dmat4 ret - Output matrix, to which the resulting transformation matrix will be put.
  • dvec3 position
  • quat rot - Rotation quaternion.
  • vec3 scale - Scaling vector (scale.x, scale.y, scale.z).

Return value

void composeTransform ( out mat4 ret, quat q0, quat q1, vec3 scale ) #

Returns the transformation matrix for the specified position, rotation and scale. For more information see Matrix Transformations.

Arguments

  • out mat4 ret - Output matrix, to which the resulting transformation matrix will be put.
  • quat q0
  • quat q1
  • vec3 scale - Scaling vector (scale.x, scale.y, scale.z).

Return value

mat4 cubeTransform ( int face ) #

Returns cube viewing matrix for the given cube face.

Arguments

  • int face - Cube face number.

Return value

Cube viewing matrix.

void decomposeProjection ( mat4 projection, out float znear, out float zfar ) #

Decomposes a given projection matrix, extracting distances to near and far clipping planes.

Arguments

  • mat4 projection - Projection matrix.
  • out float znear - Near clipping plane.
  • out float zfar - Far clipping plane.

vec3 decomposeRotationXYZ ( mat3 t ) #

Decomposes a given rotation matrix to the corresponding Euler angles. The Euler angles are specified in the axis rotation sequence - XYZ. It is an order of the rings in the three-axis gimbal set: X axis used as the outer ring (independent ring), while Z axis as the inner one (its rotation depends on other 2 rings).

When we talk about axes in UNIGINE we assume that:

  • X axis points to the right giving us a pitch angle.
  • Y axis points forward giving us a roll angle.
  • Z axis points up giving us a yaw (heading) angle.
Notice
Players have a different coordinate system:
  • X axis points to the right giving us a pitch angle.
  • Y axis points up giving us a yaw (heading) angle.
  • Z axis points backward giving us a -roll angle.

Arguments

  • mat3 t - Rotation matrix to decompose.

Return value

Vector, containing Euler angles, in degrees - (pitch, roll, yaw).

vec3 decomposeRotationXZY ( mat3 t ) #

Decomposes a given rotation matrix to the corresponding Euler angles. The Euler angles are specified in the axis rotation sequence - XZY. It is an order of the rings in the three-axis gimbal set: X axis used as the outer ring (independent ring), while Y axis as the inner one (its rotation depends on other 2 rings).

When we talk about axes in UNIGINE we assume that:

  • X axis points to the right giving us a pitch angle.
  • Y axis points forward giving us a roll angle.
  • Z axis points up giving us a yaw (heading) angle.
Notice
Players have a different coordinate system:
  • X axis points to the right giving us a pitch angle.
  • Y axis points up giving us a yaw (heading) angle.
  • Z axis points backward giving us a -roll angle.

Arguments

  • mat3 t - Rotation matrix to decompose.

Return value

Vector, containing Euler angles, in degrees - (pitch, yaw, roll).

vec3 decomposeRotationYXZ ( mat3 t ) #

Decomposes a given rotation matrix to the corresponding Euler angles. The Euler angles are specified in the axis rotation sequence - YXZ. It is an order of the rings in the three-axis gimbal set: Y axis used as the outer ring (independent ring), while Z axis as the inner one (its rotation depends on other 2 rings).

When we talk about axes in UNIGINE we assume that:

  • X axis points to the right giving us a pitch angle.
  • Y axis points forward giving us a roll angle.
  • Z axis points up giving us a yaw (heading) angle.
Notice
Players have a different coordinate system:
  • X axis points to the right giving us a pitch angle.
  • Y axis points up giving us a yaw (heading) angle.
  • Z axis points backward giving us a -roll angle.

Arguments

  • mat3 t - Rotation matrix to decompose.

Return value

Vector, containing Euler angles, in degrees - (roll, pitch, yaw).

vec3 decomposeRotationYZX ( mat3 t ) #

Decomposes a given rotation matrix to the corresponding Euler angles. The Euler angles are specified in the axis rotation sequence - YZX. It is an order of the rings in the three-axis gimbal set: Y axis used as the outer ring (independent ring), while X axis as the inner one (its rotation depends on other 2 rings).

When we talk about axes in UNIGINE we assume that:

  • X axis points to the right giving us a pitch angle.
  • Y axis points forward giving us a roll angle.
  • Z axis points up giving us a yaw (heading) angle.
Notice
Players have a different coordinate system:
  • X axis points to the right giving us a pitch angle.
  • Y axis points up giving us a yaw (heading) angle.
  • Z axis points backward giving us a -roll angle.

Arguments

  • mat3 t - Rotation matrix to decompose.

Return value

Vector, containing Euler angles, in degrees - (roll, yaw, pitch).

vec3 decomposeRotationZXY ( mat3 t ) #

Decomposes a given rotation matrix to the corresponding Euler angles. The Euler angles are specified in the axis rotation sequence - ZXY. It is an order of the rings in the three-axis gimbal set: Z axis used as the outer ring (independent ring), while Y axis as the inner one (its rotation depends on other 2 rings).

When we talk about axes in UNIGINE we assume that:

  • X axis points to the right giving us a pitch angle.
  • Y axis points forward giving us a roll angle.
  • Z axis points up giving us a yaw (heading) angle.
Notice
Players have a different coordinate system:
  • X axis points to the right giving us a pitch angle.
  • Y axis points up giving us a yaw (heading) angle.
  • Z axis points backward giving us a -roll angle.

Arguments

  • mat3 t - Rotation matrix to decompose.

Return value

Vector, containing Euler angles, in degrees - (yaw, pitch, roll).

vec3 decomposeRotationZYX ( mat3 t ) #

Decomposes a given rotation matrix to the corresponding Euler angles. The Euler angles are specified in the axis rotation sequence - ZYX. It is an order of the rings in the three-axis gimbal set: Z axis used as the outer ring (independent ring), while X axis as the inner one (its rotation depends on other 2 rings).

When we talk about axes in UNIGINE we assume that:

  • X axis points to the right giving us a pitch angle.
  • Y axis points forward giving us a roll angle.
  • Z axis points up giving us a yaw (heading) angle.
Notice
Players have a different coordinate system:
  • X axis points to the right giving us a pitch angle.
  • Y axis points up giving us a yaw (heading) angle.
  • Z axis points backward giving us a -roll angle.

Arguments

  • mat3 t - Rotation matrix to decompose.

Return value

Vector, containing Euler angles, in degrees - (yaw, roll, pitch).

void decomposeTransform ( mat4 m, out vec4 position, out quat rot ) #

Decomposes a given transformation matrix into a vector representing translation and uniform scale and a quaternion representing rotation.

Arguments

  • mat4 m - Transformation matrix to decompose.
  • out vec4 position - Output vector (X, Y, Z, W), to which translation and scale components of the transformation will be put. (X, Y, Z) - represent translation, W = (scale.X + scale.Y + scale.z) / 3.
  • out quat rot - Output quaternion, to which the rotation component of the transformation will pe put.

void decomposeTransform ( mat4 m, out vec3 position, out quat rot, out vec3 scale ) #

Decomposes a given transformation matrix into translation, rotation and scale components.

Arguments

  • mat4 m - Transformation matrix to decompose.
  • out vec3 position - Output vector, to which the translation component of the transformation will be put.
  • out quat rot - Output quaternion, to which the rotation component of the transformation will be put.
  • out vec3 scale - Output vector, to which the scale component of the transformation will be put.

void decomposeTransform ( dmat4 m, out dvec3 position, out quat rot, out vec3 scale ) #

Decomposes a given transformation matrix into translation, rotation and scale components.

Arguments

  • dmat4 m - Transformation matrix to decompose.
  • out dvec3 position - Output vector, to which the translation component of the transformation will be put.
  • out quat rot - Output quaternion, to which the rotation component of the transformation will be put.
  • out vec3 scale - Output vector, to which the scale component of the transformation will be put.

void decomposeTransform ( mat4 m, out quat q0, out quat q1, out vec3 scale ) #

Decomposes a given transformation matrix into a dual quaternion (representing both translation and rotation) and a scale vector. The dual-quaternion model is an accurate, computationally efficient, robust, and flexible method of representing rigid transforms and it is used in skeletal animation. See a Wikipedia article on dual quaternions and a beginners guide to dual-quaternions for more information.

Arguments

  • mat4 m - Transformation matrix to decompose.
  • out quat q0 - Quaternion representing a real part of the dual quaternion.
  • out quat q1 - Quaternion representing a dual part of the dual quaternion.
  • out vec3 scale - Scale part of the transformation.

float determinant ( mat3 m ) #

Returns the determinant of the given matrix.

Arguments

  • mat3 m - Matrix, for which the determinant is to be calculated.

Return value

Matrix determinant.

float determinant ( mat4 m ) #

Returns the determinant of the given matrix.

Arguments

  • mat4 m - Matrix, for which the determinant is to be calculated.

Return value

Matrix determinant.

double determinant ( dmat4 m ) #

Returns the determinant of the given matrix.

Arguments

  • dmat4 m - Matrix, for which the determinant is to be calculated.

Return value

Matrix determinant.

mat4 frustum ( float left, float right, float bottom, float top, float znear, float zfar ) #

Returns perspective projection matrix:
2.0 * znear / (right - left) 0.0 (right + left) / (right - left) 0.0
0.0 2.0 * znear / (top - bottom) (top + bottom) / (top - bottom) 0.0
0.0 0.0 -(zfar + znear) / (zfar - znear) -2.0 * zfar * znear / (zfar - znear)
0.0 0.0 -1.0 0.0

Coordinates of top, left, right, bottom are set relatively to center point of the znear plane.

There are two different points (A and B) on the picture above. Since the top, left, right, bottom are coordinates relatively to the center point of the znear plane, coordinates of the A point should be A(left, bottom, znear). Coordinates of the B point are B(k * left, k * bottom, zfar), where k = zfar/znear.

Arguments

  • float left - Left coordinate of the near clipping plane relatively to the center.
  • float right - Right coordinate of the near clipping plane relatively to the center.
  • float bottom - Bottom coordinate of the near clipping plane relatively to the center.
  • float top - Top coordinate of the near clipping plane relatively to the center.
  • float znear - Distance to the near depth clipping plane.
  • float zfar - Distance to the farther depth clipping plane.

Return value

Perspective projection matrix.

mat3 inverse ( mat3 m ) #

Returns inverse of a matrix. The inverse of a matrix is a matrix that if multiplied by the original would result in identity matrix: AA -1 = A -1A = I.

Arguments

  • mat3 m - Matrix to be inverted.

Return value

Inverse of the matrix.

dmat4 inverse ( dmat4 m ) #

Returns inverse of a matrix. The inverse of a matrix is a matrix that if multiplied by the original would result in identity matrix: AA -1 = A -1A = I.

Arguments

  • dmat4 m - Matrix to be inverted.

Return value

Inverse of the matrix.

mat4 inverse ( mat4 m ) #

Returns inverse of a matrix. The inverse of a matrix is a matrix that if multiplied by the original would result in identity matrix: AA -1 = A -1A = I.

Arguments

  • mat4 m - Matrix to be inverted.

Return value

Inverse of the matrix.

quat inverse ( quat q ) #

Returns inverse of a quaternion. The inverse of a quaternion is a quaternion that if multiplied by the original would result in identity matrix: qq -1 = 1. If q = a + bi + cj + dk, then q-1 = a - bi - cj - dk

Arguments

  • quat q - Quaternion to be inverted.

Return value

Inverse of the quaternion.

mat4 inverse4 ( mat4 m ) #

Inverts a matrix that consists of a 3×4 sub-matrix (upper left) and a translation vector. The last row of the matrix is ignored. Compared to the inverse() function, this one is a bit faster and, which is more important, more stable. A matrix suitable for such inversion looks like this:
m00 m10 m20 m30
m01 m11 m21 m31
m02 m12 m22 m32
0 0 0 1
Notice
The function does the same as inverse (const dmat4 & m)

Arguments

  • mat4 m - Matrix to be inverted.

Return value

Inverse of the matrix.

mat3 jacobi ( mat3 m, out mat3 v ) #

Returns the Jacobian matrix for the given 3x3 matrix.

Arguments

  • mat3 m - Matrix, for which the Jacobian matrix is to be calculated.
  • out mat3 v - Output matrix, to which the calculated Jacobian matrix will be put.

Return value

Jacobian matrix.

mat4 lookAt ( vec3 position, vec3 target, vec3 up, int axis = AXIS_NZ ) #

Returns the viewing matrix for the given eye point, target point, up and forward direction vectors. The forward direction vector is pointed along the specified axis. By default, it is negative Z.

Arguments

  • vec3 position - Position coordinates of the eye point.
  • vec3 target - Position of the target point.
  • vec3 up - Direction of the up vector.
  • int axis - Axis along which the forward direction vector is pointed. The default is negative Z.

Return value

The viewing matrix.

dmat4 lookAt ( dvec3 position, dvec3 target, vec3 up, int axis = AXIS_NZ ) #

Returns the viewing matrix for the given eye point, target point, up and forward direction vectors. The forward direction vector is pointed along the specified axis. By default, it is negative Z.

Arguments

  • dvec3 position - Position coordinates of the eye point.
  • dvec3 target - Position coordinates of the target point.
  • vec3 up - Direction of the up vector.
  • int axis - Axis along which the forward direction vector is pointed. The default is negative Z.

Return value

The viewing matrix.

mat4 obliqueProjection ( mat4 projection, vec4 plane ) #

Returns the oblique projection matrix.

Arguments

  • mat4 projection - Projection matrix.
  • vec4 plane - Clipping plane coordinates.

Return value

Oblique projection matrix.

mat4 ortho ( float left, float right, float bottom, float top, float znear, float zfar ) #

Returns parallel projection matrix:
2.0 / (right - left) 0.0 0.0 -(right + left) / (right - left)
0.0 2.0 / (top - bottom) 0.0 -(top + bottom) / (top - bottom)
0.0 0.0 -2.0 / (zfar - znear) -(zfar + znear) / (zfar - znear)
0.0 0.0 0.0 1.0

Arguments

  • float left - Left vertical clipping plane.
  • float right - Right vertical clipping plane.
  • float bottom - Bottom horizontal clipping plane.
  • float top - Top horizontal clipping plane.
  • float znear - Nearest depth clipping plane.
  • float zfar - Farther depth clipping plane.

Return value

Parallel projection matrix.

mat3 orthonormalize ( mat3 m ) #

Orthonormalizes a matrix.

Arguments

  • mat3 m - Matrix to be orthonormalized.

Return value

Orthonormal matrix.

mat4 orthonormalize ( mat4 m ) #

Orthonormalizes a matrix.

Arguments

  • mat4 m - Matrix to be orthonormalized.

Return value

Orthonormal matrix.

dmat4 orthonormalize ( dmat4 m ) #

Orthonormalizes a matrix.

Arguments

  • dmat4 m - Matrix to be orthonormalized.

Return value

Orthonormal matrix.

void orthonormalize ( out mat3 ret, mat3 m ) #

Orthonormalizes a matrix.

Arguments

  • out mat3 ret - Output matrix, to which the orthonormalized matrix will be put.
  • mat3 m - Matrix to be orthonormalized.

Return value

void orthonormalize ( out mat4 ret, mat4 m ) #

Orthonormalizes a matrix.

Arguments

  • out mat4 ret - Output matrix, to which the orthonormalized matrix will be put.
  • mat4 m - Matrix to be orthonormalized.

Return value

void orthonormalize ( out dmat4 ret, dmat4 m ) #

Orthonormalizes a matrix.

Arguments

  • out dmat4 ret - Output matrix, to which the orthonormalized matrix will be put.
  • dmat4 m - Matrix to be orthonormalized.

Return value

mat4 perspective ( float fov, float aspect, float znear, float zfar ) #

Returns perspective projection matrix.

Arguments

  • float fov - Field of view angle.
  • float aspect - Aspect ratio. The aspect ratio is the ratio of width to height.
  • float znear - Nearest depth clipping plane.
  • float zfar - Farther depth clipping plane.

Return value

Perspective projection matrix.

mat4 reflect ( vec4 plane ) #

Returns reflection matrix about a given plane.

Arguments

  • vec4 plane - Reflection plane.

Return value

Reflection matrix.

dmat4 reflect ( dvec4 plane ) #

Returns reflection matrix about a given plane.

Arguments

  • dvec4 plane - Reflection plane.

Return value

Reflection matrix.

vec3 reflect ( vec3 v0, vec3 v1 ) #

Reflects a given vector about a plane with the specified normal vector.

Arguments

  • vec3 v0 - Vector to be reflected.
  • vec3 v1 - Normal vector to the reflection plane.

Return value

Reflected vector.

dvec3 reflect ( dvec3 v0, dvec3 v1 ) #

Reflects a given vector about a plane with the specified normal vector.

Arguments

  • dvec3 v0 - Vector to be reflected.
  • dvec3 v1 - Normal vector to the reflection plane.

Return value

Reflected vector.

void reflect ( out vec3 ret, vec3 v0, vec3 v1 ) #

Reflects a given vector about a plane with the specified normal vector.

Arguments

  • out vec3 ret - Reflected vector.Output vector, to which the reflected vector will be put.
  • vec3 v0 - Vector to be reflected.
  • vec3 v1 - Normal vector to the reflection plane.

Return value

void reflect ( out dvec3 ret, dvec3 v0, dvec3 v1 ) #

Reflects a given vector about a plane with the specified normal vector.

Arguments

  • out dvec3 ret - Output vector, to which the reflected vector will be put.
  • dvec3 v0 - Vector to be reflected.
  • dvec3 v1 - Normal vector to the reflection plane.

Return value

mat4 rotateX ( float angle ) #

Returns rotation matrix for the given angle around X axis:
1.0 0.0 0.0 0.0
0.0 cos -sin 0.0
0.0 sin cos 0.0
0.0 0.0 0.0 1.0

Arguments

  • float angle - Rotation angle, in degrees.

Return value

Rotation matrix.

dmat4 rotateX ( double angle ) #

Returns the X rotation matrix.

Arguments

  • double angle - Rotation angle, in degrees.

Return value

Rotation matrix.

mat4 rotateY ( float angle ) #

Returns rotation matrix for the given angle around Y axis:
cos 0.0 sin 0.0
0.0 1.0 0.0 0.0
-sin 0.0 cos 0.0
0.0 0.0 0.0 1.0

Arguments

  • float angle - Rotation angle, in degrees.

Return value

Rotation matrix.

dmat4 rotateY ( double angle ) #

Returns the Y rotation matrix.

Arguments

  • double angle - Rotation angle, in degrees.

Return value

Rotation matrix.

mat4 rotateZ ( float angle ) #

Returns rotation matrix for the given angle around Z axis:
cos -sin 0.0 0.0
sin cos 0.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0

Arguments

  • float angle - Rotation angle, in degrees.

Return value

Rotation matrix.

dmat4 rotateZ ( double angle ) #

Returns the Z rotation matrix.

Arguments

  • double angle - Rotation angle, in degrees.

Return value

Rotation matrix.

dmat4 rotate ( double x, double y, double z, double angle ) #

Returns rotation matrix for the given angle around the given axis (X, Y, Z).

Arguments

  • double x - X component of rotation axis.
  • double y - Y component of rotation axis.
  • double z - Z component of rotation axis.
  • double angle - Rotation angle, in degrees.

Return value

Rotation matrix.

mat4 rotate ( float x, float y, float z, float angle ) #

Returns rotation matrix for the given angle around the given axis (X, Y, Z).

Arguments

  • float x - X component of rotation axis.
  • float y - Y component of rotation axis.
  • float z - Z component of rotation axis.
  • float angle - Rotation angle, in degrees.

Return value

Rotation matrix.

mat4 rotate ( quat q ) #

Returns rotation matrix for the given quaternion.

Arguments

  • quat q - Rotation quaternion.

Return value

Rotation matrix.

mat4 rotate ( vec3 axis, float angle ) #

Returns rotation matrix.

Arguments

  • vec3 axis - Rotation axis. This vector does not have to be normalized.
  • float angle - Rotation angle, in degrees.

Return value

Rotation matrix.

dmat4 rotate ( dvec3 axis, double angle ) #

Returns rotation matrix for the given angle around the given axis (X, Y, Z).

Arguments

  • dvec3 axis - Rotation axis. This vector does not have to be normalized.
  • double angle - Rotation angle, in degrees.

Return value

Rotation matrix.

quat rotateTowards ( quat source, quat target, float max_angle ) #

Rotates the source quaternion towards the target quaternion by an angular step of max_angle (note, that the rotation will not overshoot).

Arguments

  • quat source - Source quaternion.
  • quat target - Target quaternion.
  • float max_angle - Angular step, in degrees. If a negative value is specified, 0 will be used instead.

Return value

Resulting quaternion.

vec3 rotateTowards ( vec3 source, vec3 target, float max_angle ) #

Rotates the source vector towards the target vector by an angular step of max_angle (note, that the rotation will not overshoot).

Arguments

  • vec3 source - Source vector.
  • vec3 target - Target vector.
  • float max_angle - Angular step, in degrees. If a negative value is specified, 0 will be used instead.

Return value

Resulting vector.

mat4 rotation ( mat4 m ) #

Returns the rotation matrix for the given source matrix ignoring the translation column. For more information see Matrix Transformations.

Arguments

  • mat4 m - Source matrix.

Return value

Rotation matrix.

dmat4 rotation ( dmat4 m ) #

Returns the rotation matrix for the given source matrix ignoring the translation column. For more information see Matrix Transformations.

Arguments

  • dmat4 m - Source matrix.

Return value

Rotation matrix.

void rotation ( out mat4 ret, mat4 m ) #

Returns the rotation matrix for the given source matrix ignoring the translation column. For more information see Matrix Transformations.

Arguments

  • out mat4 ret - Output matrix, to which the rotation matrix will be put.
  • mat4 m - Source matrix.

Return value

void rotation ( out dmat4 ret, dmat4 m ) #

Returns the rotation matrix for the given source matrix ignoring the translation column. For more information see Matrix Transformations.

Arguments

  • out dmat4 ret - Output matrix, to which the rotation matrix will be put.
  • dmat4 m - Source matrix.

Return value

mat4 scale ( float x, float y, float z ) #

Returns scaling matrix for the specified scaling vector (X, Y, Z):
X 0.0 0.0 0.0
0.0 Y 0.0 0.0
0.0 0.0 Z 0.0
0.0 0.0 0.0 1.0

Arguments

  • float x - X component of the scaling vector.
  • float y - Y component of the scaling vector.
  • float z - Z component of the scaling vector.

Return value

Scaling matrix.

dmat4 scale ( double x, double y, double z ) #

Returns scaling matrix for the specified scaling vector (X, Y, Z):
X 0.0 0.0 0.0
0.0 Y 0.0 0.0
0.0 0.0 Z 0.0
0.0 0.0 0.0 1.0

Arguments

  • double x - X component of the scaling vector.
  • double y - Y component of the scaling vector.
  • double z - Z component of the scaling vector.

Return value

Scaling matrix.

mat4 scale ( vec3 v ) #

Returns the scaling matrix for the specified scaling vector (X, Y, Z):
X 0.0 0.0 0.0
0.0 Y 0.0 0.0
0.0 0.0 Z 0.0
0.0 0.0 0.0 1.0

Arguments

  • vec3 v - Scaling vector.

Return value

Scaling matrix.

dmat4 scale ( dvec3 v ) #

Returns the scaling matrix for the specified scaling vector (X, Y, Z):
X 0.0 0.0 0.0
0.0 Y 0.0 0.0
0.0 0.0 Z 0.0
0.0 0.0 0.0 1.0

Arguments

  • dvec3 v - Scaling vector.

Return value

Scaling matrix.

dmat4 setTo ( dvec3 position, dvec3 target, vec3 up, int axis = AXIS_NZ ) #

Returns the transformation matrix, which puts an object to the specified position and sets it orientation to the specified target point. At that, the forward direction vector is pointed along the specified axis. By default, it is negative Z.

Arguments

  • dvec3 position - Position of the eye point.
  • dvec3 target - Position of the target point.
  • vec3 up - Direction of the up vector.
  • int axis - Axis along which the forward direction vector is pointed. The default is negative Z.

Return value

Transformation matrix.

mat4 setTo ( vec3 position, vec3 target, vec3 up, int axis = AXIS_NZ ) #

Returns the transformation matrix, which puts an object to the specified position and sets it orientation to the specified target point. At that, the forward direction vector is pointed along the specified axis. By default, it is negative Z.

Arguments

  • vec3 position - Position of the eye point.
  • vec3 target - Position of the target point.
  • vec3 up - Direction of the up vector.
  • int axis - Axis along which the forward direction vector is pointed. The default is negative Z.

Return value

Transformation matrix.

mat4 symmetryProjection ( mat4 projection ) #

Returns the symmetry projection matrix.

Arguments

  • mat4 projection - Projection matrix.

Return value

The symmetry projection matrix.

mat4 translate ( float x, float y, float z ) #

Returns the translation matrix for the specified translation vector (X, Y, Z):
1.0 0.0 0.0 X
0.0 1.0 0.0 Y
0.0 0.0 1.0 Z
0.0 0.0 0.0 1.0

Arguments

  • float x - X component of the translation vector.
  • float y - Y component of the translation vector.
  • float z - Z component of the translation vector.

Return value

Translation matrix.

dmat4 translate ( double x, double y, double z ) #

Returns the translation matrix for the specified translation vector (X, Y, Z):
1.0 0.0 0.0 X
0.0 1.0 0.0 Y
0.0 0.0 1.0 Z
0.0 0.0 0.0 1.0

Arguments

  • double x - X component of the translation vector.
  • double y - Y component of the translation vector.
  • double z - Z component of the translation vector.

Return value

Translation matrix.

mat4 translate ( vec3 v ) #

Returns the translation matrix for the specified translation vector (X, Y, Z):
1.0 0.0 0.0 X
0.0 1.0 0.0 Y
0.0 0.0 1.0 Z
0.0 0.0 0.0 1.0

Arguments

  • vec3 v - Translation vector.

Return value

Translation matrix.

dmat4 translate ( dvec3 v ) #

Returns the translation matrix for the specified translation vector (X, Y, Z):
1.0 0.0 0.0 X
0.0 1.0 0.0 Y
0.0 0.0 1.0 Z
0.0 0.0 0.0 1.0

Arguments

  • dvec3 v - Translation vector.

Return value

Translation matrix.

mat3 transpose ( mat3 m ) #

Transposes a given 3x3 matrix.

Arguments

  • mat3 m - Matrix to be transposed.

Return value

Transposed matrix.

void transpose ( out mat3 ret, mat3 m ) #

Transposes a given 3x3 matrix.

Arguments

  • out mat3 ret - Output matrix, to which the transposed matrix will be put.
  • mat3 m - Matrix to be transposed.

mat4 transpose ( mat4 m ) #

Transposes a given 4x4 matrix.

Arguments

  • mat4 m - Matrix to be transposed.

Return value

Transposed matrix.

transpose ( out mat4 ret, mat4 m ) #

Transposes a given 4x4 matrix.

Arguments

  • out mat4 ret - Output matrix, to which the transposed matrix will be put.
  • mat4 m - Matrix to be transposed.

Return value

Transposed matrix.

mat4 transpose3 ( mat4 m ) #

Transposes the upper left 3×3 sub-matrix of a matrix.

Arguments

  • mat4 m - Matrix, a part of which will be transposed.

Return value

Matrix, in which the upper left 3×3 sub-matrix is transposed.

void transpose3 ( ) #

Transposes the upper left 3×3 sub-matrix of a matrix.

Arguments

    Return value

    Last update: 2019-08-16
    Build: ()