]> git.mxchange.org Git - flightgear.git/commitdiff
Fixed jump around the north indication.
authordavid <david>
Sun, 27 Oct 2002 20:32:34 +0000 (20:32 +0000)
committerdavid <david>
Sun, 27 Oct 2002 20:32:34 +0000 (20:32 +0000)
src/Instrumentation/heading_indicator.cxx

index dc939c5980e11d7bcf02f074608fb4421b704648..5ca92fd6ecf3491f81bb3728aa74120794c7d3e7 100644 (file)
@@ -83,6 +83,15 @@ HeadingIndicator::update (double dt)
                                 // introducing errors.
     double factor = 0.01 / (spin * spin * spin * spin * spin * spin);
     double heading = _heading_in_node->getDoubleValue();
+
+                                // Now, we have to get the current
+                                // heading and the last heading into
+                                // the same range.
+    while ((heading - _last_heading_deg) > 180)
+        _last_heading_deg += 360;
+    while ((heading - _last_heading_deg) < -180)
+        _last_heading_deg -= 360;
+
     heading = fgGetLowPass(_last_heading_deg, heading, dt/factor);
     _last_heading_deg = heading;