ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccGLMatrixTpl< T > Class Template Reference

A 4x4 'transformation' matrix (column major order) More...

#include <ecvGLMatrixTpl.h>

Inheritance diagram for ccGLMatrixTpl< T >:
Collaboration diagram for ccGLMatrixTpl< T >:

Public Member Functions

 ccGLMatrixTpl (const Eigen::Matrix< float, 4, 4 > &mat)
 Copy Function. More...
 
 ccGLMatrixTpl (const Eigen::Matrix< double, 4, 4 > &mat)
 
 ccGLMatrixTpl (const Eigen::Matrix< float, 3, 3 > &mat)
 
 ccGLMatrixTpl (const Eigen::Matrix< double, 3, 3 > &mat)
 
ccGLMatrixTpl< T > & operator= (const Eigen::Matrix< float, 4, 4 > &mat)
 Assignment Function. More...
 
ccGLMatrixTpl< T > & operator= (const Eigen::Matrix< double, 4, 4 > &mat)
 
ccGLMatrixTpl< T > & operator= (const Eigen::Matrix< float, 3, 3 > &mat)
 
ccGLMatrixTpl< T > & operator= (const Eigen::Matrix< double, 3, 3 > &mat)
 
 ccGLMatrixTpl ()
 Default constructor. More...
 
 ccGLMatrixTpl (const ccGLMatrixTpl< T > &mat)
 Copy constructor. More...
 
ccGLMatrixTpl< T > & operator= (const ccGLMatrixTpl< T > &mat)
 Copy assignment operator. More...
 
 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< T > &X, const Vector3Tpl< T > &Y, const Vector3Tpl< T > &Z, const Vector3Tpl< T > &Tr)
 Constructor from 4 columns (X,Y,Z,T) More...
 
void toQuaternion (T q[]) const
 Converts to a quaternion from a rotation matrix. More...
 
void toAngleAxis (T &alpha_rad, Vector3Tpl< T > &axis3D) const
 Returns equivalent parameters: a rotation axis and an angle. More...
 
void toEulerAngle (T &rz, T &ry, T &rx) const
 Returns equivalent parameters: 3 rotation angles. 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< T > xRotation () const
 Returns the rotation component around X only. More...
 
ccGLMatrixTpl< T > yRotation () const
 Returns the rotation component around Y only. More...
 
ccGLMatrixTpl< T > zRotation () const
 Returns the rotation component around Z only. More...
 
virtual void toZero ()
 Clears matrix. More...
 
virtual void toIdentity ()
 Sets matrix to identity. More...
 
virtual bool isIdentity () const
 Returns whether this matrix is equal to identity. More...
 
void clearTranslation ()
 Clears translation. More...
 
void initFromParameters (T alpha_rad, const Vector3Tpl< T > &axis3D, const Vector3Tpl< T > &t3D)
 Inits transformation from a rotation axis, an angle and a translation. More...
 
void initFromParameters (T phi_rad, T theta_rad, T psi_rad, const Vector3Tpl< T > &t3D)
 Inits transformation from 3 rotation angles and a translation. More...
 
void getParameters (T &alpha_rad, Vector3Tpl< T > &axis3D, Vector3Tpl< T > &t3D) const
 
void getParameters (T &phi_rad, T &theta_rad, T &psi_rad, Vector3Tpl< T > &t3D) const
 Returns equivalent parameters: 3 rotation angles and a translation. More...
 
T * data ()
 Returns a pointer to internal data. More...
 
const T * data () const
 Returns a const pointer to internal data. More...
 
T * getTranslation ()
 Retruns a pointer to internal translation. More...
 
const T * getTranslation () const
 Retruns a const pointer to internal translation. More...
 
Vector3Tpl< T > 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...
 
void setRotation (const float Rt[9])
 Sets Rotation from a float array. More...
 
void setRotation (const double Rt[9])
 Sets Rotation from a double array. More...
 
T * getColumn (unsigned index)
 Returns a pointer to a given column. More...
 
const T * getColumn (unsigned index) const
 Returns a const pointer to a given column. More...
 
Vector3Tpl< T > getColumnAsVec3D (unsigned index) const
 Returns a copy of a given column as a CCVector3. More...
 
void setColumn (unsigned index, const Vector3Tpl< T > &v)
 Sets the content of a given column. More...
 
void setColumn (unsigned index, const Tuple4Tpl< T > &v)
 Sets the content of a given column. More...
 
ccGLMatrixTpl< T > operator* (const ccGLMatrixTpl< T > &mat) const
 Multiplication by a matrix operator. More...
 
Vector3Tpl< float > operator* (const Vector3Tpl< float > &vec) const
 Multiplication by a vector operator (float version) More...
 
Vector3Tpl< double > operator* (const Vector3Tpl< double > &vec) const
 Multiplication by a vector operator (double version) More...
 
Tuple4Tpl< float > operator* (const Tuple4Tpl< float > &vec) const
 Multiplication by a 4D vector operator (float version) More...
 
Tuple4Tpl< double > operator* (const Tuple4Tpl< double > &vec) const
 Multiplication by a 4D vector operator (double version) More...
 
ccGLMatrixTpl< T > & operator+= (const ccGLMatrixTpl< T > &mat)
 (in place) Addition operator More...
 
ccGLMatrixTpl< T > & operator-= (const ccGLMatrixTpl< T > &mat)
 (in place) Difference operator More...
 
ccGLMatrixTpl< T > & operator*= (const ccGLMatrixTpl< T > &mat)
 (in place) Multiplication operator More...
 
ccGLMatrixTpl< T > & operator+= (const Vector3Tpl< float > &Tr)
 (in place) Forward translation operator (float version) More...
 
ccGLMatrixTpl< T > & operator+= (const Vector3Tpl< double > &Tr)
 (in place) Forward translation operator (double version) More...
 
ccGLMatrixTpl< T > & operator-= (const Vector3Tpl< float > &Tr)
 (in place) Backward translation operator (float version) More...
 
ccGLMatrixTpl< T > & operator-= (const Vector3Tpl< double > &Tr)
 (in place) Backward translation operator (double version) More...
 
operator() (unsigned row, unsigned col) const
 Returns the value at a given position. More...
 
void apply (float vec[3]) const
 Applies transformation to a 3D vector (in place) - float version. More...
 
void apply (double vec[3]) const
 Applies transformation to a 3D vector (in place) - double version. More...
 
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) More...
 
double applyX (const Vector3Tpl< double > &vec) const
 Get the resulting transformation along X dimension (double version) More...
 
float applyY (const Vector3Tpl< float > &vec) const
 Get the resulting transformation along Y dimension (float version) More...
 
double applyY (const Vector3Tpl< double > &vec) const
 Get the resulting transformation along Y dimension (double version) More...
 
float applyZ (const Vector3Tpl< float > &vec) const
 Get the resulting transformation along Z dimension (float version) More...
 
