GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
GLC_Matrix4x4 Class Reference

GLC_Matrix4x4 is a 4 dimensions Matrix. More...

#include <glc_matrix4x4.h>

Public Types

enum  { General = 0x0000, Direct = 0x0001, Indirect = 0x0002, Identity = 0x0003 }
 matrix possible type More...
 

Public Member Functions

Constructor
 GLC_Matrix4x4 ()
 Construct an identity matrix.
 
 GLC_Matrix4x4 (const GLC_Matrix4x4 &matrix)
 Construct a matrix from another matrix.
 
 GLC_Matrix4x4 (const double *pArray)
 Construct a matrix from an array of 16 double elements.
 
 GLC_Matrix4x4 (const float *)
 Construct a Matrix from an array of 16 float elements.
 
 GLC_Matrix4x4 (const GLC_Vector3d &Vect, const double &dAngleRad)
 Construct rotation matrix from a 3d vector and an angle in radians.
 
 GLC_Matrix4x4 (const GLC_Vector3d &Vect1, const GLC_Vector3d &Vect2)
 Construct rotation matrix from 2 3d vectors.
 
 GLC_Matrix4x4 (const GLC_Vector3d &Vect)
 Construct translation matrix from a 3d vector.
 
 GLC_Matrix4x4 (const double Tx, const double Ty, const double Tz)
 Construct translation matrix from coordinates in double.
 
Operator Overload
GLC_Matrix4x4operator= (const GLC_Matrix4x4 &matrix)
 Copy the content of the given matrix in this matrix.
 
GLC_Matrix4x4 operator* (const GLC_Matrix4x4 &Mat) const
 Return the product of this matrix to the given matrix.
 
GLC_Vector3d operator* (const GLC_Vector3d &Vect) const
 Return the result of transforming the given vector by this matrix.
 
bool operator== (const GLC_Matrix4x4 &mat) const
 Return true if this matrix is equal to the given matrix.
 
bool operator!= (const GLC_Matrix4x4 &mat) const
 Return true if this matrix is not equal to the given matrix.
 
Get Function
double determinant (void) const
 Return the determinant of this matrix.
 
const double * getData (void)
 Return a pointer to the row first array of 16 elements of this matrix.
 
const double * getData (void) const
 Return a const pointer to the row first array of 16 elements of this matrix.
 
double * setData (void)
 Return a pointer to the row first array of 16 elements of this matrix.
 
QVector< double > toEuler (void) const
 Return a QVector<double> which contains radians Euler angle of this matrix.
 
QString toString () const
 Return the string representation of this matrix.
 
GLC_Matrix4x4 rotationMatrix () const
 Return the rotation matrix of this matrix.
 
GLC_Matrix4x4 isometricMatrix () const
 Return the isometric matrix of this matrix.
 
double scalingX () const
 Return the x Scaling of this matrix.
 
double scalingY () const
 Return the y Scaling of this matrix.
 
double scalingZ () const
 Return the z Scaling of this matrix.
 
GLC_Matrix4x4 inverted () const
 Return the inverse of this matrix.
 
int type () const
 Return The type af this matrix.
 
bool isDirect () const
 Return true if this matrix is direct.
 
double trace () const
 Return this matrix trace.
 
QQuaternion quaternion () const
 Return the quaternion of this matrix.
 
QPair< GLC_Vector3d, double > rotationVectorAndAngle () const
 Return the rotation vector and angle of this matrix.
 
Set Function
GLC_Matrix4x4setMatRot (const GLC_Vector3d &, const double &)
 Set this matrix to a rotation matrix given by a 3d vector and an angle in radian.
 
GLC_Matrix4x4setMatRot (const GLC_Vector3d &, const GLC_Vector3d &)
 Set this matrix to a rotation matrix given by 2 3d vectors.
 
GLC_Matrix4x4setMatTranslate (const GLC_Vector3d &)
 Set this matrix to a translation matrix given by a 3d vector.
 
GLC_Matrix4x4setMatTranslate (const double, const double, const double)
 Set this matrix to a translation matrix given by 3 double coordinates.
 
GLC_Matrix4x4setMatScaling (const double, const double, const double)
 Set this matrix to a scaling matrix define by 3 double.
 
