[ODE] 2d system

Christopher Jefferson caj at cs.york.ac.uk
Wed Apr 2 03:53:02 2003


At 11:25 02/04/2003 +0100, Adam D. Moss wrote:
>Christopher Jefferson wrote:
>>I like C++, and quite a lot of the "front end" code will look like ODE's 
>>existing code, so I'm tempted to generate classes for ODEvec, ODEmatrix, 
>>etc. and "refactor" as much of the code as possible to be compatible with 
>>both 2d and 3d (and 1d and nd if anyone wanted it!). Then the functions 
>>which must be different would be compiled separately, probably storing 
>>the 2d and 3d in different namespaces.
>>However, this would fundamentally change the existing ODE library and 
>>force it to require a C++ compiler (probably), which I imagine many 
>>people may be unhappy about.
>
>Compiling ODE itself already requires a C++ compiler, it's the
>subsequent usage of that library that (with a little hacking) can
>be used with vanilla C, which makes me very happy. :)  Perhaps
>that's what you meant.

While ODE is quite C++ish, it's not as C++ish as it could be, for example 
while matrices and some other objects are classes, other things like the 
linked list in ode.cpp, and dxWorld, dxBody and dObject could possibly be 
more OO. Having said that the existing code is fine, and I'd just like to 
say some of the nicest code I've ever tried to read through :)


>When some minor hiccups are worked around, ODE can then be linked to
>a C program without requiring any C++ flavoured linktime or runtime
>deps.
>
>Seems like a fair model, really.
>
>Of course, if everyone who actually wants a 2D dynamics system
>is using C++ and you're a hardcore C++ devotee then there's no
>compelling reason to lower yourself to C compatability.  Except
>that interoperability with raw C apps is pragmatically cool. ;)

This is true, and i imagine exporting a C interface to a C++ library 
wouldn't be hard...

Chris