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

unique-method modified

parent d0890723
......@@ -633,14 +633,19 @@ namespace vector_operations {
inline void unique(std::vector<WorldVector<double> > &vec, double tol, std::vector<unsigned> &ind)
{
compareTol<WorldVector<double> > comp(tol);
unsigned newVec=0;
for(unsigned i=0; i<vec.size();++i) {
bool inNew=false;
for(unsigned j=0;j<newVec;++j) {
inNew=inNew||comp(vec[i],vec[j]);
if(inNew) break;
}
if(!inNew) {vec[newVec]=vec[i]; newVec++; ind.push_back(i);}
size_t newVec = 0;
for (size_t i = 0; i < vec.size(); ++i) {
bool inNew = false;
for (size_t j = 0; j < newVec; ++j) {
inNew = inNew || comp(vec[i], vec[j]);
if(inNew)
break;
}
if (!inNew) {
vec[newVec] = vec[i];
newVec++;
ind.push_back(i);
}
}
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