double applyZ (const Vector3Tpl< double > &vec) const
 Get the resulting transformation along Z dimension (double version) More...
 
float applyX (const Tuple4Tpl< float > &vec) const
 Get the resulting transformation along X dimension (float version) More...
 
double applyX (const Tuple4Tpl< double > &vec) const
 Get the resulting transformation along X dimension (double version) More...
 
float applyY (const Tuple4Tpl< float > &vec) const
 Get the resulting transformation along Y dimension (float version) More...
 
double applyY (const Tuple4Tpl< double > &vec) const
 Get the resulting transformation along Y dimension (double version) More...
 
float applyZ (const Tuple4Tpl< float > &vec) const
 Get the resulting transformation along Z dimension (float version) More...
 
double applyZ (const Tuple4Tpl< double > &vec) const
 Get the resulting transformation along Z dimension (double version) More...
 
float applyW (const Tuple4Tpl< float > &vec) const
 Get the resulting transformation along the 4th dimension (float version) More...
 
double applyW (const Tuple4Tpl< double > &vec) const
 
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< T > &vec)
 Shifts rotation center. More...
 
void transpose ()
 Transposes matrix (in place) More...
 
ccGLMatrixTpl< T > transposed () const
 Returns transposed matrix. More...
 
void invert ()
 Inverts transformation. More...
 
ccGLMatrixTpl< T > inverse () const
 Returns inverse transformation. More...
 
void scale (T coef)
 Scales the whole matrix. More...
 
void scaleLine (unsigned lineIndex, T coef)
 Scales one line of the matrix. More...
 
void scaleRotation (T coef)
 Scales the rotation part of the matrix. More...
 
void scaleRow (unsigned rowIndex, T coef)
 Scales one row of the matrix. More...
 
void scaleColumn (unsigned colIndex, T coef)
 Scales one column of the matrix. More...
 
bool isSerializable () const override
 Returns whether object is serializable of not. More...
 
bool toFile (QFile &out, short dataVersion) const override
 Saves data to binary stream. More...
 
short minimumFileVersion () const override
 Returns the minimum file version required to save this instance. 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. More...
 

Static Public Member Functions

static ccGLMatrixTpl< T > FromEigenMatrix (const Eigen::Matrix< double, 4, 4 > &mat)
 
static ccGLMatrixTpl< T > FromEigenMatrix3 (const Eigen::Matrix< T, 3, 3 > &mat)
 
static Eigen::Matrix< T, 4, 4 > ToEigenMatrix4 (const ccGLMatrixTpl< float > &mat)
 
static Eigen::Matrix< T, 4, 4 > ToEigenMatrix4 (const ccGLMatrixTpl< double > &mat)
 
static Eigen::Matrix< T, 3, 3 > ToEigenMatrix3 (const ccGLMatrixTpl< float > &mat)
 
static Eigen::Matrix< T, 3, 3 > ToEigenMatrix3 (const ccGLMatrixTpl< double > &mat)
 
static ccGLMatrixTpl Interpolate (T coef, const ccGLMatrixTpl< T > &glMat1, const ccGLMatrixTpl< T > &glMat2)
 Interpolates two matrices at relative position 'coef'. More...
 
static ccGLMatrixTpl< T > FromToRotation (const Vector3Tpl< T > &from, const Vector3Tpl< T > &to)
 Creates a transformation matrix that rotates a vector to another. More...
 
template<class Tq >
static ccGLMatrixTpl< T > FromQuaternion (const Tq q[])
 Converts a quaternion to a rotation matrix. More...
 
static Eigen::Matrix< T, 3, 3 > QuaternionToRotationMatrix (const Eigen::Matrix< T, 4, 1 > &qvec)
 Converts a quaternion to a rotation matrix. More...
 
static ccGLMatrixTpl< T > QuaternionToRotationMatrix (const Tuple4Tpl< T > &qvec)
 Converts a quaternion to a rotation matrix. More...
 
static Eigen::Matrix< T, 4, 1 > NormalizeQuaternion (const Eigen::Matrix< T, 4, 1 > &qvec)
 Converts a quaternion to a rotation matrix. More...
 
static ccGLMatrixTpl< T > FromViewDirAndUpDir (const Vector3Tpl< T > &forward, const Vector3Tpl< T > &up)
 Generates a 'viewing' matrix from a looking vector and a 'up' direction. More...
 
static ccGLMatrixTpl< T > 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 Attributes

m_mat [OPENGL_MATRIX_SIZE]
 Internal 4x4 GL-style matrix data. More...
 

Additional Inherited Members

- Public Types inherited from ccSerializableObject
enum  DeserializationFlags { DF_POINT_COORDS_64_BITS , 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) More...
 

Detailed Description

template<typename T>
class ccGLMatrixTpl< T >

A 4x4 'transformation' matrix (column major order)

Transformation (M) is composed by a rotation (R) and a translation (T): M*X = R*X + T

Definition at line 52 of file ecvGLMatrixTpl.h.

Constructor & Destructor Documentation

◆ ccGLMatrixTpl() [1/9]

template<typename T >
ccGLMatrixTpl< T >::ccGLMatrixTpl ( const Eigen::Matrix< float, 4, 4 > &  mat)
inline

Copy Function.

Definition at line 98 of file ecvGLMatrixTpl.h.

◆ ccGLMatrixTpl() [2/9]

template<typename T >
ccGLMatrixTpl< T >::ccGLMatrixTpl ( const Eigen::Matrix< double, 4, 4 > &  mat)
inline

Definition at line 99 of file ecvGLMatrixTpl.h.

◆ ccGLMatrixTpl() [3/9]

template<typename T >
ccGLMatrixTpl< T >::ccGLMatrixTpl ( const Eigen::Matrix< float, 3, 3 > &  mat)
inline

Definition at line 103 of file ecvGLMatrixTpl.h.

◆ ccGLMatrixTpl() [4/9]

template<typename T >
ccGLMatrixTpl< T >::ccGLMatrixTpl ( const Eigen::Matrix< double, 3, 3 > &  mat)
inline

Definition at line 104 of file ecvGLMatrixTpl.h.

◆ ccGLMatrixTpl() [5/9]

template<typename T >
ccGLMatrixTpl< T >::ccGLMatrixTpl ( )
inline

Default constructor.

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

Definition at line 134 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::toIdentity().

◆ ccGLMatrixTpl() [6/9]

template<typename T >
ccGLMatrixTpl< T >::ccGLMatrixTpl ( const ccGLMatrixTpl< T > &  mat)
inline

Copy constructor.

Definition at line 137 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat, and OPENGL_MATRIX_SIZE.

◆ ccGLMatrixTpl() [7/9]

template<typename T >
ccGLMatrixTpl< T >::ccGLMatrixTpl ( const float *  mat16f)
inlineexplicit

Constructor from a float GL matrix array.

Parameters
mat16fa 16 elements array (column major order)

Definition at line 154 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat, and OPENGL_MATRIX_SIZE.

◆ ccGLMatrixTpl() [8/9]

template<typename T >
ccGLMatrixTpl< T >::ccGLMatrixTpl ( const double *  mat16d)
inlineexplicit

Constructor from a double GL matrix array.

Warning
Will implicitly cast the elements to float!
Parameters
mat16da 16 elements array (column major order)

Definition at line 163 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat, and OPENGL_MATRIX_SIZE.

◆ ccGLMatrixTpl() [9/9]

template<typename T >
ccGLMatrixTpl< T >::ccGLMatrixTpl ( const Vector3Tpl< T > &  X,
const Vector3Tpl< T > &  Y,
const Vector3Tpl< T > &  Z,
const Vector3Tpl< T > &  Tr 
)
inline

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

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)

Definition at line 174 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R14, CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R24, CC_MAT_R31, CC_MAT_R32, CC_MAT_R33, CC_MAT_R34, CC_MAT_R41, CC_MAT_R42, CC_MAT_R43, CC_MAT_R44, Tuple3Tpl< Type >::x, X, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Member Function Documentation

◆ apply() [1/6]

template<typename T >
void ccGLMatrixTpl< T >::apply ( double  vec[3]) const
inline

Applies transformation to a 3D vector (in place) - double version.

Input array is directly modified after calling this method

Definition at line 1049 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::apply().

◆ apply() [2/6]

template<typename T >
void ccGLMatrixTpl< T >::apply ( float  vec[3]) const
inline

Applies transformation to a 3D vector (in place) - float version.

Input array is directly modified after calling this method

Definition at line 1039 of file ecvGLMatrixTpl.h.

Referenced by ccGLMatrixTpl< T >::apply(), DistanceMapGenerationTool::ConvertProfileToMesh(), and MainWindow::onItemPicked().

◆ apply() [3/6]

template<typename T >
void ccGLMatrixTpl< T >::apply ( Tuple4Tpl< double > &  vec) const
inline

Applies transformation to a 3D vector (in place) - double version.

Input vector is directly modified after calling this method

Definition at line 1073 of file ecvGLMatrixTpl.h.

◆ apply() [4/6]

template<typename T >
void ccGLMatrixTpl< T >::apply ( Tuple4Tpl< float > &  vec) const
inline

Applies transformation to a 4D vector (in place) - float version.

Input vector is directly modified after calling this method

Definition at line 1069 of file ecvGLMatrixTpl.h.

◆ apply() [5/6]

template<typename T >
void ccGLMatrixTpl< T >::apply ( Vector3Tpl< double > &  vec) const
inline

Applies transformation to a 3D vector (in place) - double version.

Input vector is directly modified after calling this method

Definition at line 1064 of file ecvGLMatrixTpl.h.

◆ apply() [6/6]

template<typename T >
void ccGLMatrixTpl< T >::apply ( Vector3Tpl< float > &  vec) const
inline

Applies transformation to a 3D vector (in place) - float version.

Input vector is directly modified after calling this method

Definition at line 1060 of file ecvGLMatrixTpl.h.

◆ applyRotation() [1/4]

template<typename T >
void ccGLMatrixTpl< T >::applyRotation ( double  vec[3]) const
inline

Applies rotation only to a 3D vector (in place) - float version.

Input array is directly modified after calling this method

Definition at line 1245 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R31, CC_MAT_R32, and CC_MAT_R33.

◆ applyRotation() [2/4]

template<typename T >
void ccGLMatrixTpl< T >::applyRotation ( float  vec[3]) const
inline

Applies rotation only to a 3D vector (in place) - float version.

Input array is directly modified after calling this method

Definition at line 1225 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R31, CC_MAT_R32, and CC_MAT_R33.

◆ applyRotation() [3/4]

template<typename T >
void ccGLMatrixTpl< T >::applyRotation ( Vector3Tpl< double > &  vec) const
inline

Applies rotation only to a 3D vector (in place) - double version.

Input vector is directly modified after calling this method

Definition at line 1204 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R31, CC_MAT_R32, CC_MAT_R33, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ applyRotation() [4/4]

template<typename T >
void ccGLMatrixTpl< T >::applyRotation ( Vector3Tpl< float > &  vec) const
inline

Applies rotation only to a 3D vector (in place) - float version.

Input vector is directly modified after calling this method

Definition at line 1184 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R31, CC_MAT_R32, CC_MAT_R33, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by ccGLMatrixTpl< T >::invert(), CommandMatchBestFitPlane::process(), and ccGLMatrixTpl< T >::shiftRotationCenter().

◆ applyW() [1/2]

template<typename T >
double ccGLMatrixTpl< T >::applyW ( const Tuple4Tpl< double > &  vec) const
inline

Get the resulting transformation along the 4th dimension (double version)

Definition at line 1174 of file ecvGLMatrixTpl.h.

References CC_MAT_R41, CC_MAT_R42, CC_MAT_R43, CC_MAT_R44, Tuple4Tpl< Type >::w, Tuple4Tpl< Type >::x, Tuple4Tpl< Type >::y, and Tuple4Tpl< Type >::z.

◆ applyW() [2/2]

template<typename T >
float ccGLMatrixTpl< T >::applyW ( const Tuple4Tpl< float > &  vec) const
inline

Get the resulting transformation along the 4th dimension (float version)

Definition at line 1166 of file ecvGLMatrixTpl.h.

References CC_MAT_R41, CC_MAT_R42, CC_MAT_R43, CC_MAT_R44, Tuple4Tpl< Type >::w, Tuple4Tpl< Type >::x, Tuple4Tpl< Type >::y, and Tuple4Tpl< Type >::z.

Referenced by ccGLMatrixTpl< T >::operator*().

◆ applyX() [1/4]

template<typename T >
double ccGLMatrixTpl< T >::applyX ( const Tuple4Tpl< double > &  vec) const
inline

Get the resulting transformation along X dimension (double version)

Definition at line 1128 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R14, Tuple4Tpl< Type >::w, Tuple4Tpl< Type >::x, Tuple4Tpl< Type >::y, and Tuple4Tpl< Type >::z.

◆ applyX() [2/4]

template<typename T >
float ccGLMatrixTpl< T >::applyX ( const Tuple4Tpl< float > &  vec) const
inline

Get the resulting transformation along X dimension (float version)

Definition at line 1121 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R14, Tuple4Tpl< Type >::w, Tuple4Tpl< Type >::x, Tuple4Tpl< Type >::y, and Tuple4Tpl< Type >::z.

◆ applyX() [3/4]

template<typename T >
double ccGLMatrixTpl< T >::applyX ( const Vector3Tpl< double > &  vec) const
inline

Get the resulting transformation along X dimension (double version)

