Template Function navtk::utils::linear_interpolate(double, const Y&, double, const Y&, double)

Function Documentation

template<typename Y>
Y navtk::utils::linear_interpolate(double x0, const Y &y0, double x1, const Y &y1, double x)

Performs a linear interpolation.

This is an approximation of y at x, given two reference points (x0, y0) and (x1, y1).

Parameters
  • x0 – First evaluation point of f()

  • y0f(x0)

  • x1 – Second evaluation point of f()

  • y1f(x1)

  • x – Point between x0 and x1 at which to calculate approximation.

Returns

An approximation for y = f(x). If x0 == x1, y1 is returned.