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 >:
[legend]
Collaboration diagram for ccGLMatrixTpl< T >:
[legend]

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...
 
T 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

T 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

Constructor & Destructor Documentation

◆ ccGLMatrixTpl() [1/9]

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

Copy Function.

◆ ccGLMatrixTpl() [2/9]

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

◆ ccGLMatrixTpl() [3/9]

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

◆ ccGLMatrixTpl() [4/9]

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

◆ ccGLMatrixTpl() [5/9]

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

Default constructor.

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

◆ ccGLMatrixTpl() [6/9]

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

Copy constructor.

◆ 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)

◆ 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)

◆ 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)

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

◆ apply() [2/6]

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ applyRotation() [4/4]

◆ 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)

◆ 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)

Referenced by ccGLMatrixTpl< float >::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)

◆ 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)

◆ 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)

◆ 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)

Referenced by ccGLMatrixTpl< float >::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)

◆ 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)

◆ 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)

◆ 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)

Referenced by ccGLMatrixTpl< float >::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)

◆ 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)

◆ 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)

◆ 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)

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

◆ clearTranslation()

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

Clears translation.

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

Referenced by ccGLMatrixTpl< float >::FromEigenMatrix3(), and ecvDisplayTools::SetupProjectiveViewport().

◆ data() [1/2]

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

Returns a pointer to internal data.

Referenced by MainWindow::addToDB(), ccGraphicalTransformationTool::apply(), ccPointCloud::applyRigidTransformation(), CorrespondenceMatching::applyTransformation(), TemplateAlignment::applyTransformation(), ccGBLSensor::applyViewport(), NurbsCurveFitting::compute(), FastGlobalRegistrationFilter::compute(), ccEntityAction::computeNormals(), ccCameraSensor::computeProjectionMatrix(), ecvViewportParameters::computeScaleMatrix(), DecodeRotation(), DecodeTransformation(), ccPointPair::drawMeOnly(), cc2DViewportLabel::drawMeOnly(), ccTrace::drawMeOnly(), MatrixDisplayDlg::fillDialogWith(), FromCCLibMatrix(), ccGLMatrixTpl< float >::FromQuaternion(), ccGLMatrixTpl< float >::FromString(), ccGLMatrixTpl< float >::FromViewDirAndUpDir(), ecvGenericDisplayTools::Frustum(), PclFiltersTool::get(), ecvDisplayTools::GetGLCameraParameters(), cvStreamlineFilter::getInteractorTransformation(), cvProbeFilter::getInteractorTransformation(), cvCutFilter::getInteractorTransformation(), BundlerImportDlg::getOptionalTransfoMatrix(), GetPoseInformation(), ecvViewportParameters::getUpDir(), ecvViewportParameters::getViewDir(), Frustum::initfromMPMatrix(), ccCamSensorProjectionDlg::initWithCamSensor(), ccGBLSensorProjectionDlg::initWithGBLSensor(), PTXFilter::loadFile(), PovFilter::loadFile(), FBXFilter::loadFile(), LoadImage(), qSRA::loadProfile(), LoadScan(), cloudViewer::ModelViewerWidget::ModelViewMatrix(), MainWindow::onItemPicked(), ccGLMatrixTpl< float >::operator=(), ecvGenericDisplayTools::Ortho(), ecvGenericDisplayTools::Perspective(), ccCloudLayersHelper::projectCloud(), ecvDisplayTools::RenderText(), SaveImage(), SavePoseInformation(), SaveScan(), PovFilter::saveToFile(), ccPointCloud::scale(), PclUtils::PCLVis::setModelViewMatrix(), TransformInfo::setTransformation(), ccGLMatrixTpl< float >::ToEigenMatrix3(), ccGLMatrixTpl< float >::ToEigenMatrix4(), PCLDisplayTools::transformCameraProjection(), PCLDisplayTools::transformCameraView(), ecvGenericDisplayTools::Unproject(), ccCamSensorProjectionDlg::updateCamSensor(), ecvDisplayTools::UpdateDisplayParameters(), and ccGBLSensorProjectionDlg::updateGBLSensor().

◆ data() [2/2]

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

Returns a const pointer to internal data.

◆ 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.

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

◆ 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.

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

