ProteoWizard
Public Member Functions | Public Attributes | List of all members
ralab::base::base::utilities::CubicInterpolate< TReal > Struct Template Reference

CubicInterpolate Functor. More...

#include <interpolation.hpp>

Public Member Functions

 CubicInterpolate (TReal epsilon=std::numeric_limits< TReal >::epsilon())
 
TReal operator() (TReal y0, TReal y1, TReal y2, TReal y3, double mu)
 operator
 

Public Attributes

TReal epsilon_
 

Detailed Description

template<typename TReal>
struct ralab::base::base::utilities::CubicInterpolate< TReal >

CubicInterpolate Functor.

Cubic interpolation is the simplest method that offers true continuity between the segments. As such it requires more than just the two endpoints of the segment but also the two points on either side of them. So the function requires 4 points in all labeled y0, y1, y2, and y3, in the code below. mu still behaves the same way for interpolating between the segment y1 to y2. This doe s raise issues for how to interpolate between the first and last segments. In the examples here I just haven't bothered. A common solution is the dream up two extra points at the start and end of the sequence, the new points are created so that they have a slope equal to the slope of the start or end segment.

Definition at line 97 of file interpolation.hpp.

Constructor & Destructor Documentation

◆ CubicInterpolate()

template<typename TReal >
ralab::base::base::utilities::CubicInterpolate< TReal >::CubicInterpolate ( TReal  epsilon = std::numeric_limits<TReal>::epsilon())
inline

Definition at line 100 of file interpolation.hpp.

Member Function Documentation

◆ operator()()

template<typename TReal >
TReal ralab::base::base::utilities::CubicInterpolate< TReal >::operator() ( TReal  y0,
TReal  y1,
TReal  y2,
TReal  y3,
double  mu 
)
inline

operator

Parameters
y0y0
y1y1
y2y2
y3y3
mulocation parameter in [0.,1.]

Definition at line 105 of file interpolation.hpp.

113 {
114 if(mu < epsilon_)
115 {
116 return y1;
117 }
118 else if(-(mu - 1.) < epsilon_)
119 {
120 return y2;
121 }
122 else
123 {
124 TReal a0,a1,a2,a3,mu2;
125 mu2 = mu*mu;
126 a0 = y3 - y2 - y0 + y1;
127 a1 = y0 - y1 - a0;
128 a2 = y2 - y0;
129 a3 = y1;
130 return(a0*mu*mu2 + a1*mu2 + a2*mu + a3);
131 }
132 }

References ralab::base::base::utilities::CubicInterpolate< TReal >::epsilon_.

Member Data Documentation

◆ epsilon_

template<typename TReal >
TReal ralab::base::base::utilities::CubicInterpolate< TReal >::epsilon_

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