[ODE] Tri-collider with current ODE collision code

Nate W coding at natew.com
Sun May 25 11:33:01 2003


On Sun, 25 May 2003, Vadim Macagon wrote:

> > struct dxTriangle
> > {
> > char unused [sizeof (dxGeom)];
> > dReal x,y,z,d;
> > };
> 
> Aggghhh, could we please avoid such ugly hacks? :)
> Could you write a dCollideBoxTriangle instead of the above hack?

I'm not real pleased with it either, I have to admit.

Colliding a box and triangle is actually a more complex process than
colliding a box and plane, because triangles are finite.  Tri-collider
doesn't call dCollideBoxPlane until after it has already determined that
the box lies within the bounds of the triangle, and I don't know if the
approach it uses would scale as well if you put the triangle-bounds
testing into a function like dCollideBoxTriangle where it had to be called
on triangles one by one.

A better solution might be to extract the basic functionality of
dCollideBoxPlane, put it into a new function and call that function via
wrappers like:

	dCollideBoxPlane (dxBox *box, dxPlane *realplane...
	dCollideBoxPlane (dxBox *box, dxTriangle *triplane...

If/when the tri-collider extension is deemed worthy if inclusion into ODE
proper, that refactoring might be worth considering.  But I hesitate to go
changing ODE internals to suit contrib code that hasn't made it into ODE
yet.  The primary virtue of the change I made is that it doesn't require
any changes to ODE itself.

-- 

Nate Waddoups
Redmond WA USA
http://www.natew.com