[ODE] need to understand this

Ed Jones ed.jones at oracle.com
Mon Nov 11 04:11:02 2002


Hi,

 From "common.h"...

    typedef dReal dMatrix3[4*3];

and from the top of "rotation.cpp"...

    #define _R(i,j) R[(i)*4+(j)]

;-)
Cheers,
Ed.


pia dalusong wrote:

>hello,
>
>after a lot of digging, i saw this
>void dRFromEulerAngles (dMatrix3 R, dReal phi, dReal
>theta, dReal psi)
>{
>  dReal sphi,cphi,stheta,ctheta,spsi,cpsi;
>  dAASSERT (R);
>  sphi = dSin(phi);
>  cphi = dCos(phi);
>  stheta = dSin(theta);
>  ctheta = dCos(theta);
>  spsi = dSin(psi);
>  cpsi = dCos(psi);
>  _R(0,0) = cpsi*ctheta;
>  _R(0,1) = spsi*ctheta;
>  _R(0,2) =-stheta;
>  _R(1,0) = cpsi*stheta*sphi - spsi*cphi;
>  _R(1,1) = spsi*stheta*sphi + cpsi*cphi;
>  _R(1,2) = ctheta*sphi;
>  _R(2,0) = cpsi*stheta*cphi + spsi*sphi;
>  _R(2,1) = spsi*stheta*cphi - cpsi*sphi;
>  _R(2,2) = ctheta*cphi;
>}
>i'm a little confused as to how you put values into a
>dMatrix and how do you call it?
>if i have a variable 
>const dReal *R
>and 
>dMatrix3 M
>
>is R[0]=m[0,0] ?
>i'm sorry but i don't understand what happens when you
>write _R(2,1)
>
>is it an 2d array matrix[3][3] or a 1d matrix[12]?
>
>thanks
>
>
>
>__________________________________________________
>Do you Yahoo!?
>U2 on LAUNCH - Exclusive greatest hits videos
>http://launch.yahoo.com/u2
>_______________________________________________
>ODE mailing list
>ODE@q12.org
>http://q12.org/mailman/listinfo/ode
>  
>