Implementation of Douglas-Pecker Line approximation