Collision Detection

Collision Detection

Collision detection was what made me a professional programmer. I started off writing a trigonmetry based collision detection on paper in December of 2003.


Rectangle Rectangle is the one shown below here. Circle Circle are the two below that. Circle Circle is pretty easy. Rectangle Rectangle is harder and then the Circle Rectangle, Rectangle Circle are the hardest. These scripts were written right when I got off the streets. I basically had it all memorized by then. It took almost 5 weeks to write them out and I completely drained two Bic pens doing it.

At the same time, I figured out how to do fast circle collision detection. Here are a couple samples of that:

Then a few years later, I did a google search for the intersection of two lines. It came up with a linear algebra equation that used slope intersect form. I wrote that up and in a couple hours I had a collision detections that works at any angle. Here is the intersection of two lines:

And here is what it made initially (you can drag the pentagons):

Goto http://maze-ingearth.com -- Maze-ing Earth to see the full workings of the linear collision detection.