GLC_Matrix4x4invert (void)
 Inverse this Matrix and return a reference to this matrix.
 
GLC_Matrix4x4setToIdentity ()
 Set this matrix to the identify matrix and return a reference to this matrix.
 
GLC_Matrix4x4transpose (void)
 Transpose this matrix and return a reference to this matrix.
 
GLC_Matrix4x4fromEuler (const double, const double, const double)
 Set this matrix with Euler angle and return a reference to this matrix.
 
GLC_Matrix4x4setColumn (int index, const GLC_Vector3d &vector)
 Set this matrix column from the given 3d vector.
 
GLC_Matrix4x4optimise (bool force=false)
 Optimise the usage of this matrix (Genral, Direct, Identity)
 

Private Types

enum  { TAILLEMAT4X4 = 16 }
 Number of elements of this matrix. More...
 
enum  { DIMMAT4X4 = 4 }
 Matrix size. More...
 

Private Member Functions

bool isInDiagonal (const int index) const
 Return true if the index (argument) is in the diagonal of this matrix.
 
double getDeterminantLC (const int, const int) const
 Return the determinant of this matrix cell given from 2 int.
 
void getSubMat (const int, const int, double *) const
 Compute Sub 3X3 matrix given by 2 int and set the given double pointeur.
 
GLC_Matrix4x4 getTranspose (void) const
 Return the transpose matrix of this matrix.
 
GLC_Matrix4x4 getCoMat4x4 (void) const
 Return the co-matrix of this matrix.
 

Private Attributes

double m_Matrix [TAILLEMAT4X4]
 Matrix row first array.
 
int m_Type
 the type of this matrix
 

Friends

class GLC_Vector3d
 

Detailed Description

GLC_Matrix4x4 is a 4 dimensions Matrix.

GLC_Matrix4x4 is used to represent 3d homogeneous transformation in 3d space
GLC_Matrix4x4 is a row first matrix compatible with OpenGL Matrix

Definition at line 44 of file glc_matrix4x4.h.

Member Enumeration Documentation

anonymous enum

matrix possible type

Enumerator
General 
Direct 
Indirect 
Identity 

Definition at line 49 of file glc_matrix4x4.h.

anonymous enum
private

Number of elements of this matrix.

Enumerator
TAILLEMAT4X4 

Definition at line 269 of file glc_matrix4x4.h.

anonymous enum
private

Matrix size.

Enumerator
DIMMAT4X4 

Definition at line 272 of file glc_matrix4x4.h.

Constructor & Destructor Documentation

GLC_Matrix4x4::GLC_Matrix4x4 ( )
inline

Construct an identity matrix.

Definition at line 299 of file glc_matrix4x4.h.

References setToIdentity().

Referenced by quaternion(), and rotationVectorAndAngle().

GLC_Matrix4x4::GLC_Matrix4x4 ( const GLC_Matrix4x4 matrix)
inline

Construct a matrix from another matrix.

Definition at line 67 of file glc_matrix4x4.h.

References m_Matrix.

GLC_Matrix4x4::GLC_Matrix4x4 ( const double *  pArray)
inline

Construct a matrix from an array of 16 double elements.

Definition at line 74 of file glc_matrix4x4.h.

GLC_Matrix4x4::GLC_Matrix4x4 ( const float *  Tableau)
inline

Construct a Matrix from an array of 16 float elements.

Definition at line 305 of file glc_matrix4x4.h.

References m_Matrix, and TAILLEMAT4X4.

GLC_Matrix4x4::GLC_Matrix4x4 ( const GLC_Vector3d Vect,
const double &  dAngleRad 
)
inline

Construct rotation matrix from a 3d vector and an angle in radians.

Definition at line 314 of file glc_matrix4x4.h.

References setMatRot(), and setToIdentity().

GLC_Matrix4x4::GLC_Matrix4x4 ( const GLC_Vector3d Vect1,
const GLC_Vector3d Vect2 
)
inline

Construct rotation matrix from 2 3d vectors.

Definition at line 321 of file glc_matrix4x4.h.

References setMatRot(), and setToIdentity().

GLC_Matrix4x4::GLC_Matrix4x4 ( const GLC_Vector3d Vect)
inline

Construct translation matrix from a 3d vector.

Definition at line 90 of file glc_matrix4x4.h.

