[ODE] HashSpace values

Adam D. Moss aspirin at ntlworld.com
Thu Jul 3 02:03:10 2003


Fig TaTam wrote:
> I'm still not clear on the meaning of "minlevel" and "maxlevel" 
> parameters for HashSpace in ODE's collision detection system.
> 
> How do I come up with optimum values for those variables? On what 
> factors do they depend?

They just really depend on the typical sizes of collidable
geom (groups) in your space.

Set minlevel and maxlevel such that your full range of
geom sizes are encompassed.  Say that your largest geoms
are of size 41 units (in X or Y or Z dimension) and your
smallest are 0.25 units in size.

Then your dHashSpaceSetLevels call should be:
dHashSpaceSetLevels(space, -2, 6)
to set the min and max cell sizes to 2^-2 = 0.25 and
2^6=64 (2^6 being the smallest power of 2 that '41' will
fit in).

It's more important to get the max right than to get
the min right, assuming that your tiniest objects don't
all clump together in the bottom of a hole.

You can be over-generous with these values and just suffer
a smidgen of time+space overhead.  But if you're too stingy,
your collision times start to look decreasingly like O(n)
and more like O(n^2)...

Hope that helps.

--Adam
-- 
Adam D. Moss   . ,,^^   adam@gimp.org   http://www.foxbox.org/   co:3
"When I was young, I would break down and cry whenever mom made me
throw an empty toilet paper tube in the trash can. I just imagined
it sitting at the dump, all cardboard and sad." -- T.Farnon