Thomas Sampson


Leave a comment

Advanced 2D collision detection

http://www.gamedev.net/reference/programming/features/2dRotatedRectCollision/page2.asp

This is a great article written by explaining how to achieve accurate collision detection between two dimensional objects using the “Separating Axis Theorem”.

Although this tutorial deals with the collision of rectangular objects (so would apply to bounding boxes around 2D shapes rather than pixel based collision detection), this is not limited to axis aligned rectangles. This allows the algorithm to check for collision with rotated boxes rather than the less useful axis aligned collision detection approach (hitTest() in flash anyone?).

I have finished reading the tutorial and intend to form a c++ implementation in the near future. Although some parts may need a quick re-read, this method is not as complicated as it might first appear. A word of warning, this kind of collision detection should only be triggered by a less accurate method. By this I mean that if you have a large collection of objects which require collision checking, do some simple tests firsts to check that they arent a mile apart (the radius test is suggested in the article).

Only if the result of a simpler algorithm suggest that the two shapes are in close proximity, should we go ahead and make use of the more resource expensive approach presented here. Running the algorithm suggested in this article would be wasteful if it was to be executed all the time on all objects regardless of the distance between them.

Advertisements


Leave a comment

Equation Editor

http://www.hamline.edu/~arundquist/equationeditor/

Cool equation editor made by a Physics Professor at Hamline University. I stumbled upon this today when searching for a way to digitise my handwritten boolean equations for an assignment. This tool allows you to easily create equations in plain text using codes and then render them to a GIF which you can quickly Drag & Drop into your word processing app (or whatever app you require). NB:- you can use \overline to over-line characters, over-lining a word requires \overline of each character in that word. Also \oplus can be used to create a target shape (which i am using for exclusive OR gates)

Sample Output