Hi,
Let assume that I've rotated an object using MouseRotate and that I have
the current
Transform3D because I've implemented the MouseBehaviorCallback
interface.
How do I get the rotation angles of my object from each axis around the
origin from that Transform3D?
Ignoring the inefficiencies of making new Vector3d's each time I enter
this method --
This is where I am. What is a good way to end up with RotX; RotY; RotZ?
public void transformChanged(int type, Transform3D transform)
{
Vector3d xpos = new Vector3d(1.0, 0.0, 0.0);
Vector3d ypos = new Vector3d(0.0, 1.0, 0.0);
Vector3d zpos = new Vector3d(0.0, 0.0, 1.0);
double RotX, RotY, RotZ;
//System.out.println(Integer.toString(type) + transform.toString());
//transform.transform(xpos);
//System.out.println(xpos.toString());
//transform.transform(ypos);
//System.out.println(ypos.toString());
transform.transform(ypos); //Applies the current transform to the y
axis
// Fiddle with result of applying current transform to y axis...
System.out.println(ypos.x + " " + ypos.y);
double angle = Math.atan2(ypos.x,ypos.y);
System.out.println(angle);
//System.out.println(ypos.toString() + "\n");
}
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/