docs: int subSimplify(PointList points, int fromIndex, int lastIndex) {
          if (lastIndex - fromIndex < 2) {
              return 0;
          }
          int indexWithMaxDist = -1;
          double maxDist = -1;
          double firstLat = points.getLatitude(fromIndex);
          double firstLon = points.getLongitude(fromIndex);
          double lastLat = points.getLatitude(lastIndex);
          double lastLon = points.getLongitude(lastIndex);
          for (int i = fromIndex + 1; i < lastIndex; i++) {
              double lat = points.getLatitude(i);
              if (Double.isNaN(lat)) {
                  continue;
              }
              double lon = points.getLongitude(i);
              double dist = calc.calcNormalizedEdgeDistance(lat, lon, firstLat, firstLon, lastLat, lastLon);
              if (maxDist < dist) {
                  indexWithMaxDist = i;
                  maxDist = dist;
              }
          }
  
          if (indexWithMaxDist < 0) {
              throw new IllegalStateException("maximum not found in [" + fromIndex + "," + lastIndex + "]");
          }
  
          int counter = 0;
          if (maxDist < normedMaxDist) {
              for (int i = fromIndex + 1; i < lastIndex; i++) {
                  points.set(i, Double.NaN, Double.NaN, Double.NaN);
                  counter++;
              }
          } else {
              counter = subSimplify(points, fromIndex, indexWithMaxDist);
              counter += subSimplify(points, indexWithMaxDist, lastIndex);
          }
          return counter;
      }