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

18
LINES

< > BotCompany Repo | #1032242 // test_PtTree [OK]

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

Libraryless. Click here for Pure Java version (4919L/27K).

1  
svoid test_PtTree() {
2  
  int n = 10;
3  
  Set<Pt> set = repFToSet(n, () -> randomPt(10));
4  
  print(set);
5  
  PtTree tree = PtTree.fromPointSet(set);
6  
  //printIndentedStruct(tree);
7  
  print(asList(iterator(tree)));
8  
  for (var p : set) {
9  
    Rect r = rectAround(p, 1);
10  
    var l = tree.pointsIn(r);
11  
    printVars(+p, +l);
12  
    assertTrueVerbose(str(r), l.contains(p));
13  
    for (p2 : set)
14  
      if (!r.contains(p2))
15  
        if (l.contains(p2))
16  
          fail("Bad bad: " + p2);
17  
  }
18  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032242
Snippet name: test_PtTree [OK]
Eternal ID of this version: #1032242/1
Text MD5: b32f10cfb0adadd7a2d0d08d232ace39
Transpilation MD5: 7d9393f1f10a4232387aaa284ea3e707
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-21 04:54:35
Source code size: 488 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 124 / 188
Referenced in: [show references]