Math

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

## Files

file  MathTypes.hh
Forward declarations for the math classes.

## Namespaces

namespace  gazebo::math
Math namespace.

## Classes

class  gazebo::math::Angle
An angle and related functions. More...

class  gazebo::math::Box
Mathematical representation of a box and related functions. More...

class  gazebo::math::Matrix3
A 3x3 matrix class. More...

class  gazebo::math::Matrix4
A 3x3 matrix class. More...

class  gazebo::math::Plane
A plane and related functions. More...

class  gazebo::math::Pose
Encapsulates a position and rotation in three space. More...

class  gazebo::math::Quaternion
A quaternion class. More...

class  gazebo::math::Rand
Random number generator class. More...

class  gazebo::math::RotationSpline
Spline for rotations. More...

class  gazebo::math::Spline
Splines. More...

class  gazebo::math::Vector2d
Generic double x, y vector. More...

class  gazebo::math::Vector2i
Generic integer x, y vector. More...

class  gazebo::math::Vector3
The Vector3 class represents the generic vector containing 3 elements. More...

class  gazebo::math::Vector4
double Generic x, y, z, w vector More...

## Functions

template<typename T >
gazebo::math::clamp (T _v, T _min, T _max)
simple clamping function

template<typename T >
bool gazebo::math::equal (const T &_a, const T &_b, const T &_epsilon=1e-6)
check if two values are equal, within a tolerance

bool gazebo::math::isnan (float _v)
check if a float is NaN

bool gazebo::math::isnan (double _v)
check if a double is NaN

bool gazebo::math::isPowerOfTwo (unsigned int _x)
is this a power of 2?

template<typename T >
gazebo::math::max (const std::vector< T > &_values)
get the maximum value of vector of values

template<typename T >
gazebo::math::mean (const std::vector< T > &_values)
get mean of vector of values

template<typename T >
gazebo::math::min (const std::vector< T > &_values)
get the minimum value of vector of values

double gazebo::math::parseFloat (const std::string &_input)
parse string into float

int gazebo::math::parseInt (const std::string &_input)
parse string into an integer

template<typename T >
gazebo::math::precision (const T &_a, const unsigned int &_precision)
get value at a specified precision

template<typename T >
gazebo::math::variance (const std::vector< T > &_values)
get variance of vector of values

## Variables

static const double gazebo::math::NAN_D = std::numeric_limits<double>::quiet_NaN()
Not a number.

static const double gazebo::math::NAN_I = std::numeric_limits<int>::quiet_NaN()
TODO Nate: type int has no quiet_NaN ... what does this 0 mean?

## Detailed Description

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

## Function Documentation

template<typename T >
 T gazebo::math::clamp ( T _v, T _min, T _max )
inline

simple clamping function

Parameters
 [in] _v value [in] _min minimum [in] _max maximum

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

template<typename T >
 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] _a the first value [in] _b the second value [in] _epsilon the tolerance

Referenced by gazebo::math::Quaternion::Correct(), and gazebo::math::Quaternion::GetInverse().

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

check if a float is NaN

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

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

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

check if a double is NaN

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

References gazebo::math::isnan().

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

is this a power of 2?

Parameters
 [in] _x the number
Returns
true if _x is a power of 2, false otherwise
template<typename T >
 T gazebo::math::max ( const std::vector< T > & _values )
inline

get the maximum value of vector of values

Parameters
 [in] _values the vector of values
Returns
maximum

References gazebo::math::min().

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

template<typename T >
 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
template<typename T >
 T gazebo::math::min ( const std::vector< T > & _values )
inline

get the minimum value of vector of values

Parameters
 [in] _values the 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
 _input the 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] _input the string
Returns
an integer, 0 or 0 and a message in the error stream

References gazebo::math::NAN_I.

template<typename T >
 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
template<typename T >
 T gazebo::math::variance ( const std::vector< T > & _values )
inline

get variance of vector of values

Parameters
 _values the vector of values
Returns
the squared deviation

## Variable Documentation

 const double gazebo::math::NAN_D = std::numeric_limits::quiet_NaN()
static

Not a number.

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

 const double gazebo::math::NAN_I = std::numeric_limits::quiet_NaN()
static

TODO Nate: type int has no quiet_NaN ... what does this 0 mean?

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