[ODE] My ODE++
royce3 at ev1.net
royce3 at ev1.net
Wed Jan 7 15:53:03 MST 2004
> > I started building some C++ wrappers,
> What about the ones already in ODE? How does yours compare to it?
I didn't know there were wrappers already. It took a few minutes, but I
finally managed to find the file.
Interestingly enough, there are no wrappers for dGeomID in odecpp.h, which
is where I spent most of my time.
The implementations for the other classes I did are extremely similar to
I think my work with the Geoms might possibly be suitable for submission,
once they are refactored a little bit to match the naming, style &
convention of odecpp.h
Here's a pared-down example from my modified test_boxstack.cpp with some
added documentation. What you see here is the entirely of the code necessary
to build all the types of bodies represented in the test_boxstack sample.
// the assembler is a temporary class that manages initialization and
// clean-up for building a body out of geoms
DGeomAssembler assem ( *obj[i].body );
if (cmd == 'b')
// a simple case where a single geom is put in the body...
assem.AddGeom ( new DGeomBox ( space, DENSITY, sides, sides,
sides ) );
else if (cmd == 'x')
// multiple transformed geoms are going to be in the body.
for ( int i = 0; i < 3; i++ )
// first let's create our geom....
DGeom* subgeom = 0;
switch ( i )
subgeom = new DGeomSphere ( DENSITY, dRandReal() * 0.25 + 0.05 );
subgeom = new DGeomBox ( DENSITY, sides, sides, sides );
subgeom = new DGeomCappedCylinder ( DENSITY, dRandReal()*0.1+0.05,
// now create the transformer....
DGeomTransform* xfrm = new DGeomTransform ( space, subgeom );
// set the geom's relative position...
// ... and orientation
// now attach this new geom to the assembler
assem.AddGeom ( xfrm );
// DGeomAssembler's dtor performs the final calculations necessary
// to make it work.
mail2web - Check your email from the web at
More information about the ODE