Referenced by CleanMatrix(), qFacets::exportFacets(), ccGLMatrixTpl< float >::getColumnAsVec3D(), Mouse3DInput::GetMatrix(), PTXFilter::loadFile(), PDMSFilter::loadFile(), PcdFilter::loadFile(), PcdFilter::saveToFile(), and ccGLMatrixTpl< float >::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

◆ getColumnAsVec3D()

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

◆ getParameters() [1/2]

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

Returns equivalent parameters: a rotation axis, an angle and a translation

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

Referenced by ccGraphicalTransformationTool::apply(), MatrixDisplayDlg::fillDialogWith(), ccGLMatrixTpl< float >::Interpolate(), TransformInfo::setTransformation(), ccApplyTransformationDlg::updateAll(), and ccGLMatrixTpl< float >::zRotation().

◆ 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

◆ getTranslation() [1/2]

◆ 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.

◆ getTranslationAsVec3D()

◆ initFromParameters() [1/2]

◆ initFromParameters() [2/2]

template<typename T >
void ccGLMatrixTpl< T >::initFromParameters ( T  phi_rad,
T  theta_rad,
T  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

◆ Interpolate()

template<typename T >
static ccGLMatrixTpl ccGLMatrixTpl< T >::Interpolate ( T  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

◆ inverse()

◆ invert()

◆ isIdentity()

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

Returns whether this matrix is equal to identity.

Referenced by ccHObject::minimumFileVersion().

◆ isSerializable()

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

Returns whether object is serializable of not.

Reimplemented from ccSerializableObject.

◆ 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.

Referenced by ecvViewportParameters::minimumFileVersion(), ccGenericPrimitive::minimumFileVersion_MeOnly(), and ccSensor::minimumFileVersion_MeOnly().

◆ 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

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

◆ operator()()

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

Returns the value at a given position.

◆ operator*() [1/5]

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

Multiplication by a matrix operator.

◆ 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)

◆ 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)

◆ operator*() [4/5]

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

Multiplication by a vector operator (double version)

◆ operator*() [5/5]

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

Multiplication by a vector operator (float version)

◆ operator*=()

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

(in place) Multiplication operator

◆ operator+=() [1/3]

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

(in place) Addition operator

◆ operator+=() [2/3]

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

(in place) Forward translation operator (double version)

◆ operator+=() [3/3]

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

(in place) Forward translation operator (float version)

◆ operator-=() [1/3]

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

(in place) Difference operator

◆ operator-=() [2/3]

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

(in place) Backward translation operator (double version)

◆ operator-=() [3/3]

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

(in place) Backward translation operator (float version)

◆ operator=() [1/5]

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

Copy assignment operator.

◆ operator=() [2/5]

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

◆ 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

◆ operator=() [5/5]

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

Assignment Function.

◆ 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

◆ 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

◆ scale()

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

Scales the whole matrix.

Parameters
coefscaling coef.

◆ scaleColumn()

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

Scales one column of the matrix.

Parameters
colIndex(0-3)
coefscaling coef.

◆ scaleLine()

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

Scales one line of the matrix.

Parameters
lineIndex(0-3)
coefscaling coef.

◆ scaleRotation()

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

Scales the rotation part of the matrix.

Parameters
coefscaling coef.

◆ scaleRow()

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

Scales one row of the matrix.

Parameters
rowIndextow index (0-3)
coefscaling coef.

◆ 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

◆ 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

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

◆ setRotation() [2/2]

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

◆ 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

◆ 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

◆ setTranslation() [3/4]

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

Sets translation (double version)

Parameters
Tr3D vector

◆ setTranslation() [4/4]

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

◆ 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'.

Referenced by FromCCLibMatrix(), ccMesh::Rotate(), and ccPointCloud::Rotate().

◆ 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

◆ 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.

Referenced by MatrixDisplayDlg::exportToASCII().

◆ ToEigenMatrix3() [1/2]

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

◆ 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

◆ ToEigenMatrix4() [2/2]

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

◆ 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)

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.

◆ toIdentity()

◆ toQuaternion()

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

Converts to a quaternion from a rotation matrix.

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

◆ toString()

◆ toZero()

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

◆ transpose()

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

◆ transposed()

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

◆ xRotation()

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

Returns the rotation component around X only.

◆ yRotation()

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

Returns the rotation component around Y only.

◆ zRotation()

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

Returns the rotation component around Z only.

Member Data Documentation

◆ m_mat


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