Getting the Euler angles from a RotateTransform3D

Apr 18, 2009 at 1:13 PM
Edited Apr 18, 2009 at 1:13 PM
Hi, I'm currently beating my head against a desk.  I want to be able to take the RotateTransform3D, and grab the Euler Angles out of it.  I currently am using 3 sliders X Y Z to rotate an object, and my calculations are off for getting the Euler angles because only certain objects rotate properly (I need the EulerAngles for something else).


So rx, ry, and rz are the euler angles I have to start with. I create a AxisAngleRotation3D for each axis, and then create the final transform group.
RotateTransform3D rtx = new RotateTransform3D();
rtx.Rotation = new AxisAngleRotation3D(new Vector3D(1, 0, 0), rx);
RotateTransform3D rty = new RotateTransform3D();
rty.Rotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), ry);
RotateTransform3D rtz = new RotateTransform3D();
rtz.Rotation = new AxisAngleRotation3D(new Vector3D(0, 0, 1), rz);
Transform3DGroup transform = new Transform3DGroup();
transform.Children.Add(rtx);
transform.Children.Add(rty);
transform.Children.Add(rtz);
First up, anyone know if this is the correct way to create the Transform3DGroup? Secondly, if it is, how do I get the EulerAngles out (I've tried using transform.Value and using the MatrixToEuler calculations littered around the web, to no avail). Thanks.
May 17, 2009 at 7:08 PM

Im no mathmetician but couldnt you transform the matrix to a 3d coord system and then transform them to Euler sytem to find the angle?  I find that sometimes, its best to follow the rise and run of the triangle instead of taking the short cut thru the hypotenuse (probably mispelled).  I have myself used the Euler angles for things also but never had to actually calculate them.