Ramer-Douglas-Peucker Algorithm (p5*js)