Definition at line 1083 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R14, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ applyX() [4/4]

template<typename T >
float ccGLMatrixTpl< T >::applyX ( const Vector3Tpl< float > &  vec) const
inline

Get the resulting transformation along X dimension (float version)

Definition at line 1076 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R14, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by ccGLMatrixTpl< T >::operator*().

◆ applyY() [1/4]

template<typename T >
double ccGLMatrixTpl< T >::applyY ( const Tuple4Tpl< double > &  vec) const
inline

Get the resulting transformation along Y dimension (double version)

Definition at line 1143 of file ecvGLMatrixTpl.h.

References CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R24, Tuple4Tpl< Type >::w, Tuple4Tpl< Type >::x, Tuple4Tpl< Type >::y, and Tuple4Tpl< Type >::z.

◆ applyY() [2/4]

template<typename T >
float ccGLMatrixTpl< T >::applyY ( const Tuple4Tpl< float > &  vec) const
inline

Get the resulting transformation along Y dimension (float version)

Definition at line 1136 of file ecvGLMatrixTpl.h.

References CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R24, Tuple4Tpl< Type >::w, Tuple4Tpl< Type >::x, Tuple4Tpl< Type >::y, and Tuple4Tpl< Type >::z.

◆ applyY() [3/4]

template<typename T >
double ccGLMatrixTpl< T >::applyY ( const Vector3Tpl< double > &  vec) const
inline

Get the resulting transformation along Y dimension (double version)

Definition at line 1098 of file ecvGLMatrixTpl.h.

References CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R24, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ applyY() [4/4]

template<typename T >
float ccGLMatrixTpl< T >::applyY ( const Vector3Tpl< float > &  vec) const
inline

Get the resulting transformation along Y dimension (float version)

Definition at line 1091 of file ecvGLMatrixTpl.h.

References CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R24, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by ccGLMatrixTpl< T >::operator*().

◆ applyZ() [1/4]

template<typename T >
double ccGLMatrixTpl< T >::applyZ ( const Tuple4Tpl< double > &  vec) const
inline

Get the resulting transformation along Z dimension (double version)

Definition at line 1158 of file ecvGLMatrixTpl.h.

References CC_MAT_R31, CC_MAT_R32, CC_MAT_R33, CC_MAT_R34, Tuple4Tpl< Type >::w, Tuple4Tpl< Type >::x, Tuple4Tpl< Type >::y, and Tuple4Tpl< Type >::z.

◆ applyZ() [2/4]

template<typename T >
float ccGLMatrixTpl< T >::applyZ ( const Tuple4Tpl< float > &  vec) const
inline

Get the resulting transformation along Z dimension (float version)

Definition at line 1151 of file ecvGLMatrixTpl.h.

References CC_MAT_R31, CC_MAT_R32, CC_MAT_R33, CC_MAT_R34, Tuple4Tpl< Type >::w, Tuple4Tpl< Type >::x, Tuple4Tpl< Type >::y, and Tuple4Tpl< Type >::z.

◆ applyZ() [3/4]

template<typename T >
double ccGLMatrixTpl< T >::applyZ ( const Vector3Tpl< double > &  vec) const
inline

Get the resulting transformation along Z dimension (double version)

Definition at line 1113 of file ecvGLMatrixTpl.h.

References CC_MAT_R31, CC_MAT_R32, CC_MAT_R33, CC_MAT_R34, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ applyZ() [4/4]

template<typename T >
float ccGLMatrixTpl< T >::applyZ ( const Vector3Tpl< float > &  vec) const
inline

Get the resulting transformation along Z dimension (float version)

Definition at line 1106 of file ecvGLMatrixTpl.h.

References CC_MAT_R31, CC_MAT_R32, CC_MAT_R33, CC_MAT_R34, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by ccGLMatrixTpl< T >::operator*().

◆ clearTranslation()

template<typename T >
void ccGLMatrixTpl< T >::clearTranslation ( )
inline

Clears translation.

Translation is set to (0,0,0).

Definition at line 642 of file ecvGLMatrixTpl.h.

References CC_MAT_R14, CC_MAT_R24, and CC_MAT_R34.

Referenced by ccGLMatrixTpl< T >::FromEigenMatrix3().

◆ data() [1/2]

template<typename T >
T* ccGLMatrixTpl< T >::data ( )
inline

Returns a pointer to internal data.

Definition at line 810 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat.

Referenced by MainWindow::addToDB(), ccGraphicalTransformationTool::apply(), CorrespondenceMatching::applyTransformation(), TemplateAlignment::applyTransformation(), NurbsCurveFitting::compute(), FastGlobalRegistrationFilter::compute(), ccEntityAction::computeNormals(), DecodeRotation(), DecodeTransformation(), ccPointPair::drawMeOnly(), ccTrace::drawMeOnly(), MatrixDisplayDlg::fillDialogWith(), FromCCLibMatrix(), ccGLMatrixTpl< T >::FromQuaternion(), ccGLMatrixTpl< T >::FromString(), ccGLMatrixTpl< T >::FromViewDirAndUpDir(), ecvGenericDisplayTools::Frustum(), BundlerImportDlg::getOptionalTransfoMatrix(), GetPoseInformation(), Frustum::initfromMPMatrix(), ccCamSensorProjectionDlg::initWithCamSensor(), ccGBLSensorProjectionDlg::initWithGBLSensor(), PovFilter::loadFile(), FBXFilter::loadFile(), LoadImage(), qSRA::loadProfile(), LoadScan(), cloudViewer::ModelViewerWidget::ModelViewMatrix(), MainWindow::onItemPicked(), ccGLMatrixTpl< T >::operator=(), ecvGenericDisplayTools::Ortho(), ecvGenericDisplayTools::Perspective(), ccCloudLayersHelper::projectCloud(), SaveImage(), SavePoseInformation(), SaveScan(), PovFilter::saveToFile(), TransformInfo::setTransformation(), ccGLMatrixTpl< T >::ToEigenMatrix3(), ccGLMatrixTpl< T >::ToEigenMatrix4(), ecvGenericDisplayTools::Unproject(), ccCamSensorProjectionDlg::updateCamSensor(), and ccGBLSensorProjectionDlg::updateGBLSensor().

◆ data() [2/2]

template<typename T >
const T* ccGLMatrixTpl< T >::data ( ) const
inline

Returns a const pointer to internal data.

Definition at line 813 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat.

◆ fromAsciiFile()

template<typename T >
virtual bool ccGLMatrixTpl< T >::fromAsciiFile ( QString  filename)
inlinevirtual

Loads matrix from an ASCII file.

Parameters
filenameinput file name

Reimplemented in ccIndexedTransformation.

Definition at line 538 of file ecvGLMatrixTpl.h.

References filename, and ccGLMatrixTpl< T >::m_mat.