GLC_Matrix4x4::GLC_Matrix4x4 ( const double  Tx,
const double  Ty,
const double  Tz 
)
inline

Construct translation matrix from coordinates in double.

Definition at line 94 of file glc_matrix4x4.h.

Member Function Documentation

double GLC_Matrix4x4::determinant ( void  ) const
inline

Return the determinant of this matrix.

Definition at line 664 of file glc_matrix4x4.h.

References DIMMAT4X4, getDeterminant3x3(), getSubMat(), and m_Matrix.

Referenced by invert(), and optimise().

GLC_Matrix4x4 & GLC_Matrix4x4::fromEuler ( const double  angle_x,
const double  angle_y,
const double  angle_z 
)

Set this matrix with Euler angle and return a reference to this matrix.

Definition at line 32 of file glc_matrix4x4.cpp.

References m_Matrix.

GLC_Matrix4x4 GLC_Matrix4x4::getCoMat4x4 ( void  ) const
inlineprivate

Return the co-matrix of this matrix.

Definition at line 750 of file glc_matrix4x4.h.

References DIMMAT4X4, General, getDeterminant3x3(), getSubMat(), m_Matrix, and m_Type.

Referenced by invert().

const double* GLC_Matrix4x4::getData ( void  )
inline

Return a pointer to the row first array of 16 elements of this matrix.

Don't modify data with this method

Definition at line 131 of file glc_matrix4x4.h.

Referenced by GLC_Context::glcLoadMatrix(), GLC_Context::glcMultMatrix(), GLC_WorldTo3dxml::matrixString(), GLC_UniformShaderData::setModelViewProjectionMatrix(), GLC_Viewport::unProject(), GLC_Viewport::unproject(), and GLC_Frustum::update().

const double* GLC_Matrix4x4::getData ( void  ) const
inline

Return a const pointer to the row first array of 16 elements of this matrix.

Definition at line 135 of file glc_matrix4x4.h.

double GLC_Matrix4x4::getDeterminantLC ( const int  Ligne,
const int  Colonne 
) const
inlineprivate

Return the determinant of this matrix cell given from 2 int.

Definition at line 680 of file glc_matrix4x4.h.

References DIMMAT4X4, getDeterminant3x3(), getSubMat(), and m_Matrix.

void GLC_Matrix4x4::getSubMat ( const int  Ligne,
const int  Colonne,
double *  ResultMat 
) const
inlineprivate

Compute Sub 3X3 matrix given by 2 int and set the given double pointeur.

Definition at line 695 of file glc_matrix4x4.h.

References DIMMAT4X4, and m_Matrix.

Referenced by determinant(), getCoMat4x4(), and getDeterminantLC().

GLC_Matrix4x4 GLC_Matrix4x4::getTranspose ( void  ) const
inlineprivate

Return the transpose matrix of this matrix.

Definition at line 730 of file glc_matrix4x4.h.

References DIMMAT4X4, m_Matrix, and m_Type.

Referenced by invert().

GLC_Matrix4x4 & GLC_Matrix4x4::invert ( void  )
inline

Inverse this Matrix and return a reference to this matrix.

Definition at line 585 of file glc_matrix4x4.h.

References determinant(), getCoMat4x4(), getTranspose(), m_Matrix, and TAILLEMAT4X4.

Referenced by GLC_3dsToWorld::createMeshes(), GLC_Camera::orbit(), and GLC_Camera::pan().

GLC_Matrix4x4 GLC_Matrix4x4::inverted ( ) const
inline

Return the inverse of this matrix.

Definition at line 170 of file glc_matrix4x4.h.

References GLC_Vector3d::GLC_Matrix4x4.

Referenced by GLC_TsrMover::move(), and GLC_UniformShaderData::setModelViewProjectionMatrix().

bool GLC_Matrix4x4::isDirect ( ) const
inline

Return true if this matrix is direct.

Definition at line 180 of file glc_matrix4x4.h.

bool GLC_Matrix4x4::isInDiagonal ( const int  index) const
inlineprivate

Return true if the index (argument) is in the diagonal of this matrix.

Definition at line 241 of file glc_matrix4x4.h.

GLC_Matrix4x4 GLC_Matrix4x4::isometricMatrix ( ) const
inline

Return the isometric matrix of this matrix.

