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

8
LINES

< > BotCompany Repo | #1027269 // allSubRectsOfSizeIterator_topLeftCorners

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

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

static ItIt<Pt> allSubRectsOfSizeIterator_topLeftCorners(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 ->
    pt(full.x + (i % freeplayX), full.y + (i / freeplayX)));
}

Author comment

Began life as a copy of #1027216

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: #1027269
Snippet name: allSubRectsOfSizeIterator_topLeftCorners
Eternal ID of this version: #1027269/1
Text MD5: 9e0b253eb8b81c3108eb89e6e4b1b1fd
Transpilation MD5: ff0e915d075305478358d1fbc884be0b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-28 15:09:56
Source code size: 396 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 239 / 312
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)