diff options
author | Gael Guennebaud <g.gael@free.fr> | 2008-09-09 23:17:14 +0000 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2008-09-09 23:17:14 +0000 |
commit | 5e9ee8863e0ffe38551dcffb195a894129019a71 (patch) | |
tree | e9f60577e4419c9f03a0d2b68a30184efb71ada0 /demos/opengl/trackball.cpp | |
parent | 146c9e449443453f3932b60cd1bab47f688403e7 (diff) |
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.
Diffstat (limited to 'demos/opengl/trackball.cpp')
-rw-r--r-- | demos/opengl/trackball.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/demos/opengl/trackball.cpp b/demos/opengl/trackball.cpp index 83e74a649..af2f17d11 100644 --- a/demos/opengl/trackball.cpp +++ b/demos/opengl/trackball.cpp @@ -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))); } |