Skip to content
Snippets Groups Projects
Commit 242c9749 authored by Philippe Delandmeter's avatar Philippe Delandmeter
Browse files

MFace sorted with the index of Vertices

parent 8b421593
No related branches found
No related tags found
No related merge requests found
......@@ -10,10 +10,12 @@
#include "Numeric.h"
#include "Context.h"
bool compare (MVertex* v0, MVertex* v1) {return v0->getNum() < v1->getNum();}
void sortVertices(std::vector<MVertex*> v, std::vector<char> &si)
{
std::vector<MVertex*> sorted = v;
std::sort(sorted.begin(), sorted.end());
std::sort(sorted.begin(), sorted.end(), compare);
for(unsigned int i = 0; i < sorted.size(); i++)
si.push_back(std::distance(v.begin(), std::find(v.begin(), v.end(), sorted[i])));
}
......
......@@ -134,8 +134,8 @@ struct Less_Face : public std::binary_function<MFace, MFace, bool> {
if (f1.getNumVertices() != f2.getNumVertices())
return f1.getNumVertices() < f2.getNumVertices();
for(int i = 0; i < f1.getNumVertices(); i++) {
if(f1.getSortedVertex(i) < f2.getSortedVertex(i)) return true;
if(f1.getSortedVertex(i) > f2.getSortedVertex(i)) return false;
if(f1.getSortedVertex(i)->getNum() < f2.getSortedVertex(i)->getNum()) return true;
if(f1.getSortedVertex(i)->getNum() > f2.getSortedVertex(i)->getNum()) return false;
}
return false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment