octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #39521] quaternion/q2rot gives incorrect resul


From: anonymous
Subject: [Octave-bug-tracker] [bug #39521] quaternion/q2rot gives incorrect result in some cases
Date: Thu, 18 Jul 2013 22:15:18 +0000
User-agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?39521>

                 Summary: quaternion/q2rot gives incorrect result in some
cases
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Thu 18 Jul 2013 10:15:17 PM UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Max Katsev
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.6.4
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

The function q2rot contains the following code:

  if (abs (theta) > pi)
    theta = theta - sign (theta) * pi;
  endif


I'm not sure what the purpose of this is (maybe force the output to be in
[-pi/pi] range?), but it results in incorrect values if abs(theta)>pi, since
it changes the angle by pi. This happens when q.w is negative.

Here is a test case:

[ax,an]=q2rot(rot2q([0, 1, 0], 6))
ax =

   0   1   0

an =  2.8584

Here 2.8584 rad is obviously a different rotation from 6 rad.

To fix the bug, the offending lines should be either removed completely, or
(if the intention was to have the [-pi, pi] output range, replaced by 

  if (abs (theta) > pi)
    theta = theta - sign (theta) * 2 * pi;
  endif





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?39521>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]