]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/hud_rwy.cxx
Fix MSVC compilation
[flightgear.git] / src / Cockpit / hud_rwy.cxx
index de1b7d2b818cc22afeef5de8943bba3d32c79f44..d4b56356b2ccf543408ef443d27fa632c9b929d9 100644 (file)
@@ -30,8 +30,6 @@
 #include <Aircraft/aircraft.hxx>
 #include <Environment/environment.hxx>
 #include <Environment/environment_mgr.hxx>
-#include <simgear/math/sg_geodesy.hxx>
-#include <simgear/math/polar3d.hxx>
 #include <ATCDCL/ATCutils.hxx>
 
 #include <osg/GLU>
@@ -189,7 +187,7 @@ void runway_instr::get_rwy_points(sgdVec3 *points3d)
     double alt = current_aircraft.fdm_state->get_Runway_altitude() * SG_FEET_TO_METER;
     double length = runway->lengthM() * 0.5;
     double width = runway->widthM() * 0.5;
-    double frontLat, frontLon, backLat, backLon,az, tempLat, tempLon;
+    double frontLat = 0.0, frontLon = 0.0, backLat = 0.0, backLon = 0.0, az = 0.0, tempLat = 0.0, tempLon = 0.0;
     double runwayLon = runway->geod().getLongitudeDeg(),
       runwayLat = runway->geod().getLatitudeDeg();
     double heading = runway->headingDeg();
@@ -386,12 +384,10 @@ bool runway_instr::boundOutsidePoints(sgdVec3& v, sgdVec3& m)
 
 void runway_instr::drawArrow()
 {
-    Point3D ac(0.0), rwy(0.0);
-    ac.setlat(current_aircraft.fdm_state->get_Latitude_deg());
-    ac.setlon(current_aircraft.fdm_state->get_Longitude_deg());
-    rwy.setlat(runway->latitude());
-    rwy.setlon(runway->longitude());
-    float theta = GetHeadingFromTo(ac, rwy);
+    SGGeod acPos(SGGeod::fromDeg(
+        fgGetDouble("/position/longitude-deg"), 
+        fgGetDouble("/position/latitude-deg")));
+    float theta = SGGeodesy::courseDeg(acPos, runway->geod());
     theta -= fgGetDouble("/orientation/heading-deg");
     theta = -theta;
     glMatrixMode(GL_MODELVIEW);
@@ -419,13 +415,11 @@ void runway_instr::drawArrow()
 void runway_instr::setLineWidth()
 {
     //Calculate the distance from the runway, A
-    double course, distance;
-    calc_gc_course_dist(Point3D(runway->longitude() * SGD_DEGREES_TO_RADIANS,
-            runway->latitude() * SGD_DEGREES_TO_RADIANS, 0.0),
-            Point3D(current_aircraft.fdm_state->get_Longitude(),
-            current_aircraft.fdm_state->get_Latitude(), 0.0 ),
-            &course, &distance);
-    distance *= SG_METER_TO_NM;
+    SGGeod acPos(SGGeod::fromDeg(
+        fgGetDouble("/position/longitude-deg"), 
+        fgGetDouble("/position/latitude-deg")));
+    double distance = SGGeodesy::distanceNm(acPos, runway->geod());
+    
     //Get altitude above runway, B
     double alt_nm = get_agl();
     static const SGPropertyNode *startup_units_node = fgGetNode("/sim/startup/units");