Java3D rotation problem
843799Apr 29 2009 — edited May 12 2009Hi everybody!
I'm currently working to develop a little application with a simple viewer3D. I'm rewriting a camera class, with a specific sceneGraph (BranchGroup and TransformGroup) and some simple functions (move, turn, etc). My problem is the following : when I apply series of rotation, I have an unexpected rotation coming around the non-specified axis. Here is the thing : I developped a behavior for moving the camera with the mouse. In the "mouseDragged" function, I take into account the mouse displacement from the starting point and I apply to the TransformGroup of the camera a combined rotation vector with a X and Y rotation value. I do all the maths to get the global rotation matrix (which are right) but, after a lot of rotations around X and Y, I get a Z axis rotation... I heard some people have the same problem.
I tried with the MouseRotate system which implies the same rotation error... I assume the problem comes from the Math class of Java, specifically from the cosinus and sinus functions, which are not exact and create errors which spread on all the matrix rotations.
Hope someone is aware about that and have a solution!
Romain.
PS : Sorry if my english is not correct, I'm french...