This page has been translated automatically.
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
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.

Unigine::dmat4 Struct

Header:#include <UnigineMathLib.h>

This class represents a matrix of twelve (3x4) double components.

dmat4 Class

Members


dmat4(const dvec3 & col0, const dvec3 & col1, const dvec3 & col2, const dvec3 & col3)

Constructor. Initializes the matrix using given three dvec3 vectors.
Output
Resulting matrix: 
    | col0.x  	 col1.x	  	col2.x	   col3.x | 
M=  | col0.y   	 col1.y	  	col2.y     col3.y |
    | col0.z   	 col1.z	  	col2.z     col3.z |

Arguments

  • const dvec3 & col0 - Source vector for the first column.
  • const dvec3 & col1 - Source vector for the second column.
  • const dvec3 & col2 - Source vector for the third column.
  • const dvec3 & col3 - Source vector for the fourth column.

dmat4(const quat & q, const dvec3 & v)

Constructor. Initializes the matrix using a given quaternion and a dvec3 vector.

Arguments

  • const quat & q - Source quaternion.
  • const dvec3 & v - Source vector.

dmat4(const mat3 & m, const dvec3 & v)

Constructor. Initializes the matrix using a given source mat3 matrix (3x3) and a dvec3 vector.

Arguments

  • const mat3 & m - Source matrix (3x3).
  • const dvec3 & v - Source vector.

dmat4(const float * m, int transpose)

Constructor. Initializes the matrix using a given pointer to the source matrix.

Arguments

  • const float * m - Pointer to the source matrix.
  • int transpose - If transpose is 0 (by default), the matrix is specified in the column major style.

dmat4(const double * m, int transpose)

Constructor. Initializes the matrix using a given pointer to the source matrix.

Arguments

  • const double * m - Pointer to the source matrix.
  • int transpose - If transpose is 0 (by default), the matrix is specified in the column major style.

dmat4(const mat3 & m)

Constructor. Initializes the matrix using a given mat3 source matrix (3x3). The matrix elements are filled using corresponding elements of the source matrix.
Output
Resulting matrix: 
    | m00  	 m01  	 m02	  0.0f | 
M=  | m10    m11  	 m12      0.0f |
    | m20    m21     m22      0.0f |

Arguments

  • const mat3 & m - Source matrix (3x3).

dmat4(const mat2 & m)

Constructor. Initializes the matrix using a given mat2 source matrix (2x2). The matrix elements are filled using corresponding elements of the source matrix.
Output
Resulting matrix: 
    | m00  	 m01  	 0.0f	  0.0f | 
M=  | m10    m11  	 0.0f     0.0f |
    | 0.0f   0.0f    1.0f     0.0f |

Arguments

  • const mat2 & m - Source matrix (2x2).

dmat4(double v)

Constructor. Initializes the matrix using a given scalar value.
Source code (UnigineScript)
dmat4(2.0);
						
/* Creates a matrix						
| 2.0 	2.0 	2.0		2.0	|
| 2.0 	2.0 	2.0		2.0	|
| 2.0 	2.0 	2.0		2.0	|
*/

Arguments

  • double v - Scalar value.

dmat4(const dmat4 & m)

Constructor. Initializes the matrix by copying a given source matrix.

Arguments

  • const dmat4 & m - Source matrix.

dmat4()

Default constructor. Produces an identity matrix.

explicit dmat4(const mat4 & m)

Constructor. Initializes the matrix using a given source mat4 matrix (4x4). The matrix elements are filled using corresponding elements of the source matrix.

Arguments

  • const mat4 & m - Source matrix (4x4).

explicit dmat4(const quat & q)

Constructor. Initializes the matrix using a given source quaternion.

Arguments

  • const quat & q - Source quaternion.

void set(int row, int column, double v)

Sets a new value of the matrix element specified by row and column.

Arguments

  • int row - Row.
  • int column - Column.
  • double v - The value to be set.

void set(const float * v, int transpose)

Sets new matrix values using a pointer to the source matrix.

Arguments

  • const float * v - Pointer to the source matrix.
  • int transpose - If transpose is 0 (by default), the matrix is specified in the column major style.

void set(const mat2 & m)

Sets new matrix values using a given mat2 source matrix (2x2). The matrix elements are filled using corresponding elements of the source matrix.

Arguments

  • const mat2 & m - Source matrix (2x2).

void set(const mat3 & m)

Sets new matrix values using a given mat3 source matrix (3x3). The matrix elements are filled using corresponding elements of the source matrix.

Arguments

  • const mat3 & m - Source matrix (3x3).

void set(const quat & q, const dvec3 & v)

Sets new matrix values using a given quaternion and a dvec3 vector.

Arguments

  • const quat & q - Source quaternion.
  • const dvec3 & v - Source vector.

void set(const quat & q)

Sets new matrix values using a given source quaternion.

Arguments

  • const quat & q - Source quaternion.

void set(const mat4 & m)

Sets new matrix values using a given mat4 source matrix (4x4). The matrix elements are filled using corresponding elements of the source matrix.

Arguments

  • const mat4 & m - Source matrix (4x4).

