static LL gridOfDoubleRects3(double w, double h, int cols, int rows) { ret gridOfDoubleRects3(DoubleRect(0, 0, w, h), cols, rows); } static LL gridOfDoubleRects3(DoubleRect r, int cols, int rows) { new LL l; for row to rows: { new L line; double y1 = r.y+r.h*row/rows; double y2 = r.y+r.h*(row+1)/rows; for col to cols: { double x1 = r.x+r.w*col/cols; double x2 = r.x+r.w*(col+1)/cols; line.add(DoubleRect(x1, y1, x2-x1, y2-y1)); } l.add(line); } ret l; }