Douglas-Peucker algorithm