Referenced by ccApplyTransformationDlg::loadFromASCIIFile(), and CommandApplyTransformation::process().

◆ FromEigenMatrix()

template<typename T >
static ccGLMatrixTpl<T> ccGLMatrixTpl< T >::FromEigenMatrix ( const Eigen::Matrix< double, 4, 4 > &  mat)
inlinestatic

Definition at line 54 of file ecvGLMatrixTpl.h.

◆ FromEigenMatrix3()

template<typename T >
static ccGLMatrixTpl<T> ccGLMatrixTpl< T >::FromEigenMatrix3 ( const Eigen::Matrix< T, 3, 3 > &  mat)
inlinestatic

◆ fromFile()

template<typename T >
bool ccGLMatrixTpl< T >::fromFile ( QFile &  in,
short  dataVersion,
int  flags,
LoadedIDMap oldToNewIDMap 
)
inlineoverridevirtual

Loads data from binary stream.

Parameters
ininput file (already opened)
dataVersionfile version (for version-specific deserialization)
flagsdeserialization flags (see ccSerializableObject::DeserializationFlags)
oldToNewIDMapmap to link old IDs with new IDs
Returns
success
Note: When implementing, use dataVersion checks to handle different
versions:
  • if (dataVersion >= X) { read new field } else { use default value } This ensures forward compatibility with older file formats.

Reimplemented from ccSerializableObject.

Definition at line 1427 of file ecvGLMatrixTpl.h.

◆ FromQuaternion()

template<typename T >
template<class Tq >
static ccGLMatrixTpl<T> ccGLMatrixTpl< T >::FromQuaternion ( const Tq  q[])
inlinestatic

Converts a quaternion to a rotation matrix.

Parameters
qquaternion (4 values: w,x,y,z)
Returns
corresponding rotation matrix

Definition at line 303 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::data().

◆ FromString()

template<typename T >
static ccGLMatrixTpl<T> ccGLMatrixTpl< T >::FromString ( const QString &  matText,
bool &  success 
)
inlinestatic

Converts a 'text' matrix to a ccGLMatrix.

Parameters
[in]matTextmatrix text
[out]successwhether input matrix text is valid or not

Definition at line 477 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::data(), OPENGL_MATRIX_SIZE, qtCompatSplitRegex(), and QtCompat::SkipEmptyParts.

◆ FromToRotation()

template<typename T >
static ccGLMatrixTpl<T> ccGLMatrixTpl< T >::FromToRotation ( const Vector3Tpl< T > &  from,
const Vector3Tpl< T > &  to 
)
inlinestatic

Creates a transformation matrix that rotates a vector to another.

Adapted from "Efficiently Building a Matrix to Rotate One Vector to Another" By Tomas Möller, John Hughes, Journal of Graphics Tools, 4(4):1-4, 1999

Parameters
fromnormalized non-zero source vector
tonormalized non-zero destination vector

Definition at line 230 of file ecvGLMatrixTpl.h.

References Vector3Tpl< Type >::cross(), Vector3Tpl< Type >::dot(), fabs(), cloudViewer::LessThanEpsilon(), result, Tuple3Tpl< Type >::u, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ FromViewDirAndUpDir()

template<typename T >
static ccGLMatrixTpl<T> ccGLMatrixTpl< T >::FromViewDirAndUpDir ( const Vector3Tpl< T > &  forward,
const Vector3Tpl< T > &  up 
)
inlinestatic

Generates a 'viewing' matrix from a looking vector and a 'up' direction.

Warning
No translation is applied (pure rotation matrix)
Parameters
forwardforward 'view' vector
upup vector
Returns
corresponding rotation matrix

Definition at line 436 of file ecvGLMatrixTpl.h.

