[ODE] Four little things

Matthew D. Hancher mdh at email.arc.nasa.gov
Tue Apr 13 12:13:50 MST 2004


Hey all,

Four things, all different.

Thing 1:
I've been using the C API until now, but I would like to switch to the
C++ API.  I would be happy to volunteer to bring the C++ interface up
to date, but just wanted to make sure nobody was in the middle of
doing it right now.  Anyone?

Thing 2:
There seems to be a minor bug in dMassSetCappedCylinder().  The
contribution to the inertia tensor from the two half-spheres seems to
be wrong.  (It looks like maybe someone made some false assumptions
about the symmetry of two separate half-spheres vs. a sphere?)
Someone should probably double-check my math, but I've done it a few
different ways so I'm pretty convinced.

Old: (ode/src/mass.dpp:141)
<  Ia = M1*(REAL(0.25)*a*a + (REAL(1.0)/REAL(12.0))*b*b) +
<       M2*(REAL(0.4)*a*a + REAL(0.5)*b*b);
New:
>  Ia = M1*(REAL(0.25)*a*a + (REAL(1.0)/REAL(12.0))*b*b) +
>       M2*(REAL(0.4)*a*a + REAL(0.375)*a*b + REAL(0.25)*b*b);

Thing 3:
There also appears to be a minor bug in dJointGetBody().  It looks
like it's the only remaining API function that does not respect
dJOINT_REVERSE.  (It's over in ode.cpp rather than with most of the
others in joint.cpp, so it's easy to see how it got missed.  Or does
this function expose the Bodys in ODE-internal order intentionally?
In that case this would be a documentation bug, if not an API bug,
because that's definitely not what the user will expect.

Thing 4:
Is there a reason why we don't have dBodyGetNumGeoms() and 
dBodyGetGeom()?  You can pretty much copy and paste the code from 
dBodyGetNumJoints() and dBodyGetJoint().  This seems to work, but 
perhaps there's something I'm missing that breaks it in some cases?

> int dBodyGetNumGeoms (dBodyID b)
> {
>   dAASSERT (b);
>   int count=0;
>   for (dxGeom *g=b->geom; g; g=g->body_next, count++);
>   return count;
> }
>
> dGeomID dBodyGetGeom (dBodyID b, int index)
> {
>   dAASSERT (b);
>   int i=0;
>   for (dxGeom *g=b->geom; g; g=g->body_next, i++) {
>     if (i == index) return g;
>   }
>   return 0;
> }

Later,
mdh

Matt Hancher
NASA Ames Research Center
Official: mdh at email.arc.nasa.gov
Personal: mdh at media.mit.edu


More information about the ODE mailing list