From: Torsten Dreyer Date: Mon, 17 Jan 2011 19:18:17 +0000 (+0100) Subject: Autopilot: use SimGear function X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2ba4f3ddad94c6045160663578b66bb573fd05ac;p=flightgear.git Autopilot: use SimGear function --- diff --git a/src/Autopilot/inputvalue.cxx b/src/Autopilot/inputvalue.cxx index fb80263c1..cbda6651f 100644 --- a/src/Autopilot/inputvalue.cxx +++ b/src/Autopilot/inputvalue.cxx @@ -36,23 +36,7 @@ PeriodicalValue::PeriodicalValue( SGPropertyNode_ptr root ) double PeriodicalValue::normalize( double value ) { - if( !(minPeriod && maxPeriod )) return value; - - double p1 = minPeriod->get_value(); - double p2 = maxPeriod->get_value(); - - double min = std::min(p1,p2); - double max = std::max(p1,p2); - double phase = fabs(max - min); - - if( phase > SGLimitsd::min() ) { - while( value < min ) value += phase; - while( value >= max ) value -= phase; - } else { - value = min; // phase is zero - } - - return value; + return SGMiscd::normalizePeriodic( minPeriod->get_value(), maxPeriod->get_value(), value ); } InputValue::InputValue( SGPropertyNode_ptr node, double value, double offset, double scale) :