Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SbMathHelper.h File Reference
#include <Inventor/SbBase.h>
#include <cfloat>
#include <cmath>
#include <Inventor/STL/limits>
#include <Inventor/STL/complex>

Go to the source code of this file.

Namespaces

namespace  SbMathHelper
 

Functions

SbBool SbMathHelper::floatIsEqual (float A, float B, unsigned int numFloat)
 Return true if A and B are equal.
 
template<typename T >
SbMathHelper::Max (T a, T b)
 
template<typename T >
SbMathHelper::Min (T a, T b)
 
template<typename T >
SbMathHelper::shiftValue (T v, int offset)
 shift the value of offset representable values considering value type.
 
template<>
float SbMathHelper::shiftValue (float v, int offset)
 
template<>
double SbMathHelper::shiftValue (double v, int offset)
 
template<typename T >
SbMathHelper::Clamp (T a, T minV, T maxV)
 Clamps value to given range [minV, maxV].
 
template<typename T >
SbMathHelper::alignToNextPowerOf2 (T n, size_t shift)
 Return an integer multiple of 2^shift greater or equals to n.
 
template<typename T >
SbMathHelper::getNextPow2 (T a)
 Return the next power of 2 greater or equal to a.
 
template<int N, typename T >
SbMathHelper::nearestUpperMultipleOf (T v)
 Return the nearest upper multiple of some value.
 
template<int N, typename T >
SbMathHelper::nearestLowerMultipleOf (T v)
 Return the nearest lower multiple of some value.
 
int SbMathHelper::getNextLog2 (int num)
 Return the next log of 2 greater or equal to a.
 
float SbMathHelper::deg2Rad (float a)
 Convert degrees to radians.
 
float SbMathHelper::rad2Deg (float a)
 Convert radians to degrees.
 
double SbMathHelper::roundToNearestInt (double x)
 Round the double value to the nearest integer value.
 
bool SbMathHelper::isNaN (double a)
 Returns true if the specified value is NaN.
 
int SbMathHelper::rand ()
 Returns a pseudo-random integer between 0 and OIV_RAND_MAX.
 
void SbMathHelper::srand (unsigned seed)
 Set seed for a new sequence of pseudo-random integers to be returned by rand()
 
template<typename T >
bool SbMathHelper::isCoinc (const T &x, const T &y, T tol=(T) OIV_DEF_MATH_HELPER_EPS)
 Coincidence test using given tolerance.
 
template<typename T >
SbMathHelper::abs (const T &v)
 Return absolute value of v.
 
template<>
long int SbMathHelper::abs (const long int &v)
 
template<>
float SbMathHelper::abs (const float &v)
 
template<>
double SbMathHelper::abs (const double &v)
 
template<typename T >
bool SbMathHelper::isLessThan (const T &x, const T &y, T tol=(T) OIV_DEF_MATH_HELPER_EPS)
 Less than test (x < y) using given tolerance.
 
template<typename T >
bool SbMathHelper::isGreaterThan (const T &x, const T &y, T tol=(T) OIV_DEF_MATH_HELPER_EPS)
 Greater than test (x > y) using given tolerance.
 
template<typename T >
bool SbMathHelper::isLessOrEqualThan (const T &x, const T &y, T tol=(T) OIV_DEF_MATH_HELPER_EPS)
 Less or equal than test (x <= y) using given tolerance.
 
template<typename T >
bool SbMathHelper::isGreaterOrEqualThan (const T &x, const T &y, T tol=(T) OIV_DEF_MATH_HELPER_EPS)
 Greater or equal than test (x >= y) using given tolerance.
 
template<typename T >
bool SbMathHelper::checkRangeI (const T &x, const T &min, T max, T tol=(T) OIV_DEF_MATH_HELPER_EPS)
 Inside closed interval (including endpoints) using given tolerance test.
 
template<typename T >
bool SbMathHelper::checkRangeE (const T &x, const T &min, T max, T tol=(T) OIV_DEF_MATH_HELPER_EPS)
 Inside open interval (excluding endpoints) using given tolerance test.
 
template<typename T >
bool SbMathHelper::isCoincRelativeOrAbsolute (const T &A, const T &B, T maxRelativeError, T maxAbsoluteError)
 Relative or absolute error without sign comparison.
 
template<typename T >
int SbMathHelper::sgn (const T &val)
 Implements signum return value in { -1, 0, +1 }.
 
template<typename T >
SbMathHelper::rangeMax ()
 Returns the maximum finite value representable by the numeric type T.
 
template<typename T >
SbMathHelper::rangeMin ()
 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.
 
template<>
float SbMathHelper::rangeMin< float > ()
 
template<>
double SbMathHelper::rangeMin< double > ()
 
template<typename T >
SbMathHelper::fract (const T &)
 Return fractional part of given value.
 
template<>
float SbMathHelper::fract (const float &value)
 
template<>
double SbMathHelper::fract (const double &value)
 
template<>
long double SbMathHelper::fract (const long double &value)
 
bool SbMathHelper::isFinite (double value)
 Returns true if the value is a finite value (i.e.
 
bool SbMathHelper::isFinite (float value)
 Returns true if the value is a finite value (i.e.
 

Variables

static const int SbMathHelper::OIV_RAND_MAX = 32767
 Maximum value returned by SbMathHelper::rand()
 
static const float SbMathHelper::OIV_DEF_MATH_HELPER_EPS = 1.e-6f
 Default epsilon value for coincidence and interval checking.