(See the main page.)
Classes | |
class | AbstractFilteredNumber |
class | AbstractFilteredNumber< T, sampleCount, 0 > |
This specialisation is provided for completeness' sake and should generally not be used. More... | |
class | AbstractFunction |
Simply a class that implements the function call operator, and used to implement (mathematical) functions. More... | |
class | BufferedBool |
This class can be used instead of a bool to get smoother (less eratic) transitions, that is, the value stays true or false longer. More... | |
class | BufferedNumber |
This class mimicks a float, but ensures smooth transitions. More... | |
class | BufferedState |
This class handles buffered states transitions, that is, it can be used to reduce state flickering. More... | |
class | BufferedStep |
This class combines ideas from BufferedBool and BufferedState; it represents a linear progression of buffered states. More... | |
class | ClampedNumber |
Class that represents a number that is always clamped in a range. More... | |
class | CyclicNumber |
A cyclic number is a number that is always in a given range, and wraps around when it would exceed this range. More... | |
class | DifferentiableNumber |
A DifferentiableNumber is a number that keeps track of its own derivatives. More... | |
class | DifferentiableNumber< T, 0 > |
This specialisation is provided for completeness' sake and should generally not be used. More... | |
class | DifferentiableNumber< T, 1 > |
This is the stop class for the recursive template definition of DifferentiableNumber. More... | |
class | IntegrableNumber |
An integral number is a number that keeps track of itw own integrals. More... | |
class | IntegrableNumber< T, sampleCount, 0 > |
This specialisation is provided for completeness' sake and should generally not be used. More... | |
class | IntegrableNumber< T, sampleCount, 1 > |
This is the stop class for the recursive template definition of IntegrableNumber. More... | |
class | NumberWrapper |
This class is a drop-in substitute for RangedNumbers, except that it has no logic wrapped around it's value - that is, gertValue will always returned the last value passed to setValue. More... | |
class | PIDBufferedNumber |
A PIDBufferedNumber is a simple PID controller. More... | |
class | PingPongNumber |
A PingPongNumber is a number that can grow (or shrink) up to a point, and then starts shrinking (or growing) again. More... | |
class | RangedNumber |
This class is the base class of numbers that fall in a given range. More... | |
class | ResponseCurve |
This class is described in AI Programming Wisdom 1, "The Beauty of Response Curves", by Bob Alexander. More... | |
class | UpdateableNumber |
Updateable numbers are used when a value is updated regularly, and logic should be performed on every update. More... | |
class | XYResponseCurve |
Similar to ResponseCurve, but allows sample points to be unevenly spaced. More... | |
Functions | |
template<class T> | |
T | clamp (const T &value, const T &minValue, const T &maxValue) |
Returns the given value clamped between the given minimum and maximum. | |
template<class T> | |
T | extreme (T v1, T v2, T center) |
Returns the value furthest from the center. | |
template<class T> | |
T | floor (T x) |
Returns the largest integer smaller than the argument given. | |
template<class T> | |
T | frac (T x) |
Returns the fractional part of a float or double. | |
template<unsigned int n, class T> | |
void | integrate (T samples[]) |
Integrates a sequence of numbers. | |
template<class T> | |
T | lerp (const T &value, const T &inputMin, const T &inputMax, const T &outputMin, const T &outputMax) |
Linearly interpolates a value between a given range. | |
template<class T> | |
T | line (const T &value, const T &inputMin, const T &inputMax, const T &outputMin, const T &outputMax) |
Otherwise, the returned value is outputMin + ((value - inputMin) / (inputMax - inputMin)) * (outputMax - outputMin). | |
template<class T> | |
T | max (const T &v1, const T &v2) |
template<class T> | |
T | min (const T &v1, const T &v2) |
template<class T> | |
T | mod (const T &value, const T &minValue, const T &maxValue) |
Returns the modulus of a number in a specified range, that is (min + value mod (max - min)). | |
template<class T> | |
T | ramp (const T &value, const T &inputMin, const T &inputMax, const T &outputMin, const T &outputMax) |
If the value is below the inputMin, the outputMin is returned. | |
template<class T> | |
T | reflect (const T &value, const T &minValue, const T &maxValue) |
Returns a number reflected between the bounds. | |
template<class T> | |
T | sigmoid (const T &value, const T &inputMin, const T &inputMax, const T &outputMin, const T &outputMax) |
This function is a smooth aproximation for lerp. | |
template<class T> | |
T | step (const T &input, const T &inputThreshold, const T &outputMin, const T &outputMax) |
Returns the one of two outputs, depending on whether the input value exceeds a given threshold. | |
Variables | |
const float | frameRate = FRAME_RATE |
T clamp | ( | const T & | value, | |
const T & | minValue, | |||
const T & | maxValue | |||
) | [inline] |
Returns the given value clamped between the given minimum and maximum.
T | Any type that is supported by the standard min and max functions. | |
value | The value to clamp. | |
minValue | The minimum value of the output. | |
maxValue | The maximum vakue of the output. |
Definition at line 181 of file utils.h.
Referenced by ClampedNumber::dec(), ClampedNumber::getValidValue(), ClampedNumber::inc(), ClampedNumber::operator++(), ClampedNumber::operator+=(), ClampedNumber::operator--(), and ClampedNumber::operator-=().
T extreme | ( | T | v1, | |
T | v2, | |||
T | center = 0 | |||
) | [inline] |
T floor | ( | T | x | ) | [inline] |
T frac | ( | T | x | ) | [inline] |
void integrate | ( | T | samples[] | ) | [inline] |
T lerp | ( | const T & | value, | |
const T & | inputMin, | |||
const T & | inputMax, | |||
const T & | outputMin, | |||
const T & | outputMax | |||
) | [inline] |
Linearly interpolates a value between a given range.
If the value is below the inputMin, the outputMin is returned. If the value is above the inputMax, the outputMax is returned.
Otherwise, the returned value is outputMin + ((value - inputMin) / (inputMax - inputMin)) * (outputMax - outputMin).
Definition at line 214 of file utils.h.
References ramp().
Referenced by ResponseCurve::operator()().
T line | ( | const T & | value, | |
const T & | inputMin, | |||
const T & | inputMax, | |||
const T & | outputMin, | |||
const T & | outputMax | |||
) | [inline] |
T max | ( | const T & | v1, | |
const T & | v2 | |||
) | [inline] |
Definition at line 174 of file utils.h.
Referenced by clamp(), and XYResponseCurve::findInputIndex().
T min | ( | const T & | v1, | |
const T & | v2 | |||
) | [inline] |
Definition at line 168 of file utils.h.
Referenced by clamp(), and XYResponseCurve::findInputIndex().
T mod | ( | const T & | value, | |
const T & | minValue, | |||
const T & | maxValue | |||
) | [inline] |
Returns the modulus of a number in a specified range, that is (min + value mod (max - min)).
For example,
for (int i = 0; i < 10; i++) { int r = mod(i, 2, 5); cout << i << " "; }
Definition at line 187 of file utils.h.
Referenced by CyclicNumber::dec(), CyclicNumber::getValidValue(), CyclicNumber::inc(), PeriodicResponseCurve::operator()(), CyclicNumber::operator+=(), CyclicNumber::operator-=(), CyclicNumber::operator=(), and reflect().
T ramp | ( | const T & | value, | |
const T & | inputMin, | |||
const T & | inputMax, | |||
const T & | outputMin, | |||
const T & | outputMax | |||
) | [inline] |
T reflect | ( | const T & | value, | |
const T & | minValue, | |||
const T & | maxValue | |||
) | [inline] |
T sigmoid | ( | const T & | value, | |
const T & | inputMin, | |||
const T & | inputMax, | |||
const T & | outputMin, | |||
const T & | outputMax | |||
) | [inline] |
T step | ( | const T & | input, | |
const T & | inputThreshold, | |||
const T & | outputMin, | |||
const T & | outputMax | |||
) | [inline] |
Definition at line 139 of file Numbers.h.
Referenced by ClampedNumber::dec(), ClampedNumber::inc(), DifferentiableNumber< T, 1 >::setValue(), DifferentiableNumber::setValue(), and BufferedNumber::setValue().