BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
Common Mathematical Functions

Functions

template<typename T >
BALL::Maths::abs (const T &t)
 
template<typename T >
BALL::Maths::frac (const T &t)
 
template<typename T >
BALL::Maths::max (const T &a, const T &b)
 
template<typename T >
BALL::Maths::max (const T &a, const T &b, const T &ct)
 
template<typename T >
BALL::Maths::min (const T &a, const T &b)
 
template<typename T >
BALL::Maths::min (const T &a, const T &b, const T &ct)
 
template<typename T >
BALL::Maths::round (const T &t)
 
template<typename T >
BALL::Maths::sgn (const T &t)
 
template<typename T >
bool BALL::Maths::isFinite (const T &t)
 
template<typename T >
bool BALL::Maths::isNan (const T &t)
 
template<typename T >
bool BALL::Maths::isInfinite (const T &t)
 
template<typename T >
bool BALL::Maths::isZero (const T &t)
 
template<typename T >
bool BALL::Maths::isNotZero (const T &t)
 
template<typename T1 , typename T2 >
bool BALL::Maths::isEqual (const T1 &a, const T2 &b)
 
template<typename T1 , typename T2 >
bool BALL::Maths::isNotEqual (const T1 &a, const T2 &b)
 
template<typename T1 , typename T2 >
bool BALL::Maths::isLess (const T1 &a, const T2 &b)
 
template<typename T1 , typename T2 >
bool BALL::Maths::isLessOrEqual (const T1 &a, const T2 &b)
 
template<typename T1 , typename T2 >
bool BALL::Maths::isGreaterOrEqual (const T1 &a, const T2 &b)
 
template<typename T1 , typename T2 >
bool BALL::Maths::isGreater (const T1 &a, const T2 &b)
 
template<typename T >
long BALL::Maths::floor (const T &t)
 
template<typename T >
long BALL::Maths::ceiling (const T &t)
 
template<typename T1 , typename T2 >
Index BALL::Maths::compare (const T1 &a, const T2 &b)
 
template<typename T >
bool BALL::Maths::isNear (const T &a, const T &b, const T &max_diff)
 
double BALL::Maths::rint (double x)
 round to integral value in floating-point format More...
 

Detailed Description

Namespace: BALL::Maths

Function Documentation

template<typename T >
T BALL::Maths::abs ( const T &  t)
inline

Return the absolute value of a number.

Parameters
tthe number
Returns
T the absolute value

Definition at line 54 of file MATHS/common.h.

template<typename T >
long BALL::Maths::ceiling ( const T &  t)
inline

Return the ceiling of a number.

Parameters
tthe number
Returns
T the ceiling

Definition at line 302 of file MATHS/common.h.

template<typename T1 , typename T2 >
Index BALL::Maths::compare ( const T1 &  a,
const T2 &  b 
)
inline

Compare two numbers to each other.

Parameters
athe first number
bthe second number
Returns
Index -1 a < b; 0 a = b; 1 a > b

Definition at line 314 of file MATHS/common.h.

template<typename T >
long BALL::Maths::floor ( const T &  t)
inline

Return the floor of a number.

Parameters
tthe number
Returns
T the floor

Definition at line 291 of file MATHS/common.h.

template<typename T >
T BALL::Maths::frac ( const T &  t)
inline

Return the fraction of a number.

Parameters
tthe number
Returns
T the fraction

Definition at line 65 of file MATHS/common.h.

template<typename T1 , typename T2 >
bool BALL::Maths::isEqual ( const T1 &  a,
const T2 &  b 
)
inline

Test whether a number is equal to another.

Parameters
athe first number
bthe second number
Returns
bool, true if the absolute distance of a and b is below Constants::EPSILON

Definition at line 219 of file MATHS/common.h.

template<typename T >
bool BALL::Maths::isFinite ( const T &  t)
inline

Test whether a number is finite.

Parameters
tthe number
Returns
bool, true if t is finite

Definition at line 153 of file MATHS/common.h.

template<typename T1 , typename T2 >
bool BALL::Maths::isGreater ( const T1 &  a,
const T2 &  b 
)
inline

Test whether a number is greater compared to another.

Parameters
athe first number
bthe second number
Returns
bool, true if a is greater than b

Definition at line 280 of file MATHS/common.h.

