C DIRDIS - FIND SHORTEST DIRECTION AND DISTANCE BETWEEN TWO C POINTS IN A UNIV W/ WRAP-AROUND # GSW 2/28/82 SUBROUTINE DIRDIS(X0, Y0, X1, Y1, DIR, DIS) CINPUT - POINTS CO-ORDS, 1.0 TO 101.0 REAL X0, Y0, X1, Y1 COUTPUT- DIRECTION (X0,Y0) TO (X1,X1), 0-360 REAL DIR COUTPUT- DISTANCE BETWEEN POINTS REAL DIS CDEGREES PER RADIAN CONVERSION XC = X1 DX = ABS(X0 - X1) IF (.NOT.(DX .GT. 50.)) GOTO 2000 DX = 100. - DX IF (.NOT.(X1 .LT. 51.)) GOTO 2020 XC = XC + 100. GOTO 2030 2020 CONTINUE XC = XC - 100. 2030 CONTINUE 2000 CONTINUE YC = Y1 DY = ABS(Y0 - Y1) IF (.NOT.(DY .GT. 50.)) GOTO 2040 DY = 100. - DY IF (.NOT.(YC .LT. 51.)) GOTO 2060 YC = YC + 100. GOTO 2070 2060 CONTINUE YC = YC - 100. 2070 CONTINUE 2040 CONTINUE DIS = SQRT(DX*DX + DY*DY) DIR = ATAN3(YC - Y0, XC - X0)*57.29577951 IF (.NOT.(DIR.LT.0)) GOTO 2080 DIR = DIR + 360. 2080 CONTINUE RETURN END C DSTNCE - FIND SHORTEST DISTANCE BETWEEN TWO C POINTS IN A UNIV W/ WRAP-AROUND # GSW 2/28/82 REAL FUNCTION DSTNCE(X0, Y0, X1, Y1, DIR, DIS) CINPUT - POINTS CO-ORDS, 1.0 TO 101.0 REAL X0, Y0, X1, Y1 COUTPUT- DISTANCE BETWEEN POINTS REAL DIS XC = X1 DX = ABS(X0 - X1) IF (.NOT.(DX .GT. 50.)) GOTO 2100 DX = 100. - DX IF (.NOT.(X1 .LT. 51.)) GOTO 2120 XC = XC + 100. GOTO 2130 2120 CONTINUE XC = XC - 100. 2130 CONTINUE 2100 CONTINUE YC = Y1 DY = ABS(Y0 - Y1) IF (.NOT.(DY .GT. 50.)) GOTO 2140 DY = 100. - DY IF (.NOT.(YC .LT. 51.)) GOTO 2160 YC = YC + 100. GOTO 2170 2160 CONTINUE YC = YC - 100. 2170 CONTINUE 2140 CONTINUE DSTNCE = SQRT(DX*DX + DY*DY) RETURN END