(just fixed a warning-producing redundant assert)
This commit is contained in:
parent
2c3d20ca40
commit
90cdbb6214
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Annotations:
|
Annotations:
|
||||||
Opengl stores matrix in column-major order. That is, the matrix is stored as:
|
Opengl stores matrix in column-major order. That is, the matrix is stored as:
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ for 'column' vectors.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** This class represent a 4x4 matrix. T is the kind of element in the matrix.
|
/** This class represent a 4x4 matrix. T is the kind of element in the matrix.
|
||||||
*/
|
*/
|
||||||
template <class T> class Matrix44 {
|
template <class T> class Matrix44 {
|
||||||
protected:
|
protected:
|
||||||
|
@ -78,7 +78,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
typedef T ScalarType;
|
typedef T ScalarType;
|
||||||
|
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/** $name Constructors
|
/** $name Constructors
|
||||||
* No automatic casting and default constructor is empty
|
* No automatic casting and default constructor is empty
|
||||||
|
@ -462,7 +462,7 @@ template <class T> Matrix44<T> &Matrix44<T>::SetTranslate(const T tx, const T ty
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> Matrix44<T> &Matrix44<T>::SetColumn(const unsigned int ii,const Point3<T> &t) {
|
template <class T> Matrix44<T> &Matrix44<T>::SetColumn(const unsigned int ii,const Point3<T> &t) {
|
||||||
assert((ii >= 0) && (ii < 4));
|
assert( ii < 4 );
|
||||||
ElementAt(0, ii) = t.X();
|
ElementAt(0, ii) = t.X();
|
||||||
ElementAt(1, ii) = t.Y();
|
ElementAt(1, ii) = t.Y();
|
||||||
ElementAt(2, ii) = t.Z();
|
ElementAt(2, ii) = t.Z();
|
||||||
|
@ -470,7 +470,7 @@ template <class T> Matrix44<T> &Matrix44<T>::SetColumn(const unsigned int ii,con
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> Matrix44<T> &Matrix44<T>::SetColumn(const unsigned int ii,const Point4<T> &t) {
|
template <class T> Matrix44<T> &Matrix44<T>::SetColumn(const unsigned int ii,const Point4<T> &t) {
|
||||||
assert((ii < 4));
|
assert( ii < 4 );
|
||||||
ElementAt(0, ii) = t[0];
|
ElementAt(0, ii) = t[0];
|
||||||
ElementAt(1, ii) = t[1];
|
ElementAt(1, ii) = t[1];
|
||||||
ElementAt(2, ii) = t[2];
|
ElementAt(2, ii) = t[2];
|
||||||
|
@ -512,11 +512,11 @@ template <class T> Matrix44<T> &Matrix44<T>::SetRotateRad(T AngleRad, const Poin
|
||||||
/*
|
/*
|
||||||
Given a non singular, non projective matrix (e.g. with the last row equal to [0,0,0,1] )
|
Given a non singular, non projective matrix (e.g. with the last row equal to [0,0,0,1] )
|
||||||
This procedure decompose it in a sequence of
|
This procedure decompose it in a sequence of
|
||||||
Scale,Shear,Rotation e Translation
|
- Scale,Shear,Rotation e Translation
|
||||||
|
|
||||||
- ScaleV and Tranv are obiviously scaling and translation.
|
- ScaleV and Tranv are obiviously scaling and translation.
|
||||||
- ShearV contains three scalars with, respectively
|
- ShearV contains three scalars with, respectively,
|
||||||
ShearXY, ShearXZ e ShearYZ
|
ShearXY, ShearXZ and ShearYZ
|
||||||
- RotateV contains the rotations (in degree!) around the x,y,z axis
|
- RotateV contains the rotations (in degree!) around the x,y,z axis
|
||||||
The input matrix is modified leaving inside it a simple roto translation.
|
The input matrix is modified leaving inside it a simple roto translation.
|
||||||
|
|
||||||
|
@ -558,6 +558,7 @@ double srv() { return (double(rand()%40)-20)/2.0; } // small random value
|
||||||
// Now Rebuild is equal to StartM
|
// Now Rebuild is equal to StartM
|
||||||
Matrix44d RebuildM = Trn * Rtx*Rty*Rtz * Syz*Sxz*Sxy * Scl ;
|
Matrix44d RebuildM = Trn * Rtx*Rty*Rtz * Syz*Sxz*Sxy * Scl ;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
bool Decompose(Matrix44<T> &M, Point3<T> &ScaleV, Point3<T> &ShearV, Point3<T> &RotV,Point3<T> &TranV)
|
bool Decompose(Matrix44<T> &M, Point3<T> &ScaleV, Point3<T> &ShearV, Point3<T> &RotV,Point3<T> &TranV)
|
||||||
{
|
{
|
||||||
|
@ -568,7 +569,6 @@ bool Decompose(Matrix44<T> &M, Point3<T> &ScaleV, Point3<T> &ShearV, Point3<T> &
|
||||||
// First Step recover the traslation
|
// First Step recover the traslation
|
||||||
TranV=M.GetColumn3(3);
|
TranV=M.GetColumn3(3);
|
||||||
|
|
||||||
|
|
||||||
// Second Step Recover Scale and Shearing interleaved
|
// Second Step Recover Scale and Shearing interleaved
|
||||||
ScaleV[0]=Norm(M.GetColumn3(0));
|
ScaleV[0]=Norm(M.GetColumn3(0));
|
||||||
Point3<T> R[3];
|
Point3<T> R[3];
|
||||||
|
|
Loading…
Reference in New Issue