References Vector3Tpl< Type >::cross(), ccGLMatrixTpl< T >::data(), Vector3Tpl< Type >::normalize(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ getColumn() [1/2]

template<typename T >
T* ccGLMatrixTpl< T >::getColumn ( unsigned  index)
inline

Returns a pointer to a given column.

Parameters
indexcolumn index (between 0 and 3)
Returns
pointer to the first element of the corresponding column

Definition at line 904 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat.

Referenced by qFacets::exportFacets(), ccGLMatrixTpl< T >::getColumnAsVec3D(), PcdFilter::loadFile(), PDMSFilter::loadFile(), PcdFilter::saveToFile(), and ccGLMatrixTpl< T >::scaleColumn().

◆ getColumn() [2/2]

template<typename T >
const T* ccGLMatrixTpl< T >::getColumn ( unsigned  index) const
inline

Returns a const pointer to a given column.

Parameters
indexcolumn index (between 0 and 3)
Returns
pointer to the first element of the corresponding column

Definition at line 910 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat.

◆ getColumnAsVec3D()

template<typename T >
Vector3Tpl<T> ccGLMatrixTpl< T >::getColumnAsVec3D ( unsigned  index) const
inline

Returns a copy of a given column as a CCVector3.

4th value is ignored.

Parameters
indexcolumn index (between 0 and 3)
Returns
copy of the three first elements of the corresponding column

Definition at line 919 of file ecvGLMatrixTpl.h.

References Vector3Tpl< Type >::fromArray(), and ccGLMatrixTpl< T >::getColumn().

Referenced by ccDBRoot::alignCameraWithEntity(), ccBoundingBoxEditorDlg::fromClipboardClicked(), GetConeProfile(), ccGLMatrixTpl< T >::getTranslationAsVec3D(), and ccGLMatrixTpl< T >::invert().

◆ getParameters() [1/2]

template<typename T >
void ccGLMatrixTpl< T >::getParameters ( T &  alpha_rad,
Vector3Tpl< T > &  axis3D,
Vector3Tpl< T > &  t3D 
) const
inline

◆ getParameters() [2/2]

template<typename T >
void ccGLMatrixTpl< T >::getParameters ( T &  phi_rad,
T &  theta_rad,
T &  psi_rad,
Vector3Tpl< T > &  t3D 
) const
inline

Returns equivalent parameters: 3 rotation angles and a translation.

See http://en.wikipedia.org/wiki/Euler_angles (Tait-Bryan Z1Y2X3)

Parameters
[out]phi_radPhi angle (in radians)
[out]theta_radTheta angle (in radians)
[out]psi_radPsi angle (in radians)
[out]t3Dtranslation

Definition at line 777 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R14, CC_MAT_R21, CC_MAT_R24, CC_MAT_R31, CC_MAT_R32, CC_MAT_R33, CC_MAT_R34, fabs(), M_PI_2, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ getTranslation() [1/2]

template<typename T >
T* ccGLMatrixTpl< T >::getTranslation ( )
inline

◆ getTranslation() [2/2]

template<typename T >
const T* ccGLMatrixTpl< T >::getTranslation ( ) const
inline

Retruns a const pointer to internal translation.

Translation corresponds to the beginning of the third column of the matrix.

Definition at line 825 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat.

◆ getTranslationAsVec3D()

◆ initFromParameters() [1/2]

◆ initFromParameters() [2/2]

template<typename T >
void ccGLMatrixTpl< T >::initFromParameters ( phi_rad,
theta_rad,
psi_rad,
const Vector3Tpl< T > &  t3D 
)
inline

Inits transformation from 3 rotation angles and a translation.

See http://en.wikipedia.org/wiki/Euler_angles (Tait-Bryan Z1Y2X3)

Parameters
[in]phi_radPhi angle (in radians)
[in]theta_radTheta angle (in radians)
[in]psi_radPsi angle (in radians)
[in]t3Dtranslation

Definition at line 698 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R14, CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R24, CC_MAT_R31, CC_MAT_R32, CC_MAT_R33, CC_MAT_R34, CC_MAT_R41, CC_MAT_R42, CC_MAT_R43, CC_MAT_R44, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ Interpolate()

template<typename T >
static ccGLMatrixTpl ccGLMatrixTpl< T >::Interpolate ( coef,
const ccGLMatrixTpl< T > &  glMat1,
const ccGLMatrixTpl< T > &  glMat2 
)
inlinestatic

Interpolates two matrices at relative position 'coef'.

Parameters
coefinterpolation position (should be between 0 and 1).
glMat1'left' matrix
glMat2'right' matrix

Definition at line 201 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::getParameters(), ccGLMatrixTpl< T >::initFromParameters(), and ccGLMatrixTpl< T >::inverse().

◆ inverse()

◆ invert()

◆ isIdentity()

template<typename T >
virtual bool ccGLMatrixTpl< T >::isIdentity ( ) const
inlinevirtual

Returns whether this matrix is equal to identity.

Definition at line 628 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat.

◆ isSerializable()

template<typename T >
bool ccGLMatrixTpl< T >::isSerializable ( ) const
inlineoverridevirtual

Returns whether object is serializable of not.

Reimplemented from ccSerializableObject.

Definition at line 1403 of file ecvGLMatrixTpl.h.

◆ minimumFileVersion()

template<typename T >
short ccGLMatrixTpl< T >::minimumFileVersion ( ) const
inlineoverridevirtual

Returns the minimum file version required to save this instance.

To be overridden by subclasses to indicate their minimum required version. This enables the system to determine:

  • Forward compatibility: newer software can read older files (dataVersion check in fromFile)
  • Backward compatibility: determine minimum version needed to save current data
    Returns
    minimum file version required for this object

Implements ccSerializableObject.

Definition at line 1422 of file ecvGLMatrixTpl.h.

◆ NormalizeQuaternion()

template<typename T >
static Eigen::Matrix<T, 4, 1> ccGLMatrixTpl< T >::NormalizeQuaternion ( const Eigen::Matrix< T, 4, 1 > &  qvec)
inlinestatic

Converts a quaternion to a rotation matrix.

Parameters
qquaternion (4 values: w,x,y,z)
Returns
corresponding normalized quaternion

Definition at line 377 of file ecvGLMatrixTpl.h.

Referenced by ccGLMatrixTpl< T >::QuaternionToRotationMatrix().

◆ operator()()

template<typename T >
T ccGLMatrixTpl< T >::operator() ( unsigned  row,
unsigned  col 
) const
inline

Returns the value at a given position.

Definition at line 1032 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat.

◆ operator*() [1/5]

template<typename T >
ccGLMatrixTpl<T> ccGLMatrixTpl< T >::operator* ( const ccGLMatrixTpl< T > &  mat) const
inline

Multiplication by a matrix operator.

Definition at line 947 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat, and result.

◆ operator*() [2/5]

template<typename T >
Tuple4Tpl<double> ccGLMatrixTpl< T >::operator* ( const Tuple4Tpl< double > &  vec) const
inline

Multiplication by a 4D vector operator (double version)

Definition at line 977 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::applyW(), ccGLMatrixTpl< T >::applyX(), ccGLMatrixTpl< T >::applyY(), and ccGLMatrixTpl< T >::applyZ().

◆ operator*() [3/5]

template<typename T >
Tuple4Tpl<float> ccGLMatrixTpl< T >::operator* ( const Tuple4Tpl< float > &  vec) const
inline

Multiplication by a 4D vector operator (float version)

Definition at line 972 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::applyW(), ccGLMatrixTpl< T >::applyX(), ccGLMatrixTpl< T >::applyY(), and ccGLMatrixTpl< T >::applyZ().

◆ operator*() [4/5]

template<typename T >
Vector3Tpl<double> ccGLMatrixTpl< T >::operator* ( const Vector3Tpl< double > &  vec) const
inline

Multiplication by a vector operator (double version)

Definition at line 967 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::applyX(), ccGLMatrixTpl< T >::applyY(), and ccGLMatrixTpl< T >::applyZ().

◆ operator*() [5/5]

template<typename T >
Vector3Tpl<float> ccGLMatrixTpl< T >::operator* ( const Vector3Tpl< float > &  vec) const
inline

Multiplication by a vector operator (float version)

Definition at line 963 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::applyX(), ccGLMatrixTpl< T >::applyY(), and ccGLMatrixTpl< T >::applyZ().

◆ operator*=()

template<typename T >
ccGLMatrixTpl<T>& ccGLMatrixTpl< T >::operator*= ( const ccGLMatrixTpl< T > &  mat)
inline

(in place) Multiplication operator

Definition at line 997 of file ecvGLMatrixTpl.h.

◆ operator+=() [1/3]

template<typename T >
ccGLMatrixTpl<T>& ccGLMatrixTpl< T >::operator+= ( const ccGLMatrixTpl< T > &  mat)
inline

(in place) Addition operator

Definition at line 983 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat, and OPENGL_MATRIX_SIZE.

◆ operator+=() [2/3]

template<typename T >
ccGLMatrixTpl<T>& ccGLMatrixTpl< T >::operator+= ( const Vector3Tpl< double > &  Tr)
inline

(in place) Forward translation operator (double version)

Definition at line 1010 of file ecvGLMatrixTpl.h.

References CC_MAT_R14, CC_MAT_R24, CC_MAT_R34, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ operator+=() [3/3]

template<typename T >
ccGLMatrixTpl<T>& ccGLMatrixTpl< T >::operator+= ( const Vector3Tpl< float > &  Tr)
inline

(in place) Forward translation operator (float version)

Definition at line 1003 of file ecvGLMatrixTpl.h.

References CC_MAT_R14, CC_MAT_R24, CC_MAT_R34, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ operator-=() [1/3]

template<typename T >
ccGLMatrixTpl<T>& ccGLMatrixTpl< T >::operator-= ( const ccGLMatrixTpl< T > &  mat)
inline

(in place) Difference operator

Definition at line 990 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat, and OPENGL_MATRIX_SIZE.

◆ operator-=() [2/3]

template<typename T >
ccGLMatrixTpl<T>& ccGLMatrixTpl< T >::operator-= ( const Vector3Tpl< double > &  Tr)
inline

(in place) Backward translation operator (double version)

Definition at line 1024 of file ecvGLMatrixTpl.h.

References CC_MAT_R14, CC_MAT_R24, CC_MAT_R34, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ operator-=() [3/3]

template<typename T >
ccGLMatrixTpl<T>& ccGLMatrixTpl< T >::operator-= ( const Vector3Tpl< float > &  Tr)
inline

(in place) Backward translation operator (float version)

Definition at line 1017 of file ecvGLMatrixTpl.h.

References CC_MAT_R14, CC_MAT_R24, CC_MAT_R34, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ operator=() [1/5]

template<typename T >
ccGLMatrixTpl<T>& ccGLMatrixTpl< T >::operator= ( const ccGLMatrixTpl< T > &  mat)
inline

Copy assignment operator.

Definition at line 143 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat, and OPENGL_MATRIX_SIZE.

◆ operator=() [2/5]

template<typename T >
ccGLMatrixTpl<T>& ccGLMatrixTpl< T >::operator= ( const Eigen::Matrix< double, 3, 3 > &  mat)
inline

Definition at line 126 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::setRotation().

◆ operator=() [3/5]

template<typename T >
ccGLMatrixTpl<T>& ccGLMatrixTpl< T >::operator= ( const Eigen::Matrix< double, 4, 4 > &  mat)
inline

◆ operator=() [4/5]

template<typename T >
ccGLMatrixTpl<T>& ccGLMatrixTpl< T >::operator= ( const Eigen::Matrix< float, 3, 3 > &  mat)
inline

Definition at line 122 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::setRotation().

◆ operator=() [5/5]

template<typename T >
ccGLMatrixTpl<T>& ccGLMatrixTpl< T >::operator= ( const Eigen::Matrix< float, 4, 4 > &  mat)
inline

Assignment Function.

Definition at line 109 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::data(), ccGLMatrixTpl< T >::m_mat, and OPENGL_MATRIX_SIZE.

◆ QuaternionToRotationMatrix() [1/2]

template<typename T >
static Eigen::Matrix<T, 3, 3> ccGLMatrixTpl< T >::QuaternionToRotationMatrix ( const Eigen::Matrix< T, 4, 1 > &  qvec)
inlinestatic

Converts a quaternion to a rotation matrix.

Parameters
qquaternion (4 values: w,x,y,z)
Returns
corresponding rotation matrix

Definition at line 346 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::NormalizeQuaternion().

◆ QuaternionToRotationMatrix() [2/2]

template<typename T >
static ccGLMatrixTpl<T> ccGLMatrixTpl< T >::QuaternionToRotationMatrix ( const Tuple4Tpl< T > &  qvec)
inlinestatic

Converts a quaternion to a rotation matrix.

Parameters
qquaternion (4 values: w,x,y,z)
Returns
corresponding rotation matrix

Definition at line 359 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::FromEigenMatrix3(), ccGLMatrixTpl< T >::NormalizeQuaternion(), Tuple4Tpl< Type >::w, Tuple4Tpl< Type >::x, Tuple4Tpl< Type >::y, and Tuple4Tpl< Type >::z.

◆ scale()

template<typename T >
void ccGLMatrixTpl< T >::scale ( coef)
inline

Scales the whole matrix.

Parameters
coefscaling coef.

Definition at line 1335 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R14, CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R24, CC_MAT_R31, CC_MAT_R32, CC_MAT_R33, and CC_MAT_R34.

◆ scaleColumn()

template<typename T >
void ccGLMatrixTpl< T >::scaleColumn ( unsigned  colIndex,
coef 
)
inline

Scales one column of the matrix.

Parameters
colIndex(0-3)
coefscaling coef.

Definition at line 1393 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::getColumn().

◆ scaleLine()

template<typename T >
void ccGLMatrixTpl< T >::scaleLine ( unsigned  lineIndex,
coef 
)
inline

Scales one line of the matrix.

Parameters
lineIndex(0-3)
coefscaling coef.

Definition at line 1354 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat.

◆ scaleRotation()

template<typename T >
void ccGLMatrixTpl< T >::scaleRotation ( coef)
inline

Scales the rotation part of the matrix.

Parameters
coefscaling coef.

Definition at line 1365 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R31, CC_MAT_R32, and CC_MAT_R33.

◆ scaleRow()

template<typename T >
void ccGLMatrixTpl< T >::scaleRow ( unsigned  rowIndex,
coef 
)
inline

Scales one row of the matrix.

Parameters
rowIndextow index (0-3)
coefscaling coef.

Definition at line 1381 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat.

◆ setColumn() [1/2]

template<typename T >
void ccGLMatrixTpl< T >::setColumn ( unsigned  index,
const Tuple4Tpl< T > &  v 
)
inline

Sets the content of a given column.

Parameters
indexcolumn index (between 0 and 3)
vnew column values

Definition at line 938 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat, Tuple4Tpl< Type >::w, Tuple4Tpl< Type >::x, Tuple4Tpl< Type >::y, and Tuple4Tpl< Type >::z.

◆ setColumn() [2/2]

template<typename T >
void ccGLMatrixTpl< T >::setColumn ( unsigned  index,
const Vector3Tpl< T > &  v 
)
inline

Sets the content of a given column.

Parameters
indexcolumn index (between 0 and 3)
vnew column values

Definition at line 927 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by ccBoundingBoxEditorDlg::toClipboardClicked().

◆ setRotation() [1/2]

template<typename T >
void ccGLMatrixTpl< T >::setRotation ( const double  Rt[9])
inline

Sets Rotation from a double array.

Parameters
RtRotation matrix as a double array

Definition at line 886 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R31, CC_MAT_R32, and CC_MAT_R33.

◆ setRotation() [2/2]

template<typename T >
void ccGLMatrixTpl< T >::setRotation ( const float  Rt[9])
inline

Sets Rotation from a float array.

Parameters
RtRotation matrix as a float array

Definition at line 869 of file ecvGLMatrixTpl.h.

References CC_MAT_R11, CC_MAT_R12, CC_MAT_R13, CC_MAT_R21, CC_MAT_R22, CC_MAT_R23, CC_MAT_R31, CC_MAT_R32, and CC_MAT_R33.

Referenced by ccGLMatrixTpl< T >::FromEigenMatrix3(), and ccGLMatrixTpl< T >::operator=().

◆ setTranslation() [1/4]

template<typename T >
void ccGLMatrixTpl< T >::setTranslation ( const double  Tr[3])
inline

Sets translation from a double array.

Parameters
Tr3D vector as a double array

Definition at line 860 of file ecvGLMatrixTpl.h.

References CC_MAT_R14, CC_MAT_R24, and CC_MAT_R34.

◆ setTranslation() [2/4]

template<typename T >
void ccGLMatrixTpl< T >::setTranslation ( const float  Tr[3])
inline

Sets translation from a float array.

Parameters
Tr3D vector as a float array

Definition at line 852 of file ecvGLMatrixTpl.h.

References CC_MAT_R14, CC_MAT_R24, and CC_MAT_R34.

◆ setTranslation() [3/4]

template<typename T >
void ccGLMatrixTpl< T >::setTranslation ( const Vector3Tpl< double > &  Tr)
inline

Sets translation (double version)

Parameters
Tr3D vector

Definition at line 843 of file ecvGLMatrixTpl.h.

References CC_MAT_R14, CC_MAT_R24, CC_MAT_R34, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ setTranslation() [4/4]

◆ shiftRotationCenter()

template<typename T >
void ccGLMatrixTpl< T >::shiftRotationCenter ( const Vector3Tpl< T > &  vec)
inline

Shifts rotation center.

Warning, this method only applies a shift (i.e. relatively to the current rotation center). This is not a way to set an absolute rotation center 'directly'.

Definition at line 1268 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::applyRotation().

Referenced by FromCCLibMatrix().

◆ toAngleAxis()

template<typename T >
void ccGLMatrixTpl< T >::toAngleAxis ( T &  alpha_rad,
Vector3Tpl< T > &  axis3D 
) const
inline

Returns equivalent parameters: a rotation axis and an angle.

Parameters
[out]alpha_radrotation angle in radians (in [0;pi])
[out]axis3Dunit rotation axis

Definition at line 408 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::ToEigenMatrix3(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ toAsciiFile()

template<typename T >
virtual bool ccGLMatrixTpl< T >::toAsciiFile ( QString  filename,
int  precision = 12 
) const
inlinevirtual

Saves matrix to an ASCII file.

Parameters
filenameoutput file name
precisionoutput digits precision

Reimplemented in ccIndexedTransformation.

Definition at line 520 of file ecvGLMatrixTpl.h.

References QtCompat::endl(), filename, and ccGLMatrixTpl< T >::m_mat.

Referenced by MatrixDisplayDlg::exportToASCII().

◆ ToEigenMatrix3() [1/2]

template<typename T >
static Eigen::Matrix<T, 3, 3> ccGLMatrixTpl< T >::ToEigenMatrix3 ( const ccGLMatrixTpl< double > &  mat)
inlinestatic

Definition at line 87 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::data().

◆ ToEigenMatrix3() [2/2]

template<typename T >
static Eigen::Matrix<T, 3, 3> ccGLMatrixTpl< T >::ToEigenMatrix3 ( const ccGLMatrixTpl< float > &  mat)
inlinestatic

◆ ToEigenMatrix4() [1/2]

template<typename T >
static Eigen::Matrix<T, 4, 4> ccGLMatrixTpl< T >::ToEigenMatrix4 ( const ccGLMatrixTpl< double > &  mat)
inlinestatic

Definition at line 72 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::data().

◆ ToEigenMatrix4() [2/2]

template<typename T >
static Eigen::Matrix<T, 4, 4> ccGLMatrixTpl< T >::ToEigenMatrix4 ( const ccGLMatrixTpl< float > &  mat)
inlinestatic

Definition at line 67 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::data().

◆ toEulerAngle()

template<typename T >
void ccGLMatrixTpl< T >::toEulerAngle ( T &  rz,
T &  ry,
T &  rx 
) const
inline

Returns equivalent parameters: 3 rotation angles.

yaw(rz) pitch(ry) roll(rx)

Parameters
[out]rzangle (in radians)
[out]ryangle (in radians)
[out]rxangle (in radians)

Definition at line 422 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::ToEigenMatrix3().

Referenced by TransformInfo::setTransformation().

◆ toFile()

template<typename T >
bool ccGLMatrixTpl< T >::toFile ( QFile &  out,
short  dataVersion 
) const
inlineoverridevirtual

Saves data to binary stream.

Parameters
outoutput file (already opened)
dataVersiontarget file version (for forward/backward compatibility)
Returns
success

Reimplemented from ccSerializableObject.

Definition at line 1405 of file ecvGLMatrixTpl.h.

◆ toIdentity()

◆ toQuaternion()

template<typename T >
void ccGLMatrixTpl< T >::toQuaternion ( q[]) const
inline

Converts to a quaternion from a rotation matrix.

Parameters
qquaternion (4 values: w,x,y,z)
Returns
corresponding quaternion

Definition at line 395 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::ToEigenMatrix3().

◆ toString()

◆ toZero()

template<typename T >
virtual void ccGLMatrixTpl< T >::toZero ( )
inlinevirtual

Clears matrix.

Matrix is set to 0.

Definition at line 617 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::m_mat, and OPENGL_MATRIX_SIZE.

Referenced by MatrixDisplayDlg::clear(), BundlerImportDlg::getOptionalTransfoMatrix(), and ccGLMatrixTpl< T >::toIdentity().

◆ transpose()

template<typename T >
void ccGLMatrixTpl< T >::transpose ( )
inline

◆ transposed()

template<typename T >
ccGLMatrixTpl<T> ccGLMatrixTpl< T >::transposed ( ) const
inline

Returns transposed matrix.

Definition at line 1286 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::transpose().

Referenced by ccGraphicalTransformationTool::apply().

◆ xRotation()

template<typename T >
ccGLMatrixTpl<T> ccGLMatrixTpl< T >::xRotation ( ) const
inline

Returns the rotation component around X only.

Definition at line 555 of file ecvGLMatrixTpl.h.

References CC_MAT_R13, CC_MAT_R23, CC_MAT_R33, ccGLMatrixTpl< T >::getTranslation(), ccGLMatrixTpl< T >::setTranslation(), and ccGLMatrixTpl< T >::toIdentity().

◆ yRotation()

template<typename T >
ccGLMatrixTpl<T> ccGLMatrixTpl< T >::yRotation ( ) const
inline

Returns the rotation component around Y only.

Definition at line 578 of file ecvGLMatrixTpl.h.

References CC_MAT_R31, CC_MAT_R32, CC_MAT_R33, ccGLMatrixTpl< T >::getTranslation(), ccGLMatrixTpl< T >::setTranslation(), and ccGLMatrixTpl< T >::toIdentity().

◆ zRotation()

template<typename T >
ccGLMatrixTpl<T> ccGLMatrixTpl< T >::zRotation ( ) const
inline

Returns the rotation component around Z only.

Definition at line 601 of file ecvGLMatrixTpl.h.

References ccGLMatrixTpl< T >::getParameters(), ccGLMatrixTpl< T >::initFromParameters(), and Vector3Tpl< Type >::norm2().

Member Data Documentation

◆ m_mat


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