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

HermiteInterpolation. More...

#include <interpolation.hpp>

Public Member Functions

 HermiteInterpolate (TReal tension, TReal bias, TReal epsilon=std::numeric_limits< TReal >::epsilon())
 
TReal operator() (TReal y0, TReal y1, TReal y2, TReal y3, TReal mu)
 operator
 

Public Attributes

TReal tension_
 
TReal bias_
 
TReal epsilon_
 

Detailed Description

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

HermiteInterpolation.

Hermite interpolation like cubic requires 4 points so that it can achieve a higher degree of continuity. In addition it has nice tension and biasing controls. Tension can be used to tighten up the curvature at the known points. The bias is used to twist the curve about the known points. The examples shown here have the default tension and bias values of 0, it will be left as an exercise for the reader to explore different tension and bias values.

Definition at line 144 of file interpolation.hpp.

Constructor & Destructor Documentation

◆ HermiteInterpolate()

template<typename TReal >
ralab::base::base::utilities::HermiteInterpolate< TReal >::HermiteInterpolate ( TReal  tension,
TReal  bias,
TReal  epsilon = std::numeric_limits<TReal>::epsilon() 
)
inline
Parameters
tension1 is high, 0 normal, -1 is low
bias0 is even, positive is towards first segment, negative towards the other

Definition at line 149 of file interpolation.hpp.

Member Function Documentation

◆ operator()()

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

operator

Parameters
y0y0
y1y1
y2y2
y3y3
mulocation

Definition at line 156 of file interpolation.hpp.

163 {
164 if(mu < epsilon_)
165 {
166 return y1;
167 }
168 else if(-(mu - 1.) < epsilon_)
169 {
170 return y2;
171 }
172 else
173 {
174 TReal m0,m1,mu2,mu3;
175 TReal a0,a1,a2,a3;
176 mu2 = mu * mu;
177 mu3 = mu2 * mu;
178 m0 = (y1-y0)*(1+bias_)*(1-tension_)/2;
179 m0 += (y2-y1)*(1-bias_)*(1-tension_)/2;
180 m1 = (y2-y1)*(1+bias_)*(1-tension_)/2;
181 m1 += (y3-y2)*(1-bias_)*(1-tension_)/2;
182 a0 = 2*mu3 - 3*mu2 + 1;
183 a1 = mu3 - 2*mu2 + mu;
184 a2 = mu3 - mu2;
185 a3 = -2*mu3 + 3*mu2;
186 return( a0*y1 + a1*m0 + a2*m1 + a3*y2 );
187 }
188 }

References ralab::base::base::utilities::HermiteInterpolate< TReal >::bias_, ralab::base::base::utilities::HermiteInterpolate< TReal >::epsilon_, and ralab::base::base::utilities::HermiteInterpolate< TReal >::tension_.

Member Data Documentation

◆ tension_

template<typename TReal >
TReal ralab::base::base::utilities::HermiteInterpolate< TReal >::tension_

◆ bias_

template<typename TReal >
TReal ralab::base::base::utilities::HermiteInterpolate< TReal >::bias_

◆ epsilon_

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

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