Functions | |
| template<typename T> | |
| T const | Lerp (T const &a, T const &b, float const s) |
Interpolates between a and b based on s. | |
| template<typename T> | |
| T const | Clamp (T const &value, T const &low, T const &high) |
Clamps a value to the range [low,high]. | |
| template<typename T> | |
| T const | Saturate (T const &value) |
| A specialized case of the Clamp function with a range [0,1]. | |
The goal of the Math namespace is not to replace standard math functions, but to compliment them. Thus to use standard math functions you still have to use <cmath>.
| T const PWToolBox::Math::Clamp | ( | T const & | value, | |
| T const & | low, | |||
| T const & | high | |||
| ) | [inline] |
Clamps a value to the range [low,high].
| value | The value to clamp | |
| low | The lowest value in the range. | |
| high | The highest value in the range |
low, high] | T const PWToolBox::Math::Lerp | ( | T const & | a, | |
| T const & | b, | |||
| float const | s | |||
| ) | [inline] |
Interpolates between a and b based on s.
If s is not in the range [0,1] a linear extrapolation is performed instead.
| a | The first value | |
| b | The second value | |
| s | A value that interpolates between a and b |
s is 0, a is returned. When s is 1, b is returned. When s is between 0 and 1, a linear interpolation between a and b is returned. | T const PWToolBox::Math::Saturate | ( | T const & | value | ) | [inline] |
A specialized case of the Clamp function with a range [0,1].
| value | The value to saturate |
1.5.1