void set(const double * v, int transpose)

Sets new matrix values using a pointer to the source matrix.

Arguments

  • const double * v - Pointer to the source matrix.
  • int transpose - If transpose is 0 (by default), the matrix is specified in the column major style.

void set(const dmat4 & m)

Sets the matrix equal to the specified source matrix.

Arguments

  • const dmat4 & m - Source matrix.

void set(const mat3 & m, const dvec3 & v)

Sets new matrix values using a given source mat3 matrix (3x3) and a dvec3 vector.

Arguments

  • const mat3 & m - Source matrix (3x3).
  • const dvec3 & v - Source vector.

double & get(int row, int column)

Returns the reference to the matrix element specified by given row and column.

Arguments

  • int row - Row.
  • int column - Column.

Return value

Matrix element reference.

double get(int row, int column) const

Returns the value of the matrix element specified by given row and column.

Arguments

  • int row - Row.
  • int column - Column.

Return value

Matrix element value.

double * get()

Returns the pointer to the matrix.

Return value

Pointer to the matrix.

const double * get() const

Returns the constant pointer to the matrix.

Return value

Constant pointer to the matrix.

void get(double * m, int transpose)

Fills the destination matrix, specified by the given pointer, with matrix values.

Arguments

  • double * m - Destination matrix pointer.
  • int transpose - If transpose is 0 (by default), the matrix is specified in the column major style.

dvec3 getBack()

Returns the 'backward' vector (positive Y) of the matrix.

Return value

'Backward' vector of the matrix.

void setColumn(int column, const dvec4 & v)

Sets the specified column of the matrix using a given dvec4 vector as a source.

Arguments

  • int column - Column.
  • const dvec4 & v - Source vector.

dvec4 getColumn(int column) const

Returns the specified matrix column.

Arguments

  • int column - Column.

Return value

The dvec4 vector with column values.

void setColumn3(int column, const dvec3 & v)

Sets the specified column of the matrix using a given three-component dvec3 vector as a source.

Arguments

  • int column - Column.
  • const dvec3 & v - Three-component source vector.

dvec3 getColumn3(int column) const

Returns the specified matrix column.

Arguments

  • int column - Column.

Return value

The dvec3 vector with column values.

dvec3 getDown()

Returns the 'down' vector (negative Z) of the matrix.

Return value

'Down' vector of the matrix.

dvec3 getForward()

Returns the 'forward' vector (negative Y) of the matrix.

Return value

'Forward' vector of the matrix.

void setIdentity()

Sets the matrix equal to the identity matrix.

dvec3 getLeft()

Returns the 'left' vector (positive X) of the matrix.

Return value

'Left' vector of the matrix.

dvec3 getRight()

Returns the 'right' vector (negative X) of the matrix.

Return value

'Right' vector of the matrix.

void setRotate(const dvec3 & axis, double angle)

Sets the rotation matrix for a given axis.

Arguments

  • const dvec3 & axis - Rotation axis.
  • double angle - Rotation angle, in degrees.

quat getRotate() const

Returns the quaternion, representing the rotation part of the matrix.

Return value

Matrix rotation part.

void setRotateX(double angle)

Sets X rotation matrix.

Arguments

  • double angle - Rotation angle, in degrees.

void setRotateY(double angle)

Sets Y rotation matrix.

Arguments

  • double angle - Rotation angle, in degrees.

void setRotateZ(double angle)

Sets Z rotation matrix.

Arguments

  • double angle - Rotation angle, in degrees.

void setRow(int row, const dvec4 & v)

Sets the specified row of the matrix using a given dvec4 vector as a source.

Arguments

  • int row - Row.
  • const dvec4 & v - Source vector.

dvec4 getRow(int row) const

Returns the specified matrix row.

Arguments

  • int row - Row.

Return value

The dvec4 vector with row values.

void setRow3(int row, const dvec3 & v)

Sets the specified row of the matrix using a given three-component dvec3 vector as a source, the last element of the row remains as is.

Arguments

  • int row - Row.
  • const dvec3 & v - Three-component source vector.

dvec3 getRow3(int row) const

Returns the first three elements of the specified matrix row.

Arguments

  • int row - Row.

Return value

The dvec3 vector with the first three elements of the specified matrix row.

void setScale(const dvec3 & v)

Fills the scaling matrix using a given dvec3 source vector.
Output
Scaling matrix: 
    | v.x   	0.0f  	  0.0f	    0.0f | 
S=  | 0.0f      v.y  	  0.0f      0.0f |
    | 0.0f      0.0f      v.z  		0.0f |

Arguments

  • const dvec3 & v - Source vector.

vec3 getScale() const

Returns the three-component vec3 vector, representing the scaling part of the matrix.

Return value

Three-component vector with the scaling part of the matrix.

void setTranslate(const dvec3 & v)

Fills the translation matrix using a given dvec3 source vector.
Output
Translation matrix: 
    | 1.0f   	0.0f  	  0.0f	    v.x | 
T=  | 0.0f      1.0f  	  0.0f      v.y |
    | 0.0f      0.0f      1.0f  	v.z |

Arguments

  • const dvec3 & v - Source vector.

