Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. cDbScan::cDbScan(list<cPoint> data, float eps, int minpts)
  2. {  
  3.     while(data.size() > 0)
  4.     {
  5.         list<cPoint> cluster_list;
  6.         cluster_list.push_back(*data.begin());
  7.         data.erase(data.begin());
  8.        
  9.         for(list<cPoint>::iterator it = cluster_list.begin();it != cluster_list.end();it++)
  10.         {
  11.             for(list<cPoint>::iterator main_it = data.begin();main_it != data.end();main_it++)
  12.             {
  13.  
  14.                 if((*it).dist2(*main_it) < eps*eps)
  15.                 {
  16.                     cluster_list.push_back(*main_it);          
  17.                     data.erase(main_it);
  18.                 }
  19.             }
  20.         }
  21.  
  22.         if(cluster_list.size() >= minpts)
  23.         {
  24.             this->push_back(cCluster(cluster_list));
  25.         }
  26.        
  27.         cluster_list.empty();
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement