#include <C:/Work/specialnumbers_svn/NumberLib/NumbersLib/ResponseCurve.h>
Essentailly, this class provides a look-up table with linear interpolation for arbitrary functions.
n | Number of output samples. | |
T | The number type of the input and output, usually float or double. |
Definition at line 24 of file ResponseCurve.h.
Public Member Functions | |
public T | getInputMax () const |
public T | getInputMin () const |
T | operator() (const T input) const |
If the input is below the inputMin given in the constructor, the output is clamped to the first output sample. | |
ResponseCurve (T inputMin, T inputMax, T outputSamples[n]) | |
Constructs a new TransferFunction. | |
Private Attributes | |
T | mInputMax |
T | mInputMin |
T | mOutputSamples [n] |
T | mPeriod |
The difference between two adjacent input values at sample points. |
ResponseCurve | ( | T | inputMin, | |
T | inputMax, | |||
T | outputSamples[n] | |||
) | [inline] |
Constructs a new TransferFunction.
inputMin | The minimum value an input can be. | |
inputMax | The maximum value an input can be. | |
outputSamples | Samples of outputs. |
Definition at line 70 of file ResponseCurve.h.
References ResponseCurve::mOutputSamples.
T getInputMax | ( | ) | const [inline] |
T getInputMin | ( | ) | const [inline] |
T operator() | ( | const T | input | ) | const [inline, virtual] |
If the input is below the inputMin given in the constructor, the output is clamped to the first output sample.
If the input is above the inputMax given in the constructor, the output is clamped to the last output sample.
Otherwise an index is calculated, and the output is interpolated between outputSample[index] and outputSample[index + 1].
input | The input for which output is sought. |
Implements AbstractFunction.
Definition at line 82 of file ResponseCurve.h.
References luma::numbers::lerp(), ResponseCurve::mInputMax, ResponseCurve::mInputMin, ResponseCurve::mOutputSamples, and ResponseCurve::mPeriod.
T mInputMax [private] |
Definition at line 59 of file ResponseCurve.h.
Referenced by ResponseCurve::getInputMax(), and ResponseCurve::operator()().
T mInputMin [private] |
Definition at line 58 of file ResponseCurve.h.
Referenced by ResponseCurve::getInputMin(), and ResponseCurve::operator()().
T mOutputSamples[n] [private] |
Definition at line 60 of file ResponseCurve.h.
Referenced by ResponseCurve::operator()(), and ResponseCurve::ResponseCurve().
T mPeriod [private] |
The difference between two adjacent input values at sample points.
Definition at line 66 of file ResponseCurve.h.
Referenced by ResponseCurve::operator()().