List createPolys(int nItems,double size,int nPts){
  double overlapPct=0.2;
  int nCells=(int)Math.sqrt(nItems);
  List geoms=new ArrayList();
  double width=nCells * (1 - overlapPct) * size;
  double height=nCells * 2 * size;
  double xInc=width / nCells;
  double yInc=height / nCells;
  for (int i=0; i < nCells; i++) {
    for (int j=0; j < nCells; j++) {
      Coordinate base=new Coordinate(i * xInc,j * yInc);
      Geometry poly=createPoly(base,size,nPts);
      geoms.add(poly);
    }
  }
  return geoms;
}

List createPolys ( int nItems , double size , int nPts ) { double overlapPct = 0.2 ; int nCells = ( int ) Math . sqrt ( nItems ) ; List geoms = new ArrayList ( ) ; double width = nCells * ( 1 - overlapPct ) * size ; double height = nCells * 2 * size ; double xInc = width / nCells ; double yInc = height / nCells ; for ( int i = 0 ; i < nCells ; i ++ ) { for ( int j = 0 ; j < nCells ; j ++ ) { Coordinate base = new Coordinate ( i * xInc , j * yInc ) ; Geometry poly = createPoly ( base , size , nPts ) ; geoms . add ( poly ) ; } } return geoms ; }
creates a grid of circles with a small percentage of overlap in both directions . this approximated likely real - world cases well , and seems to produce close to worst - case performance for the iterated algorithm . sample times : 1000 items / 100 pts - cascaded : 2718 ms , iterated 150 s
