But you missed a solution, when cos(A) = 0... You should be wary of dividing with variable expressions when they can equal 0. Here is a better way of solving the equation:
Using a vector to rotate another vector without storing an angle, thus bypassing using sin and cos as much as possible? (sort of like a matrix, except just for rotation and scaling)
I used it several times for physics problems. If you have two sound waves of close frequencies and you add them, you get a new wave with some special properties (modulation,..). This happens with light too and diffraction/interference stuff.
But you missed a solution, when cos(A) = 0... You should be wary of dividing with variable expressions when they can equal 0. Here is a better way of solving the equation:
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse