PCL
pcl::CubicSplineInterpolation< T > Class Template Reference

Generic interpolating cubic spline. More...

#include <CubicSplineInterpolation.h>

+ Inheritance diagram for pcl::CubicSplineInterpolation< T >:

Public Member Functions

 CubicSplineInterpolation ()=default
 
 CubicSplineInterpolation (const CubicSplineInterpolation &)=default
 
 CubicSplineInterpolation (CubicSplineInterpolation &&)=default
 
 ~CubicSplineInterpolation () override
 
void Clear () override
 
void GetBoundaryConditions (double &y1, double &yn) const
 
void Initialize (const vector_type &x, const vector_type &y) override
 
bool IsValid () const override
 
double operator() (double x) const override
 
void SetBoundaryConditions (double y1, double yn)
 
- Public Member Functions inherited from pcl::UnidimensionalInterpolation< double >
 UnidimensionalInterpolation ()=default
 
 UnidimensionalInterpolation (const UnidimensionalInterpolation &)=default
 
virtual ~UnidimensionalInterpolation ()
 
void Initialize (const double *x, const double *y, int n)
 
virtual void Initialize (const vector_type &x, const vector_type &y)
 
int Length () const
 
bool UsingImplicitX () const
 
const vector_typeX () const
 
const vector_typeY () const
 

Additional Inherited Members

- Public Types inherited from pcl::UnidimensionalInterpolation< double >
using vector_type = GenericVector< double >
 

Detailed Description

template<typename T = double>
class pcl::CubicSplineInterpolation< T >

Interpolation with piecewise cubic polynomials. Spline interpolation is usually preferred to interpolation with high-degree polynomials, which are subject to oscillations caused by the Runge's phenomenon.

See also
AkimaInterpolation, LinearInterpolation

Definition at line 81 of file CubicSplineInterpolation.h.

Constructor & Destructor Documentation

◆ CubicSplineInterpolation() [1/3]

template<typename T = double>
pcl::CubicSplineInterpolation< T >::CubicSplineInterpolation ( )
default

Constructs an empty CubicSplineInterpolation instance, which cannot be used for interpolation prior to initialization.

◆ CubicSplineInterpolation() [2/3]

template<typename T = double>
pcl::CubicSplineInterpolation< T >::CubicSplineInterpolation ( const CubicSplineInterpolation< T > &  )
default

Copy constructor.

◆ CubicSplineInterpolation() [3/3]

template<typename T = double>
pcl::CubicSplineInterpolation< T >::CubicSplineInterpolation ( CubicSplineInterpolation< T > &&  )
default

Move constructor.

◆ ~CubicSplineInterpolation()

template<typename T = double>
pcl::CubicSplineInterpolation< T >::~CubicSplineInterpolation ( )
inlineoverride

Virtual destructor.

Definition at line 106 of file CubicSplineInterpolation.h.

Member Function Documentation

◆ Clear()

template<typename T = double>
void pcl::CubicSplineInterpolation< T >::Clear ( )
inlineoverridevirtual

Resets this cubic spline interpolation, deallocating all internal working structures.

Reimplemented from pcl::UnidimensionalInterpolation< double >.

Definition at line 324 of file CubicSplineInterpolation.h.

References pcl::UnidimensionalInterpolation< T >::Clear().

◆ GetBoundaryConditions()

template<typename T = double>
void pcl::CubicSplineInterpolation< T >::GetBoundaryConditions ( double &  y1,
double &  yn 
) const
inline

Gets the boundary conditions of this interpolating cubic spline.

Parameters
[out]y1First derivative of the interpolating cubic spline at the first data point x[0].
[out]ynFirst derivative of the interpolating cubic spline at the last data point x[n-1].

Definition at line 119 of file CubicSplineInterpolation.h.

◆ Initialize()

template<typename T = double>
void pcl::CubicSplineInterpolation< T >::Initialize ( const vector_type &  x,
const vector_type &  y 
)
inlineoverride

Generation of an interpolating cubic spline.

Parameters
xVector of x-values:

  • If x is not empty: Must be a vector of monotonically increasing, distinct values: x[0] < x[1] < ... < x[n-1].
  • If x is empty: This function will generate a natural cubic spline with implicit x[i] = i for i = {0,1,...,n-1}.
yVector of function values for i = {0,1,...,n-1}.

When x is an empty vector, a natural spline is always generated: boundary conditions are ignored and taken as zero at both ends of the data sequence.

The length of the y vector (and also the length of a nonempty x vector) must be n >= 2.

Definition at line 160 of file CubicSplineInterpolation.h.

◆ IsValid()

template<typename T = double>
bool pcl::CubicSplineInterpolation< T >::IsValid ( ) const
inlineoverridevirtual

Returns true iff this interpolation is valid, i.e. if it has been correctly initialized and is ready to interpolate function values.

Reimplemented from pcl::UnidimensionalInterpolation< double >.

Definition at line 334 of file CubicSplineInterpolation.h.

◆ operator()()

template<typename T = double>
double pcl::CubicSplineInterpolation< T >::operator() ( double  x) const
inlineoverridevirtual

Cubic spline interpolation. Returns an interpolated value at the specified point x.

Implements pcl::UnidimensionalInterpolation< double >.

Definition at line 259 of file CubicSplineInterpolation.h.

◆ SetBoundaryConditions()

template<typename T = double>
void pcl::CubicSplineInterpolation< T >::SetBoundaryConditions ( double  y1,
double  yn 
)
inline

Sets the boundary conditions of this interpolating cubic spline.

Parameters
y1First derivative of the interpolating cubic spline at the first data point x[0].
ynFirst derivative of the interpolating cubic spline at the last data point x[n-1].

Definition at line 134 of file CubicSplineInterpolation.h.


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