ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
DerivativeFilter.cpp
Go to the documentation of this file.
1#include "DerivativeFilter.h"
2
4
8
9float DerivativeFilter::Filter(float value) {
10 float amplitude = fabs(value - previousReading);
11 float normalized = output.Filter(amplitude);
12 float minimum = minFilter.Filter(normalized);
13
14 previousReading = value;
15 outputValue = Mathematics::Constrain(normalized - minimum, 0.0f, 1.0f);
16
17 return outputValue;
18}
Provides a DerivativeFilter class for calculating the rate of change of input values.
float previousReading
Stores the previous input value for calculating the rate of change.
float GetOutput()
Retrieves the current filtered derivative output.
DerivativeFilter()
Constructs a DerivativeFilter instance with default configurations.
float outputValue
Stores the most recent filtered derivative value.
float Filter(float value)
Filters the derivative of the input value and normalizes the output.
MinFilter< 40 > minFilter
Minimum filter for baseline normalization.
RunningAverageFilter< 10 > output
Running average filter for smoothing the derivative output.
static T Constrain(T value, T minimum, T maximum)
Constrains a value between minimum and maximum.
float Filter(float value)
Filters the given value, updating the minimum value within the memory window.
float Filter(float value)
Filters the input value using the running average.