Monado OpenXR Runtime
xrt::auxiliary::math::IntegerLowPassIIRFilter< Scalar > Class Template Reference

A very simple integer low-pass filter, using a "one-pole infinite impulse response" design (one-pole IIR), also known as an exponential filter. More...

#include <math/m_lowpass_integer.hpp>

Public Member Functions

 IntegerLowPassIIRFilter (math::Rational< Scalar > alpha) noexcept
 Constructor. More...
 
void reset () noexcept
 Reset the filter to newly-created state. More...
 
void addSample (Scalar sample, math::Rational< Scalar > weight=math::Rational< Scalar >::simplestUnity())
 Filter a sample, with an optional weight. More...
 
Scalar getState () const noexcept
 Get the filtered value. More...
 
bool isInitialized () const noexcept
 Get whether we have initialized state. More...
 

Detailed Description

template<typename Scalar>
class xrt::auxiliary::math::IntegerLowPassIIRFilter< Scalar >

A very simple integer low-pass filter, using a "one-pole infinite impulse response" design (one-pole IIR), also known as an exponential filter.

Configurable in scalar type.

Constructor & Destructor Documentation

◆ IntegerLowPassIIRFilter()

template<typename Scalar >
xrt::auxiliary::math::IntegerLowPassIIRFilter< Scalar >::IntegerLowPassIIRFilter ( math::Rational< Scalar alpha)
inlineexplicitnoexcept

Constructor.

Note
Taking alpha, not a cutoff frequency, here, because it's easier with the rational math.
Parameters
alphaThe alpha value used to blend between new input and existing state. Larger values mean more influence from new input. math::Rational::isBetweenZeroAndOne() must be true for alpha.

Member Function Documentation

◆ addSample()

template<typename Scalar >
void xrt::auxiliary::math::IntegerLowPassIIRFilter< Scalar >::addSample ( Scalar  sample,
math::Rational< Scalar weight = math::Rational<Scalar>::simplestUnity() 
)
inline

Filter a sample, with an optional weight.

Parameters
sampleThe value to filter
weightAn optional value between 0 and 1. The smaller this value, the less the current sample influences the filter state. For the first call, this is always assumed to be 1 regardless of what you pass.

◆ getState()

template<typename Scalar >
Scalar xrt::auxiliary::math::IntegerLowPassIIRFilter< Scalar >::getState ( ) const
inlinenoexcept

Get the filtered value.

Referenced by m_lowpass_integer::m_lowpass_integer_get_state().

◆ isInitialized()

template<typename Scalar >
bool xrt::auxiliary::math::IntegerLowPassIIRFilter< Scalar >::isInitialized ( ) const
inlinenoexcept

Get whether we have initialized state.

Referenced by m_lowpass_integer::m_lowpass_integer_is_initialized().

◆ reset()

template<typename Scalar >
void xrt::auxiliary::math::IntegerLowPassIIRFilter< Scalar >::reset ( )
inlinenoexcept

Reset the filter to newly-created state.

References xrt::auxiliary::math::detail::IntegerLowPassIIR< Value, Scalar >::reset().


The documentation for this class was generated from the following file: