34 lines
1.1 KiB
Plaintext
34 lines
1.1 KiB
Plaintext
100 REM Angle difference between two bearings
|
|
110 DECLARE EXTERNAL FUNCTION GetDiff
|
|
120 REM
|
|
130 SUB PrintRow(B1, B2)
|
|
140 PRINT USING "#######.###### #######.###### #######.######": B1, B2, GetDiff(B1, B2)
|
|
150 END SUB
|
|
160 REM
|
|
170 print "Input in -180 to +180 range"
|
|
180 PRINT " Bearing 1 Bearing 2 Difference"
|
|
190 CALL PrintRow(20.0, 45.0)
|
|
200 CALL PrintRow(-45.0, 45.0)
|
|
210 CALL PrintRow(-85.0, 90.0)
|
|
220 CALL PrintRow(-95.0, 90.0)
|
|
230 CALL PrintRow(-45.0, 125.0)
|
|
240 CALL PrintRow(-45.0, 145.0)
|
|
250 CALL PrintRow(-45.0, 125.0)
|
|
260 CALL PrintRow(-45.0, 145.0)
|
|
270 CALL PrintRow(29.4803, -88.6381)
|
|
280 CALL PrintRow(-78.3251, -159.036)
|
|
290 PRINT
|
|
300 PRINT "Input in wider range"
|
|
310 PRINT " Bearing 1 Bearing 2 Difference"
|
|
320 CALL PrintRow(-70099.74233810938, 29840.67437876723)
|
|
330 CALL PrintRow(-165313.6666297357, 33693.9894517456)
|
|
340 CALL PrintRow(1174.8380510598456, -154146.66490124757)
|
|
350 CALL PrintRow(60175.77306795546, 42213.07192354373)
|
|
360 END
|
|
370 REM
|
|
380 EXTERNAL FUNCTION GetDiff (B1, B2)
|
|
390 LET R = MOD(B2 - B1, 360.0)
|
|
400 IF R >= 180.0 THEN LET R = R - 360.0
|
|
410 LET GetDiff = R
|
|
420 END FUNCTION
|