[ODE] Rotation about Z-axis clockwise ?

Alexandre Tolmos ktulu at free.fr
Wed Aug 27 08:11:02 2003


I'm new to ODE an not sure about that but maybe you expect a row-major  
matrix where it's actually a column-major matrix so maybe you have to  
transpose the matrix.

Cheerz

------------------------------------------------------------------------ 
-
Alexandre Tolmos
E-mail: ktulu@free.fr
ICQ: 92964905
------------------------------------------------------------------------ 
-
"Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn."
------------------------------------------------------------------------ 
-

Le mercredi, 27 aoû 2003, à 16:05 Europe/Paris, thomas.miconi@free.fr a  
écrit :

> Quoting Antonio Tejada Lacaci <wildfred@teleline.es>:
>
>> On Tue, 26 Aug 2003 17:31:33 +0200, thomas.miconi@free.fr wrote:
>>> According to the Rule Thumb, this seems to correspond to an indirect
>> rotation
>>> about the z-axis (i.e. clockwise rotation if the z-axis points to  
>>> you).
>>
>> If you are in a "right-handed coordinate system", i.e. a system which
>> holds the right-hand rule, rotating when the axis points towards you
>> (out of the computer screen) is counterclockwise, not clockwise.
>
>    (0.707107, -0.707107, 0.000000) (0.707107, 0.707107, 0.000000)  
> (0.000000,
> 0.000000, 1.000000)
>
> I agree wholeheartedly. This is exactly what I wrote (direct ->  
> counterclock,
> indirect -> clock). And it seems to me that ODE does exactly the  
> contrary !
>
> This seems highly improbable however, because somebody would probably  
> have
> seen it already. So I just can't find the problem.
>
> Below is a minimum piece of code that shows the problem with  
> quaternions. One
> can just copy/paste it and compile with "gcc -Wall -I../../include
> ./Program.cpp ../../lib/libode.a -lm" (possibly changing the  
> directories, of
> course).
>
> A much simpler way to see it is simply to call   
> dRFromAxisAndAngle(mymatrix,
> 0, 0, 1, pi/4), and to have a look at the resulting matrix: It looks  
> like it's
> been rotated *clockwise* (i.e. indirect direction - it gives the same  
> coords
> as indicated below).
>
> Please, what am I doing wrong ?
>
> Amicalement,
> Thomas
> ======
> #include <ode/ode.h>
> #include <drawstuff/drawstuff.h>
> #include <stdlib.h>
> #define MyPi 3.14159265
>
> int main (int argc, char **argv)
> {
>     dWorldID world;
>     dBodyID limb1;
>     dReal * tmpmat;
>     dQuaternion q;
>
>     world = dWorldCreate();
>
>     limb1 = dBodyCreate (world);
>
>     tmpmat = (double *) dBodyGetRotation (limb1);
>     printf(" (%f, %f, %f) (%f, %f, %f) (%f, %f, %f) \n",
>             tmpmat[0], tmpmat[1], tmpmat[2],
>             tmpmat[4], tmpmat[5], tmpmat[6],
>             tmpmat[8], tmpmat[9], tmpmat[10]);
>     // This prints the standard expected coords (100)(010)(001)
>
>     // Now, rotating Pi/4 around the Z axis...
>     // Expecting normal, direct, counterclockwise rotation
>     dQFromAxisAndAngle(q, 0, 0, 1, MyPi / 4.0);
>     dBodySetQuaternion (limb1, q);
>     tmpmat = (double *) dBodyGetRotation (limb1);
>     printf("\n (%f, %f, %f) (%f, %f, %f) (%f, %f, %f) \n",
>             tmpmat[0], tmpmat[1], tmpmat[2],
>             tmpmat[4], tmpmat[5], tmpmat[6],
>             tmpmat[8], tmpmat[9], tmpmat[10]);
>     // Resulting coords:
>     // (0.707107, -0.707107, 0.000000)
>     // (0.707107, 0.707107, 0.000000)
>     // (0.000000, 0.000000, 1.000000)
>     //  This looks like an indirect rotation !
>     dWorldDestroy (world);
>     return 0;
> }
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode