Ramer Douglas Peucker demo in Processing.
Draws a line formed by a set of points (black)
Optimizes the line using RDP and a distance tolerance. Points within the tolerance distance are removed.
Draws the new line (green)
See also https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm