I am working on a simple mesh viewer implementation in C++ with basic functionality such as translation, rotation, scaling. I'm stuck with with implementing the rotation of the object along z-axis using the mouse. What I want to implement is the following:
- Click and drag the mouse vertically (almost vertical will do, as I use a simple threshold to filter slight deviations along the horizontal axis) to rotate the object along y-axis (this part is done).
- Click and drag the mouse horizontally just as described above to rotate the object along x-axis (this part is done too).
- For z-axis rotation, I want to detect a circular (or along an arc) mouse movement. I'm stuck with this part, and don't know how to implement this.
For the above two, i just use atan2() to determine the angle of movement. But how do I detect circular movements?