Functions | |
SbBool | floatIsEqual (float A, float B, unsigned int numFloat) |
template<typename T > | |
T | Max (T a, T b) |
template<typename T > | |
T | Min (T a, T b) |
template<typename T > | |
T | shiftValue (T v, int offset) |
template<> | |
float | shiftValue (float v, int offset) |
template<> | |
double | shiftValue (double v, int offset) |
template<typename T > | |
T | Clamp (T a, T minV, T maxV) |
template<typename T > | |
T | alignToNextPowerOf2 (T n, size_t shift) |
template<typename T > | |
T | getNextPow2 (T a) |
template<int N, typename T > | |
T | nearestUpperMultipleOf (T v) |
template<int N, typename T > | |
T | nearestLowerMultipleOf (T v) |
int | getNextLog2 (int num) |
float | deg2Rad (float a) |
float | rad2Deg (float a) |
bool | isNaN (double a) |
int | rand () |
void | srand (unsigned seed) |
template<typename T > | |
bool | isCoinc (const T &x, const T &y, T tol=(T) OIV_DEF_MATH_HELPER_EPS) |
template<typename T > | |
T | abs (const T &v) |
template<> | |
long int | abs (const long int &v) |
template<> | |
float | abs (const float &v) |
template<> | |
double | abs (const double &v) |
template<typename T > | |
bool | isLessThan (const T &x, const T &y, T tol=(T) OIV_DEF_MATH_HELPER_EPS) |
template<typename T > | |
bool | isGreaterThan (const T &x, const T &y, T tol=(T) OIV_DEF_MATH_HELPER_EPS) |
template<typename T > | |
bool | isLessOrEqualThan (const T &x, const T &y, T tol=(T) OIV_DEF_MATH_HELPER_EPS) |
template<typename T > | |
bool | isGreaterOrEqualThan (const T &x, const T &y, T tol=(T) OIV_DEF_MATH_HELPER_EPS) |
template<typename T > | |
bool | checkRangeI (const T &x, const T &min, T max, T tol=(T) OIV_DEF_MATH_HELPER_EPS) |
template<typename T > | |
bool | checkRangeE (const T &x, const T &min, T max, T tol=(T) OIV_DEF_MATH_HELPER_EPS) |
template<typename T > | |
bool | isCoincRelativeOrAbsolute (const T &A, const T &B, T maxRelativeError, T maxAbsoluteError) |
template<typename T > | |
int | sgn (const T &val) |
template<typename T > | |
T | rangeMax () |
template<typename T > | |
T | rangeMin () |
template<> | |
float | rangeMin< float > () |
template<> | |
double | rangeMin< double > () |
template<typename T > | |
T | fract (const T &value) |
template<> | |
float | fract (const float &value) |
template<> | |
double | fract (const double &value) |
template<> | |
long double | fract (const long double &value) |
Variables | |
static const int | OIV_RAND_MAX = 32767 |
static const float | OIV_DEF_MATH_HELPER_EPS = 1.e-6f |
| |
bool | isFinite (double value) |
bool | isFinite (float value) |
double SbMathHelper::abs | ( | const double & | v | ) | [inline] |
float SbMathHelper::abs | ( | const float & | v | ) | [inline] |
long int SbMathHelper::abs | ( | const long int & | v | ) | [inline] |
T SbMathHelper::abs | ( | const T & | v | ) | [inline] |
Return absolute value of v.
T SbMathHelper::alignToNextPowerOf2 | ( | T | n, | |
size_t | shift | |||
) | [inline] |
Return an integer multiple of 2^shift greater or equals to n.
bool SbMathHelper::checkRangeE | ( | const T & | x, | |
const T & | min, | |||
T | max, | |||
T | tol = (T)OIV_DEF_MATH_HELPER_EPS | |||
) | [inline] |
Inside open interval (excluding endpoints) using given tolerance test.
bool SbMathHelper::checkRangeI | ( | const T & | x, | |
const T & | min, | |||
T | max, | |||
T | tol = (T)OIV_DEF_MATH_HELPER_EPS | |||
) | [inline] |
Inside closed interval (including endpoints) using given tolerance test.
T SbMathHelper::Clamp | ( | T | a, | |
T | minV, | |||
T | maxV | |||
) | [inline] |
Clamps value to given range [minV, maxV].
float SbMathHelper::deg2Rad | ( | float | a | ) | [inline] |
Convert degrees to radians.
SbBool SbMathHelper::floatIsEqual | ( | float | A, | |
float | B, | |||
unsigned int | numFloat | |||
) |
Return true if A and B are equal.
numFloat is the number of allowed representable IEEE float between A and B. For example, there is no number between 10000 and 10000.000977. So if numFloat=1 it will return true for these two numbers.
long double SbMathHelper::fract | ( | const long double & | value | ) | [inline] |
double SbMathHelper::fract | ( | const double & | value | ) | [inline] |
float SbMathHelper::fract | ( | const float & | value | ) | [inline] |
T SbMathHelper::fract | ( | const T & | value | ) | [inline] |
Return fractional part of given value.
ex: fract(23.15) return 0.15
int SbMathHelper::getNextLog2 | ( | int | num | ) |
Return the next log of 2 greater or equal to a.
T SbMathHelper::getNextPow2 | ( | T | a | ) | [inline] |
Return the next power of 2 greater or equal to a.
bool SbMathHelper::isCoinc | ( | const T & | x, | |
const T & | y, | |||
T | tol = (T)OIV_DEF_MATH_HELPER_EPS | |||
) | [inline] |
Coincidence test using given tolerance.
bool SbMathHelper::isCoincRelativeOrAbsolute | ( | const T & | A, | |
const T & | B, | |||
T | maxRelativeError, | |||
T | maxAbsoluteError | |||
) | [inline] |
Relative error comparison.
bool SbMathHelper::isFinite | ( | float | value | ) | [inline] |
Returns true if the value is a finite value (i.e.
is is normal, subnormal or zero but not infinite or NaN).
bool SbMathHelper::isFinite | ( | double | value | ) | [inline] |
Returns true if the value is a finite value (i.e.
is is normal, subnormal or zero but not infinite or NaN).
bool SbMathHelper::isGreaterOrEqualThan | ( | const T & | x, | |
const T & | y, | |||
T | tol = (T)OIV_DEF_MATH_HELPER_EPS | |||
) | [inline] |
Greater or equal than test (x >= y) using given tolerance.
bool SbMathHelper::isGreaterThan | ( | const T & | x, | |
const T & | y, | |||
T | tol = (T)OIV_DEF_MATH_HELPER_EPS | |||
) | [inline] |
Greater than test (x > y) using given tolerance.
bool SbMathHelper::isLessOrEqualThan | ( | const T & | x, | |
const T & | y, | |||
T | tol = (T)OIV_DEF_MATH_HELPER_EPS | |||
) | [inline] |
Less or equal than test (x <= y) using given tolerance.
bool SbMathHelper::isLessThan | ( | const T & | x, | |
const T & | y, | |||
T | tol = (T)OIV_DEF_MATH_HELPER_EPS | |||
) | [inline] |
Less than test (x < y) using given tolerance.
bool SbMathHelper::isNaN | ( | double | a | ) | [inline] |
Returns true if the specified value is NaN.
T SbMathHelper::Max | ( | T | a, | |
T | b | |||
) | [inline] |
T SbMathHelper::Min | ( | T | a, | |
T | b | |||
) | [inline] |
T SbMathHelper::nearestLowerMultipleOf | ( | T | v | ) | [inline] |
Return the nearest lower multiple of some value.
for example nearestLowerMultipleOf<4>(7) return 4. Template because it let compiler to do some optimizations.
T SbMathHelper::nearestUpperMultipleOf | ( | T | v | ) | [inline] |
Return the nearest upper multiple of some value.
for example nearestUpperMultipleOf<4>(7) return 8. Template because it let compiler to do some optimizations.
float SbMathHelper::rad2Deg | ( | float | a | ) | [inline] |
Convert radians to degrees.
int SbMathHelper::rand | ( | ) |
Returns a pseudo-random integer between 0 and OIV_RAND_MAX.
The returned sequence will be the same on all machines.
T SbMathHelper::rangeMax | ( | ) | [inline] |
Returns the maximum finite value representable by the numeric type T.
T SbMathHelper::rangeMin | ( | ) | [inline] |
Returns the lowest finite value representable by the numeric type T, that is, a finite value x such that there is no other finite value y where y < x.
double SbMathHelper::rangeMin< double > | ( | ) | [inline] |
float SbMathHelper::rangeMin< float > | ( | ) | [inline] |
int SbMathHelper::sgn | ( | const T & | val | ) | [inline] |
Implements signum return value in { -1, 0, +1 }.
double SbMathHelper::shiftValue | ( | double | v, | |
int | offset | |||
) | [inline] |
float SbMathHelper::shiftValue | ( | float | v, | |
int | offset | |||
) | [inline] |
T SbMathHelper::shiftValue | ( | T | v, | |
int | offset | |||
) | [inline] |
shift the value of offset representable values considering value type.
If T is an integer type (char, short, etc...), it just return v + offset. If T is a float type (float, double, ...) it return the offset'th representable value starting from v. ex: shiftValue(10000.0f, 1) returns 10000.000977...
void SbMathHelper::srand | ( | unsigned | seed | ) |
Set seed for a new sequence of pseudo-random integers to be returned by rand().
const float SbMathHelper::OIV_DEF_MATH_HELPER_EPS = 1.e-6f [static] |
Default epsilon value for coincidence and interval checking.
const int SbMathHelper::OIV_RAND_MAX = 32767 [static] |
Maximum value returned by SbMathHelper::rand().