Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
sci.math.*
»
sci.math
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
Euler Angle Order convertion
Replies:
3
Last Post:
Jun 25, 2009 2:33 PM




Re: Euler Angle Order convertion
Posted:
Jun 25, 2009 2:33 PM


Anyone else have problems getting Ken Shoemake's code working? Eberly's formulas work fine, though I like the way Shoemake has packaged things, and how it handles a nonstatic ("rotating") frame of reference  if only I could get it to work. It seems to be decomposing the rotations in the wrong order. Here's my simple test case that breaks:
// Create a rotation of 90 degrees about a diagonal axis Quat q = AxisAngle( Vector( 1, 1, 1 ), M_PI * 0.5 );
// Convert to ZXY euler angles with static frame int enc = EulOrdZXYs; EulerAngles ea = Eul_FromQuat( q, enc );
// Generate quaternions for each indivudual axes Quat qx = AxisAngle( Vector( 1, 0, 0 ), ea.x ); Quat qy = AxisAngle( Vector( 0, 1, 0 ), ea.y ); Quat qz = AxisAngle( Vector( 0, 0, 1 ), ea.z );
// Combine the individual rotations const Quat qAct = qy * qx * qz;
If I print out the the expected quaternion and the actual one, I get two different rotations:
q (0.707107 0.408248 0.408248 0.408248) qAct (0.707107 0.523699 0.243049 0.408248)
However, if I combine the individual rotations in ZYX order, it all works fine:
q (0.707107 0.408248 0.408248 0.408248) qAct (0.707107 0.408248 0.408248 0.408248)
I presume Shoemake's code actually does work, since lots of people cite it. So, any thoughts as to what I might be doing wrong?



