Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-847

Using Rotation to convert Euler angles to Quaternions produces wrong results

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 3.0
    • Fix Version/s: 3.1
    • Labels:
      None
    • Environment:

      1.6

      Description

      import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
      import org.apache.commons.math3.geometry.euclidean.threed.RotationOrder;

      public class temp {
      public static void main(String args[])

      { Rotation r = new Rotation(RotationOrder.XYZ, -Math.PI / 2d, 0, 0); System.out.println("(" + r.getQ0() + " " + r.getQ1() + " " + r.getQ2() + " " + r.getQ3() + ")"); }

      }

      Prints (0.707 0.707 0.0 0.0) (in-sig-figs elided), but when I type the same thing into Wolfram Alpha I get (.707 -.707 0 0) (note the negative) see: http://www.wolframalpha.com/input/?i=euler+angles&a=*C.euler+angles-_*Formula.dflt-&a=*FP.EulerRotation.EAS-_e123&f3=-pi%2F2+rad&f=EulerRotation.th1_-pi%2F2+rad&f4=0&f=EulerRotation.th2_0&f5=0&f=EulerRotation.th3_0

      One of the guys in the lab suggested that if Rotation is assuming the Euler angle is in a left-handed coordinate space this is an expected result, but if that's the case the question is, why is the less popular coordinate system the only option?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dunmatt M@ Dunlap
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: