simplify<T extends Point<double>> function

List<T> simplify<T extends Point<double>>(
  1. List<T> points,
  2. {double? tolerance,
  3. bool highestQuality = false}
)

Implementation

List<T> simplify<T extends Point<double>>(
  List<T> points, {
  double? tolerance,
  bool highestQuality = false,
}) {
  if (points.length <= 2) {
    return points;
  }

  List<T> nextPoints = points;

  final double sqTolerance = tolerance != null ? tolerance * tolerance : 1;

  nextPoints =
      highestQuality ? points : _simplifyRadialDist(nextPoints, sqTolerance);

  nextPoints = _simplifyDouglasPeucker(nextPoints, sqTolerance);

  return nextPoints;
}