qCC_db version 2.13.alpha (Qt) - 31 May 2022
CloudCompare 3D entities
Public Member Functions | List of all members
ccGLMatrixd Class Reference

Double version of ccGLMatrixTpl. More...

#include <ccGLMatrix.h>

Inheritance diagram for ccGLMatrixd:
Inheritance graph
[legend]
Collaboration diagram for ccGLMatrixd:
Collaboration graph
[legend]

Public Member Functions

 ccGLMatrixd ()
 Default constructor. More...
 
 ccGLMatrixd (const ccGLMatrixTpl< double > &mat)
 Copy constructor from a ccGLMatrixTpl. More...
 
 ccGLMatrixd (const float *mat16f)
 Constructor from a float GL matrix array. More...
 
 ccGLMatrixd (const double *mat16d)
 Constructor from a double GL matrix array. More...
 
 ccGLMatrixd (const Vector3Tpl< double > &X, const Vector3Tpl< double > &Y, const Vector3Tpl< double > &Z, const Vector3Tpl< double > &Tr)
 Constructor from 4 columns (X,Y,Z,Tr) More...
 
- Public Member Functions inherited from ccGLMatrixTpl< double >
 ccGLMatrixTpl ()
 Default constructor. More...
 
 ccGLMatrixTpl (const ccGLMatrixTpl< double > &mat)
 Copy constructor.
 
 ccGLMatrixTpl (const float *mat16f)
 Constructor from a float GL matrix array. More...
 
 ccGLMatrixTpl (const double *mat16d)
 Constructor from a double GL matrix array. More...
 
 ccGLMatrixTpl (const Vector3Tpl< double > &X, const Vector3Tpl< double > &Y, const Vector3Tpl< double > &Z, const Vector3Tpl< double > &Tr)
 Constructor from 4 columns (X,Y,Z,T) More...
 
QString toString (int precision=12, QChar separator=' ') const
 Returns matrix as a string. More...
 
virtual bool toAsciiFile (QString filename, int precision=12) const
 Saves matrix to an ASCII file. More...
 
virtual bool fromAsciiFile (QString filename)
 Loads matrix from an ASCII file. More...
 
ccGLMatrixTpl< double > xRotation () const
 Returns the rotation component around X only.
 
ccGLMatrixTpl< double > yRotation () const
 Returns the rotation component around Y only.
 
ccGLMatrixTpl< double > zRotation () const
 Returns the rotation component around Z only.
 
virtual void toZero ()
 Clears matrix. More...
 
virtual void toIdentity ()
 Sets matrix to identity.
 
void clearTranslation ()
 Clears translation. More...
 
void initFromParameters (double alpha_rad, const Vector3Tpl< double > &axis3D, const Vector3Tpl< double > &t3D)
 Inits transformation from a rotation axis, an angle and a translation. More...
 
void initFromParameters (double phi_rad, double theta_rad, double psi_rad, const Vector3Tpl< double > &t3D)
 Inits transformation from 3 rotation angles and a translation. More...
 
void getParameters (double &alpha_rad, Vector3Tpl< double > &axis3D, Vector3Tpl< double > &t3D) const
 Returns equivalent parameters: a rotation axis, an angle and a translation. More...
 
void getParameters (double &phi_rad, double &theta_rad, double &psi_rad, Vector3Tpl< double > &t3D) const
 Returns equivalent parameters: 3 rotation angles and a translation. More...
 
double * data ()
 Returns a pointer to internal data.
 
const double * data () const
 Returns a const pointer to internal data.
 
double * getTranslation ()
 Returns a pointer to internal translation. More...
 
const double * getTranslation () const
 Returns a const pointer to internal translation. More...
 
Vector3Tpl< double > getTranslationAsVec3D () const
 Returns a copy of the translation as a CCVector3. More...
 
void setTranslation (const Vector3Tpl< float > &Tr)
 Sets translation (float version) More...
 
void setTranslation (const Vector3Tpl< double > &Tr)
 Sets translation (double version) More...
 
void setTranslation (const float Tr[3])
 Sets translation from a float array. More...
 
void setTranslation (const double Tr[3])
 Sets translation from a double array. More...
 
double * getColumn (unsigned index)
 Returns a pointer to a given column. More...
 
const double * getColumn (unsigned index) const
 Returns a const pointer to a given column. More...
 
Vector3Tpl< double > getColumnAsVec3D (unsigned index) const
 Returns a copy of a given column as a CCVector3. More...
 
void setColumn (unsigned index, const Vector3Tpl< double > &v)
 Sets the content of a given column. More...
 
void setColumn (unsigned index, const Tuple4Tpl< double > &v)
 Sets the content of a given column. More...
 
