0.2.0
Loading...
Searching...
No Matches
NAV::CubicSpline< Scalar > Class Template Reference

Cubic Spline class. More...

Classes

struct  BoundaryCondition
 Boundary conditions for the spline end-points. More...
 

Public Member Functions

 CubicSpline ()=default
 Default Constructor.
 
 CubicSpline (const std::vector< Scalar > &X, const std::vector< Scalar > &Y, BoundaryCondition leftBoundaryCondition={ BoundaryCondition::SecondDerivative, 0.0 }, BoundaryCondition rightBoundaryCondition={ BoundaryCondition::SecondDerivative, 0.0 })
 Constructor.
 
Scalar derivative (size_t order, Scalar x) const
 Calculates the derivative of the spline.
 
Scalar operator() (Scalar x) const
 Interpolates or extrapolates a value on the spline.
 
void setBoundaries (BoundaryCondition leftBoundaryCondition, BoundaryCondition rightBoundaryCondition)
 Set the boundaries conditions. Has to be called before setPoints.
 
void setPoints (const std::vector< Scalar > &x, const std::vector< Scalar > &y)
 Set the points/knots of the spline and calculate the spline coefficients.
 
size_t size () const noexcept
 Returns the size of the spline vector.
 

Detailed Description

template<typename Scalar>
class NAV::CubicSpline< Scalar >

Cubic Spline class.

Constructor & Destructor Documentation

◆ CubicSpline()

template<typename Scalar >
NAV::CubicSpline< Scalar >::CubicSpline ( const std::vector< Scalar > & X,
const std::vector< Scalar > & Y,
BoundaryCondition leftBoundaryCondition = BoundaryCondition::SecondDerivative, 0.0 },
BoundaryCondition rightBoundaryCondition = BoundaryCondition::SecondDerivative, 0.0 } )
inline

Constructor.

Parameters
[in]XList of x coordinates for the spline points/knots
[in]YList of y coordinates for the spline points/knots
[in]leftBoundaryConditionBoundary condition for the start knot
[in]rightBoundaryConditionBoundary condition for the end knot

Member Function Documentation

◆ derivative()

template<typename Scalar >
Scalar NAV::CubicSpline< Scalar >::derivative ( size_t order,
Scalar x ) const
inline

Calculates the derivative of the spline.

Parameters
[in]orderOrder of the derivative to calculate (<= 3)
[in]xX coordinate to calculate the derivative for
Returns
The derivative of y up to the given order

◆ operator()()

template<typename Scalar >
Scalar NAV::CubicSpline< Scalar >::operator() ( Scalar x) const
inline

Interpolates or extrapolates a value on the spline.

Parameters
[in]xX coordinate to inter-/extrapolate the value for
Returns
The y coordinate

◆ setBoundaries()

template<typename Scalar >
void NAV::CubicSpline< Scalar >::setBoundaries ( BoundaryCondition leftBoundaryCondition,
BoundaryCondition rightBoundaryCondition )
inline

Set the boundaries conditions. Has to be called before setPoints.

Parameters
[in]leftBoundaryConditionBoundary condition for the start knot
[in]rightBoundaryConditionBoundary condition for the end knot

◆ setPoints()

template<typename Scalar >
void NAV::CubicSpline< Scalar >::setPoints ( const std::vector< Scalar > & x,
const std::vector< Scalar > & y )
inline

Set the points/knots of the spline and calculate the spline coefficients.

Parameters
[in]xList of x coordinates of the points
[in]yList of y coordinates of the points

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