compilation fixes with Eigen

This commit is contained in:
Paolo Cignoni 2009-07-21 07:29:13 +00:00
parent 1608800d69
commit 9608ec798b
3 changed files with 166 additions and 160 deletions

View File

@ -867,7 +867,7 @@ static void VertexCoordViewDepth(MeshType &m,
{
CoordType np = TD[*vi].sum/TD[*vi].cnt;
CoordType d = (*vi).cP() - viewpoint; d.Normalize();
ScalarType s = d * ( np - (*vi).cP() );
ScalarType s = d .dot ( np - (*vi).cP() );
(*vi).P() += d * (s*alpha);
}
}

View File

@ -25,7 +25,7 @@
#define EIGEN_VCGLIB
// TODO enable the vectorization
#define EIGEN_DONT_VECTORIZE
// #define EIGEN_DONT_VECTORIZE
#define EIGEN_MATRIXBASE_PLUGIN <vcg/math/eigen_matrixbase_addons.h>
#define EIGEN_MATRIX_PLUGIN <vcg/math/eigen_matrix_addons.h>

View File

@ -216,12 +216,18 @@ void Trackball::ApplyInverse() {
// T(c) S R T(t) T(-c) => S R T(S^(-1) R^(-1)(c) + t - c)
Matrix44f Trackball::Matrix() const{
#ifndef VCG_USE_EIGEN
Matrix44f r; track.rot.ToMatrix(r);
Matrix44f sr = Matrix44f().SetScale(track.sca, track.sca, track.sca) * r;
Matrix44f s_inv = Matrix44f().SetScale(1/track.sca, 1/track.sca, 1/track.sca);
Matrix44f t = Matrix44f().SetTranslate(s_inv*r.transpose()*center + track.tra - center);
return Matrix44f(sr*t);
#else
Eigen::Quaternionf rot(track.rot);
Eigen::Translation3f tr( (1/track.sca) * (rot.inverse() * center) + track.tra - center );
return ( Eigen::Scaling3f(track.sca) * (rot * tr) ).matrix();
#endif
}
Matrix44f Trackball::InverseMatrix() const{