PropertyWizard 1-8-2 includes an extra inverse tan function, ‘atan2’:

atan2(<y-value>, <x-value>)

The new function allows you to calculate the angle of a line from the line’s Y and X components (note the order of the arguments!) and it will return angle values from -π to +π radians (-180 to +180 degrees).

This is more versatile than the existing function ‘atan’, which can only return angles from -π/2 to +π/2 radians (-90 to +90 degrees).

The reason for the difference is shown in the plot of the tan function:

The single input to the atan function is a value on the y-axis. The function does not have enough information to tell which of the red curves to use for the calculation, so it chooses the one nearest the y-axis. Meaning it can only return x-axis values between -π/2 and +π/2.

In contrast, the two inputs to the atan2 function give it more information – it can tell which quadrant of the circle the relevant line lies in, and so it can return values between -π and +π:

## Why are the arguments in the ‘wrong’ order?

The input arguments to the new atan2 function seem to be in the ‘wrong’ order – Y and then X. This might seem illogical at first glance, but it makes some sense when you notice that:

tan(angle) = Y/X angle = atan(Y/X)

This order also matches the underlying C# Math.Atan2(Double, Double) method and the Python math.atan2(y, x), so it will be familiar to people coming from those backgrounds.