Visualization of the Ramer Douglas Peucker algorithm, an iterative end-point fit algorithm for decimating a polyline to a simpler polyline
The function used in the code (as shown in the above image) isf(x)=e-xcos(2πx) for x in [0, 5] as used in the wikipedia article RDP algorithm
The example function, variation of epsilon (inversely related to the fidelity of the approximated polyline), and the domain of x can be varied by the user
Further, in the implemented program, code to plot the original polyline (in grey (solid)) (not shown above) along with the simplified polyline (in red (dashed)) has also been provided