Originally Posted by mmx2000
Just a tip for your pythagorean theorems: As an alternative to doing (x2-x1)*(x2-x1) in case you have huge variable names or whatever, I believe you can use Pow(x2-x1, 2.0) to square it.
That's doing exactly the same thing, and might even be slower depending on how exactly the native Pow function works. The only advantage it would have with large variable names is number of characters?
Another useful thing to avoid having to SquareRoot in cases is when you are checking the distance between points against a certain number (using mathematical comparison, 2 > 1 etc).
if SquareRoot(x*x+y*y) > dist then
if x*x+y*y > dist*dist then