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.

1  
srecord noeq RegionHoleBounds(IImageRegion region) {
2  
  new L<Rect> holeBounds;
3  
  BoundsFinder bf;
4  
  
5  
  L<Rect> get() {
6  
    if (region == null) ret holeBounds;
7  
    var borderWalker = new RegionBorder_innerPoints_v2(region);
8  
    borderWalker.onNewTrace(isHole -> {
9  
      if (isHole) {
10  
        if (bf != null) holeBounds.add(bf!);
11  
        bf = new BoundsFinder;
12  
      } else
13  
        bf = null;
14  
    });
15  
    borderWalker.onFoundPoint(p -> { bf?.addPt(p); });
16  
    borderWalker.run();
17  
    if (bf != null) holeBounds.add(bf!);
18  
    ret holeBounds;
19  
  }
20  
}

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: 137 / 229
Version history: 6 change(s)
Referenced in: [show references]