Contents - Index


ArcTan2 (function)

ArcTan2( nY,nX ) : number    

ArcTan2 calculates ArcTan(nY/nX) returning values between -pi and pi. The function handles the special situations for each specific quadrant, as well as for cases where nX or nY are 0, returning values as follows:
For nX>0: arctan(nY/nX)
For nX<0 and nY>=0: arctan(nY/nX)+pi
For nX<0 and nY<0:  arctan(nY/nX)-pi 
For nX=0 and nY>0: pi/2
For nX=0 and nY<0: -pi/2
For nX=0 and nY=0: zero (despite the fact that mathematically arctan2 is undefined for that condition).

Related ArcTan

Alpha List         Category List