LocalGuidance
A library that generates velocity references to follow a path.
rbf::RBF1D Class Reference

Function approximation of a function with radial basis functions (polyharmonic splines) with C3 continuity. More...

#include <RBF1D.hpp>

Inheritance diagram for rbf::RBF1D:
Inheritance graph

Public Member Functions

 RBF1D (void)
 Constructor. More...
 
virtual ~RBF1D (void)
 Destructor. More...
 
virtual void setRBFData (const std::vector< double > &x_input, const std::vector< double > &f_input)
 
virtual void setRBFData (const Eigen::VectorXd &x_input, const Eigen::VectorXd &f_input)
 
virtual double evaluate (double x) const
 
virtual double evaluateFirstDerivative (double x) const
 
virtual double evaluateSecondDerivative (double x) const
 
virtual double evaluateThirdDerivative (double x) const
 
int getKnotCount () const
 
virtual double getKnotValue (int idx) const
 
virtual double getKnotPosition (int idx) const
 
virtual double evaluateDerivative (double x, int order) const
 

Protected Member Functions

double getR (double xCenter, double x) const
 
double drdx (double xCenter, double x) const
 
double d2rdx2 (double xCenter, double x) const
 
double d3rdx3 (double xCenter, double x) const
 
virtual double evaluateBasisFunction (double r) const
 
virtual double evaluateBasisFunction (double xCenter, double x) const
 
virtual double dBFdr (double r) const
 
virtual double d2BFdr2 (double r) const
 
virtual double d3BFdr3 (double r) const
 
double dBFdx (double xCenter, double x) const
 
double d2BFdx2 (double xCenter, double x) const
 
double d3BFdx3 (double xCenter, double x) const
 
double Mod (double x, double y) const
 
double wrapToRange (double x, double min, double max) const
 

Protected Attributes

bool isInitialized
 true if RFB data was set More...
 
Eigen::VectorXd xInput
 points (knots) that are interpolated More...
 
Eigen::VectorXd fInput
 values of points that are interpolated More...
 
Eigen::VectorXd w
 stacked array of weights for the basis functions and the polynomial More...
 

Detailed Description

Function approximation of a function with radial basis functions (polyharmonic splines) with C3 continuity.

Compute function f(x), so that f(x_i) = f_i. The form of f is: f = sum_i w_i * F_i(r) + a + b*x + c*x*x + d*x*x*x, where F_i are basis functions, one for each (x_i, f_i) pair. The weights w_i, as well as the polynomial coefficients a, b, c and d are computed so that the function interpolates the input data, The basis function is F_i(r_i) = r_i*r_i*log(r_i) with r_i = (x_i-x)*(x_i-x)

Constructor & Destructor Documentation

rbf::RBF1D::RBF1D ( void  )

Constructor.

virtual rbf::RBF1D::~RBF1D ( void  )
virtual

Destructor.

Member Function Documentation

virtual double rbf::RBF1D::d2BFdr2 ( double  r) const
protectedvirtual
double rbf::RBF1D::d2BFdx2 ( double  xCenter,
double  x 
) const
protected
double rbf::RBF1D::d2rdx2 ( double  xCenter,
double  x 
) const
protected
virtual double rbf::RBF1D::d3BFdr3 ( double  r) const
protectedvirtual
double rbf::RBF1D::d3BFdx3 ( double  xCenter,
double  x 
) const
protected
double rbf::RBF1D::d3rdx3 ( double  xCenter,
double  x 
) const
protected
virtual double rbf::RBF1D::dBFdr ( double  r) const
protectedvirtual
double rbf::RBF1D::dBFdx ( double  xCenter,
double  x 
) const
protected
double rbf::RBF1D::drdx ( double  xCenter,
double  x 
) const
protected
virtual double rbf::RBF1D::evaluate ( double  x) const
virtual

Evaluates the interpolation function at x, i.e. computes f(x)

