[ODE] implementation of nearCallback

Patrik Stellmann stellmann at tu-harburg.de
Wed Apr 19 00:01:54 MST 2006


Hi there,

I'm wondering if the implementation of nearCallback from the 
documentation is really suitable for a hierachical space-structure:

void nearCallback(void *data, dGeomID o1, dGeomID o2)
{
if (dGeomIsSpace(o1) || dGeomIsSpace(o2)) {
  dSpaceCollide2(o1,o2,data,&nearCallback);
  if (dGeomIsSpace(o1)) dSpaceCollide(o1,data,&nearCallback);
  if (dGeomIsSpace(o2)) dSpaceCollide(o2,data,&nearCallback);
}
else {
  int num_contact = dCollide(o1,o2,max_contacts,contact_array,skip);
  [...]
}
}

let's imagine that we have the spaces A and B and the geoms w, x, y and 
z. Their dependency is like this:
A = {B, w, x}
B = {y, z}
When I call dSpaceCollide for A I' expect nearCallback to be called for 
the following pairs:
{B, w}, {B, x}, {w, x}
But with the nearCallback above this would result in dSpaceCollide(B) 
beeing called twice!?

Is there any internal voodoo that avoids this problem, did I get 
anything wrong or is the implementation of nearCallback just unsuitable 
for such kinds of space-hierarchies?

(I implemented it now that way, that I never call dSpaceCollide(...) in 
nearCallback(...) and hold a list of spaces which should generate 
internal collisions and call it for them)

Thanks for any comments!

Patrik






More information about the ODE mailing list