[ODE] center of mass

Jon Watte (ODE) hplus-ode at mindcontrol.org
Thu Jan 12 18:44:38 MST 2006


> is "good enough" not to warrent a change.  In making up a clean patch, 
> I've found the memory is certainly _less_ than currently, and 
> performance, while being difficult to measure, seems both theoretically 
> and practically no different.

That'd be great if it were true! I'd certainly support it.

Currently, for a regular geom (not offset), it actually gets a copy of 
the matrix pointer of the body, so it uses zero bytes for storing its 
transform. When using a geomtransform, one new matrix has to be 
allocated, plus the space for a geomtransform.

I haven't had time to look at your diff, but it sounds as if you put in 
some flags to tell a geom which mode it's in, and if it's "specific 
offset" mode, then you allocate a new matrix, else you point it to the 
body matrix. Assuming you found somewhere to hide the flag (padding, 
existing flag field, etc), then there is a clear win in memory, because 
you don't need to allocate the geomtransform object. There's likely a 
small cost in performance for testing the flag when getting the 
transform of a geom; this may predict reasonably if most of your geoms 
have the same transform state.

If you had to expand the size of dGeom to accomplish this, then there's 
a trade-off depending on how many items would need a geomtransform, 
versus how many items don't.

Hmm... or maybe you made the "mode" selection dependent on whether the 
matrix pointer is the same as for the body or not? This would add a 
potential cache miss (getting the body struct) that may not matter if 
you always need the read the body anyway (which isn't clear that you do 
inside collision detection, unfortunately).

So, anyway, this sounds better than the previous proposal (as I 
understood it, at least :-)

Cheers,

			/ h+



More information about the ODE mailing list