FromTrackball() corrected
This commit is contained in:
parent
0233f3799a
commit
abaae0c2fd
wrap/gl
|
@ -23,6 +23,9 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
History
|
History
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.4 2004/12/15 18:45:06 tommyfranken
|
||||||
|
*** empty log message ***
|
||||||
|
|
||||||
Revision 1.3 2004/11/03 09:41:57 ganovelli
|
Revision 1.3 2004/11/03 09:41:57 ganovelli
|
||||||
added FromTrackball and fixed include names (Poiint to point)
|
added FromTrackball and fixed include names (Poiint to point)
|
||||||
|
|
||||||
|
@ -116,23 +119,25 @@ static void UnsetView()
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
}
|
}
|
||||||
|
|
||||||
// takes a shot and a trackball and retursn the shot corresponding to the transformation
|
/**********************************
|
||||||
// applied by the trackball
|
DEFINE SHOT FROM TRACKBALL
|
||||||
|
Adds to a given shot the trackball transformations.
|
||||||
|
After this operation the trackball should be resetted, to avoid
|
||||||
|
multiple apply of the same transformation.
|
||||||
|
***********************************/
|
||||||
static void FromTrackball(const vcg::Trackball & tr,
|
static void FromTrackball(const vcg::Trackball & tr,
|
||||||
const vcg::Shot<ScalarType> & sShot,
|
const vcg::Shot<ScalarType> & sShot,
|
||||||
vcg::Shot<ScalarType> & shot )
|
vcg::Shot<ScalarType> & shot )
|
||||||
{
|
{
|
||||||
vcg::Point3<ScalarType> vp = sShot.ViewPoint();
|
Point3<ScalarType> cen; cen.Import(tr.center);
|
||||||
vcg::Point3<float> vpf = vcg::Point3<float>(vp[0],vp[1],vp[2]);
|
Point3<ScalarType> tra; tra.Import(tr.track.tra);
|
||||||
vcg::Matrix44<float> trInvM = tr.track.InverseMatrix();
|
Matrix44<ScalarType> trM; trM.FromMatrix(tr.track.Matrix());
|
||||||
|
|
||||||
vcg::Matrix44<ScalarType> trM; /*=*/ trM.FromMatrix(tr.track.Matrix());
|
Point3<ScalarType> vp = Inverse(trM)*(sShot.ViewPoint()-cen) +cen +tra;
|
||||||
|
|
||||||
vcg::Point3<float> nvp = trInvM*vpf;// nvp = shInvM*nvp;
|
shot.SetViewPoint(vp);
|
||||||
|
|
||||||
shot.SetViewPoint(vcg::Point3<ScalarType>(nvp[0],nvp[1],nvp[2]));
|
|
||||||
shot.similarity.rot = sShot.similarity.rot*trM;
|
shot.similarity.rot = sShot.similarity.rot*trM;
|
||||||
shot.similarity.sca = sShot.similarity.sca*tr.track.sca;
|
shot.similarity.sca = sShot.similarity.sca*(ScalarType)tr.track.sca;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue