1 | // m = cols, n = rows |
2 | static L<Rect> tileRects(int w, int h, int m, int n) { |
3 | new L<Rect> tiles; |
4 | for y to n: { |
5 | int y1 = y*h/n, y2 = (y+1)*h/n; |
6 | for x to m: { |
7 | int x1 = x*w/m, x2 = (x+1)*w/m; |
8 | Rect r = rectFromPoints(x1, y1, x2, y2); |
9 | tiles.add(r); |
10 | } |
11 | } |
12 | ret tiles; |
13 | } |
Began life as a copy of #1016032
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1016661 |
Snippet name: | tileRects |
Eternal ID of this version: | #1016661/1 |
Text MD5: | d688a589d6c47a108adea4ad3a261509 |
Author: | stefan |
Category: | javax / maths |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-27 00:51:29 |
Source code size: | 309 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 328 / 361 |
Referenced in: | [show references] |