A set of classes that encapsulate math related properties and functions.
More...
|
file | MathTypes.hh |
| Forward declarations for the math classes.
|
|
|
template<typename T > |
T | clamp (T _v, T _min, T _max) |
| Simple clamping function. More...
|
|
template<typename T > |
bool | equal (const T &_a, const T &_b, const T &_epsilon=1e-6) |
| check if two values are equal, within a tolerance More...
|
|
float | fixnan (float _v) |
| Fix a nan value. More...
|
|
double | fixnan (double _v) |
| Fix a nan value. More...
|
|
bool | isnan (float _v) |
| check if a float is NaN More...
|
|
bool | isnan (double _v) |
| check if a double is NaN More...
|
|
bool | isPowerOfTwo (unsigned int _x) |
| is this a power of 2? More...
|
|
template<typename T > |
T | max (const std::vector< T > &_values) |
| get the maximum value of vector of values More...
|
|
template<typename T > |
T | mean (const std::vector< T > &_values) |
| get mean of vector of values More...
|
|
template<typename T > |
T | min (const std::vector< T > &_values) |
| get the minimum value of vector of values More...
|
|
double | parseFloat (const std::string &_input) |
| parse string into float More...
|
|
int | parseInt (const std::string &_input) |
| parse string into an integer More...
|
|
template<typename T > |
T | precision (const T &_a, const unsigned int &_precision) |
| get value at a specified precision More...
|
|
unsigned int | roundUpPowerOfTwo (unsigned int _x) |
| Get the smallest power of two that is greater or equal to a given value. More...
|
|
template<typename T > |
T | variance (const std::vector< T > &_values) |
| get variance of vector of values More...
|
|
|
static const double | NAN_D = std::numeric_limits<double>::quiet_NaN() |
| Returns the representation of a quiet not a number (NAN) More...
|
|
static const int | NAN_I = std::numeric_limits<int>::quiet_NaN() |
| Returns the representation of a quiet not a number (NAN) More...
|
|
A set of classes that encapsulate math related properties and functions.
§ clamp()
T gazebo::math::clamp |
( |
T |
_v, |
|
|
T |
_min, |
|
|
T |
_max |
|
) |
| |
|
inline |
§ equal()
bool gazebo::math::equal |
( |
const T & |
_a, |
|
|
const T & |
_b, |
|
|
const T & |
_epsilon = 1e-6 |
|
) |
| |
|
inline |
§ fixnan() [1/2]
float gazebo::math::fixnan |
( |
float |
_v | ) |
|
|
inline |
§ fixnan() [2/2]
double gazebo::math::fixnan |
( |
double |
_v | ) |
|
|
inline |
§ isnan() [1/2]
bool gazebo::math::isnan |
( |
float |
_v | ) |
|
|
inline |
§ isnan() [2/2]
bool gazebo::math::isnan |
( |
double |
_v | ) |
|
|
inline |
check if a double is NaN
- Parameters
-
- Returns
- true if _v is not a number, false otherwise
Referenced by gazebo::math::isnan().
§ isPowerOfTwo()
bool gazebo::math::isPowerOfTwo |
( |
unsigned int |
_x | ) |
|
|
inline |
§ max()
T gazebo::math::max |
( |
const std::vector< T > & |
_values | ) |
|
|
inline |
§ mean()
T gazebo::math::mean |
( |
const std::vector< T > & |
_values | ) |
|
|
inline |
get mean of vector of values
- Parameters
-
[in] | _values | the vector of values |
- Returns
- the mean
§ min()
T gazebo::math::min |
( |
const std::vector< T > & |
_values | ) |
|
|
inline |
§ parseFloat()
double gazebo::math::parseFloat |
( |
const std::string & |
_input | ) |
|
|
inline |
parse string into float
- Parameters
-
- Returns
- a floating point number (can be NaN) or 0 with a message in the error stream
References gazebo::math::NAN_D.
§ parseInt()
int gazebo::math::parseInt |
( |
const std::string & |
_input | ) |
|
|
inline |
parse string into an integer
- Parameters
-
- Returns
- an integer, 0 or 0 and a message in the error stream
References gazebo::math::NAN_I.
§ precision()
T gazebo::math::precision |
( |
const T & |
_a, |
|
|
const unsigned int & |
_precision |
|
) |
| |
|
inline |
get value at a specified precision
- Parameters
-
[in] | _a | the number |
[in] | _precision | the precision |
- Returns
- the value for the specified precision
§ roundUpPowerOfTwo()
unsigned int gazebo::math::roundUpPowerOfTwo |
( |
unsigned int |
_x | ) |
|
|
inline |
Get the smallest power of two that is greater or equal to a given value.
- Parameters
-
- Returns
- the same value if _x is already a power of two. Otherwise, it returns the smallest power of two that is greater than _x
References gazebo::math::isPowerOfTwo().
§ variance()
T gazebo::math::variance |
( |
const std::vector< T > & |
_values | ) |
|
|
inline |
get variance of vector of values
- Parameters
-
[in] | _values | the vector of values |
- Returns
- the squared deviation
§ NAN_D
const double NAN_D = std::numeric_limits<double>::quiet_NaN() |
|
static |
§ NAN_I
const int NAN_I = std::numeric_limits<int>::quiet_NaN() |
|
static |