Code used for Douglas Peucker reduction

Based on from:
http://phpriot.com/articles/reducing-map-path-douglas-peucker-algorithm.