[ODE] body geometry dualism

Nate W coding at natew.com
Thu Aug 8 16:56:02 2002


On Thu, 8 Aug 2002, don wrote:

> That said, the first thing I did was to start a library of objects
> where each object manages a body and a geometry.  That way my app
> doesn't need to worry about it.  I think soemthing like this would be
> a good addition to ODE.  Would folks rather see C++ classes, or a
> plain "C" interface for something like this?

Could this be done by deriving classes from the existing C++ wrappers?

For example, something like:

class dCCylinderBody : public dCCylinder, public dBody
{
	CCylinderBody (dWordID world, dSpaceID space, dReal radius, dReal length) :
		dBody (world), dCCylinder (space, radius, length)
	{
		dCCylinder::setBody (dCCylinder::_id);
	}

	...
};

Note that I just wrote that off the top of my head, and I'm just guessing
on the syntax to deal with both base classes having members named _id...
but I think the idea would work.  If it does work, then I think your idea
could be implemented with a relatively small addition to the existing
odecpp.h header file.  

Personally I think this fits best at the C++ level.  Seems to me that a
plain-C layer that does the same thing wouldn't provide the user with much
benefit as compared to the usual approach of just associating the body and
geometry objects at the application level.  That might just be a
reflection of my own pro-C++ prejudices though. :-)

-- 

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