Write a highly efficient C++ function that calculates the magnitude and direction (in degrees) of a given x,y coordinate such as with this definition:
void calcVector(x, y, float* magnitude, float* direction)
You can also just show me how to use an existing library. I looked at Boost C++ and MV++ but didn't see the function I needed from them.
A template style function would be nice in case I don't want to use floats but not necessary for a perfect 10 score. A function defined to be inline would be good too. The function has to be executed for every pixel on the screen over and over again so its got to be efficient!
The code should be a stand-alone c++ module that can compile on Mac/Linux/PC.