39 #ifndef __VMML__LOWPASS_FILTER__HPP__
40 #define __VMML__LOWPASS_FILTER__HPP__
60 const T&
get()
const {
return _value; }
73 T
add(
const T& value );
82 std::deque< T > _data;
90 _data.push_front( value );
92 while( _data.size() > M )
96 typename std::deque< T >::const_iterator i = _data.begin();
98 double weight = _smooth_factor;
100 for( ++i ; i != _data.end(); ++i )
102 _value = _value * (1 - weight) + (*i) * weight;
103 weight *= _smooth_factor;
109 template<
size_t M,
typename T >
const T * operator->() const
Access the filtered value.
void set_smooth_factor(const float &f)
Sets the smooth factor.
T add(const T &value)
Add a value to the data set and return the filtered output.
lowpass_filter(const float F)
Constructor.
const T & operator*() const
Access the filtered value.