atan2 ( y ; x )
returns the base angle (arctan) of a triangle with the sides X and Y.
Average rating: 3.9 (41 votes) Log in to vote
Michael George - Show more from this author
Michael George Consulting
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
The function atan2(y;x) returns the arctan of y,x with adjustments for the signs of x and y so that the angle returned is the angle of the cartesian point (x,y) in radians.
The commonest use of atan2 is in converting between rectangular and polar co-ordinates. The formula for calculating the *initial* heading for a great-circle route from point A to point B uses atan2.
Please be aware that the parameter order is y,x and not x,y as usual.
Rouel Fernandez, Mountain View, Ca
Dec 22, 2010
The above does not give the same results as Microsoft Excel. I use the following, Note the special for x=0 and y=0, I define ATAN2(x,y) = 0:
Let ( [
Case ( x > 0 ; Atan( y / x ) ;
x < 0 ; If ( y ≥ 0 ; Pi + Atan ( y / x) ; -Pi + Atan ( y / x)) ;
x = 0 ; If ( y > 0 ; Pi / 2 ; If ( y < 0 ; -Pi / 2 ; 0) )) ;
Convert from 0 to 2*pi: result = mod ( 2* pi + a ; 2 * pi)
Michael George, Michael George Consulting
Sep 28, 2013
Excel has the two parameters reversed:
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.