Quote Originally Posted by rakeshthp View Post
How to compute the angle of rotation from the mouse events?
Mouse gestures can be interpreted according to needs of your application.
If you know the orientation of lookAt vector at the time gesture starts (V1), and you know its orientation after gesture (V2), then you should rotate around vector V = V1 x V2, and the angle is ang = arccos((V1.V2)/|V1.V2|), where x is vector product, . - scalar (dot) product, || - norma (length).

With quaternions, if qc ia a quaternion that represents orientation of the camera, and qr is a quaternion that represents desired rotation, then
qc = qc * qr

The problem is to define quaternion that represents rotation. If you know the axis around which you want to rotate and the angle, then:
Code :
void Quaternion::fromAxis(const vec &axis, double angle)
  double sinAngle;
  angle *= 0.5;
  vect vn(v);
  sinAngle = sin(angle);
  x = (vn.x * sinAngle);
  y = (vn.y * sinAngle);
  z = (vn.z * sinAngle); 
  w = cos(angle);