ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
DerivativeFilter.h
Go to the documentation of this file.
1/**
2 * @file DerivativeFilter.h
3 * @brief Provides a `DerivativeFilter` class for calculating the rate of change of input values.
4 *
5 * The `DerivativeFilter` combines a running average filter and a minimum filter to normalize
6 * and constrain the derivative values, ensuring stability and noise reduction.
7 *
8 * @date 22/12/2024
9 * @version 1.0
10 * @author Coela Can't
11 */
12
13#pragma once
14
15#include "RunningAverageFilter.h" // Includes the running average filter utility.
16#include "MinFilter.h" // Includes the minimum filter utility.
17#include "../Math/Mathematics.h" // Includes mathematical utilities for constraints and operations.
18
19/**
20 * @class DerivativeFilter
21 * @brief Calculates the derivative (rate of change) of input values with filtering for stability.
22 *
23 * The `DerivativeFilter` smooths the derivative output using a running average filter
24 * and normalizes it using a minimum filter to prevent rapid fluctuations.
25 */
27private:
28 RunningAverageFilter<10> output = RunningAverageFilter<10>(0.2f); ///< Running average filter for smoothing the derivative output.
29 MinFilter<40> minFilter; ///< Minimum filter for baseline normalization.
30 float previousReading = 0.0f; ///< Stores the previous input value for calculating the rate of change.
31 float outputValue = 0.0f; ///< Stores the most recent filtered derivative value.
32
33public:
34 /**
35 * @brief Constructs a `DerivativeFilter` instance with default configurations.
36 */
38
39 /**
40 * @brief Retrieves the current filtered derivative output.
41 *
42 * @return The filtered derivative value.
43 */
44 float GetOutput();
45
46 /**
47 * @brief Filters the derivative of the input value and normalizes the output.
48 *
49 * @param value The current input value.
50 * @return The filtered and normalized derivative value.
51 */
52 float Filter(float value);
53};
Provides a collection of mathematical utility functions and constants.
Implements a moving minimum filter for processing data streams.
Implements a running average filter for smoothing data.
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.
Implements a minimum filter over a sliding window.
Definition MinFilter.h:28
Smooths data values using a weighted running average.