Fix a NaN at higher altitudes: sin_beta could become greater than 1.0 which is hard to understand for asin.

This commit is contained in:
ehofman
2009-04-15 23:03:07 +02:00
committed by Tim Moore
parent 872db67f21
commit 58f3985567
+1
View File
@@ -396,6 +396,7 @@ bool SGSun::reposition( double rightAscension, double declination,
double gamma = SG_PI - sun_angle;
double sin_beta = ( position_radius * sin ( gamma ) ) / r_tropo;
if (sin_beta > 1.0) sin_beta = 1.0;
double alpha = SG_PI - gamma - asin( sin_beta );
// OK, now let's calculate the distance the light travels