mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
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:
@@ -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)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user