Math

A set of classes that encapsulate math related properties and functions. More...

Files

file  MathTypes.hh
 Forward declarations for the math classes.
 

Namespaces

 gazebo::math
 Math namespace.
 

Classes

class  Angle
 An angle and related functions. More...
 
class  BiQuad< T >
 Bi-quad filter base class. More...
 
class  BiQuadVector3
 BiQuad vector3 filter. More...
 
class  Box
 Mathematical representation of a box and related functions. More...
 
class  Filter< T >
 Filter base class. More...
 
class  Kmeans
 K-Means clustering algorithm. More...
 
class  Matrix3
 A 3x3 matrix class. More...
 
class  Matrix4
 A 3x3 matrix class. More...
 
class  OnePole< T >
 A one-pole DSP filter. More...
 
class  OnePoleQuaternion
 One-pole quaternion filter. More...
 
class  OnePoleVector3
 One-pole vector3 filter. More...
 
class  Plane
 A plane and related functions. More...
 
class  Pose
 Encapsulates a position and rotation in three space. More...
 
class  Quaternion
 A quaternion class. More...
 
class  Rand
 Random number generator class. More...
 
class  RotationSpline
 Spline for rotations. More...
 
class  SignalStatistic
 Statistical properties of a discrete time scalar signal. More...
 
class  Spline
 Splines. More...
 
class  Vector2d
 Generic double x, y vector. More...
 
class  Vector2i
 Generic integer x, y vector. More...
 
class  Vector3
 The Vector3 class represents the generic vector containing 3 elements. More...
 
class  Vector3Stats
 Collection of statistics for a Vector3 signal. More...
 
class  Vector4
 double Generic x, y, z, w vector More...
 

Functions

template<typename 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 >
max (const std::vector< T > &_values)
 get the maximum value of vector of values More...
 
template<typename T >
mean (const std::vector< T > &_values)
 get mean of vector of values More...
 
template<typename 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 >
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 >
variance (const std::vector< T > &_values)
 get variance of vector of values More...
 

Variables

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...
 

Detailed Description

A set of classes that encapsulate math related properties and functions.

Function Documentation

T gazebo::math::clamp ( _v,
_min,
_max 
)
inline

Simple clamping function.

Parameters
[in]_vvalue
[in]_minminimum
[in]_maxmaximum

References gazebo::math::max(), and gazebo::math::min().

bool gazebo::math::equal ( const T &  _a,
const T &  _b,
const T &  _epsilon = 1e-6 
)
inline

check if two values are equal, within a tolerance

Parameters
[in]_athe first value
[in]_bthe second value
[in]_epsilonthe tolerance

Referenced by Quaternion::Correct(), Quaternion::GetInverse(), SimbodySphereShape::SetRadius(), BulletSphereShape::SetRadius(), SimbodyBoxShape::SetSize(), SimbodyCylinderShape::SetSize(), BulletBoxShape::SetSize(), and BulletCylinderShape::SetSize().

float gazebo::math::fixnan ( float  _v)
inline

Fix a nan value.

Parameters
[in]_vValue to correct.
Returns
0 if _v is NaN, _v otherwise.

References gazebo::math::isnan().

double gazebo::math::fixnan ( double  _v)
inline

Fix a nan value.

Parameters
[in]_vValue to correct.
Returns
0 if _v is NaN, _v otherwise.

References gazebo::math::isnan().

bool gazebo::math::isnan ( float  _v)
inline

check if a float is NaN

Parameters
[in]_vthe value
Returns
true if _v is not a number, false otherwise

References gazebo::math::isnan().

Referenced by gazebo::math::fixnan().

bool gazebo::math::isnan ( double  _v)
inline

check if a double is NaN

Parameters
[in]_vthe value
Returns
true if _v is not a number, false otherwise

Referenced by gazebo::math::isnan().

bool gazebo::math::isPowerOfTwo ( unsigned int  _x)
inline

is this a power of 2?

Parameters
[in]_xthe number
Returns
true if _x is a power of 2, false otherwise

Referenced by gazebo::math::roundUpPowerOfTwo().

T gazebo::math::max ( const std::vector< T > &  _values)
inline

get the maximum value of vector of values

Parameters
[in]_valuesthe vector of values
Returns
maximum

References gazebo::math::min().

Referenced by gazebo::math::clamp(), and gazebo::math::min().

T gazebo::math::mean ( const std::vector< T > &  _values)
inline

get mean of vector of values

Parameters
[in]_valuesthe vector of values
Returns
the mean
T gazebo::math::min ( const std::vector< T > &  _values)
inline

get the minimum value of vector of values

Parameters
[in]_valuesthe vector of values
Returns
minimum

References gazebo::math::max().

Referenced by gazebo::math::clamp(), and gazebo::math::max().

double gazebo::math::parseFloat ( const std::string &  _input)
inline

parse string into float

Parameters
_inputthe string
Returns
a floating point number (can be NaN) or 0 with a message in the error stream

References gazebo::math::NAN_D.

int gazebo::math::parseInt ( const std::string &  _input)
inline

parse string into an integer

Parameters
[in]_inputthe string
Returns
an integer, 0 or 0 and a message in the error stream

References gazebo::math::NAN_I.

T gazebo::math::precision ( const T &  _a,
const unsigned int &  _precision 
)
inline

get value at a specified precision

Parameters
[in]_athe number
[in]_precisionthe precision
Returns
the value for the specified precision
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
[in]_xthe number
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().

T gazebo::math::variance ( const std::vector< T > &  _values)
inline

get variance of vector of values

Parameters
[in]_valuesthe vector of values
Returns
the squared deviation

Variable Documentation

const double NAN_D = std::numeric_limits<double>::quiet_NaN()
static

Returns the representation of a quiet not a number (NAN)

Referenced by gazebo::math::parseFloat().

const int NAN_I = std::numeric_limits<int>::quiet_NaN()
static

Returns the representation of a quiet not a number (NAN)

Referenced by gazebo::math::parseInt().