In almost every programming language there some sort of math module with various trigonometric functions including functions called **atan** and **atan2**.

#### atan(x,y)

Now everybody knows atan, it’s just inverse tangent, arctan, just as we know it in math. If we have vector **v** with coordintes **[x,y]**, and we calcualte **atan(x,y)**, we cannot really tell in which quadrant the vector v is in. Absolute value of this result just tells us the smallest angle between the vector v and X-axis.

#### atan2

Atan2 is nothing else just more comfortable version for atan. Result of atan2 returns angle between vector **v** from the “angular start” on unit circle.

#### Picture is worth thousand words

Compare what angles in radians is returned by **atan(x,y)** compared to **atan2(x,y)**

Here, calculating **atan(x,y) **would result in value approximately around **-pi/6** showed on the picture as angle alpha.

In this case, calcualting **atan2(x,y)** would result in value around 5pi/6, showed on the picture as angle alpha.