Math functions.
Namespace: | dmMath |
Include: | #include <dmsdk/dlib/math.h> |
FUNCTIONS | |
---|---|
template <T> T Abs(T x) | Abs function |
template <T> T Clamp(T v, T min, T max) | Clamp function |
template <T> T Max(T a, T b) | Max function |
template <T> T Min(T a, T b) | Min function |
template <T> T Select(T x, T a, T b) | Select one of two values |
T Abs(T x)
Abs function
PARAMETERS
T |
x |
RETURNS
T |
Absolute value of x |
T Clamp(T v, T min, T max)
Clamp function
PARAMETERS
T |
v |
Value to clamp |
T |
min |
Lower bound |
T |
max |
Upper bound |
RETURNS
T |
Value closest to v inside the range [min, max] |
T Max(T a, T b)
Max function
PARAMETERS
T |
a |
Value a |
T |
b |
Value b |
RETURNS
T |
Max of a and b |
T Min(T a, T b)
Min function
PARAMETERS
T |
a |
Value a |
T |
b |
Value b |
RETURNS
T |
Min of a and b |
T Select(T x, T a, T b)
Select one of two values depending on the sign of another.
PARAMETERS
T |
x |
Value to test for positiveness |
T |
a |
Result if test succeeded |
T |
b |
Result if test failed |
RETURNS
T |
a when x >= 0, b otherwise |