]> git.mxchange.org Git - flightgear.git/commitdiff
Ron JENSEN: fix division by zero problem (asin -> atan2; navradio.cxx)
authormfranz <mfranz>
Thu, 2 Apr 2009 18:14:50 +0000 (18:14 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 15 Apr 2009 21:19:29 +0000 (23:19 +0200)
src/Instrumentation/navradio.cxx

index b4455be10013b15952ecf0d3823739e4c52e19a8..4553744d795b1a8ea001269c1a3444902a65177a 100644 (file)
@@ -607,10 +607,10 @@ FGNavRadio::update(double dt)
                 // FIXME/FINISHME, what should be set here?
             } else if ( inrange ) {
                 double x = gs_dist_node->getDoubleValue();
-                double y = (fgGetDouble("/position/altitude-ft") - nav_elev)
+                double y = (alt_node->getDoubleValue() - nav_elev)
                     * SG_FEET_TO_METER;
                 // cout << "dist = " << x << " height = " << y << endl;
-                double angle = asin( y / x ) * SGD_RADIANS_TO_DEGREES;
+                double angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES;
                 r = (target_gs - angle) * 5.0;
                 r *= signal_quality_norm;
             }