code: function simplify(points, tolerance, highestQuality) {
  
              if (points.length <= 1)
                  return points;
  
              var sqTolerance = tolerance !== undefined ? tolerance * tolerance
                      : 1;
  
              points = highestQuality ? points : simplifyRadialDist(points,
                      sqTolerance);
              points = simplifyDouglasPeucker(points, sqTolerance);
  
              return points;
          }
docs: both algorithms combined for awesome performance