Skip to content

Instantly share code, notes, and snippets.

@roxlu
Created July 20, 2011 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roxlu/1095704 to your computer and use it in GitHub Desktop.
Save roxlu/1095704 to your computer and use it in GitHub Desktop.
Defining outside loop?
inline std::vector<HE_Edge*> HE_Selection::getOuterEdges() {
HE_Selection copy = getCopy();
copy.collectEdges();
const std::vector<HE_Edge*>& copy_edges = copy.getEdgesRef();
const std::vector<HE_Edge*>::const_iterator it = copy_edges.begin();
HE_Edge* e = NULL;
HE_Face* f1 = NULL;
HE_Face* f2 = NULL;
std::vector<HE_Edge*> result;
while(it != copy_edges.end()) {
e = (*it);
f1 = e->getFirstFace();
f2 = e->getSecondFace();
if( (f1 == NULL) || (f2 == NULL) || (!containsFace(f1)) || (!constainsFace(f2)) {
result.push_back(e);
}
}
return result;
}
// ---------- or inside loop
inline std::vector<HE_Edge*> HE_Selection::getOuterEdges() {
HE_Selection copy = getCopy();
copy.collectEdges();
const std::vector<HE_Edge*>& copy_edges = copy.getEdgesRef();
const std::vector<HE_Edge*>::const_iterator it = copy_edges.begin();
HE_Edge* e = NULL;
std::vector<HE_Edge*> result;
while(it != copy_edges.end()) {
e = (*it);
HE_Face* f1 = e->getFirstFace();
HE_Face* f2 = e->getSecondFace();
if( (f1 == NULL) || (f2 == NULL) || (!containsFace(f1)) || (!constainsFace(f2)) {
result.push_back(e);
}
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment