simplify function

List<Point> simplify(
  1. Iterable<Point> points,
  2. num tolerance, {
  3. bool highQuality = false,
})

Implementation

List<Point> simplify(Iterable<Point> points, num tolerance, {bool highQuality = false}) {
  var pointList = points.toList();
  if (pointList.length <= 2) {
    return pointList;
  }

  var squaredTolerance = pow(tolerance, 2);

  return highQuality
      ? simplifyDouglasPeucker(pointList, squaredTolerance)
      : simplifyDouglasPeucker(simplifyRadialDistance(pointList, squaredTolerance), squaredTolerance);
}