GLC_lib
2.5.0
|
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_Matrix4x4 & | operator= (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_Matrix4x4 & | setMatRot (const GLC_Vector3d &, const double &) |
Set this matrix to a rotation matrix given by a 3d vector and an angle in radian. | |
GLC_Matrix4x4 & | setMatRot (const GLC_Vector3d &, const GLC_Vector3d &) |
Set this matrix to a rotation matrix given by 2 3d vectors. | |
GLC_Matrix4x4 & | setMatTranslate (const GLC_Vector3d &) |
Set this matrix to a translation matrix given by a 3d vector. | |
GLC_Matrix4x4 & | setMatTranslate (const double, const double, const double) |
Set this matrix to a translation matrix given by 3 double coordinates. | |
GLC_Matrix4x4 & | setMatScaling (const double, const double, const double) |
Set this matrix to a scaling matrix define by 3 double. | |
GLC_Matrix4x4 & | invert (void) |
Inverse this Matrix and return a reference to this matrix. | |
GLC_Matrix4x4 & | setToIdentity () |
Set this matrix to the identify matrix and return a reference to this matrix. | |
GLC_Matrix4x4 & | transpose (void) |
Transpose this matrix and return a reference to this matrix. | |
GLC_Matrix4x4 & | fromEuler (const double, const double, const double) |
Set this matrix with Euler angle and return a reference to this matrix. | |
GLC_Matrix4x4 & | setColumn (int index, const GLC_Vector3d &vector) |
Set this matrix column from the given 3d vector. | |
GLC_Matrix4x4 & | optimise (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 |
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.
anonymous enum |
matrix possible type
Enumerator | |
---|---|
General | |
Direct | |
Indirect | |
Identity |
Definition at line 49 of file glc_matrix4x4.h.
|
private |
Number of elements of this matrix.
Enumerator | |
---|---|
TAILLEMAT4X4 |
Definition at line 269 of file glc_matrix4x4.h.
|
private |
|
inline |
Construct an identity matrix.
Definition at line 299 of file glc_matrix4x4.h.
References setToIdentity().
Referenced by quaternion(), and rotationVectorAndAngle().
|
inline |
Construct a matrix from another matrix.
Definition at line 67 of file glc_matrix4x4.h.
References m_Matrix.
|
inline |
Construct a matrix from an array of 16 double elements.
Definition at line 74 of file glc_matrix4x4.h.
|
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.
|
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().
|
inline |
Construct rotation matrix from 2 3d vectors.
Definition at line 321 of file glc_matrix4x4.h.
References setMatRot(), and setToIdentity().
|
inline |
Construct translation matrix from a 3d vector.
Definition at line 90 of file glc_matrix4x4.h.
|
inline |
Construct translation matrix from coordinates in double.
Definition at line 94 of file glc_matrix4x4.h.
|
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.
|
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().
|
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().
|
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.
|
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.
|
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().
|
inlineprivate |
|
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().
|
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().
|
inline |
Return true if this matrix is direct.
Definition at line 180 of file glc_matrix4x4.h.
|
inlineprivate |
Return true if the index (argument) is in the diagonal of this matrix.
Definition at line 241 of file glc_matrix4x4.h.
|
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().
|
inline |
Return true if this matrix is not equal to the given matrix.
Definition at line 116 of file glc_matrix4x4.h.
References operator==().
|
inline |
|
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.
|
inline |
Copy the content of the given matrix in this matrix.
Definition at line 373 of file glc_matrix4x4.h.
|
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.
|
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().
|
inline |
Return the rotation matrix of this matrix.
Definition at line 424 of file glc_matrix4x4.h.
References General, m_Matrix, m_Type, scalingX(), scalingY(), and scalingZ().
Referenced by GLC_Camera::move(), GLC_CuttingPlane::moveManipulatorRep(), quaternion(), GLC_CuttingPlane::rotationNavigator(), and GLC_Mesh::transformVertice().
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().
|
inline |
Return the x Scaling of this matrix.
Definition at line 158 of file glc_matrix4x4.h.
References GLC_Vector3d::GLC_Vector3d().
Referenced by GLC_3DViewInstance::choseLod(), isometricMatrix(), rotationMatrix(), GLC_WorldTo3ds::setNodePosition(), and GLC_OctreeNode::updateViewableInstances().
|
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().
|
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().
|
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().
|
inline |
Set this matrix to a rotation matrix given by a 3d vector and an angle in radian.
Definition at line 474 of file glc_matrix4x4.h.
References Direct, m_Matrix, m_Type, GLC_Vector3d::m_Vector, and GLC_Vector3d::normalize().
Referenced by GLC_Interpolator::CalcInterpolAngulaireMat(), GLC_CuttingPlane::GLC_CuttingPlane(), GLC_Matrix4x4(), GLC_RepTrackBallMover::GLC_RepTrackBallMover(), GLC_RepTrackBallMover::init(), GLC_Axis::moveManipulatorRep(), GLC_CuttingPlane::moveManipulatorRep(), glc::polygonIn2d(), setMatRot(), and glc::triangulatePolygon().
|
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().
|
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().
|
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().
|
inline |
Set this matrix to a translation matrix given by 3 double coordinates.
Definition at line 560 of file glc_matrix4x4.h.
|
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.
|
inline |
Return this matrix trace.
Definition at line 184 of file glc_matrix4x4.h.
Referenced by quaternion().
|
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().
|
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().
|
friend |
Definition at line 46 of file glc_matrix4x4.h.
Referenced by GLC_Vector3d::inverted(), GLC_Vector3d::operator*(), GLC_Vector3d::operator+(), GLC_Vector3d::operator-(), rotationVectorAndAngle(), and GLC_Vector4d::toVector3d().
|
private |
Matrix row first array.
Definition at line 275 of file glc_matrix4x4.h.
Referenced by determinant(), fromEuler(), getCoMat4x4(), getDeterminantLC(), getSubMat(), getTranspose(), GLC_Matrix4x4(), invert(), isometricMatrix(), operator*(), operator=(), operator==(), optimise(), quaternion(), rotationMatrix(), setColumn(), setMatRot(), setMatScaling(), setMatTranslate(), setToIdentity(), toEuler(), toString(), and transpose().
|
private |
the type of this matrix
Definition at line 278 of file glc_matrix4x4.h.
Referenced by getCoMat4x4(), getTranspose(), isometricMatrix(), operator*(), operator=(), optimise(), rotationMatrix(), setColumn(), setMatRot(), setMatScaling(), setMatTranslate(), and setToIdentity().