Parasol Planning Library (PPL)
Functions
MPUtils.cpp File Reference
#include "MPUtils.h"
#include "MetricUtils.h"
#include "ConfigurationSpace/Cfg.h"
#include "MPProblem/Robot/Robot.h"
Include dependency graph for MPUtils.cpp:

Functions

double DRand ()
 
long LRand ()
 
long MRand ()
 
double GRand (bool _reset)
 
double GaussianDistribution (double _mean, double _stdev)
 Same as GRand, but one can specify the mean and stdev of the distribution. More...
 
void SRand (const unsigned long _seed)
 Use seedval as the seed. More...
 
double Normalize (const double &_a)
 Normalize a value into the range [-1,1). More...
 
double TriangleHeight (const Point3d &_a, const Point3d &_b, const Point3d &_c)
 
bool PtInTriangle (const Point2d &_a, const Point2d &_b, const Point2d &_c, const Point2d &_p)
 
bool PtInTriangle (const Point2d &_a, const Point2d &_b, const Point2d &_c, const Point2d &_p, double &_u, double &_v)
 
Point3d GetPtFromBarycentricCoords (const Point3d &_a, const Point3d &_b, const Point3d &_c, double _u, double _v)
 
double NormalizeTheta (double _theta)
 
bool binom_test (double _alpha, size_t _n, size_t _k, double _p)
 
double binomial (size_t _n, size_t _k, double _p)
 
std::vector< CfgLoadPath (const std::string &_filename, Robot *_robot)
 Loads a configuration path from a file for a dynamic obstacle. More...
 

Function Documentation

◆ binom_test()

bool binom_test ( double  _alpha,
size_t  _n,
size_t  _k,
double  _p 
)

Given a significance level, the number of trials, the number of successes and the probability of success. Conduct a two-sided p-test.

Parameters
_alphaThe reference configuration.
_nThe number of trials conducted
_kThe number of trial successes
_pThe probability of success for the null. The assumed true value of success
Returns
If we fail to reject the null (true) and if we have enough evidence to reject the null (false).

◆ binomial()

double binomial ( size_t  _n,
size_t  _k,
double  _p 
)

Given the number of trials, the number of successes, and the probability of success, returns the probability density function evaluated k.

Parameters
_nThe number of trials
_kThe number of successes we are interested in
_pThe probability of success
Returns
The pdf of a binomial random variable evaluated at binom(n,k)

◆ DRand()

double DRand ( )

Return non-negative double-prevision floating-point values uniformly distributed over the interval [0.0, 1.0).

◆ GaussianDistribution()

double GaussianDistribution ( double  _mean,
double  _stdev 
)

Same as GRand, but one can specify the mean and stdev of the distribution.

◆ GetPtFromBarycentricCoords()

Point3d GetPtFromBarycentricCoords ( const Point3d &  _a,
const Point3d &  _b,
const Point3d &  _c,
double  _u,
double  _v 
)

Given triange defined by _a, _b, _c, return the point inside triangle defined by barycentric coordinates _u, _v.

◆ GRand()

double GRand ( bool  _reset = false)

Return normally(gaussian) distributed random numbers via the Marsaglia polar method.

Parameters
_resetIf true, clear internal cache and return 0.

◆ LoadPath()

std::vector<Cfg> LoadPath ( const std::string &  _filename,
Robot _robot 
)

Loads a configuration path from a file for a dynamic obstacle.

◆ LRand()

long LRand ( )

Return non-negative long integers uniformly distributed over the interval [0, 2**31).

◆ MRand()

long MRand ( )

Return signed long integers uniformly distributed over the interval [-2**31, 2**31).

◆ Normalize()

double Normalize ( const double &  _a)

Normalize a value into the range [-1,1).

◆ NormalizeTheta()

double NormalizeTheta ( double  _theta)

Normalize an angle to standard range.

Parameters
_thetaThe angle to normalize.
Returns
Normalized representation of _theta in the range -PI to PI.

◆ PtInTriangle() [1/2]

bool PtInTriangle ( const Point2d &  _a,
const Point2d &  _b,
const Point2d &  _c,
const Point2d &  _p 
)

Check if a 2d point lies inside the triangle defined by three other points.

Parameters
_aThe first triangle vertex.
_bThe second triangle vertex.
_cThe third triangle vertex.
_pThe query point.
Returns
True if _p is inside triangle _a_b_c, or false otherwise.

◆ PtInTriangle() [2/2]

bool PtInTriangle ( const Point2d &  _a,
const Point2d &  _b,
const Point2d &  _c,
const Point2d &  _p,
double &  _u,
double &  _v 
)

Check if a 2d point lies inside the triangle defined by three other points.

Parameters
_aThe first triangle vertex.
_bThe second triangle vertex.
_cThe third triangle vertex.
_pThe query point.
_uThe barycentric coordinate factor for _b.
_vThe barycentric coordinate factor for _c.
Returns
True if _p is inside triangle _a_b_c, or false otherwise.

◆ SRand()

void SRand ( const unsigned long  _seed)

Use seedval as the seed.

◆ TriangleHeight()

double TriangleHeight ( const Point3d &  _a,
const Point3d &  _b,
const Point3d &  _c 
)

Determine height of triangle defined by three points.

Parameters
_aThe first triangle vertex.
_bThe second triangle vertex.
_cThe third triangle vertex.
Returns
The height of the triangle.