Libraryless. Click here for Pure Java version (2506L/16K).
1 | static ItIt<Rect> allSubRectsOfSizeIterator(int w, int h, Rect full) { |
2 | if (full == null) ret emptyItIt(); |
3 | int fullW = full.w, fullH = full.h; |
4 | if (w > fullW || h > fullH) ret emptyItIt(); |
5 | int freeplayX = fullW-w+1, freeplayY = fullH-h+1, freeplay = freeplayX*freeplayY; |
6 | ret mapI(iota_zero(freeplay), i -> |
7 | rect(full.x + (i % freeplayX), full.y + (i / freeplayX), w, h)); |
8 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027216 |
Snippet name: | allSubRectsOfSizeIterator |
Eternal ID of this version: | #1027216/1 |
Text MD5: | ccbecee49b2b241ad839174976aa9839 |
Transpilation MD5: | 3c6e9e9ce81bd1d535af917bc8ee7c0a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-26 12:28:45 |
Source code size: | 391 bytes / 8 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 228 / 316 |
Referenced in: | [show references] |