Class ElevationInterpolator

Class Documentation

class ElevationInterpolator

This class uses four GDAL elevation posts and an offset from the top left post to calculate a weighted elevation value for the given offset.

Public Functions

ElevationInterpolator(double top_left, double top_right, double bottom_left, double bottom_right)

Used to interpolate the elevation from GDAL given four adjacent posts.

Parameters
  • top_left – top left post elevation

  • top_right – top right post elevation

  • bottom_left – bottom left post elevation

  • bottom_right – bottom right post elevation

double interpolate(std::pair<double, double> fractions) const

This method interpolates a GDAL elevation using 3 linear interpolations.

One on the top posts, one on the bottom posts, and a third between the results of the first two.

Interpolate the elevation given the first element of the std::pair is a percentage from top_left to top_right in the x direction and the second element is a percentage from top_left to bottom_left in the y direction.

Parameters

fractions – A pair where the first is the distance from top left post to selected post in x direction (0 - 1) and the second is the distance from top left post to selected post in y direction (0 - 1)

Returns

Interpolated elevation between the four posts.