Hello List,
I think there's a small bug in the moving-average filter in
xmlauto.cxx
I noticed that the output from it was always out a bit and
checking with a calculator showed that it seemed to be dividing
by the number of samples + 1 instead of just the number of
samples.
subtracting 1 from 'samples' in line 702 seems to fix the problem
and as 'samples' doesn't seem to be used elsewhere I think it's
safe. Possibly implies that the number of samples may be one
less than specified but I'm not familiar enough with c++ to spot
it. The amended code segment is pasted below.
else if (filterType == movingAverage)
{
output.push_front(output[0] +
(input[0] - input.back()) /
(samples - 1));
unsigned int i;
for ( i = 0; i < output_list.size(); ++i ) {
output_list[i]->setDoubleValue( output[0] );
}
output.resize(1);
}
note the line break due to wrap just in front the amended code.
LeeE
_______________________________________________
Flightgear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d