Class to handle mapping from one range to another (warped) range, based on the reciprocal function 1/x. More...
#include <marvin_Reciprocal.h>
Public Member Functions | |
Reciprocal (ReciprocalRange< T > src, ReciprocalRange< T > dest) | |
Reciprocal (ReciprocalRange< T > dest) | |
T | operator() (T toMap) noexcept |
Class to handle mapping from one range to another (warped) range, based on the reciprocal function 1/x.
Shamelessly lifted (with permission) from Signalsmith's Reciprocal class from his dsp library - all credit here to Signalsmith Audio.
marvin::math::Reciprocal< T >::Reciprocal | ( | ReciprocalRange< T > | src, |
ReciprocalRange< T > | dest ) |
Constructs a Reciprocal, which will map from src
to dest
.
src | The original range. |
dest | The new range to map to. |
|
explicit |
Constructs a Reciprocal, which will map from src
to dest
. This overload will assume a src
range of {0, 0.5, 1}.
dest | The new range to map to. |
|
noexcept |
Performs the mapping from src
to dest
on the given value.
toMap | The value (in the range src ) to remap. |