Unigine.dmat4 Struct
This class represents a matrix of twelve (3x4) double components.
dmat4 Class
Members
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.
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 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.void setIdentity()
Sets the matrix equal to the identity 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.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.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.dmat4 & operator*=(const dmat4 & m)
Performs matrix multiplication.Arguments
- const dmat4 & m - Matrix.
Return value
Resulting matrix.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.dmat4 IDENTITY
Description
Identity matrix.dmat4 ONE
Description
Matrix of ones.dmat4 ZERO
Description
Zero matrix.Last update: 2018-08-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)