From 9a5080b6ad29db80dd1d0c8ed2a577aec55b16ca Mon Sep 17 00:00:00 2001 From: david Date: Sun, 27 Oct 2002 20:32:34 +0000 Subject: [PATCH] Fixed jump around the north indication. --- src/Instrumentation/heading_indicator.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Instrumentation/heading_indicator.cxx b/src/Instrumentation/heading_indicator.cxx index dc939c598..5ca92fd6e 100644 --- a/src/Instrumentation/heading_indicator.cxx +++ b/src/Instrumentation/heading_indicator.cxx @@ -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; -- 2.39.5