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

21
LINES

< > BotCompany Repo | #1035445 // PointSetSimilarity - shared vs total pixels between two point sets

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

Libraryless. Click here for Pure Java version (152L/1K).

sclass PointSetSimilarity {
  Set<Pt> set1, set2;
  int totalPoints;
  int sharedPoints;
  
  *(Set<Pt> *set1, Set<Pt> *set2) {
    for (Pt p : set1) {
      ++totalPoints;
      if (set2.contains(p))
        ++sharedPoints;
    }
    
    for (Pt p : set2)
      if (!set1.contains(p))
        ++totalPoints;
  }
  
  double get() {
    ret doubleRatio(sharedPoints, totalPoints);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035445
Snippet name: PointSetSimilarity - shared vs total pixels between two point sets
Eternal ID of this version: #1035445/1
Text MD5: 2c2d26d7d8701ca5d6f0377f0c8ebc49
Transpilation MD5: 3695f73f0546e0876414937bfe061b44
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-13 15:08:26
Source code size: 407 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 177 / 263
Referenced in: [show references]