dvec3 getTranslate() const

Returns the three-component vec3 vector, representing the translation part of the matrix.

Return value

Three-component vector with the translation part of the matrix.

dvec3 getUp()

Returns the 'up' vector (positive Z) of the matrix.

Return value

'Up' vector (positive Z) of the matrix.

void setZero()

Sets all matrix elements equal to 0.

const double * operator const double *()

Performs type conversion to const double *.

const void * operator const void *()

Performs type conversion to const void *.

double * operator double *()

Performs type conversion to double *.

void * operator void *()

Performs type conversion to void *.

dmat4 & operator*=(const dmat4 & m)

Performs matrix multiplication.

Arguments

  • const dmat4 & m - Matrix.

Return value

Resulting matrix.

dmat4 & operator*=(double v)

Performs scalar multiplication.

Arguments

  • double v - Scalar value.

Return value

Resulting matrix.

dmat4 & operator+=(const dmat4 & m)

Performs matrix addition.

Arguments

  • const dmat4 & m - Matrix.

Return value

Resulting matrix.

dmat4 operator-()

Performs matrix negation.

Return value

Resulting matrix.

dmat4 & operator-=(const dmat4 & m)

Performs matrix subtraction.

Arguments

  • const dmat4 & m - Matrix.

Return value

Resulting matrix.

dmat4 & operator=(const dmat4 & m)

Performs matrix assignment. Destination matrix = Source matrix.

Arguments

  • const dmat4 & m - Source matrix.

Return value

Result.

double & operator[](int i)

Performs array access to the matrix item reference using given item index.

Arguments

  • int i - Matrix item index.

Return value

Matrix item reference.

double operator[](int i) const

Performs array access to the matrix item using given item index.

Arguments

  • int i - Matrix item index.

Return value

Matrix item.

__m128d sse0()

Returns the values of matrix elements m00, m10 as a 128-bit variable.
Notice
We do not recommend to use this method unless you have a clear understanding of SSE2.

Return value

128-bit variable containing the following matrix elements: m00, m10.

void sse0(const __m128d & v)

Sets the values of matrix elements m00, m10 using a given 128-bit variable.
Notice
We do not recommend to use this method unless you have a clear understanding of SSE2.

Arguments

  • const __m128d & v - 128-bit variable containing the following matrix elements: m00, m10.

void sse1(const __m128d & v)

Sets the values of matrix elements m20, m01 using a given 128-bit variable.
Notice
We do not recommend to use this method unless you have a clear understanding of SSE2.

Arguments

  • const __m128d & v - 128-bit variable containing the following matrix elements: m20, m01.

__m128d sse1()

Returns the values of matrix elements m20, m01 as a 128-bit variable.
Notice
We do not recommend to use this method unless you have a clear understanding of SSE2.

Return value

128-bit variable containing the following matrix elements: m20, m01.

void sse2(const __m128d & v)

Sets the values of matrix elements m11, m21 using a given 128-bit variable.
Notice
We do not recommend to use this method unless you have a clear understanding of SSE2.

Arguments

  • const __m128d & v - 128-bit variable containing the following matrix elements: m11, m21.

__m128d sse2()

Returns the values of matrix elements m11, m21 as a 128-bit variable.
Notice
We do not recommend to use this method unless you have a clear understanding of SSE2.

Return value

128-bit variable containing the following matrix elements: m11, m21.

void sse3(const __m128d & v)

Sets the values of matrix elements m02, m12 using a given 128-bit variable.
Notice
We do not recommend to use this method unless you have a clear understanding of SSE2.

Arguments

  • const __m128d & v - 128-bit variable containing the following matrix elements: m02, m12.

__m128d sse3()

Returns the values of matrix elements m02, m12 as a 128-bit variable.
Notice
We do not recommend to use this method unless you have a clear understanding of SSE2.

Return value

128-bit variable containing the following matrix elements: m02, m12.

void sse4(const __m128d & v)

Sets the values of matrix elements m22, m03 using a given 128-bit variable.
Notice
We do not recommend to use this method unless you have a clear understanding of SSE2.

Arguments

  • const __m128d & v - 128-bit variable containing the following matrix elements: m22, m03.

__m128d sse4()

Returns the values of matrix elements m22, m03 as a 128-bit variable.
Notice
We do not recommend to use this method unless you have a clear understanding of SSE2.

Return value

128-bit variable containing the following matrix elements: m22, m03.

__m128d sse5()

Returns the values of matrix elements m13, m23 as a 128-bit variable.
Notice
We do not recommend to use this method unless you have a clear understanding of SSE2.

Return value

128-bit variable containing the following matrix elements: m13, m23.

void sse5(const __m128d & v)

Sets the values of matrix elements m13, m23 using a given 128-bit variable.
Notice
We do not recommend to use this method unless you have a clear understanding of SSE2.

Arguments

  • const __m128d & v - 128-bit variable containing the following matrix elements: m13, m23.

dmat4 IDENTITY

Description

Identity matrix.

dmat4 ONE

Description

Matrix of ones.

dmat4 ZERO

Description

Zero matrix.
Last update: 2017-10-20
Build: ()