Commons Math
  1. Commons Math
  2. MATH-846

Rotation constructor does wrong calculation

    Details

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

      Windows java 1.7r5

      Description

      The following code produces the wrong result. The resulting Rotation is does not even hold a normalized quaternion:

      final Vector3D u1 = new Vector3D(1.0, 0.0, 0.0);
      final Vector3D u2 = new Vector3D(1.0, -1.0, 0.0);
      final Vector3D v1 = new Vector3D(0.9999999, 0., 0.0);
      final Vector3D v2 = new Vector3D(0., 1., 0.0);
      final Rotation rot = new Rotation(u1, u2, v1, v2);
      System.err.println("rot quaternion: " + rot.getQ0() + " " + rot.getQ1() + " " + rot.getQ2() + " " + rot.getQ3());

      For me it outputs:

      rot quaternion: 0.0 0.0 0.0 -7.450580596923828E-9

      The correct output should have been:

      rot quaternion: 0.0 1.0 0.0 0.0

      The constructor seems to be hitting some kind of numerical instability.

        Activity

        Hide
        Luc Maisonobe added a comment -

        I am not able to reproduce this behavior with the current development version.

        I think the problem has already been solved on June 6th as part of MATH-801.

        Could you check with the development version from our subversion repository?

        Show
        Luc Maisonobe added a comment - I am not able to reproduce this behavior with the current development version. I think the problem has already been solved on June 6th as part of MATH-801 . Could you check with the development version from our subversion repository?
        Hide
        Frank Hess added a comment -

        I think you are right. I downloaded svn HEAD (r1373782) and the problem seems to be gone. Thanks for your help.

        Show
        Frank Hess added a comment - I think you are right. I downloaded svn HEAD (r1373782) and the problem seems to be gone. Thanks for your help.
        Hide
        Luc Maisonobe added a comment -

        This issue was fixed as part of fixing MATH-801

        Show
        Luc Maisonobe added a comment - This issue was fixed as part of fixing MATH-801

          People

          • Assignee:
            Unassigned
            Reporter:
            Frank Hess
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development