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

9
LINES

< > BotCompany Repo | #1031381 // assignEachPointToClosestNeighbor

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

Libraryless. Click here for Pure Java version (3126L/18K).

1  
static LPair<Pt> assignEachPointToClosestNeighbor(Cl<Pt> l1, Cl<Pt> l2) {
2  
  new LPair<Pt> pairs;
3  
  for (Pt a : l1) {
4  
    Pt b = lowestAccordingTo(l2, x -> ptDistanceSquared(a, x));
5  
    if (b != null) l2.remove(b);
6  
    pairs.add(pair(a, b));
7  
  }
8  
  ret pairs;
9  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031381
Snippet name: assignEachPointToClosestNeighbor
Eternal ID of this version: #1031381/6
Text MD5: 33d402a7cffde5597cbc38e37ed9d020
Transpilation MD5: e294ecb450e0c9129b812b614e511f77
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-07 15:20:36
Source code size: 267 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 139 / 201
Version history: 5 change(s)
Referenced in: [show references]