MostlyHarmless 0.0.1
 
Loading...
Searching...
No Matches
marvin::math::Reciprocal< T > Class Template Referencefinal

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)
 
operator() (T toMap) noexcept
 

Detailed Description

template<FloatType T>
class marvin::math::Reciprocal< T >

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.

Constructor & Destructor Documentation

◆ Reciprocal() [1/2]

template<FloatType T>
marvin::math::Reciprocal< T >::Reciprocal ( ReciprocalRange< T > src,
ReciprocalRange< T > dest )

Constructs a Reciprocal, which will map from src to dest.

Parameters
srcThe original range.
destThe new range to map to.

◆ Reciprocal() [2/2]

template<FloatType T>
marvin::math::Reciprocal< T >::Reciprocal ( ReciprocalRange< T > dest)
explicit

Constructs a Reciprocal, which will map from src to dest. This overload will assume a src range of {0, 0.5, 1}.

Parameters
destThe new range to map to.

Member Function Documentation

◆ operator()()

template<FloatType T>
T marvin::math::Reciprocal< T >::operator() ( T toMap)
noexcept

Performs the mapping from src to dest on the given value.

Parameters
toMapThe value (in the range src) to remap.

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