Approximation of an elevation profile using Lagrange and spline interpolation methods.
This program performs elevation profile approximation using two interpolation methods – Lagrange and spline – and allows making a cursory comparison, taking processing time and result accuracy into account.
As an input program takes text file describing elevation profile of some route. The file contains rows with data in the form of: distance\
1.43 17.2
2.11 16.68
2.5 16.94
From the input a given number of reference samples is taken. Then, from among those samples, the program chooses a given number of interpolation nodes. Based on interpolation nodes, the set of new (approximated) values is generated.
Results are saved into text file, similar to that containing input. The additional Python script uses those results to generate graphs showing the original and the approximated routes.
Following parameters are adjustable:
#define SAMPLES
const char* data_sets[4]
; data must answer the description introduced aboveint intervals[4]
arrayBy default 4 sets of values are generated for one method – each set created with different number of interpolation nodes.