C FUNCTION ARCTAN.FT C ------------------ C C C FUNCTION ARCTAN(Y,X) C C C C GERSON GROSFELD C IMAGE PROCESSING UNIT, DCBD C NATIONAL CANCER INSTITUTE C NATIONAL INSTITUTES OF HEALTH C 9000 ROCKVILLE PIKE C BETHESDA, MD. 20014 C C C C WRITTEN 12 DEC 1975 C C *** NOTE: THIS PROGRAM REPLACES AN EARLIER PROGRAM WITH C THE SAME NAME (LAST DATED 11/21/75) WHICH WAS FOUND TO C HAVE BASIC COMPUTATIONAL FLAWS. C C C C C THE FUNCTION RETURNS THE ARCTANGENT, IN RADIANS, BETWEEN C POINT (X,Y) AND THE ORIGIN, IN THE RANGE: C 0=0, THEN TEST Y FOR QUADRANT [1.3] C IF(X)180,12,13 C C C C [1.2] TEST Y C IF Y<0, THEN ARCTAN=3*PI/2 C IF Y=0, THEN POINT (X,Y)=ORIGIN C IF Y>0, THEN ARCTAN=PI/2 C 12 IF(Y)270,2001,90 C C C [1.3] TEST Y C IF Y<0, THEN ARCTAN=ATAN+2*PI C IF Y>=0, THEN ARCTAN=ATAN C 13 IF(Y)360,1000,1000 C C C [1.4] ARCTAN=PI/2 C 90 ARCTAN=PI/2. RETURN C C C [1.5] ARCTAN=ATAN+PI C 180 ARCTAN=ATAN(Y/X)+PI RETURN C C C [1.6] ARCTAN=3*PI/2 C 270 ARCTAN=3.*PI/2. RETURN C C C [1.7] ARCTAN=ATAN+2*PI C 360 ARCTAN=ATAN(Y/X)+2.*PI RETURN C C C [1.8] ARCTAN=ATAN C 1000 ARCTAN=ATAN(Y/X) RETURN C C C C [2.0] POINT=ORIGIN C SET ARCTAN TO ZERO 2001 ARCTAN=0 RETURN C C C END