Definition at line 451 of file glc_matrix4x4.h.

References General, m_Matrix, m_Type, scalingX(), scalingY(), and scalingZ().

Referenced by GLC_WorldTo3ds::setNodePosition().

bool GLC_Matrix4x4::operator!= ( const GLC_Matrix4x4 mat) const
inline

Return true if this matrix is not equal to the given matrix.

Definition at line 116 of file glc_matrix4x4.h.

References operator==().

GLC_Matrix4x4 GLC_Matrix4x4::operator* ( const GLC_Matrix4x4 Mat) const
inline

Return the product of this matrix to the given matrix.

Definition at line 328 of file glc_matrix4x4.h.

References DIMMAT4X4, Identity, Indirect, m_Matrix, and m_Type.

GLC_Vector3d GLC_Matrix4x4::operator* ( const GLC_Vector3d Vect) const
inline

Return the result of transforming the given vector by this matrix.

Definition at line 381 of file glc_matrix4x4.h.

References DIMMAT4X4, m_Matrix, and GLC_Vector3d::m_Vector.

GLC_Matrix4x4 & GLC_Matrix4x4::operator= ( const GLC_Matrix4x4 matrix)
inline

Copy the content of the given matrix in this matrix.

Definition at line 373 of file glc_matrix4x4.h.

References m_Matrix, and m_Type.

bool GLC_Matrix4x4::operator== ( const GLC_Matrix4x4 mat) const
inline

Return true if this matrix is equal to the given matrix.

Definition at line 412 of file glc_matrix4x4.h.

References glc::EPSILON, m_Matrix, and TAILLEMAT4X4.

GLC_Matrix4x4 & GLC_Matrix4x4::optimise ( bool  force = false)
inline

Optimise the usage of this matrix (Genral, Direct, Identity)

Definition at line 637 of file glc_matrix4x4.h.

References determinant(), Direct, General, Identity, Indirect, m_Matrix, and m_Type.

Referenced by GLC_ColladaToWorld::composeMatrixNode(), GLC_3dsToWorld::createMeshes(), GLC_3dxmlToWorld::loadMatrix(), and GLC_ColladaToWorld::scaleNode().

QQuaternion GLC_Matrix4x4::quaternion ( ) const

Return the quaternion of this matrix.

Definition at line 124 of file glc_matrix4x4.cpp.

References GLC_Matrix4x4(), Identity, m_Matrix, rotationMatrix(), trace(), and type().

Referenced by rotationVectorAndAngle(), and GLC_WorldTo3ds::setNodePosition().

GLC_Matrix4x4 GLC_Matrix4x4::rotationMatrix ( ) const
inline
QPair< GLC_Vector3d, double > GLC_Matrix4x4::rotationVectorAndAngle ( ) const

Return the rotation vector and angle of this matrix.

Definition at line 177 of file glc_matrix4x4.cpp.

References GLC_Matrix4x4(), GLC_Vector3d, Identity, and quaternion().

Referenced by GLC_WorldTo3ds::setNodePosition().

double GLC_Matrix4x4::scalingX ( ) const
inline
double GLC_Matrix4x4::scalingY ( ) const
inline

Return the y Scaling of this matrix.

Definition at line 162 of file glc_matrix4x4.h.

References GLC_Vector3d::GLC_Vector3d().

Referenced by isometricMatrix(), rotationMatrix(), and GLC_WorldTo3ds::setNodePosition().

double GLC_Matrix4x4::scalingZ ( ) const
inline

Return the z Scaling of this matrix.

Definition at line 166 of file glc_matrix4x4.h.

References GLC_Vector3d::GLC_Vector3d().

Referenced by isometricMatrix(), rotationMatrix(), and GLC_WorldTo3ds::setNodePosition().

GLC_Matrix4x4 & GLC_Matrix4x4::setColumn ( int  index,
const GLC_Vector3d vector 
)

Set this matrix column from the given 3d vector.

Definition at line 60 of file glc_matrix4x4.cpp.

References General, m_Matrix, m_Type, GLC_Vector3d::x(), GLC_Vector3d::y(), and GLC_Vector3d::z().

Referenced by GLC_Arrow::createWire().

double* GLC_Matrix4x4::setData ( void  )
inline

