[ODE] Re: Capped Cylinder - trimesh collider - FIXED!!!

Adam D. Moss adam at gimp.org
Thu Apr 15 20:03:10 MST 2004


Hi Nguyen, thanks for this!

I haven't had time to try it out yet, but have been reading
through the code.

Just some nit-pick requests until I get to try/apply it, in
case you get started on porting the other colliders with the
same template:

1) Please replace 'SUBSTRACT' with 'SUBTRACT' (I see this has
bled over from collision_trimesh_box.cpp :) )
2) Please don't use 'inline' so generously (almost every
function in collision_trimesh_ccylinder.cpp has been declared
inline!), and declare the non-exported functions static.
3) Stylistically it hurts to see so many globals... I don't
really know what to say about that.
4) Many macros are shared with collision_trimesh_box.cpp
(which makes sense) -- since I imagine that more such colliders
are coming, it's probably a good idea to split these out to
a common .h until the day they get completely absorbed into ODE's
utility layers.
5) Some of those macros aren't used. :)
6) Most of those macros aren't syntactically safe to use as...
if(x)
   MACRO();
... and such.
As an example of making them safe, you can turn
#define GETCOL(m,a,v) \
         (v)[0]=(m)[(a)+0]; \
         (v)[1]=(m)[(a)+4]; \
         (v)[2]=(m)[(a)+8];
into
#define GETCOL(m,a,v) do { \
         (v)[0]=(m)[(a)+0]; \
         (v)[1]=(m)[(a)+4]; \
         (v)[2]=(m)[(a)+8]; } while(0)

Thanks for the work,
--Adam
-- 
Adam D. Moss   . ,,^^   adam at gimp.org   http://www.foxbox.org/   co:3


More information about the ODE mailing list