Commit f2548627 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

unique-method modified

parent d0890723
...@@ -633,14 +633,19 @@ namespace vector_operations { ...@@ -633,14 +633,19 @@ namespace vector_operations {
inline void unique(std::vector<WorldVector<double> > &vec, double tol, std::vector<unsigned> &ind) inline void unique(std::vector<WorldVector<double> > &vec, double tol, std::vector<unsigned> &ind)
{ {
compareTol<WorldVector<double> > comp(tol); compareTol<WorldVector<double> > comp(tol);
unsigned newVec=0; size_t newVec = 0;
for(unsigned i=0; i<vec.size();++i) { for (size_t i = 0; i < vec.size(); ++i) {
bool inNew=false; bool inNew = false;
for(unsigned j=0;j<newVec;++j) { for (size_t j = 0; j < newVec; ++j) {
inNew=inNew||comp(vec[i],vec[j]); inNew = inNew || comp(vec[i], vec[j]);
if(inNew) break; if(inNew)
break;
}
if (!inNew) {
vec[newVec] = vec[i];
newVec++;
ind.push_back(i);
} }
if(!inNew) {vec[newVec]=vec[i]; newVec++; ind.push_back(i);}
} }
vec.erase(vec.begin()+newVec,vec.end()); vec.erase(vec.begin()+newVec,vec.end());
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment