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

13
LINES

< > BotCompany Repo | #1015502 // makeGridOfRects - does not include partial rects. takes rw and rh, returns L<Rect>

JavaX fragment (include)

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

static L<Rect> makeGridOfRects(Rect r, int rw, int rh) {
  new L<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)
    for (int x = r.x; x < w; x += rw)
      l.add(Rect(x, y, rw, rh));
  ret l;
}

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: #1015502
Snippet name: makeGridOfRects - does not include partial rects. takes rw and rh, returns L<Rect>
Eternal ID of this version: #1015502/3
Text MD5: 07bb041b63b96f7edf2a65563586b30b
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:42
Source code size: 374 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 323 / 360
Version history: 2 change(s)
Referenced in: [show references]