1
0
Fork 0

[apt_math] Maintenance

This commit is contained in:
scttgs0 2023-05-14 02:09:50 -05:00
parent 48e80937c9
commit f9575d0d4e

View file

@ -13,8 +13,9 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
// //
#include <simgear/compiler.h>
#include "apt_math.hxx" #include "apt_math.hxx"
#include <simgear/compiler.h>
tgContour gen_wgs84_area(SGGeod origin, tgContour gen_wgs84_area(SGGeod origin,
double length_m, double length_m,
@ -25,7 +26,7 @@ tgContour gen_wgs84_area( SGGeod origin,
{ {
tgContour result; tgContour result;
double length_hdg = heading_deg; double length_hdg = heading_deg;
double left_hdg = SGMiscd::normalizePeriodic(0, 360, length_hdg - 90.0); double left_hdg = SGMiscd::normalizePeriodic(0.0, 360.0, length_hdg - 90.0);
// move to the +l end/center of the runway // move to the +l end/center of the runway
SGGeod ref = SGGeodesy::direct(origin, length_hdg, length_m / 2.0 - displ2); SGGeod ref = SGGeodesy::direct(origin, length_hdg, length_m / 2.0 - displ2);
@ -67,13 +68,13 @@ tgContour gen_wgs84_area( SGGeod end1, SGGeod end2,
bool add_mid) bool add_mid)
{ {
tgContour result; tgContour result;
double left_hdg = SGMiscd::normalizePeriodic( 0, 360, heading_deg - 90.0 ); double left_hdg = SGMiscd::normalizePeriodic(0.0, 360.0, heading_deg - 90.0);
double course1, course2, distance; double course1, course2, distance;
SGGeodesy::inverse(end1, end2, course1, course2, distance); SGGeodesy::inverse(end1, end2, course1, course2, distance);
// Calc the center // Calc the center
SGGeod center = SGGeodesy::direct(end1, course1, distance/2 ); SGGeod center = SGGeodesy::direct(end1, course1, distance / 2.0);
// move from end2 to the displaced threshold // move from end2 to the displaced threshold
SGGeod ref = SGGeodesy::direct(end2, heading_deg, length_ext / 2.0 - displ2); SGGeod ref = SGGeodesy::direct(end2, heading_deg, length_ext / 2.0 - displ2);
@ -114,7 +115,7 @@ tgContour gen_wgs84_rect( SGGeod origin, double heading, double length, double w
// starting point is in the middle of the rectangle width, at the beginning - stretch to heading // starting point is in the middle of the rectangle width, at the beginning - stretch to heading
// Point 1 is -90deg, 1/2 width away // Point 1 is -90deg, 1/2 width away
double left_hdg = SGMiscd::normalizePeriodic(0, 360, heading -90 ); double left_hdg = SGMiscd::normalizePeriodic(0.0, 360.0, heading - 90.0);
p = SGGeodesy::direct(origin, left_hdg, width / 2.0); p = SGGeodesy::direct(origin, left_hdg, width / 2.0);
result.AddNode(p); result.AddNode(p);