Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1015511 // makeGridOfRects2 - does not include partial rects. takes rw and rh, returns LL<Rect>

JavaX fragment (include)

static LL<Rect> makeGridOfRects2(int w, int h, int rw, int rh) {
  ret makeGridOfRects2(Rect(0, 0, w, h), rw, rh);
}

static LL<Rect> makeGridOfRects2(Rect r, int rw, int rh) {
  new LL<Rect> l;
  int w = r.w-mod(r.w, rw);
  int h = r.h-mod(r.h, rh);
  for (int y = r.y; y < h; y += rh) {
    new L<Rect> line;
    for (int x = r.x; x < w; x += rw)
      line.add(Rect(x, y, rw, rh));
    l.add(line);
  }
  ret l;
}

Author comment

Began life as a copy of #1015502

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1015511
Snippet name: makeGridOfRects2 - does not include partial rects. takes rw and rh, returns LL<Rect>
Eternal ID of this version: #1015511/2
Text MD5: 283a9fe36c33622092c41a7ffeead332
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-22 23:35:24
Source code size: 431 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 399 / 429
Version history: 1 change(s)
Referenced in: [show references]