Cubic Interpolation

template<typename T>
struct cubic

1D cubic interpolation

Template Parameters:

T – The datatype to use for the interpolation. E.g. float/double/etc.

Public Types

typedef T VALUE_TYPE

The data type this function is operating with, e.g. for float images, it is float.

Public Functions

inline T operator()(const Data<cubic<T>, 1> &p, double x)

Compute the cubic interpolation of the given points and position.

Given 4 values, and a position in the interval [0, 1], this function returns the interpolated value using a uniform Catmull-Rom spline.

Note

This function operates in double mode. The result is cast to the set template type T. NO rounding to nearest etc. is performed for e.g. integers.

Parameters:
  • p[in] The 4 values to interpolate

  • x[in] The position in the interval [0, 1] to interpolate

Returns:

The result of the interpolation

Public Static Attributes

static constexpr int NUMBER_OF_VALUES = 4

The number of datapoints required to perform the interpolation. Cubic interpolation needs four datapoints.