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).

static LPair<Pt> assignEachPointToClosestNeighbor(Cl<Pt> l1, Cl<Pt> l2) {
  new LPair<Pt> pairs;
  for (Pt a : l1) {
    Pt b = lowestAccordingTo(l2, x -> ptDistanceSquared(a, x));
    if (b != null) l2.remove(b);
    pairs.add(pair(a, b));
  }
  ret pairs;
}

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: 136 / 198
Version history: 5 change(s)
Referenced in: [show references]