ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
MinFilter< memory > Class Template Reference

Implements a minimum filter over a sliding window. More...

#include <MinFilter.h>

Public Member Functions

 MinFilter (bool ignoreSame=true)
 Constructs a MinFilter with the specified memory size and behavior.
 
float Filter (float value)
 Filters the given value, updating the minimum value within the memory window.
 

Private Member Functions

void ShiftArray (uint8_t mem, float *arr)
 Shifts the values in the specified array to make room for a new value.
 

Private Attributes

const int minMemory = static_cast<int>(std::ceil(memory / 10.0))
 Number of memory blocks for minimum tracking.
 
float values [memory]
 Circular buffer of values.
 
float minValues [memory/10]
 Array of minimum values in each block.
 
uint8_t currentAmount = 0
 Number of values currently stored in the buffer.
 
bool ignoreSame
 Whether to ignore consecutive identical values.
 

Detailed Description

template<size_t memory>
class MinFilter< memory >

Implements a minimum filter over a sliding window.

This class filters input data by maintaining a history of minimum values over a specified memory window. It is particularly useful for detecting and tracking minimum values in data streams.

Template Parameters
memoryThe size of the memory window for tracking minimum values.

Definition at line 28 of file MinFilter.h.

Constructor & Destructor Documentation

◆ MinFilter()

template<size_t memory>
MinFilter ( bool  ignoreSame = true)

Constructs a MinFilter with the specified memory size and behavior.

Parameters
ignoreSameWhether to ignore consecutive identical values (default: true).

Member Function Documentation

◆ Filter()

template<size_t memory>
float Filter ( float  value)

Filters the given value, updating the minimum value within the memory window.

Parameters
valueThe input value to filter.
Returns
The minimum value within the memory window after updating with the new value.

Referenced by DerivativeFilter::Filter(), APDS9960::isBooped(), MicrophoneSimple::Update(), MMC56X3::Update(), Oscilloscope::Update(), and MicrophoneSimple::Update().

◆ ShiftArray()

template<size_t memory>
void ShiftArray ( uint8_t  mem,
float arr 
)
private

Shifts the values in the specified array to make room for a new value.

Parameters
memThe size of the array.
arrThe array to shift.

Member Data Documentation

◆ currentAmount

template<size_t memory>
uint8_t currentAmount = 0
private

Number of values currently stored in the buffer.

Definition at line 33 of file MinFilter.h.

◆ ignoreSame

template<size_t memory>
bool ignoreSame
private

Whether to ignore consecutive identical values.

Definition at line 34 of file MinFilter.h.

◆ minMemory

template<size_t memory>
const int minMemory = static_cast<int>(std::ceil(memory / 10.0))
private

Number of memory blocks for minimum tracking.

Definition at line 30 of file MinFilter.h.

◆ minValues

template<size_t memory>
float minValues[memory/10]
private

Array of minimum values in each block.

Definition at line 32 of file MinFilter.h.

◆ values

template<size_t memory>
float values[memory]
private

Circular buffer of values.

Definition at line 31 of file MinFilter.h.


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