I wish to add multi-geom support to the API and have been discussing it with Jani over the last week. I thought I would move the discussion here
When I looked into this I have thought up a few improvements to the API as well.
Here's a few things I think should be changed:
Geom has a set/getBody methods - I think these should just be dropped as otherwise you can have this situation:
Geom g = new Geom ();
Body b1 = new Body (world);
Body b2 = new Body (world);
which is very misleading (in actual fact - the setBody in this context means zip).
Body needs to be expanded to support multiple Geom's. This is fairly easy, we would just have a linked list of Geoms instead of one.
"setGeom" would be changed to "addGeom" - and
Iterator getGeomIterator() would replace getGeom. set/getGeom could be retrofitted to simply add a Geom to the list - and return the first Geom in the list.
Space shouldn't really know about Bodies - hence both "add" methods would be removed.
addGeom would be added to add a Geom to the space.
addBodyGeoms would be created as a conveniance method to add all the geoms in that body to the space (but not the body itself).
An assert would be added to ensure no Geom is added twice (Matt's problem in the other thread).
Instead of Space maintaining a list of Bodies - I think the World should. So world could have:
All of these suggested changes can be made without breaking the API as far as I can see. The benifits are: basic multi-geom support and a less confusing API.
Full Multi-Geom's support will need a little more work but the basic support would be there.