BALL 1.5.0
Loading...
Searching...
No Matches
BALL::Maths Namespace Reference

Functions

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

Function Documentation

◆ abs()

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 50 of file MATHS/common.h.

◆ ceiling()

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 295 of file MATHS/common.h.

◆ compare()

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 307 of file MATHS/common.h.

◆ floor()

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 284 of file MATHS/common.h.

◆ frac()

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 61 of file MATHS/common.h.

◆ isEqual()

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 212 of file MATHS/common.h.

◆ isFinite()

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 149 of file MATHS/common.h.

◆ isGreater()

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 273 of file MATHS/common.h.

◆ isGreaterOrEqual()

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 261 of file MATHS/common.h.

◆ isInfinite()

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 178 of file MATHS/common.h.

◆ isLess()

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 236 of file MATHS/common.h.

◆ isLessOrEqual()

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 249 of file MATHS/common.h.

◆ isNan()

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 160 of file MATHS/common.h.

◆ isNear()

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 320 of file MATHS/common.h.

◆ isNotEqual()

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 224 of file MATHS/common.h.

◆ isNotZero()

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 200 of file MATHS/common.h.

◆ isZero()

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 189 of file MATHS/common.h.

◆ max() [1/2]

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 75 of file MATHS/common.h.

◆ max() [2/2]

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 88 of file MATHS/common.h.

◆ min() [1/2]

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 102 of file MATHS/common.h.

◆ min() [2/2]

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 115 of file MATHS/common.h.

◆ rint()

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

round to integral value in floating-point format

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

◆ round()

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 127 of file MATHS/common.h.

◆ sgn()

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 138 of file MATHS/common.h.