Ocean
Ocean::Interpolation Class Reference

This class implements data interpolation functions. More...

Data Structures

class  LinearInterpolation
 This class implements a helper linear interpolation helper class allowing to overload the interpolation function for specific data types. More...
 

Static Public Member Functions

template<typename T , typename TFactor >
static T linear (const T &v0, const T &v1, const TFactor &t)
 Performs a linear interpolation between two values. More...
 
template<typename T , typename TFactor >
static T bilinear (const T &v00, const T &v01, const T &v10, const T &v11, const TFactor &tx, const TFactor &ty)
 Performs a bi-linear interpolation between four values within a 2x2 neighborhood. More...
 
template<typename T , typename TFactor >
static T bilinear (const T &v00, const T &v01, const T &v10, const T &v11, const bool valid00, const bool valid01, const bool valid10, const bool valid11, const TFactor &tx, const TFactor &ty)
 Performs a bi-linear interpolation between at most four values within a 2x2 neighborhood. More...
 
template<typename T , typename TFactor >
static T cubic (const T &v0, const T &v1, const T &v2, const T &v3, const TFactor &t)
 Performs a cubic (Catmull-Rom) interpolation between mainly two values while two further supporting points are requested. More...
 
template<typename T , typename TKey >
static T lagrange2 (const TKey &x0, const T &y0, const TKey &x1, const T &y1, const TKey &x)
 Performs a Lagrange interpolation for a polynomial with degree 2. More...
 
template<typename T , typename TKey >
static T lagrange3 (const TKey &x0, const T &y0, const TKey &x1, const T &y1, const TKey &x2, const T &y2, const TKey &x)
 Performs a Lagrange interpolation for a polynomial with degree 3. More...
 

Detailed Description

This class implements data interpolation functions.

An interpolation value of 0 provides the first value, 1 provides the second value.

Member Function Documentation

◆ bilinear() [1/2]

template<typename T , typename TFactor >
T Ocean::Interpolation::bilinear ( const T &  v00,
const T &  v01,
const T &  v10,
const T &  v11,
const bool  valid00,
const bool  valid01,
const bool  valid10,
const bool  valid11,
const TFactor &  tx,
const TFactor &  ty 
)
inlinestatic

Performs a bi-linear interpolation between at most four values within a 2x2 neighborhood.

This function allows the interpolation between a subset of the given four values.
Thus, boolean statements for each individual value define whether the corresponding value is applied for interpolation or not.
If only one value is provided, than the 'interpolation' result is the value itself without investigating the interpolation factors.
The layout of the four values are defined as follows:

v00 v01
v10 v11
Parameters
v00Top left value
v01Top right value
v10Bottom left value
v11Bottom right value
valid00True, if the value v00 is valid and has to be applied for interpolation
valid01True, if the value v01 is valid and has to be applied for interpolation
valid10True, if the value v10 is valid and has to be applied for interpolation
valid11True, if the value v11 is valid and has to be applied for interpolation
txHorizontal (left - right) interpolation factor, with range [0, 1]
tyVertical (top - bottom) interpolation factor, with range [0, 1]
Returns
Resulting interpolation value
Template Parameters
TData type of the values to be interpolated
TFactorData type of the interpolation value

◆ bilinear() [2/2]

template<typename T , typename TFactor >
T Ocean::Interpolation::bilinear ( const T &  v00,
const T &  v01,
const T &  v10,
const T &  v11,
const TFactor &  tx,
const TFactor &  ty 
)
inlinestatic

Performs a bi-linear interpolation between four values within a 2x2 neighborhood.

The layout of the four values are defined as follows:

v00 v01
v10 v11
Parameters
v00Top left value
v01Top right value
v10Bottom left value
v11Bottom right value
txHorizontal (left - right) interpolation factor, with range [0, 1]
tyVertical (top - bottom) interpolation factor, with range [0, 1]
Returns
Resulting interpolation value
Template Parameters
TData type of the values to be interpolated
TFactorData type of the interpolation value

◆ cubic()

template<typename T , typename TFactor >
T Ocean::Interpolation::cubic ( const T &  v0,
const T &  v1,
const T &  v2,
const T &  v3,
const TFactor &  t 
)
inlinestatic

Performs a cubic (Catmull-Rom) interpolation between mainly two values while two further supporting points are requested.

Parameters
v0Supporting value in front of the first value
v1First value
v2Second value
v3Supporting value behind the second value
tInterpolation factor, with range [0, 1]
Returns
Resulting interpolation value
Template Parameters
TData type of the values to be interpolated
TFactorData type of the interpolation value

◆ lagrange2()

template<typename T , typename TKey >
T Ocean::Interpolation::lagrange2 ( const TKey &  x0,
const T &  y0,
const TKey &  x1,
const T &  y1,
const TKey &  x 
)
static

Performs a Lagrange interpolation for a polynomial with degree 2.

Parameters
x0Position of the first supporting value, must not be identical with x1
y0First supporting value
x1Position of the second supporting value, must not be identical with x0
y1Second supporting value
xPosition for that the interpolation value is requested
Returns
Resulting Lagrange intgerpolatino value
Template Parameters
TData type of the supporting values
TKeyData type of the positions of the supporting values

◆ lagrange3()

template<typename T , typename TKey >
T Ocean::Interpolation::lagrange3 ( const TKey &  x0,
const T &  y0,
const TKey &  x1,
const T &  y1,
const TKey &  x2,
const T &  y2,
const TKey &  x 
)
static

Performs a Lagrange interpolation for a polynomial with degree 3.

Parameters
x0Position of the first supporting value, must not be identical with x1 or x2
y0First supporting value
x1Position of the second supporting value, must not be identical with x0 or x2
y1Second supporting value
x2Position of the third supporting value, must not be identical with x0 or x1
y2Third supporting value
xPosition for that the interpolation value is requested
Returns
Resulting Lagrange intgerpolatino value
Template Parameters
TData type of the supporting values
TKeyData type of the positions of the supporting values

◆ linear()

template<typename T , typename TFactor >
T Ocean::Interpolation::linear ( const T &  v0,
const T &  v1,
const TFactor &  t 
)
inlinestatic

Performs a linear interpolation between two values.

Parameters
v0First value corresponding to the interpolation factor t = 0
v1Second value corresponding to the interpolation factor t = 1
tInterpolation factor, with range [0, 1]
Returns
Resulting interpolation value
Template Parameters
TData type of the values to be interpolated
TFactorData type of the interpolation value

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