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

David Bateman dbateman at dbateman.org
Sat Jan 17 11:14:22 CST 2009


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
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