From deccb6c9a788789d2bcb4511981e59ced83b59b4 Mon Sep 17 00:00:00 2001 From: ehofman Date: Sun, 21 Mar 2004 10:57:44 +0000 Subject: [PATCH] Fix a problem where the windspeed could be negative in the property tree. Animations relying on this property could become stressed because of that. --- src/Environment/environment.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Environment/environment.cxx b/src/Environment/environment.cxx index 47e4d061f..2448ec3ed 100644 --- a/src/Environment/environment.cxx +++ b/src/Environment/environment.cxx @@ -442,12 +442,22 @@ FGEnvironment::_recalc_hdgspd () wind_from_heading_deg = 90 - wind_from_heading_deg; else wind_from_heading_deg = 270 - wind_from_heading_deg; + +#if 0 + // FIXME: Windspeed can become negative with these formulas. + // which can cause problems for animations that rely + // on the windspeed property. if (angle_rad == 0) wind_speed_kt = fabs(wind_from_east_fps * SG_METER_TO_NM * SG_FEET_TO_METER * 3600); else wind_speed_kt = (wind_from_north_fps / sin(angle_rad)) * SG_METER_TO_NM * SG_FEET_TO_METER * 3600; +#else + wind_speed_kt = sqrt(wind_from_north_fps * wind_from_north_fps + + wind_from_east_fps * wind_from_east_fps) + * SG_METER_TO_NM * SG_FEET_TO_METER * 3600; +#endif } void -- 2.39.5