Fwd: Quaternion to axis/angle conversion is buggy when w(4)<0

David Bateman dbateman at dbateman.org
Fri Feb 6 15:03:48 CST 2009


My understanding of quaternions is that this is like the right hand rule 
of vector multiplication. You've redefined the normal vector (the thumb 
of your right hand) to be in the negative direction and so your fingers 
are now points in the opposite direction than if your unit vector was 
defined in the positive direction. Thus the difference. Quaternions are 
not what I work with normally though so a second (or rather third) 
opinion, would be welcome

D.




Vijay Pradeep wrote:
> Hello David,
>
> So what you are arguing is that composing two quaterions q & -q is the 
> same as composing q & q.  And I completely agree with you.  However, 
> what I am trying to argue is that in certain special cases (that is, 
> when w(4) < 0), the conversion from quaternion to axis-angle is incorrect.
>
> Let me try to explain in another example.
>
> *octave:1> *q = [0 0 -.01 -.99995]
> q =
>
>    0.00000   0.00000  -0.01000  -0.99995
>
>
> *octave:2> [ax4 ang4] = quaternion(q)*
> ax4 =
>
>   -0  -0  -1
>
> ang4 =  3.1216
>
>
> Note that the rotation angle (ang4) is close to PI, whereas the 
> quaternion is very close to [0 0 0 -1], and hence it should be a 
> rotation of zero.
>
> Cheers,
> Vijay
>
>
> On Sat, Jan 17, 2009 at 9:14 AM, David Bateman <dbateman at dbateman.org 
> <mailto:dbateman at dbateman.org>> wrote:
>
>     Vijay Pradeep wrote:
>
>         Hello David,
>
>         I believe that you are arguing that the two sets of [ax ang]
>         that you computed are equivalent, and that they're simply
>         rotations in opposite directions.  If so, then ang1+ang2
>         should equal 2*PI.  However, they sum to PI, so it's off by
>         180 degrees.
>
>
>     That would be true if the direction of the first unit vector
>     defining the quaternion wasn't reversed. But it is and so Pi is
>     the right answer. Start with your original definition
>
>     w = quaternion([1 0 0], pi/4);
>
>     Consider that the w= -w for a quaternion and that multiplication
>     of two quaternions gives the equivalent rotation of the applying
>     each of the rotations consecutively. Therefore w * -w should be a
>     rotation of pi/2 around the i^\hat or -i^\hat
>
>     [ac3, ang3] = quaternion (qmult (w, -w))
>     ac3 =
>
>      -1   0   0
>
>     ang3 =  1.5708
>
>     seems right. So I still don't see the issue.
>
>     D.
>
>
>     -- 
>     David Bateman                                dbateman at dbateman.org
>     <mailto:dbateman at dbateman.org>
>     35 rue Gambetta                              +33 1 46 04 02 18 (Home)
>     92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)
>
>


-- 
David Bateman                                dbateman at dbateman.org
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)



More information about the Bug-octave mailing list