[ODE] 2d system

Christopher Jefferson caj at cs.york.ac.uk
Wed Apr 2 03:11:01 2003


Hi!

I've been thinking about implementing an 2D ODE last night... I think I 
would like to implement it "properly" so intend to have an attempt (after 
my current rush at work is over in a couple of weeks...)

My main thoughts on the subject:

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.

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
(4) Design C++ library in some fundamentally different way (note: I include 
this because there may be some people who think ODE could be designed in a 
totally different way and this could be the opportunity to experiment with 
this new design in a simpler setting)

Any thoughts / comments appreciated!

I'm just throwing out thoughts here, on the other hand I do need a 2d rigid 
body library (I'd like a 2d non-rigid body library, but I think that could 
be getting a bit to carried away too soon!) so am going to have to make one 
anyway and would like the opportunity to write something other people may 
find useful.

In reply to Daniel's mail, My belief is that the difference between what 
you have written (which sounds impressive!) and a full library is a full 
library will be more "feature complete" (do you deal with rotations, 
friction, 3-body collisions well/at all) and a reasonable guarantee of 
scalability. Having tried to do it before, turning some code in a nice 
library is much harder than I expected it to be (I didn't write the 
original code however, so maybe it was the writer's fault!)

Chris


At 14:16 01/04/2003 -0600, david@csworkbench.com wrote:
>I don't know about "guaranteed" to be easier than ODE to implement.  Sure,
>there's a few less possible joints since there's only 3 degrees of
>freedom, but all the rest of the internal work would still be the same,
>just on a smaller (and therefore more efficient) matrix.  That is assuming
>you took the same approach at the problem as ODE does.  The only thing you
>wouldn't need to implement would be amotors and ball joints, and maybe
>hinge2's.  But you'd probably want to keep hinge2's in there and convert
>the turning axis to a suspension slider only.
>
>David
>
> > This question popped up on the list a few weeks ago and fizzled out
> > quickly (DOH).
> >
> > http://q12.org/pipermail/ode/2003-March/003616.html
> >
> > and the replies...
> > http://q12.org/pipermail/ode/2003-March/003619.html
> > http://q12.org/pipermail/ode/2003-March/003620.html
> >
> > I haven't been able to find any 2D rigid-body physics software. Seems
> > that most people who want 2D physics have just written their own
> > spring-mass system with cross bars and funny integrators for stability.
> > Let me know if you find any though.
> >
> > Anyway, it wouldn't make much sense to insert 2D functionality into ODE
> > as it currently stands. You'd be better off reimplementing the API in a
> > 2D-like fashion, and seeing if you can pull in the solver and other guts
> >  as well. On the bright side, it's GUARANTEED to be easier than ODE to
> > implement!
> >
> > I am interested in assisting if you pick up that challenge.
> >
> > Christopher Jefferson wrote:
> >> Hi!
> >> I would like to use ODE in a 2 dimensional system. I notice from the
> >> documentation that 2d is mentioned in the changelog but can't find it
> >> anywhere else. To simple get me started I decided to try using spheres
> >> and cubes and set the co-ordinates appropriately. This does work at
> >> first but unsurprisingly it slowly drifts into the third dimension. I
> >> can keep forcing things back into 2d but I was wondering if there is a
> >> better way to do this?
> >> Chris
> >
> > _______________________________________________
> > ODE mailing list
> > ODE@q12.org
> > http://q12.org/mailman/listinfo/ode
>
>
>
>_______________________________________________
>ODE mailing list
>ODE@q12.org
>http://q12.org/mailman/listinfo/ode