Implementation of Douglas-Peucker line approximation algorithm