All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Classes | Typedefs | Functions | Variables
ignition::math Namespace Reference

Math classes and function useful in robot applications. More...

Classes

class  AffineException
 ignition/math/AffineException.hh More...
 
class  Angle
 An angle and related functions. More...
 
class  BiQuad
 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
 Filter base class. More...
 
class  IndexException
 Exception that is thrown when an out-of-bounds index is encountered. More...
 
class  Kmeans
 K-Means clustering algorithm. More...
 
class  Line2
 A two dimensional line segment. More...
 
class  Matrix3
 A 3x3 matrix class. More...
 
class  Matrix4
 A 4x4 matrix class. More...
 
class  OnePole
 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  Pose3
 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  Spline
 Splines. More...
 
class  Triangle
 Triangle class and related functions. More...
 
class  Vector2
 Two dimensional (x, y) vector. More...
 
class  Vector3
 The Vector3 class represents the generic vector containing 3 elements. More...
 
class  Vector4
 T Generic x, y, z, w vector. More...
 

Typedefs

typedef std::mt19937 GeneratorType
 
typedef Line2< double > Line2d
 
typedef Line2< float > Line2f
 
typedef Line2< int > Line2i
 
typedef Matrix3< double > Matrix3d
 
typedef Matrix3< float > Matrix3f
 
typedef Matrix3< int > Matrix3i
 
typedef Matrix4< double > Matrix4d
 
typedef Matrix4< float > Matrix4f
 
typedef Matrix4< int > Matrix4i
 
typedef
std::normal_distribution
< double > 
NormalRealDist
 
typedef Plane< double > Planed
 
typedef Plane< float > Planef
 
typedef Plane< int > Planei
 
typedef Pose3< double > Pose3d
 
typedef Pose3< float > Pose3f
 
typedef Pose3< int > Pose3i
 
typedef Quaternion< double > Quaterniond
 
typedef Quaternion< float > Quaternionf
 
typedef Quaternion< int > Quaternioni
 
typedef Triangle< double > Triangled
 Double specialization of the Triangle class. More...
 
typedef Triangle< float > Trianglef
 Float specialization of the Triangle class. More...
 
typedef Triangle< int > Trianglei
 Integer specialization of the Triangle class. More...
 
typedef
std::uniform_int_distribution
< int32_t > 
UniformIntDist
 
typedef
std::uniform_real_distribution
< double > 
UniformRealDist
 
typedef Vector2< double > Vector2d
 
typedef Vector2< float > Vector2f
 
typedef Vector2< int > Vector2i
 
typedef Vector3< double > Vector3d
 
typedef Vector3< float > Vector3f
 
typedef Vector3< int > Vector3i
 
typedef Vector4< double > Vector4d
 
typedef Vector4< float > Vector4f
 
typedef Vector4< int > Vector4i
 

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 float NAN_F = std::numeric_limits<float>::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

Math classes and function useful in robot applications.

Typedef Documentation

typedef std::mt19937 ignition::math::GeneratorType
typedef Line2<double> ignition::math::Line2d
typedef Line2<float> ignition::math::Line2f
typedef std::normal_distribution<double> ignition::math::NormalRealDist
typedef Plane<double> ignition::math::Planed
typedef Plane<float> ignition::math::Planef
typedef Pose3<double> ignition::math::Pose3d
typedef Pose3<float> ignition::math::Pose3f

Double specialization of the Triangle class.

Float specialization of the Triangle class.

Integer specialization of the Triangle class.

typedef std::uniform_int_distribution<int32_t> ignition::math::UniformIntDist
typedef std::uniform_real_distribution<double> ignition::math::UniformRealDist

Function Documentation

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

Simple clamping function.

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

References max(), and min().

template<typename T >
bool ignition::math::equal ( const T &  _a,
const T &  _b,
const T &  _epsilon = 1e-6 
)
inline
float ignition::math::fixnan ( float  _v)
inline

Fix a nan value.

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

References isnan().

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

Fix a nan value.

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

References isnan().

bool ignition::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 isnan().

Referenced by fixnan().

bool ignition::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 isnan().

bool ignition::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 roundUpPowerOfTwo().

template<typename T >
T ignition::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 min().

Referenced by clamp(), ignition::math::Line2< T >::Intersect(), ignition::math::Box::Max(), ignition::math::Vector3< double >::Max(), min(), and ignition::math::Line2< T >::Within().

template<typename T >
T ignition::math::mean ( const std::vector< T > &  _values)
inline

get mean of vector of values

Parameters
[in]_valuesthe vector of values
Returns
the mean
template<typename T >
T ignition::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 max().

Referenced by clamp(), ignition::math::Line2< T >::Intersect(), max(), ignition::math::Box::Min(), ignition::math::Vector3< double >::Min(), and ignition::math::Line2< T >::Within().

double ignition::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 NAN_D.

int ignition::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 NAN_I.

template<typename T >
T ignition::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

Referenced by ignition::math::Vector3< double >::Round(), and ignition::math::Quaternion< T >::Round().

unsigned int ignition::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 isPowerOfTwo().

template<typename T >
T ignition::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 ignition::math::NAN_D = std::numeric_limits<double>::quiet_NaN()
static

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

Referenced by parseFloat(), and ignition::math::Line2< T >::Slope().

const float ignition::math::NAN_F = std::numeric_limits<float>::quiet_NaN()
static

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

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

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

Referenced by parseInt().