FastLED 3.9.15
Loading...
Searching...
No Matches

◆ Interp()

template<typename KeyT, typename ValT>
ValT Interp ( const KeyT & k,
const InterpData< KeyT, ValT > * array,
const int n )
inline

Definition at line 54 of file ApproximatingFunction.h.

54 {
55 if (n < 1) {
56 return ValT(0);
57 }
58
59 int low_idx = -1;
60 int high_idx = -1;
61
62 SelectInterpPoints<KeyT, ValT>(k, array, n, &low_idx, &high_idx);
63
64 if (low_idx == high_idx) {
65 return array[low_idx].val;
66 }
67
68 const InterpData<KeyT, ValT>* curr = &array[low_idx];
69 const InterpData<KeyT, ValT>* next = &array[high_idx];
70 // map(...) only works on integers. MapT<> is the same thing but it works on
71 // all datatypes.
72 return MapT<KeyT, ValT>(k, curr->key, next->key, curr->val, next->val);
73}
void SelectInterpPoints(const KeyT &k, const InterpData< KeyT, ValT > *array, const int n, int *dest_lower_bound, int *dest_upper_bound)
const Y MapT(const X &x, const X &x1, const X &x2, const Y &y1, const Y &y2)

References InterpData< KeyT, ValT >::key, MapT(), SelectInterpPoints(), and InterpData< KeyT, ValT >::val.

Referenced by AttackRemapFactor(), anonymous_namespace{Painter.cpp}::LuminanceDecay(), MapDecayTime(), and ToBrightness().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: