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

20
LINES

< > BotCompany Repo | #1034662 // RegionHoleBounds - find bounds of each hole in region

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

Transpiled version (8654L) is out of date.

srecord noeq RegionHoleBounds(IImageRegion region) {
  new L<Rect> holeBounds;
  BoundsFinder bf;
  
  L<Rect> get() {
    if (region == null) ret holeBounds;
    var borderWalker = new RegionBorder_innerPoints_v2(region);
    borderWalker.onNewTrace(isHole -> {
      if (isHole) {
        if (bf != null) holeBounds.add(bf!);
        bf = new BoundsFinder;
      } else
        bf = null;
    });
    borderWalker.onFoundPoint(p -> { bf?.addPt(p); });
    borderWalker.run();
    if (bf != null) holeBounds.add(bf!);
    ret holeBounds;
  }
}

Author comment

Began life as a copy of #1034657

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034662
Snippet name: RegionHoleBounds - find bounds of each hole in region
Eternal ID of this version: #1034662/7
Text MD5: 6bed9216ad47e1243f3cb6dc67a74c9f
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-28 23:45:47
Source code size: 563 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 135 / 227
Version history: 6 change(s)
Referenced in: [show references]