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

8
LINES

< > BotCompany Repo | #1027216 // allSubRectsOfSizeIterator

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2506L/16K).

static ItIt<Rect> allSubRectsOfSizeIterator(int w, int h, Rect full) {
  if (full == null) ret emptyItIt();
  int fullW = full.w, fullH = full.h;
  if (w > fullW || h > fullH) ret emptyItIt();
  int freeplayX = fullW-w+1, freeplayY = fullH-h+1, freeplay = freeplayX*freeplayY;
  ret mapI(iota_zero(freeplay), i ->
    rect(full.x + (i % freeplayX), full.y + (i / freeplayX), w, h));
}

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: 227 / 315
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1027269 - allSubRectsOfSizeIterator_topLeftCorners