![]()  | 
  
    RobWorkProject
    23.9.11-
    
   | 
 
Utility functions for the rw::math module. More...
#include <Math.hpp>
Static Public Member Functions | |
| template<class A > | |
| static rw::math::EAA< A > | quaternionToEAA (const rw::math::Quaternion< A > &quat) | 
| Quaternion to equivalent angle axis conversion.  More... | |
| template<class A > | |
| static rw::math::Quaternion< A > | eaaToQuaternion (const rw::math::EAA< A > &eaa) | 
| Equivalent angle axis to quaternion conversion.  More... | |
| template<class A > | |
| static rw::math::Rotation3D< A > | zyxToRotation3D (A roll, A pitch, A yaw) | 
| this function converts a EAA object to a Quaternion  More... | |
| template<class R > | |
| static Eigen::Matrix< R, 3, 3 > | skew (const rw::math::Vector3D< R > &s) | 
| Constructs a 3x3 skew-symmetric matrix \( S\in so(3)\).  More... | |
| static double | clamp (double val, double min, double max) | 
| clamp val to either min or max  More... | |
| static rw::math::Q | clampQ (const rw::math::Q &q, const rw::math::Q &min, const rw::math::Q &max) | 
| Clamps values of q with min and max.  More... | |
| static rw::math::Q | clampQ (const rw::math::Q &q, const std::pair< rw::math::Q, rw::math::Q > &bounds) | 
| Clamps values of q with bounds.first and bounds.second.  More... | |
| static rw::math::Vector3D | clamp (const rw::math::Vector3D<> &q, const rw::math::Vector3D<> &min, const rw::math::Vector3D<> &max) | 
| Clamps values of q with min and max.  More... | |
| static double | ran () | 
| A random double in the range [0, 1[ using a uniform distribution.  More... | |
| static void | seed (unsigned seed) | 
| Seeds the random number generator.  More... | |
| static void | seed () | 
| Seeds the random number generator with current time of day.  More... | |
| static double | ran (double from, double to) | 
| A random double in the range [from, to[ using a uniform distribution.  More... | |
| static int | ranI (int from, int to) | 
| A random integer in the range [from, to[ using a uniform distribution.  More... | |
| static double | ranNormalDist (double mean, double sigma) | 
| Returns a random sample around mean with standard deviation sigma using the normal distribution.  More... | |
| static rw::math::Q | ranQ (const rw::math::Q &from, const rw::math::Q &to) | 
| Returns a random Q between with values in the range [from, to[ using a uniform distribution.  More... | |
| static rw::math::Q | ranQ (const std::pair< rw::math::Q, rw::math::Q > &bounds) | 
| Returns a random Q between with values in the range [bounds.first, bounds.second[ using a uniform distribution.  More... | |
| static rw::math::Q | ranDir (size_t dim, double length=1) | 
| Returns a random direction in dim dimensions using the standard normal distribution.  More... | |
| static rw::math::Q | ranWeightedDir (size_t dim, const rw::math::Q &weights, double length=1) | 
| Returns a weighted random direction in dim dimensions using the standard normal distribution.  More... | |
| template<class T > | |
| static rw::math::Quaternion< T > | ranQuaternion () | 
| Returns a uniformly distributed random orientation.  More... | |
| template<class T > | |
| static rw::math::Rotation3D< T > | ranRotation3D () | 
| Returns a uniformly distributed random orientation.  More... | |
| template<class T > | |
| static rw::math::Transform3D< T > | ranTransform3D (const double translationLength=1) | 
| Returns random Transform3D based on ranDir (using the standard normal distribution) and ranRotation3D (using a uniform distribution).  More... | |
| static double | round (double d) | 
| Rounds off to nearest integer.  More... | |
| template<class T > | |
| static T | sqr (const T &d) | 
| The square of d.  More... | |
| static rw::math::Q | sqr (const rw::math::Q &q) | 
| The squares of the elements of q.  | |
| static rw::math::Q | sqrt (const rw::math::Q &q) | 
| The square roots of the elements of q.  | |
| static rw::math::Q | abs (const rw::math::Q &v) | 
| Returns vector with the absolute values.  More... | |
| static double | min (const rw::math::Q &v) | 
| Returns the smallest element of v.  More... | |
| static double | max (const rw::math::Q &v) | 
| Returns the largest element of v.  More... | |
| template<class T > | |
| static T | min (const T &a, const T &b) | 
| Returns vector with the elementwise smallest elements of a and b.  More... | |
| template<class T > | |
| static T | max (const T &a, const T &b) | 
| Returns vector with the elementwise largest elements of a and b.  More... | |
| template<class T > | |
| static Vector3D< T > | abs (const Vector3D< T > &v) | 
| Returns vector with the absolute values.  More... | |
| template<class T > | |
| static T | min (const Vector3D< T > &v) | 
| Returns the smallest element of v.  More... | |
| template<class T > | |
| static T | max (const Vector3D< T > &v) | 
| Returns the largest element of v.  More... | |
| template<class T > | |
| static Vector3D< T > | min (const Vector3D< T > &a, const Vector3D< T > &b) | 
| Returns vector with the elementwise smallest elements of a and b.  More... | |
| template<class T > | |
| static Vector3D< T > | max (const Vector3D< T > &a, const Vector3D< T > &b) | 
| Returns vector with the elementwise largest elements of a and b.  More... | |
| static double | sign (double s) | 
| Returns the sign of s.  More... | |
| static rw::math::Q | sign (const rw::math::Q &q) | 
| Returns the sign of each element.  More... | |
| static int | ceilLog2 (int n) | 
| Exact implementation of ceil(log_2(n)) for n > 0.  | |
| static long long | factorial (long long n) | 
| Factorial The method does not implement any safe guards for negative numbers of overflow of numbers.  | |
| template<class ARR > | |
| static std::vector< double > | toStdVector (const ARR &tmp, int size) | 
| convert a math vector type to an vector of doubles. The input should have the index operator () in order to use this conversion  More... | |
| template<class MAT > | |
| static std::vector< double > | toStdVector (const MAT &tmp, int size1, int size2) | 
| convert a math matrix type to an vector of doubles. The input should have the index operator (x,y) in order to use this conversion  More... | |
| template<class T , class ARR > | |
| static ARR | fromStdVector (const std::vector< T > &data, ARR &tmp) | 
| template<class T , class MAT > | |
| static MAT | fromStdVectorToMat (const std::vector< T > &data, MAT &tmp, int size1, int size2) | 
| static bool | isNaN (double d) | 
| Implements an isNaN function.  More... | |
| static double | NaN () | 
| Get a value for NaN.  More... | |
Utility functions for the rw::math module.
      
  | 
  inlinestatic | 
Returns vector with the absolute values.
Given a vector \( v=[v_1,v_2,\ldots,v_n] \) then Abs(v) is defined as \( Abs(v)=[abs(v_1),abs(v_i),\ldots,abs(v_n)] \)
| v | [in] the vector \( v\) | 
Returns vector with the absolute values.
Given a vector \(v=[v_1,v_2,\ldots,v_n]\) then Abs(v) is defined as \(Abs(v)=[abs(v_1),abs(v_i),\ldots,abs(v_n)] \)
| v | [in] the vector \(v\) | 
      
  | 
  inlinestatic | 
Clamps values of q with min and max.
| q | [in] Values to clamp | 
| min | [min] The minimum value | 
| max | [min] The maximum value | 
      
  | 
  inlinestatic | 
clamp val to either min or max
| val | [in] the value that is to be clamped | 
| min | [in] the minimum allowed value | 
| max | [in] the maximum allowed value | 
      
  | 
  static | 
Clamps values of q with min and max.
| q | [in] Values to clamp | 
| min | [min] The minimum value | 
| max | [min] The maximum value | 
      
  | 
  inlinestatic | 
Clamps values of q with bounds.first and bounds.second.
| q | [in] Values to clamp | 
| bounds | [min] The pair containing minimum and maximum values as first and second element | 
      
  | 
  inlinestatic | 
Equivalent angle axis to quaternion conversion.
| eaa | [in] the EAA object that is to be converted | 
      
  | 
  inlinestatic | 
convert a vector of doubles to a vector math type. The math type should implement the operator () in order to use this function.
| data | [in] the input | 
| tmp | [out] the output | 
      
  | 
  inlinestatic | 
convert a vector of doubles to a matrix math type. The math type should implement the operator (i,j) in order to use this function.
| data | [in] the input | 
| tmp | [out] the output | 
| size1 | [in] the size of the first dimension of the matrix. | 
| size2 | [in] the size of the second dimension of the matrix. | 
      
  | 
  static | 
Implements an isNaN function.
Use to make sure code is independent of specific compile specific implementations
      
  | 
  inlinestatic | 
Returns the largest element of v.
If the vector has zero length, the method returns 0
| v | [in] the vector v | 
      
  | 
  inlinestatic | 
Returns vector with the elementwise largest elements of a and b.
| a | [in] the vector a | 
| b | [in] the vector b | 
Returns vector with the elementwise largest elements of a and b.
| a | [in] the vector a | 
| b | [in] the vector b | 
      
  | 
  inlinestatic | 
Returns the largest element of v.
| v | [in] the vector v | 
      
  | 
  inlinestatic | 
Returns the smallest element of v.
If the vector has zero length, the method returns 0
| v | [in] the vector v | 
      
  | 
  inlinestatic | 
Returns vector with the elementwise smallest elements of a and b.
| a | [in] the vector a | 
| b | [in] the vector b | 
Returns vector with the elementwise smallest elements of a and b.
| a | [in] the vector a | 
| b | [in] the vector b | 
      
  | 
  inlinestatic | 
Returns the smallest element of v.
| v | [in] the vector v | 
      
  | 
  static | 
Get a value for NaN.
Use to make sure code is independent of specific compile specific implementations
      
  | 
  inlinestatic | 
Quaternion to equivalent angle axis conversion.
| quat | [in] the Quaternion object that is to be converted. | 
      
  | 
  static | 
A random double in the range [0, 1[ using a uniform distribution.
      
  | 
  static | 
A random double in the range [from, to[ using a uniform distribution.
      
  | 
  static | 
Returns a random direction in dim dimensions using the standard normal distribution.
The length of the vector is given by length;
| dim | [in] Number of dimensions | 
| length | [in] Length of return vector. Default is 1; | 
      
  | 
  static | 
A random integer in the range [from, to[ using a uniform distribution.
      
  | 
  static | 
Returns a random sample around mean with standard deviation sigma using the normal distribution.
| mean | [in] Means value | 
| sigma | [in] Standard deviation | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  inlinestatic | 
Returns a uniformly distributed random orientation.
      
  | 
  inlinestatic | 
Returns a uniformly distributed random orientation.
      
  | 
  inlinestatic | 
Returns random Transform3D based on ranDir (using the standard normal distribution) and ranRotation3D (using a uniform distribution).
| translationLength | [in] | 
      
  | 
  static | 
Returns a weighted random direction in dim dimensions using the standard normal distribution.
The length of the vector is given by length;
| dim | [in] Number of dimensions | 
| weights | [in] Weights to use | 
| length | [in] Length of return vector when weights are applied as weighted Euclidean metric. Default is 1; | 
      
  | 
  inlinestatic | 
Rounds off to nearest integer.
With some compilers round can be found in math.h. This however does not appear to be ansi C/C++ standard
| d | [in] number to round | 
      
  | 
  static | 
Seeds the random number generator with current time of day.
      
  | 
  static | 
Seeds the random number generator.
      
  | 
  inlinestatic | 
      
  | 
  inlinestatic | 
Returns the sign of s.
If s < 0 it return 0. If s >= 0 then 1 is returned.
| s | [in] The value for which to return the sign | 
      
  | 
  inlinestatic | 
Constructs a 3x3 skew-symmetric matrix \( S\in so(3)\).
| s | [in] the \( s_x \), \( s_y \) and \( s_z \) of the matrix | 
\( S = \left [ \begin {array}{ccc} 0 & -s_z & s_y\\ s_z & 0 & -s_x\\ -s_y & s_x & 0 \end {array} \right ] \)
      
  | 
  inlinestatic | 
The square of d.
| d | [in] Number to square | 
      
  | 
  inlinestatic | 
convert a math vector type to an vector of doubles. The input should have the index operator () in order to use this conversion
| tmp | [in] input | 
| size | [in] length of tmp | 
      
  | 
  inlinestatic | 
convert a math matrix type to an vector of doubles. The input should have the index operator (x,y) in order to use this conversion
| tmp | [in] input matrix type | 
| size1 | [in] width of tmp | 
| size2 | [in] height of tmp | 
      
  | 
  inlinestatic | 
this function converts a EAA object to a Quaternion
| roll | [in] rotation around z | 
| pitch | [in] rotation around y | 
| yaw | [in] rotation around x |