ccGLMatrixTpl< double > operator* (const ccGLMatrixTpl< double > &mat) const
 Multiplication by a matrix operator.
 
Vector3Tpl< float > operator* (const Vector3Tpl< float > &vec) const
 Multiplication by a vector operator (float version)
 
Vector3Tpl< double > operator* (const Vector3Tpl< double > &vec) const
 Multiplication by a vector operator (double version)
 
Tuple4Tpl< float > operator* (const Tuple4Tpl< float > &vec) const
 Multiplication by a 4D vector operator (float version)
 
Tuple4Tpl< double > operator* (const Tuple4Tpl< double > &vec) const
 Multiplication by a 4D vector operator (double version)
 
ccGLMatrixTpl< double > & operator+= (const ccGLMatrixTpl< double > &mat)
 (in place) Addition operator
 
ccGLMatrixTpl< double > & operator+= (const Vector3Tpl< float > &Tr)
 (in place) Forward translation operator (float version)
 
ccGLMatrixTpl< double > & operator+= (const Vector3Tpl< double > &Tr)
 (in place) Forward translation operator (double version)
 
ccGLMatrixTpl< double > & operator-= (const ccGLMatrixTpl< double > &mat)
 (in place) Difference operator
 
ccGLMatrixTpl< double > & operator-= (const Vector3Tpl< float > &Tr)
 (in place) Backward translation operator (float version)
 
ccGLMatrixTpl< double > & operator-= (const Vector3Tpl< double > &Tr)
 (in place) Backward translation operator (double version)
 
ccGLMatrixTpl< double > & operator*= (const ccGLMatrixTpl< double > &mat)
 (in place) Multiplication operator
 
double operator() (unsigned row, unsigned col) const
 Returns the value at a given position.
 
void apply (Vector3Tpl< float > &vec) const
 Applies transformation to a 3D vector (in place) - float version. More...
 
void apply (Vector3Tpl< double > &vec) const
 Applies transformation to a 3D vector (in place) - double version. More...
 
void apply (Tuple4Tpl< float > &vec) const
 Applies transformation to a 4D vector (in place) - float version. More...
 
void apply (Tuple4Tpl< double > &vec) const
 Applies transformation to a 3D vector (in place) - double version. More...
 
float applyX (const Vector3Tpl< float > &vec) const
 Get the resulting transformation along X dimension (float version)
 
double applyX (const Vector3Tpl< double > &vec) const
 Get the resulting transformation along X dimension (double version)
 
float applyX (const Tuple4Tpl< float > &vec) const
 Get the resulting transformation along X dimension (float version)
 
double applyX (const Tuple4Tpl< double > &vec) const
 Get the resulting transformation along X dimension (double version)
 
float applyY (const Vector3Tpl< float > &vec) const
 Get the resulting transformation along Y dimension (float version)
 
double applyY (const Vector3Tpl< double > &vec) const
 Get the resulting transformation along Y dimension (double version)
 
float applyY (const Tuple4Tpl< float > &vec) const
 Get the resulting transformation along Y dimension (float version)
 
double applyY (const Tuple4Tpl< double > &vec) const
 Get the resulting transformation along Y dimension (double version)
 
float applyZ (const Vector3Tpl< float > &vec) const
 Get the resulting transformation along Z dimension (float version)
 
double applyZ (const Vector3Tpl< double > &vec) const
 Get the resulting transformation along Z dimension (double version)
 
float applyZ (const Tuple4Tpl< float > &vec) const
 Get the resulting transformation along Z dimension (float version)
 
double applyZ (const Tuple4Tpl< double > &vec) const
 Get the resulting transformation along Z dimension (double version)
 
float applyW (const Tuple4Tpl< float > &vec) const
 Get the resulting transformation along the 4th dimension (float version)
 
double applyW (const Tuple4Tpl< double > &vec) const
 Get the resulting transformation along the 4th dimension (double version)
 
void applyRotation (Vector3Tpl< float > &vec) const
 Applies rotation only to a 3D vector (in place) - float version. More...
 
void applyRotation (Vector3Tpl< double > &vec) const
 Applies rotation only to a 3D vector (in place) - double version. More...
 
void applyRotation (float vec[3]) const
 Applies rotation only to a 3D vector (in place) - float version. More...
 
void applyRotation (double vec[3]) const
 Applies rotation only to a 3D vector (in place) - float version. More...
 
void shiftRotationCenter (const Vector3Tpl< double > &vec)
 Shifts rotation center. More...
 
void transpose ()
 Transposes matrix (in place)
 
ccGLMatrixTpl< double > transposed () const
 Returns transposed matrix.
 
void invert ()
 Inverts transformation.
 
ccGLMatrixTpl< double > inverse () const
 Returns inverse transformation.
 
