Functions | |
template<typename F> | |
bool | approx (F a, F b, F epsilon=1e-5) |
template<typename F> | |
bool | abs_approx (F a, F b, F epsilon=1e-5) |
template<typename I, typename F> | |
I | ifloor (F arg) |
template<typename I, typename F> | |
I | nearest (F arg) |
double | fmodulo (double v1, double v2) |
template<typename I> | |
I | imodulo (I v1, I v2) |
template<typename T> | |
T | sign (const T &signvalue) |
template<typename T, typename I> | |
T | xpow (I m, T val) |
template<typename I> | |
uint32 | isqrt (I arg) |
template<typename I> | |
int | ilog2 (I arg) |
double | safe_atan2 (double y, double x) |
template<typename T, typename Iter, typename Comp> | |
void | interpol_helper (const Iter &begin, const Iter &end, const T &val, Comp comp, tsize &idx, T &frac) |
template<typename T, typename Iter> | |
void | interpol_helper (const Iter &begin, const Iter &end, const T &val, tsize &idx, T &frac) |
bool approx | ( | F | a, | |
F | b, | |||
F | epsilon = 1e-5 | |||
) | [inline] |
Returns true if | a-b | <= epsilon * | b |, else false.
Definition at line 43 of file math_utils.h.
bool abs_approx | ( | F | a, | |
F | b, | |||
F | epsilon = 1e-5 | |||
) | [inline] |
Returns true if | a-b | <= epsilon, else false.
Definition at line 50 of file math_utils.h.
I ifloor | ( | F | arg | ) | [inline] |
Returns the largest integer which is smaller than (or equal to) arg.
Definition at line 57 of file math_utils.h.
I nearest | ( | F | arg | ) | [inline] |
Returns the integer which is nearest to arg.
Definition at line 64 of file math_utils.h.
double fmodulo | ( | double | v1, | |
double | v2 | |||
) | [inline] |
Returns the remainder of the division v1/v2. The result is non-negative. v1 can be positive or negative; v2 must be positive.
Definition at line 70 of file math_utils.h.
I imodulo | ( | I | v1, | |
I | v2 | |||
) | [inline] |
Returns the remainder of the division v1/v2. The result is non-negative. v1 can be positive or negative; v2 must be positive.
Definition at line 83 of file math_utils.h.
T sign | ( | const T & | signvalue | ) | [inline] |
Returns -1 if signvalue is negative, else +1.
Definition at line 87 of file math_utils.h.
T xpow | ( | I | m, | |
T | val | |||
) | [inline] |
Returns val*pow(-1,m)
Definition at line 91 of file math_utils.h.
uint32 isqrt | ( | I | arg | ) | [inline] |
Returns the integer n, which fulfills n*n<=arg<(n+1)*(n+1).
Definition at line 120 of file math_utils.h.
int ilog2 | ( | I | arg | ) | [inline] |
Returns the largest integer n that fulfills 2^n<=arg.
Definition at line 124 of file math_utils.h.
double safe_atan2 | ( | double | y, | |
double | x | |||
) | [inline] |
Returns atan2(y,x) if x!=0 or y!=0; else returns 0.
Definition at line 178 of file math_utils.h.
void interpol_helper | ( | const Iter & | begin, | |
const Iter & | end, | |||
const T & | val, | |||
Comp | comp, | |||
tsize & | idx, | |||
T & | frac | |||
) | [inline] |
Helper function for linear interpolation (or extrapolation). The array must be ordered in ascending order; no two values may be equal.
Definition at line 187 of file math_utils.h.
void interpol_helper | ( | const Iter & | begin, | |
const Iter & | end, | |||
const T & | val, | |||
tsize & | idx, | |||
T & | frac | |||
) | [inline] |
Helper function for linear interpolation (or extrapolation). The array must be ordered in ascending order; no two values may be equal.
Definition at line 201 of file math_utils.h.