opengl demo, now working:

- quaternion vs euler angles interpolation (though the Euler angle version looks a bit too bad)
 - navigation using either a mapping from 2D screen coordinates to 3D points on a sphere
   or the standard approach mapping mouse displacements as rotations around camera's axes.
This commit is contained in:
Gael Guennebaud
2008-09-09 23:17:14 +00:00
parent 146c9e4494
commit 5e9ee8863e
4 changed files with 171 additions and 82 deletions

View File

@@ -40,9 +40,9 @@ void Trackball::track(const Vector2i& point2D)
float cos_angle = mLastPoint3D.dot(newPoint3D);
if ( ei_abs(cos_angle) < 1.0 )
{
float angle = acos(cos_angle);
float angle = 2. * acos(cos_angle);
if (mMode==Around)
mpCamera->rotateAroundTarget(Quaternionf(AngleAxisf(2.*angle, axis))); // *2 to speedup the rotation
mpCamera->rotateAroundTarget(Quaternionf(AngleAxisf(angle, axis)));
else
mpCamera->localRotate(Quaternionf(AngleAxisf(-angle, axis)));
}