Wheeeeeeeee Gravity!1!!eleven!

Sooooo…. a few days ago I felt like simulating a bit of gravity. Turns out that was the easy part… Basically I wrote a gravity simulator with accurate(?) collision detection all based on force vectors applied over time. I did all the physics and trig work from the top of my head, and the last time I had a physics or trig class was eight years ago, so I might have forgotten something important. Collisions look right to me right now, but the code driving them relies on some pretty loose interpretations of gravity/time, so any frameskips could cause some rather interesting reflections. Tarball (with source) and Ubuntu deb package (binary only) at their respective links.

I made a half-assed attempt at commenting the source, because I’m a nice guy. You should be able to get an idea of what I was thinking from there.

Update [20081002003930EDT]: Almost forgot, uses Cairo for drawing. XOrg process maxes the cpu at the resolution I’m using for this thing… NO idea why. Any programmers wanna help?

One thought on “Wheeeeeeeee Gravity!1!!eleven!”

Leave a Reply