[ODE] 2d system
Adam D. Moss
aspirin at ntlworld.com
Wed Apr 2 03:26:01 2003
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.
> So, as far as I can see there are 4(ish) options available.
>
> (1) Combine new 2d code with ODE, make ODE C++
> (2) Make new C library with some code differing from ODE by just a few
> 3s turned to 2s
> (3) Make a new 2d C++ library using ODE's design and code as inspiration
> but redesign API to be C++ish
Maybe there's some misunderstanding. ODE itself is implemented in
C++, though without using any standard C++ classes. As I understand
it, it then exports two APIs, both of which are pretty good but are
quite different, one for vanilla C and one for C++.
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. ;)
--Adam
--
Adam D. Moss . ,,^^ adam@gimp.org http://www.foxbox.org/ co:3
"Half of the harm that is done in this world is due to people who
want to feel important. They don't mean to do harm. But the harm
does not interest them." -- T. S. Eliot