2
$\begingroup$

I've been writing a small utility library for converting different 3D rotation representations. My sources are mainly Wikipedia, a couple text books, and Martin Baker's excellent site. I've been unit testing each of my conversions (using values verified with MATLAB), and the only ones that don't hold up are the Euler angles to axis-angle conversion and the inverse of that. Using Martin Baker's conventions of bank=Rx, heading=Ry, and attitude=Rz, I'm unable to achieve the correct output.

I'm using his equations from here for axis-angle to Euler, and here for Euler to axis-angle, but they are not matching my sample cases. I'm thinking it may be confusion over ordering.

Given Rx, Ry, and Rz representing rotation about the X, Y, and Z axes, respectively, and applied in XYZ order (i.e. first rotate around X, then Y, then Z), what is the conversion from Euler angles to axis-angle, and vice versa?

NOTE: Ultimately I can always fall back to converting through another representation such as a quaternion, as those pairs of conversions work. However, I'd like to understand the direct conversion.

I am aware of this question that has been asked here previously, but the accepted solution is overly formal and I can't quite extract the simple conversion equations. The second answer converts through a rotation matrix, and, as I mentioned, I'd like to find a direct conversion.

$\endgroup$
  • $\begingroup$ Martin Baker assumes Euler angles are applied in the sequence y, z, x. It's strange, however, that you seem to have correct conversions between Euler and quaternions but not Euler and axis-angle, since the steps for each conversion are almost the same. $\endgroup$ – David K Jun 12 '17 at 21:30
  • $\begingroup$ @DavidK: I saw his convention was YZX, which is why I think it may be an ordering issue. I can't seem to determine the correct adjustments. The reason I have working Euler/Quaternion conversions is because I used Wikipedia as my source for that pair. Similarly I used this site for Euler/Rotation Matrices. Martin Baker seems to be the only resource for direct Euler/Axis-Angle conversion equations though $\endgroup$ – marcman Jun 12 '17 at 21:32
  • $\begingroup$ Same problem trying to understand Baker's site, which defaults to XZY rotation order (where Y is applied first). I even tried all the possible combinations of axis flipping, and figure out what was the right order, but I couldn't get it working for all the possible orders. For reference, here's the brute-force search: Javascript commit -- In the end I gave up and used matrices. You can see that conversion in Three.js src $\endgroup$ – endavid May 23 at 17:21
  • $\begingroup$ Another good resource is this 3D Rotation Converter site, that uses the Three.js library under the hood. I used it to generate unit tests for my code. $\endgroup$ – endavid May 23 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.