latest version v1.9 - last update 10 Apr 2010 |
This functor implements a cubic spline interpolation for tabulated functions. More...
#include <ltiCubicSpline.h>
Classes | |
class | parameters |
the parameters for the class cubicSpline More... | |
Public Member Functions | |
cubicSpline () | |
cubicSpline (const cubicSpline &other) | |
virtual | ~cubicSpline () |
virtual const char * | getTypeName () const |
bool | apply (tpointList< T > &srcdest) const |
bool | apply (const T &x, T &fx) const |
cubicSpline & | copy (const cubicSpline &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
virtual bool | updateParameters () |
Protected Member Functions | |
void | spline (const tpointList< T > &in, const double &yp1, const double &ypn, const bool &natural) |
bool | splint (const tpointList< T > &function, const T &x, T &y) const |
Protected Attributes | |
std::vector< double > | secondDerivatives |
This functor implements a cubic spline interpolation for tabulated functions.
The input parameters are some sampling points in a tpointList<double>. The requirements of the input points are that they must be a kind of function. Therefore this rule x(n) < x(n+1) is required for each n and the list must consist of at least three points. Furthermore the parameters consist of the derivatives at the beginning (first point) and end of the function (last point). If the parameter useNaturalDerivatives is true the derivatives from the parameters are ignored and the algorithm calculates the optimal derivatives at the beginning and end.
The template T type corresponds to the coordinate types. Only the float, double and int types are supported.
lti::cubicSpline< T >::cubicSpline | ( | ) |
default constructor
lti::cubicSpline< T >::cubicSpline | ( | const cubicSpline< T > & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::cubicSpline< T >::~cubicSpline | ( | ) | [virtual] |
destructor
bool lti::cubicSpline< T >::apply | ( | const T & | x, | |
T & | fx | |||
) | const |
operates on a copy of the given parameters.
x | double with the source data. | |
fx | double where the result will be left. |
bool lti::cubicSpline< T >::apply | ( | tpointList< T > & | srcdest | ) | const |
operates on the given parameter.
srcdest | tpointList<double> with the source data in the x part of the tpoints. The result for every x value is writen in the y part of the same tpoint. |
virtual functor* lti::cubicSpline< T >::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Implements lti::variablySpacedSamplesInterpolator.
cubicSpline& lti::cubicSpline< T >::copy | ( | const cubicSpline< T > & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::variablySpacedSamplesInterpolator.
const parameters& lti::cubicSpline< T >::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::variablySpacedSamplesInterpolator.
virtual const char* lti::cubicSpline< T >::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("cubicSpline")
Reimplemented from lti::variablySpacedSamplesInterpolator.
void lti::cubicSpline< T >::spline | ( | const tpointList< T > & | in, | |
const double & | yp1, | |||
const double & | ypn, | |||
const bool & | natural | |||
) | [protected] |
This function calcualtes the second derivatives at each point of the tpointList<double> &in.
in | the point list with the source data | |
yp1 | the first derivative an the first point of the tpointlist | |
ypn | the first derivative an the last point of the tpointlist | |
natural | if true constructs a natural spline |
bool lti::cubicSpline< T >::splint | ( | const tpointList< T > & | function, | |
const T & | x, | |||
T & | y | |||
) | const [protected] |
This function evaluate the spline at one x value.
function | list of points to be interpolated | |
x | the value where the spline is evaluated | |
y | the return value |
virtual bool lti::cubicSpline< T >::updateParameters | ( | ) | [virtual] |
sets the functor's parameters.
Reimplemented from lti::functor.
std::vector<double> lti::cubicSpline< T >::secondDerivatives [protected] |
This vector saves the second derivatives at each point of the sampling points.