So I saw the post asking how to convert from atan to atan2. But I haven't seen the reverse. So how would one convert from atan2 to atan? Any help is much appreciated!
I am actually extremely surprised that I could not find this question anywhere on stack overflow (my searching skills may be limited lol). I want to go this route since atan2 seems more numerically stable than atan (but I may be wrong).
You can do the opposite from what was done in this question.
double myatan(double y, double x)
{
double pi = 3.14159265358979323846;
if (x >= 0)
return atan2(y, x);
else if (y >= 0)
return atan2(y, x) - pi;
else
return atan2(y, x) + pi;
}