private static Position[] simplifyDouglasPeucker(Position[] points,double sqTolerance){
  int last=points.length - 1;
  ArrayList<Position> simplified=new ArrayList<>();
  simplified.add(points[0]);
  simplified.addAll(simplifyDpStep(points,0,last,sqTolerance,simplified));
  simplified.add(points[last]);
  return simplified.toArray(new Position[simplified.size()]);
}

private static Position [ ] simplifyDouglasPeucker ( Position [ ] points , double sqTolerance ) { int last = points . length - 1 ; ArrayList < Position > simplified = new ArrayList < > ( ) ; simplified . add ( points [ 0 ] ) ; simplified . addAll ( simplifyDpStep ( points , 0 , last , sqTolerance , simplified ) ) ; simplified . add ( points [ last ] ) ; return simplified . toArray ( new Position [ simplified . size ( ) ] ) ; }
simplification using ramer - douglas - peucker algorithm