template<typename T1 , typename T2 >
bool BALL::Maths::isGreaterOrEqual ( const T1 &  a,
const T2 &  b 
)
inline

Test whether a number is greater or equal compared to another.

Parameters
athe first number
bthe second number
Returns
bool, true if a is greater or equal than b

Definition at line 268 of file MATHS/common.h.

template<typename T >
bool BALL::Maths::isInfinite ( const T &  t)
inline

Test whether a number is infinite.

Parameters
tthe number
Returns
bool, true if t equals inf or -inf

Definition at line 185 of file MATHS/common.h.

template<typename T1 , typename T2 >
bool BALL::Maths::isLess ( const T1 &  a,
const T2 &  b 
)
inline

Test whether a number is less compared to another.

Parameters
athe first number
bthe second number
Returns
bool, true if a is smaller than b

Definition at line 243 of file MATHS/common.h.

template<typename T1 , typename T2 >
bool BALL::Maths::isLessOrEqual ( const T1 &  a,
const T2 &  b 
)
inline

Test whether a number is less or equal compared to another.

Parameters
athe first number
bthe second number
Returns
bool, true if a is less or equal b

Definition at line 256 of file MATHS/common.h.

template<typename T >
bool BALL::Maths::isNan ( const T &  t)
inline

Test whether a value is not a number.

Parameters
tthe number
Returns
bool, true if t equals nan

Definition at line 168 of file MATHS/common.h.

template<typename T >
bool BALL::Maths::isNear ( const T &  a,
const T &  b,
const T &  max_diff 
)
inline

Test whether two numbers are close to each other.

Parameters
athe first number
bthe second number
max_diffthe maximum allowed difference between the two numbers
Returns
bool, true if the absolute distance between a and b is below max_diff

Definition at line 327 of file MATHS/common.h.

template<typename T1 , typename T2 >
bool BALL::Maths::isNotEqual ( const T1 &  a,
const T2 &  b 
)
inline

Test whether a number is not equal to another.

Parameters
athe first number
bthe second number
Returns
bool, true if the absolute distance of a and b is at least Constants::EPSILON

Definition at line 231 of file MATHS/common.h.

template<typename T >
bool BALL::Maths::isNotZero ( const T &  t)
inline

Test whether a number is not zero.

Parameters
tthe number
Returns
bool, true, if the absolute value of t is at least Constants::EPSILON

Definition at line 207 of file MATHS/common.h.

template<typename T >
bool BALL::Maths::isZero ( const T &  t)
inline

Test whether a number is zero.

Parameters
tthe number
Returns
bool, true if the absolute value of t is below Constants::EPSILON

Definition at line 196 of file MATHS/common.h.

template<typename T >
T BALL::Maths::max ( const T &  a,
const T &  b 
)
inline

Return the greater of two numbers.

Parameters
athe first number
bthe second number
Returns
T the greatest number

Definition at line 79 of file MATHS/common.h.

template<typename T >
T BALL::Maths::max ( const T &  a,
const T &  b,
const T &  ct 
)
inline

Return the greatest of three numbers.

Parameters
athe first number
bthe second number
ctthe third number
Returns
T the greatest number

Definition at line 92 of file MATHS/common.h.

template<typename T >
T BALL::Maths::min ( const T &  a,
const T &  b 
)
inline

Return the smallest of two numbers.

Parameters
athe first number
bthe second number
Returns
T the smallest number

Definition at line 106 of file MATHS/common.h.

template<typename T >
T BALL::Maths::min ( const T &  a,
const T &  b,
const T &  ct 
)
inline

Return the smallest of three numbers.

Parameters
athe first number
bthe second number
ctthe third number
Returns
T the smallest number

Definition at line 119 of file MATHS/common.h.

double BALL::Maths::rint ( double  x)
inline

round to integral value in floating-point format

Definition at line 334 of file MATHS/common.h.

template<typename T >
T BALL::Maths::round ( const T &  t)
inline

Round a number and return the result.

Parameters
tthe number
Returns
T the result

Definition at line 131 of file MATHS/common.h.

template<typename T >
T BALL::Maths::sgn ( const T &  t)
inline

Return the sign of a number.

Parameters
tthe number
Returns
Index -1 t < 0; 0 t = 0; 1 t > 0

Definition at line 142 of file MATHS/common.h.