se2ez
se2ez::math Namespace Reference

Helper functions and constants require for mathematical operations. More...

Functions

Eigen::VectorXd toVector (double x)
 Converts a single double value into a 1 x 1 matrix. More...
 
Eigen::MatrixXd toMatrix (const std::vector< Eigen::VectorXd > &vlist)
 Converts a vector of lists into a Matrix. More...
 
Eigen::VectorXd toVector (const std::initializer_list< double > &x)
 Converts an initialize list into a vector. More...
 
double remap (double a1, double a2, double av, double b1, double b2)
 Remap a value av in the interval a1, a2 to the interval b1, b2. More...
 
double clamp (double v, double a, double b)
 Clamp a value v between a range [a, b]. More...
 
double angleDistance (double v1, double v2)
 Return the minimum distance between two angles (wrapping from -pi to pi). More...
 
double angleNormalize (double v)
 Normalize an angle between -pi to pi. More...
 
double toDegrees (double v)
 Convert an angle to degrees. More...
 
double toRadians (double v)
 Convert an angle to radians. More...
 
double uniformReal (double lower, double upper)
 Return a uniform random number between lower and upper. More...
 
int uniformInteger (int lower, int upper)
 Return a uniform random integer between lower and upper (inclusive). More...
 
double gaussianReal (double mean, double std)
 Return a random number sampled from a gaussain with given std and mean. More...
 

Variables

static ompl::RNG rng
 Random number generation from OMPL. An instance of this class cannot be used by multiple threads at once. More...
 
static const double pi = boost::math::constants::pi<double>()
 
static const double pipi = 2. * pi
 
static const double pi2 = pi / 2.
 
static const double eps = std::numeric_limits<double>::epsilon()
 
static const double inf = std::numeric_limits<double>::infinity()
 
static const double nan = std::numeric_limits<double>::quiet_NaN()
 

Detailed Description

Helper functions and constants require for mathematical operations.

Function Documentation

◆ angleDistance()

double se2ez::math::angleDistance ( double  v1,
double  v2 
)

Return the minimum distance between two angles (wrapping from -pi to pi).

Parameters
[in]v1First angle.
[in]v2Second angle.
Returns
The distance between angles.

Definition at line 184 of file math.cpp.

◆ angleNormalize()

double se2ez::math::angleNormalize ( double  v)

Normalize an angle between -pi to pi.

Parameters
[in]vThe angle.
Returns
The normalized angle.

Definition at line 189 of file math.cpp.

◆ clamp()

double se2ez::math::clamp ( double  v,
double  a,
double  b 
)

Clamp a value v between a range [a, b].

Parameters
[in]vValue to clamp.
[in]aLower bound.
[in]bUpper bound.
Returns
The clamped value.

Definition at line 179 of file math.cpp.

◆ gaussianReal()

double se2ez::math::gaussianReal ( double  mean,
double  std 
)

Return a random number sampled from a gaussain with given std and mean.

Parameters
[in]meanThe mean of the gaussian.
[in]stdThe standard deviation of the gaussian.
Returns
random number sampled from gaussian

Definition at line 236 of file math.cpp.

◆ remap()

double se2ez::math::remap ( double  a1,
double  a2,
double  av,
double  b1,
double  b2 
)

Remap a value av in the interval a1, a2 to the interval b1, b2.

Parameters
[in]a1Lower end of first interval.
[in]a2Upper end of first interval.
[in]avValue in first interval.
[in]b1Lower end of second interval.
[in]b2Upper end of second interval.
Returns
The remapped value in the second interval.

Definition at line 160 of file math.cpp.

◆ toDegrees()

double se2ez::math::toDegrees ( double  v)

Convert an angle to degrees.

Parameters
[in]vThe angle in radians.
Returns
The angle in degrees.

Definition at line 194 of file math.cpp.

◆ toMatrix()

Eigen::MatrixXd se2ez::math::toMatrix ( const std::vector< Eigen::VectorXd > &  vlist)

Converts a vector of lists into a Matrix.

Parameters
[in]vlistvector of lists to convert.
Returns
a matrix with the values of the Eigen vectors.

Definition at line 150 of file math.cpp.

◆ toRadians()

double se2ez::math::toRadians ( double  v)

Convert an angle to radians.

Parameters
[in]vThe angle in degrees.
Returns
The angle in radians.

Definition at line 204 of file math.cpp.

◆ toVector() [1/2]

Eigen::VectorXd se2ez::math::toVector ( double  x)

Converts a single double value into a 1 x 1 matrix.

Parameters
[in]xValue to convert.
Returns
a 1-dimensional vector with x as the value.

Definition at line 134 of file math.cpp.

◆ toVector() [2/2]

Eigen::VectorXd se2ez::math::toVector ( const std::initializer_list< double > &  x)

Converts an initialize list into a vector.

Parameters
[in]xValues to convert.
Returns
a vector with the values of the list.

Definition at line 139 of file math.cpp.

◆ uniformInteger()

int se2ez::math::uniformInteger ( int  lower,
int  upper 
)

Return a uniform random integer between lower and upper (inclusive).

Parameters
[in]lowerLower bound
[in]upperUpper bound
Returns
random number between lower and upper

Definition at line 228 of file math.cpp.

◆ uniformReal()

double se2ez::math::uniformReal ( double  lower,
double  upper 
)

Return a uniform random number between lower and upper.

Parameters
[in]lowerLower bound.
[in]upperUpper bound.
Returns
random number between lower and upper

Definition at line 217 of file math.cpp.

Variable Documentation

◆ eps

const double se2ez::math::eps = std::numeric_limits<double>::epsilon()
static

Definition at line 36 of file math.h.

◆ inf

const double se2ez::math::inf = std::numeric_limits<double>::infinity()
static

Definition at line 37 of file math.h.

◆ nan

const double se2ez::math::nan = std::numeric_limits<double>::quiet_NaN()
static

Definition at line 38 of file math.h.

◆ pi

const double se2ez::math::pi = boost::math::constants::pi<double>()
static

Definition at line 32 of file math.h.

◆ pi2

const double se2ez::math::pi2 = pi / 2.
static

Definition at line 34 of file math.h.

◆ pipi

const double se2ez::math::pipi = 2. * pi
static

Definition at line 33 of file math.h.

◆ rng

ompl::RNG se2ez::math::rng
static

Random number generation from OMPL. An instance of this class cannot be used by multiple threads at once.

Definition at line 30 of file math.h.