ApplyRigidTransformation fixed

This commit is contained in:
Massimiliano Corsini 2011-05-24 12:13:21 +00:00
parent 7ff3b08e5f
commit f35731d425
1 changed files with 6 additions and 7 deletions

View File

@ -204,7 +204,7 @@ public:
void RescalingWorld(S scalefactor); void RescalingWorld(S scalefactor);
/// Given a pure roto-translation (4-by-4) modify the reference frame accordingly. /// Given a pure roto-translation (4-by-4) modify the reference frame accordingly.
void ApplyRigidTransformation(Matrix44<S> & M); void ApplyRigidTransformation(const Matrix44<S> & M);
/// convert a 3d point from world to camera coordinates (do not confuse with the Shot reference frame) /// convert a 3d point from world to camera coordinates (do not confuse with the Shot reference frame)
vcg::Point3<S> ConvertWorldToCameraCoordinates(const vcg::Point3<S> & p) const; vcg::Point3<S> ConvertWorldToCameraCoordinates(const vcg::Point3<S> & p) const;
@ -467,7 +467,7 @@ void Shot<S, RotationType>::RescalingWorld(S scalefactor)
/// Given a pure roto-translation matrix (4-by-4) modify the reference frame accordingly. /// Given a pure roto-translation matrix (4-by-4) modify the reference frame accordingly.
template <class S, class RotationType> template <class S, class RotationType>
void Shot<S, RotationType>::ApplyRigidTransformation(Matrix44<S> & M) void Shot<S, RotationType>::ApplyRigidTransformation(const Matrix44<S> & M)
{ {
Matrix44<S> currentM; Matrix44<S> currentM;
Matrix44<S> rotM; Matrix44<S> rotM;
@ -476,12 +476,11 @@ void Shot<S, RotationType>::ApplyRigidTransformation(Matrix44<S> & M)
// roto-translate the viewpoint // roto-translate the viewpoint
Extrinsics.tra = M * Extrinsics.tra; Extrinsics.tra = M * Extrinsics.tra;
// nullify translation
M.ElementAt(0,3) = 0;
M.ElementAt(1,3) = 0;
M.ElementAt(2,3) = 0;
Extrinsics.rot = rotM * M.transpose(); Extrinsics.rot = rotM * M.transpose();
Extrinsics.rot.ElementAt(3,0) = 0;
Extrinsics.rot.ElementAt(3,1) = 0;
Extrinsics.rot.ElementAt(3,2) = 0;
} }