39 #ifndef __VMML__LOWPASS_FILTER__HPP__ 40 #define __VMML__LOWPASS_FILTER__HPP__ 46 template <
size_t M,
typename T>
57 const T&
get()
const {
return _value; }
63 const T&
add(
const T& value);
71 template <
size_t M,
typename T>
74 _data.push_front(value);
76 while (_data.size() > M)
80 typename std::deque<T>::const_iterator i = _data.begin();
82 double weight = _smoothFactor;
84 for (++i; i != _data.end(); ++i)
86 _value = _value * (1 - weight) + (*i) * weight;
87 weight *= _smoothFactor;
LowpassFilter(const float F)
Construct a new lowpass filter with the given smoothing.
const T * operator->() const
Access the filtered value.
const T & operator*() const
Access the filtered value.
const T & add(const T &value)
Add a value to the data set and return the filtered output.