Parameters
xvalue
Returns
f(x)

Reimplemented in rbf::BoundedRBF1D, rbf::PeriodicRBF1DC1, and rbf::PeriodicRBF1DC3.

virtual double rbf::RBF1D::evaluateBasisFunction ( double  r) const
protectedvirtual

Evaluates only the basis function see evaluate

Parameters
rthe radial distance
Returns
virtual double rbf::RBF1D::evaluateBasisFunction ( double  xCenter,
double  x 
) const
protectedvirtual
virtual double rbf::RBF1D::evaluateDerivative ( double  x,
int  order 
) const
inlinevirtual
virtual double rbf::RBF1D::evaluateFirstDerivative ( double  x) const
virtual

Evaluates the first derivative of the interpolation function at x, i.e. computes dfdx(x)

Parameters
xvalue
Returns
dfdx(x)

Reimplemented in rbf::BoundedRBF1D, rbf::PeriodicRBF1DC1, and rbf::PeriodicRBF1DC3.

virtual double rbf::RBF1D::evaluateSecondDerivative ( double  x) const
virtual

Evaluates the second derivative of the interpolation function at x, i.e. computes d2fdx2(x)

Parameters
xvalue
Returns
d2fdx2(x)

Reimplemented in rbf::BoundedRBF1D, rbf::PeriodicRBF1DC1, and rbf::PeriodicRBF1DC3.

virtual double rbf::RBF1D::evaluateThirdDerivative ( double  x) const
virtual

Evaluates the third derivative of the interpolation function at x, i.e. computes d3fdx3(x)

Parameters
xvalue
Returns
d3fdx3(x)

Reimplemented in rbf::BoundedRBF1D, rbf::PeriodicRBF1DC1, and rbf::PeriodicRBF1DC3.

int rbf::RBF1D::getKnotCount ( ) const
Returns
gets the number of knots
virtual double rbf::RBF1D::getKnotPosition ( int  idx) const
virtual

Gets the knot position by index

Parameters
idxindex of the knot
Returns
value
virtual double rbf::RBF1D::getKnotValue ( int  idx) const
virtual

Gets the knot value by index

Parameters
idxindex of the knot
Returns
value
double rbf::RBF1D::getR ( double  xCenter,
double  x 
) const
protected

Gets the radial distance

Parameters
xCenterthe center point
xthe input variable
Returns
radial
double rbf::RBF1D::Mod ( double  x,
double  y 
) const
protected

modulu - similar to matlab's mod() result is always positive. not similar to fmod() Mod(-3,4)= 1 fmod(-3,4)= -3

Parameters
xnominator
ydenominator
Returns
x-y*floor(x/y)
virtual void rbf::RBF1D::setRBFData ( const std::vector< double > &  x_input,
const std::vector< double > &  f_input 
)
virtual

Compute function f(x), so that f(x_i) = f_i. The form of f is:

Parameters
x_inputthe centers x_i
f_inputthe function values f_i

Reimplemented in rbf::BoundedRBF1D, rbf::PeriodicRBF1DC1, and rbf::PeriodicRBF1DC3.

virtual void rbf::RBF1D::setRBFData ( const Eigen::VectorXd &  x_input,
const Eigen::VectorXd &  f_input 
)
virtual
double rbf::RBF1D::wrapToRange ( double  x,
double  min,
double  max 
) const
protected

Wrap x to [min, max)

Parameters
xinput variable
minminimal value
maxmaximal value
Returns
wrapped variable

Member Data Documentation

Eigen::VectorXd rbf::RBF1D::fInput
protected

values of points that are interpolated

bool rbf::RBF1D::isInitialized
protected

true if RFB data was set

Eigen::VectorXd rbf::RBF1D::w
protected

stacked array of weights for the basis functions and the polynomial

Eigen::VectorXd rbf::RBF1D::xInput
protected

points (knots) that are interpolated


The documentation for this class was generated from the following file: