1
0
Fork 0

Ron JENSEN: fix division by zero problem (asin -> atan2; navradio.cxx)

This commit is contained in:
mfranz 2009-04-02 18:14:50 +00:00 committed by Tim Moore
parent aa30b94750
commit 0ec4bf22bf

View file

@ -607,10 +607,10 @@ FGNavRadio::update(double dt)
// FIXME/FINISHME, what should be set here? // FIXME/FINISHME, what should be set here?
} else if ( inrange ) { } else if ( inrange ) {
double x = gs_dist_node->getDoubleValue(); 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; * SG_FEET_TO_METER;
// cout << "dist = " << x << " height = " << y << endl; // 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 = (target_gs - angle) * 5.0;
r *= signal_quality_norm; r *= signal_quality_norm;
} }