home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hacker Chronicles 2
/
HACKER2.BIN
/
781.QTHLIB.2
< prev
next >
Wrap
Text File
|
1985-09-28
|
2KB
|
46 lines
.HE Figure 7.2
5000 REM SUBROUTINE TO PERFORM CALCULATIONS
500╡ RE═ BaseΣ oε ß routinσ useΣ b∙ WA3VQ─ anΣ N3NN¼á7│ Magazinσ DE├ 1978
5010 P8 = 3.14159 / 180 / REM DEG -> RAD CONV FACTOR
5020 L = L2 - L1
5030 IF L < -180 THEN L = L + 360
5040 IF L > 180 THEN L = L - 360
5050 IF L < 0 THEN X = 0 ELSE X = 1
5060 REM CONVERT L AND B TO RADIANS
5070 A1 = A * P8
5080 B1 = B * P8
5090 L = L * P8
5100 REM COMPUTE DISTANCE ANGLE
5110 D = COS(L)*COS(A1)*COS(B1) + SIN(A1)*SIN(B1)
5120 IF D > .99998 THEN D = 0 ELSE D = ATN(SQRT(1-D*D)/D)
5130 D1 = D / P8
5140 REM ENSURE POSITIVE VALUE
5150 IF D1 < 0 THEN D1 = D1 + 180
5160 REM COMPUTE DISTANCE
5170 D1 = INT(D1 * 60 * 1.1512 + .5)
5180 D2 = INT (D1*1.6093 + .5)
5190 REM COMPUTE BEARING ANGLE
5200 IF D = 0 THEN R = 0 ELSE R = COS(B1) * SIN(L) / SIN(D)
5210 IF R = 0 THEN R1 = 0 ELSE R1 = ATN(R/SQRT(1 - R * R))
5220 REM CONVERT TO DEGREES
5230 R2 = INT ( ( R1 / P8 ) + 0.5 )
5240 REM PUT IN RIGHT QUADRANT
5250 IF ABS(R) > .99998 THEN 5360
5260 IF ABS(R) < .00174 THEN 5380
5270 B2 = ( B + 0.1) * P8
5280 R3 = COS(L) * COS(A1) * COS (B2) + SIN(B2) * SIN(A1)
5290 IF R3 >.999998 THEN R4 = 0 ELSE R4 = ATN(SQRT(1 - R3 * R3) / R3)
5300 IF R4 = 0 THEN R6 = 90 * P8 ELSE R6 = COS(B2) * SIN(L) / SIN(R4)
5310 IF X=1 THEN 5340
5320 IF ABS(R6) > ABS(R) THEN R2=180+ABS(R2) ELSE R2=360-ABS(R2)
5330 GOTO 5420
5340 IF ABS(R6) < ABS(R) THEN R2 = ABS(R2) ELSE R2 = 180 - ABS(R2)
5350 GOTO 5420
5360 IF X=1 THEN R2 = 90 ELSE R2 = 270
5370 GOTO 5420
5380 IF ABS(L) > 178 THEN 5410
5390 IF B < A THEN R2 = 180 ELSE R2 = 0
5400 GOTO 5420
5410 IF B > A THEN R2 = 180 ELSE R2 = 0
5420 RETURN