From 0ec4bf22bf75159cf9d183788d0a3d58e07b91f3 Mon Sep 17 00:00:00 2001 From: mfranz Date: Thu, 2 Apr 2009 18:14:50 +0000 Subject: [PATCH] Ron JENSEN: fix division by zero problem (asin -> atan2; navradio.cxx) --- src/Instrumentation/navradio.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Instrumentation/navradio.cxx b/src/Instrumentation/navradio.cxx index b4455be10..4553744d7 100644 --- a/src/Instrumentation/navradio.cxx +++ b/src/Instrumentation/navradio.cxx @@ -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; }