Libraryless. Click here for Pure Java version (4765L/27K).
static L<Rect> gridOfRects3_flattened(int w, int h, int cols, int rows) { ret gridOfRects3_flattened(Rect(0, 0, w, h), cols, rows); } static L<Rect> gridOfRects3_flattened(Rect r, int cols, int rows) { new L<Rect> l; for row to rows: { int y1 = r.y+iround(r.h*(double) row/rows); int y2 = r.y+iround(r.h*(double) (row+1)/rows); for col to cols: { int x1 = r.x+iround(r.w*(double) col/cols); int x2 = r.x+iround(r.w*(double) (col+1)/cols); l.add(Rect(x1, y1, x2-x1, y2-y1)); } } ret l; }
Began life as a copy of #1024667
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1034017 |
| Snippet name: | gridOfRects3_flattened - takes cols and rows, returns L<Rect> |
| Eternal ID of this version: | #1034017/3 |
| Text MD5: | c213470c8e109291d642b09ed8a38339 |
| Transpilation MD5: | 84d5098465e31b691cb36407d58fd8bf |
| Author: | stefan |
| Category: | javax / imaging |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-01-17 14:25:56 |
| Source code size: | 547 bytes / 17 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 358 / 473 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |