The reason there is atan and atan2 is as follow, whenever you calculate the value of tan its true for 2 angles, the angle you calculate at as well as the back angle of that angle (Example):

Tan (45) = 1

Tan(45+180)= Tan(225) =1

So what they did is they restricted atan to provide you the values of only the first quadrant and the fourth quadrant which means your output angle will never exceed 90 and your range is [-90,90].

So what atan2 does it allows you to define what quadrant you want to be in by switching to rectangular coordinates (X,Y) , Here are a couple of examples:

atan2 (0.2,1) --> First Quadrant 80 Degrees

atan2 (-0.2,1) --> Second Quadrant 100 Degrees

atan2 (-0.2,-1) --> Third Quadrant -100 Degrees

atan2(0.2,-1) --> Fourth Quadrant -80 Degrees

As you can see you can define what quadrant your in, Which means you will get a range of [-180,180] if you wish to have the range of [0,360] simply have an "if" statement that checks if the value is negative and add 360 and you'll end up with only positive values.

--------------------------------------

Here is a quick plot using Matlab for all angles (Circles were plotted at different radii)

Blue: atan function

Orange: atan2 function

As you can see it justifies what we said above.

PS. atan2 returns only the real value and eliminates the imaginary part (Might be useful for some future project )

Hope its useful

**Edited by Bluef16, 2017-05-10 @ 20:49.**