Sylib
A C++ Library For V5
Loading...
Searching...
No Matches
sylib::RangeExtremaFilter Class Reference

Extrema Filter. More...

#include <math.hpp>

Public Member Functions

 RangeExtremaFilter (int sampleSize)
 Creates an Extrema filter that returns the largest absolute value of recent inputs. More...
 
double filter (double rawValue)
 Filters an input value. More...
 
int getQueueLength () const
 Gets the current length of the queue of previous values. More...
 
int getQueueMaxLength () const
 Gets the number of median values to average when the sample size is even. More...
 
double getCurrentValue () const
 Gets the current filter output without providing a new input value. More...
 

Detailed Description

Extrema Filter.

Constructor & Destructor Documentation

◆ RangeExtremaFilter()

sylib::RangeExtremaFilter::RangeExtremaFilter ( int  sampleSize)

Creates an Extrema filter that returns the largest absolute value of recent inputs.

Parameters
sampleSizeThe number of previous values to consider. A higher number will result in a more stable value, but with more lag.

Member Function Documentation

◆ filter()

double sylib::RangeExtremaFilter::filter ( double  rawValue)

Filters an input value.

Parameters
rawValueThe raw input value to filter
Returns
Filter output

◆ getCurrentValue()

double sylib::RangeExtremaFilter::getCurrentValue ( ) const

Gets the current filter output without providing a new input value.

Returns
Filter output

◆ getQueueLength()

int sylib::RangeExtremaFilter::getQueueLength ( ) const

Gets the current length of the queue of previous values.

Returns
Queue length

◆ getQueueMaxLength()

int sylib::RangeExtremaFilter::getQueueMaxLength ( ) const

Gets the number of median values to average when the sample size is even.

Returns
Center size