Ron JENSEN: fix division by zero problem (asin -> atan2; navradio.cxx)
This commit is contained in:
parent
aa30b94750
commit
0ec4bf22bf
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue