# [ODE] Vector in world coordinates

Lewis Foster doof205 at gmail.com
Thu Mar 15 15:57:11 MST 2007

```That sounds like an idea Jon, might give that a go. But in the mean time,
the following seems to work (although if anyone could explain why or how,
that would be great) :-):

Given the points in the form:

dReal points[]= // points for a cube
{
0.25f,0.25f,0.25f,  //  point 0
-0.25f,0.25f,0.25f, //  point 1

0.25f,-0.25f,0.25f, //  point 2
-0.25f,-0.25f ,0.25f,//  point 3

0.25f,0.25f,-0.25f, //  point 4
-0.25f,0.25f,-0.25f,//  point 5

0.25f,-0.25f,-0.25f,//  point 6
-0.25f,-0.25f,-0.25f,// point 7
};

The following seems to work: (taken from test_boxstack and convex.cpp by
Rodrigo Hernandez)

j loops through number of points
dMULTIPLY0_331 (aPoint,cvx2.final_posr->R,cvx2.points+(j*3));
aPoint[0]+=cvx2.final_posr->pos[0];
aPoint[1]+=cvx2.final_posr->pos[1];
aPoint[2]+=cvx2.final_posr->pos[2];

I don't get why or how it works though. The code for the macro is below, and
seems to make aPoint equal to the dot product of various parts of the
rotation matrix of cvx2.final_posr in the direction of each point...I'm
getting awfully lost with it.

#define dMULTIPLYOP0_331(A,op,B,C) \
do { \
(A)[0] op dDOT((B),(C)); \
(A)[1] op dDOT((B+4),(C)); \
(A)[2] op dDOT((B+8),(C)); \
}

Lewis

On 3/15/07, Jon Watte (ODE) <hplus-ode at mindcontrol.org> wrote:
>
>  How about just snarfing the code from the dBody function, and creating a
> similar dGeom function? Geoms also have orientations (which sometimes are
> the same as those of bodies).
>
> Cheers,
>
>           / h+
>
>
> Lewis Foster wrote:
>
> I dont think i can use that. I'm working on a dCollidexxx function within
> a new geom class so only have the two colliding geoms to work with. So no
> bodyID can be passed. I presume that function is for using ODE externally.
>
> Any other ideas anyone?
>
> Thanks,
>
> Lewis
>
> ------------------------------
>
> _______________________________________________
> ODE mailing list
>
> ODE at ode.org
> http://mooshika.org/mailman/listinfo/ode
>
>
-------------- next part --------------
An HTML attachment was scrubbed...