[ODE] Re: dSpaceCollide2 - quadspace vs hashspace bug

Hannes Norda hannes.norda at gmail.com
Mon Dec 13 19:52:44 MST 2004


I honestly don't see the problem.
(Except that of course fixing quadspace would be a good idea, but what
I don't have right now is a lot of spare time...)

"int type;" is inherited down from dxGeom and is set by all subclass
constructors.
"collide2" must be implemented by all subclasses of dxGeom, since it's
defined as a pure virtual function in dxSpace.

Cheers!
/Hannes



On Mon, 13 Dec 2004 09:04:11 -0800, Jon Watte <hplus-ode at mindcontrol.org> wrote:
> 
> Does the ODE abstraction really allow you to test for
> specific implementations inside dSpaceCollide2()? At first
> glance, this seems like it would break abstraction. I think
> the "real" solution is making sure that the QuadTree does
> the right thing.
> 
> Cheers,
> 
>                         / h+
> 
> 
> 
> 
> -----Original Message-----
> From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of
> Hannes Norda
> Sent: Monday, December 13, 2004 1:17 AM
> To: ode
> Subject: [ODE] Re: dSpaceCollide2 - quadspace vs hashspace bug
> 
> Due to the lack of interest in this topic I feel obliged to reply to myself. :)
> 
> I just patched in the not-so-beautiful solution here..
> 
> In dSpaceCollide2, collision_space.cpp, add these lines:
>     if(s1->type == dQuadTreeSpaceClass)
>     {
>       for (dxGeom *g = s2->first; g; g=g->next) {
>         s1->collide2 (data,g,callback);
>       }
>     }
>     else if(s2->type == dQuadTreeSpaceClass)
>     {
>       for (dxGeom *g = s1->first; g; g=g->next) {
>         s2->collide2 (data,g,callback);
>       }
>     }
>     else
> 
> ... just before these lines:
>  // iterate through the space that has the fewest geoms, calling
>         // collide2 in the other space for each one.
>         if (s1->count < s2->count) {
> 
> /Hannes
> 
> On Fri, 10 Dec 2004 15:43:01 +0100, Hannes Norda <hannes.norda at gmail.com> wrote:
> > Hi!
> >
> > I noticed that when using dSpaceCollide2 to collide a hashspace with a
> > quadspace, and the hashspace contains more objects than the quadspace,
> > no collision occurs.
> >
> > The root of the problem seems to be that the quadspace doesn't use the
> > variable dxGeom *first; in dxSpace. It is always NULL.
> >
> > Look at this piece of code (in dSpaceCollide2, collision_space.cpp):
> > // iterate through the space that has the fewest geoms, calling
> >        // collide2 in the other space for each one.
> >        if (s1->count < s2->count) {
> >          for (dxGeom *g = s1->first; g; g=g->next) {
> >            s2->collide2 (data,g,callback);
> >          }
> >        }
> >        else {
> >          for (dxGeom *g = s2->first; g; g=g->next) {
> >            s1->collide2 (data,g,callback);
> >          }
> >        }
> >
> > When (hashspace->count > quadspace->count) there will be no
> > collisions, since the for-loop is immediately ended.
> >
> > Anyone else stumbled across this and solved it nicely?
> > Anyhow, I guess I will do some research and see if I can perhaps
> > modify void dxQuadTreeSpace::add(dxGeom* g)  and make it work. Not
> > very familiar with quadspace internal structure, so we'll see what
> > happens.... :)
> >
> > Normally this isn't an issue for me, since I store my static world in
> > the quadspace and my dynamic objects in the hashspace, and I've always
> > had more static objects up until I made a small test application
> > yesterday. Was mildly confused when all of a sudden no collisions
> > occured..
> >
> > /Hannes
> >
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
> 
>


More information about the ODE mailing list