]> git.mxchange.org Git - flightgear.git/commitdiff
Jim Wilson:
authorcurt <curt>
Sun, 16 Feb 2003 20:47:40 +0000 (20:47 +0000)
committercurt <curt>
Sun, 16 Feb 2003 20:47:40 +0000 (20:47 +0000)
Here's a patch to fix the asi problem (it affects most aircraft panels).
[ Avoids a sqrt( x < 0 ) ]

src/Instrumentation/airspeed_indicator.cxx

index 46eb585c8aab0075e42bc38569cd18ed53c4abee..5ae7543324d253e23a919e979154a7106ed845eb 100644 (file)
@@ -59,7 +59,9 @@ AirspeedIndicator::update (double dt)
         double p = _static_pressure_node->getDoubleValue();
         double q = ( pt - p ) * INHGTOPSF;      // dynamic pressure
 
-                                // Now, reverse the equation
+        // Now, reverse the equation (normalize dynamic pressure to
+        // avoid "nan" results from sqrt)
+        if ( q < 0 ) { q = 0.0; }
         double v_fps = sqrt((2 * q) / SEA_LEVEL_DENSITY_SLUGFT3);
 
                                 // Publish the indicated airspeed