Return a pointer to the row first array of 16 elements of this matrix.

Definition at line 139 of file glc_matrix4x4.h.

Referenced by GLC_Camera::createMatComp(), GLC_Context::glcFrustum(), and GLC_Context::glcOrtho().

GLC_Matrix4x4 & GLC_Matrix4x4::setMatRot ( const GLC_Vector3d Vect,
const double &  dAngleRad 
)
inline
GLC_Matrix4x4 & GLC_Matrix4x4::setMatRot ( const GLC_Vector3d v1,
const GLC_Vector3d v2 
)
inline

Set this matrix to a rotation matrix given by 2 3d vectors.

Definition at line 518 of file glc_matrix4x4.h.

References GLC_Vector3d::isNull(), normalize(), glc::PI, setMatRot(), glc::Y_AXIS(), and glc::Z_AXIS().

GLC_Matrix4x4 & GLC_Matrix4x4::setMatScaling ( const double  sX,
const double  sY,
const double  sZ 
)
inline

Set this matrix to a scaling matrix define by 3 double.

Definition at line 572 of file glc_matrix4x4.h.

References General, m_Matrix, and m_Type.

Referenced by GLC_Context::glcScaled(), GLC_Axis::moveManipulatorRep(), GLC_CuttingPlane::moveManipulatorRep(), and GLC_ColladaToWorld::scaleNode().

GLC_Matrix4x4 & GLC_Matrix4x4::setMatTranslate ( const GLC_Vector3d Vect)
inline

Set this matrix to a translation matrix given by a 3d vector.

Definition at line 548 of file glc_matrix4x4.h.

References Direct, m_Matrix, m_Type, and GLC_Vector3d::m_Vector.

Referenced by GLC_Interpolator::CalcInterpolLineaireMat(), GLC_RepCrossMover::createCrossInstance(), glc::gluLookAt(), and GLC_Axis::moveManipulatorRep().

GLC_Matrix4x4 & GLC_Matrix4x4::setMatTranslate ( const double  Tx,
const double  Ty,
const double  Tz 
)
inline

Set this matrix to a translation matrix given by 3 double coordinates.

Definition at line 560 of file glc_matrix4x4.h.

References Direct, m_Matrix, and m_Type.

GLC_Matrix4x4 & GLC_Matrix4x4::setToIdentity ( )
inline

Set this matrix to the identify matrix and return a reference to this matrix.

Definition at line 603 of file glc_matrix4x4.h.

References Identity, m_Matrix, and m_Type.

Referenced by GLC_Interpolator::CalcInterpolAngulaireMat(), GLC_Interpolator::CalcInterpolLineaireMat(), GLC_Matrix4x4(), and GLC_3DViewInstance::resetMatrix().

QVector< double > GLC_Matrix4x4::toEuler ( void  ) const

Return a QVector<double> which contains radians Euler angle of this matrix.

Definition at line 76 of file glc_matrix4x4.cpp.

References glc::EPSILON, m_Matrix, and glc::PI.

QString GLC_Matrix4x4::toString ( ) const

Return the string representation of this matrix.

Definition at line 110 of file glc_matrix4x4.cpp.

References DIMMAT4X4, and m_Matrix.

double GLC_Matrix4x4::trace ( ) const
inline

Return this matrix trace.

Definition at line 184 of file glc_matrix4x4.h.

Referenced by quaternion().

GLC_Matrix4x4 & GLC_Matrix4x4::transpose ( void  )
inline

Transpose this matrix and return a reference to this matrix.

Definition at line 615 of file glc_matrix4x4.h.

References DIMMAT4X4, and m_Matrix.

Referenced by GLC_UniformShaderData::setModelViewProjectionMatrix().

int GLC_Matrix4x4::type ( ) const
inline

Return The type af this matrix.

Definition at line 174 of file glc_matrix4x4.h.

Referenced by GLC_WorldTo3ds::createMeshsFrom3DRep(), quaternion(), GLC_3DViewInstance::render(), and GLC_Mesh::transformVertice().

Friends And Related Function Documentation

friend class GLC_Vector3d
friend

Member Data Documentation

double GLC_Matrix4x4::m_Matrix[TAILLEMAT4X4]
private
int GLC_Matrix4x4::m_Type
private

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

©2005-2013 Laurent Ribon