Considering the fact that you are getting 8xx FPS from your game, stuff like pre-squaring the constant is a good idea, but not necessarily required. You'd get a bigger difference from replacing your draw statements with 2d ones (glVertex2f, etc.) or replacing display lists with VBOs, etc.
Just because I like to perform insane close flybys in games of this style, why not do exact collision detection? Check the circle test, and then if within it, do a line by line test.
For a line:
Code:
struct Point
{
float x, y;
}
struct Line
{
Point a, b;
}
bool counterClockwise(Point a, Point b, Point c)
{
return ((b.y - a.y) * (c.x - b.x) < (c.y - b.y) * (b.x - a.x));
}
bool testIntersection(Line a, Line b) //Returns true if the segments intersect eachother
{
return (counterClockwise(a.a, a.b, b.a) != counterClockwise(a.a, a.b, b.b) &&
counterClockwise(b.a, b.b, a.a) != counterClockwise(b.a, b.b, a.b));
}
So, check the lines of the ship against the lines of the asteroid you are detecting a possible collision with. (If you are feeling performance crazy, you could store the lines of the asteroid within a binary search tree and pass the lines of the ship relative to it)