void scaleRotation (double coef)
 Scales the rotation part of the matrix. More...
 
void scaleRow (unsigned rowIndex, double coef)
 Scales one row of the matrix. More...
 
void scaleColumn (unsigned colIndex, double coef)
 Scales one column of the matrix. More...
 
bool isSerializable () const override
 Returns whether object is serializable of not. More...
 
bool toFile (QFile &out) const override
 Saves data to binary stream. More...
 
bool fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
 Loads data from binary stream. More...
 
- Public Member Functions inherited from ccSerializableObject
virtual ~ccSerializableObject ()=default
 Destructor.
 
virtual bool isSerializable () const
 Returns whether object is serializable of not. More...
 
virtual bool toFile (QFile &out) const
 Saves data to binary stream. More...
 
virtual bool fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap)
 Loads data from binary stream. More...
 

Additional Inherited Members

- Public Types inherited from ccSerializableObject
enum  DeserializationFlags { DF_POINT_COORDS_64_BITS = 1 , DF_SCALAR_VAL_32_BITS = 2 }
 Deserialization flags (bit-field) More...
 
typedef QMultiMap< unsigned, unsigned > LoadedIDMap
 Map of loaded unique IDs (old ID --> new ID)
 
- Static Public Member Functions inherited from ccGLMatrixTpl< double >
static ccGLMatrixTpl Interpolate (double coef, const ccGLMatrixTpl< double > &glMat1, const ccGLMatrixTpl< double > &glMat2)
 Interpolates two matrices at relative position 'coef'. More...
 
static ccGLMatrixTpl< double > FromToRotation (const Vector3Tpl< double > &from, const Vector3Tpl< double > &to)
 Creates a transformation matrix that rotates a vector to another. More...
 
static ccGLMatrixTpl< double > FromQuaternion (const Tq q[])
 Converts a quaternion to a rotation matrix. More...
 
static ccGLMatrixTpl< double > FromViewDirAndUpDir (const Vector3Tpl< double > &forward, const Vector3Tpl< double > &up)
 Generates a 'viewing' matrix from a looking vector and a 'up' direction. More...
 
static ccGLMatrixTpl< double > FromString (const QString &matText, bool &success)
 Converts a 'text' matrix to a ccGLMatrix. More...
 
- Static Public Member Functions inherited from ccSerializableObject
static bool WriteError ()
 Sends a custom error message (write error) and returns 'false'. More...
 
static bool ReadError ()
 Sends a custom error message (read error) and returns 'false'. More...
 
static bool MemoryError ()
 Sends a custom error message (not enough memory) and returns 'false'. More...
 
static bool CorruptError ()
 Sends a custom error message (corrupted file) and returns 'false'. More...
 
- Protected Member Functions inherited from ccGLMatrixTpl< double >
void internalRescale ()
 Transfers the homogenous coordinate (scale) to the whole matrix.
 
- Protected Attributes inherited from ccGLMatrixTpl< double >
double m_mat [OPENGL_MATRIX_SIZE]
 Internal 4x4 GL-style matrix data.
 

Detailed Description

Double version of ccGLMatrixTpl.

Constructor & Destructor Documentation

◆ ccGLMatrixd() [1/5]

ccGLMatrixd::ccGLMatrixd ( )
inline

Default constructor.

Matrix is set to identity (see ccGLMatrixTpl::toIdentity) by default.

◆ ccGLMatrixd() [2/5]

ccGLMatrixd::ccGLMatrixd ( const ccGLMatrixTpl< double > &  mat)
inline

Copy constructor from a ccGLMatrixTpl.

Parameters
matmatrix

◆ ccGLMatrixd() [3/5]

ccGLMatrixd::ccGLMatrixd ( const float *  mat16f)
inlineexplicit

Constructor from a float GL matrix array.

Parameters
mat16fa 16 elements array (column major order)

◆ ccGLMatrixd() [4/5]

ccGLMatrixd::ccGLMatrixd ( const double *  mat16d)
inlineexplicit

Constructor from a double GL matrix array.

Parameters
mat16da 16 elements array (column major order)

◆ ccGLMatrixd() [5/5]

ccGLMatrixd::ccGLMatrixd ( const Vector3Tpl< double > &  X,
const Vector3Tpl< double > &  Y,
const Vector3Tpl< double > &  Z,
const Vector3Tpl< double > &  Tr 
)
inline

Constructor from 4 columns (X,Y,Z,Tr)

Parameters
X3 first elements of the 1st column (last one is 0)
Y3 first elements of the 2nd column (last one is 0)
Z3 first elements of the 3rd column (last one is 0)
Tr3 first elements of the last column (last one is 1)

The documentation for this class was generated from the following file: