Data update

This commit is contained in:
Ingy döt Net 2025-02-27 18:35:13 -05:00
parent 8e4e15fa56
commit 72eb4943cb
1853 changed files with 35514 additions and 9441 deletions

View file

@ -0,0 +1,33 @@
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

View file

@ -2,34 +2,40 @@
#include <iostream>
using namespace std;
double getDifference(double b1, double b2) {
double r = fmod(b2 - b1, 360.0);
if (r < -180.0)
r += 360.0;
if (r >= 180.0)
r -= 360.0;
return r;
double getDifference(double b1, double b2)
{
double r = fmod(b2 - b1, 360.0);
if (r < -180.0)
r += 360.0;
if (r >= 180.0)
r -= 360.0;
return r;
}
inline void printRow(double b1, double b2)
{
cout << getDifference(b1, b2) << endl;
}
int main()
{
cout << "Input in -180 to +180 range" << endl;
cout << getDifference(20.0, 45.0) << endl;
cout << getDifference(-45.0, 45.0) << endl;
cout << getDifference(-85.0, 90.0) << endl;
cout << getDifference(-95.0, 90.0) << endl;
cout << getDifference(-45.0, 125.0) << endl;
cout << getDifference(-45.0, 145.0) << endl;
cout << getDifference(-45.0, 125.0) << endl;
cout << getDifference(-45.0, 145.0) << endl;
cout << getDifference(29.4803, -88.6381) << endl;
cout << getDifference(-78.3251, -159.036) << endl;
cout << "Input in wider range" << endl;
cout << getDifference(-70099.74233810938, 29840.67437876723) << endl;
cout << getDifference(-165313.6666297357, 33693.9894517456) << endl;
cout << getDifference(1174.8380510598456, -154146.66490124757) << endl;
cout << getDifference(60175.77306795546, 42213.07192354373) << endl;
cout << "Input in -180 to +180 range" << endl;
printRow(20.0, 45.0);
printRow(-45.0, 45.0);
printRow(-85.0, 90.0);
printRow(-95.0, 90.0);
printRow(-45.0, 125.0);
printRow(-45.0, 145.0);
printRow(-45.0, 125.0);
printRow(-45.0, 145.0);
printRow(29.4803, -88.6381);
printRow(-78.3251, -159.036);
return 0;
cout << endl << "Input in wider range" << endl;
printRow(-70099.74233810938, 29840.67437876723);
printRow(-165313.6666297357, 33693.9894517456);
printRow(1174.8380510598456, -154146.66490124757);
printRow(60175.77306795546, 42213.07192354373);
return 0;
}

View file

@ -0,0 +1,38 @@
<?php
// Angle difference between two bearings
function get_diff($b1, $b2) {
$r = ($b2 - $b1) - intdiv($b2 - $b1, 360) * 360;
if ($r > 180.0)
$r -= 360.0;
if ($r < -180.0)
$r += 360.0;
return $r;
}
function echo_row($b1, $b2) {
echo str_pad(number_format($b1, 6, ".", ""), 14, " ", STR_PAD_LEFT).' ';
echo str_pad(number_format($b2, 6, ".", ""), 14, " ", STR_PAD_LEFT).' ';
echo str_pad(number_format(get_diff($b1, $b2), 6), 14, " ", STR_PAD_LEFT);
echo "\n";
}
echo "Input in -180 to +180 range\n";
echo " Bearing 1 Bearing 2 Difference\n";
echo_row(20.0, 45.0);
echo_row(-45.0, 45.0);
echo_row(-85.0, 90.0);
echo_row(-95.0, 90.0);
echo_row(-45.0, 125.0);
echo_row(-45.0, 145.0);
echo_row(-45.0, 125.0);
echo_row(-45.0, 145.0);
echo_row(29.4803, -88.6381);
echo_row(-78.3251, -159.036);
echo "\nInput in wider range\n";
echo " Bearing 1 Bearing 2 Difference\n";
echo_row(-70099.74233810938, 29840.67437876723);
echo_row(-165313.6666297357, 33693.9894517456);
echo_row(1174.8380510598456, -154146.66490124757);
echo_row(60175.77306795546, 42213.07192354373);
?>