1
0
Fork 0

Autopilot: use SimGear function

This commit is contained in:
Torsten Dreyer 2011-01-17 20:18:17 +01:00
parent 8691d2fe54
commit 2ba4f3ddad

View file

@ -36,23 +36,7 @@ PeriodicalValue::PeriodicalValue( SGPropertyNode_ptr root )
double PeriodicalValue::normalize( double value ) double PeriodicalValue::normalize( double value )
{ {
if( !(minPeriod && maxPeriod )) return value; return SGMiscd::normalizePeriodic( minPeriod->get_value(), maxPeriod->get_value(), value );
double p1 = minPeriod->get_value();
double p2 = maxPeriod->get_value();
double min = std::min<double>(p1,p2);
double max = std::max<double>(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;
} }
InputValue::InputValue( SGPropertyNode_ptr node, double value, double offset, double scale) : InputValue::InputValue( SGPropertyNode_ptr node, double value, double offset, double scale) :