code: function simplifyDouglasPeucker(points, sqTolerance) {
      var last = points.length - 1;
  
      var simplified = [points[0]];
      simplifyDPStep(points, 0, last, sqTolerance, simplified);
      simplified.push(points[last]);
  
      return simplified;
  }
docs: simplification using Ramer-Douglas-Peucker algorithm