Commit cb6cd448 by Pierre Kraemer

### traversors2 updated

parent d0f183b2
 ... ... @@ -30,6 +30,10 @@ namespace CGoGN { /******************************************************************************* VERTEX CENTERED TRAVERSALS *******************************************************************************/ // Traverse the edges incident to a given vertex template class Traversor1VE ... ... @@ -103,6 +107,10 @@ public: } } ; /******************************************************************************* EDGE CENTERED TRAVERSALS *******************************************************************************/ // Traverse the vertices incident to a given edge template class Traversor1EV ... ...
 ... ... @@ -30,6 +30,10 @@ namespace CGoGN { /******************************************************************************* VERTEX CENTERED TRAVERSALS *******************************************************************************/ // Traverse the edges incident to a given vertex template class Traversor2VE ... ... @@ -77,7 +81,7 @@ public: if(current != NIL) { current = m.alpha1(current) ; if(m.isBoundarymarked(current)) if(m.isBoundarymarked(current)) // jump over a boundary face current = m.alpha1(current) ; if(current == start) current = NIL ; ... ... @@ -128,10 +132,183 @@ private: public: Traversor2VVaF(MAP& map, Dart dart) : m(map) { if(m.isBoundaryMarked(dart)) dart = m.alpha1(dart) ; start = m.phi1(m.phi1(dart)) ; if(start == dart) start = m.phi1(dart) ; stop = dart ; } Dart begin() { current = start ; return current ; } Dart end() { return NIL ; } Dart next() { if(current != NIL) { current = m.phi1(current) ; if(current == stop) { Dart d = m.alpha1(current) ; if(m.isBoundaryMarked(d)) // jump over a boundary face d = m.alpha1(d) ; current = m.phi1(m.phi1(d)) ; if(current == d) current = m.phi1(d) ; stop = d ; } if(current == start) current = NIL ; } return current ; } } ; /******************************************************************************* EDGE CENTERED TRAVERSALS *******************************************************************************/ // Traverse the vertices incident to a given edge template class Traversor2EV { private: MAP& m ; Dart start ; Dart current ; public: Traversor2EV(MAP& map, Dart dart) : m(map), start(dart) {} Dart begin() { current = start ; return current ; } Dart end() { return NIL ; } Dart next() { if(current != NIL) { current = m.phi2(current) ; if(current == start) current = NIL ; } return current ; } } ; // Traverse the faces incident to a given edge template class Traversor2EF { private: MAP& m ; Dart start ; Dart current ; public: Traversor2EF(MAP& map, Dart dart) : m(map), start(dart) {} Dart begin() { current = start ; return current ; } Dart end() { return NIL ; } Dart next() { if(current != NIL) { current = m.phi2(current) ; if(current == start || m.isBoundaryMarked(current)) // do not consider a boundary face current = NIL ; } return current ; } } ; // Traverse the edges adjacent to a given edge through sharing a common vertex template class Traversor2EEaV { private: MAP& m ; Dart start ; Dart current ; Dart stop1, stop2 ; public: Traversor2EEaV(MAP& map, Dart dart) : m(map) { start = m.alpha1(dart) ; stop1 = dart ; stop2 = m.phi2(dart) ; } Dart begin() { current = start ; return current ; } Dart end() { return NIL ; } Dart next() { if(current != NIL) { current = m.alpha1(current) ; if(current == stop1) current = m.alpha1(stop2) ; else if(current == stop2) current = NIL ; } return current ; } } ; // Traverse the edges adjacent to a given edge through sharing a common face template class Traversor2EEaF { private: MAP& m ; Dart start ; Dart current ; Dart stop1, stop2 ; public: Traversor2EEaF(MAP& map, Dart dart) : m(map) { start = m.phi1(dart) ; stop = m.phi_1(dart) ; stop1 = dart ; stop2 = m.phi2(dart) ; } Dart begin() { current = start ; return current ; } Dart end() { return NIL ; } Dart next() { if(current != NIL) { current = m.phi1(current) ; if(current == stop1) current = m.phi1(stop2) ; else if(current == stop2) current = NIL ; } return current ; } } ; /******************************************************************************* FACE CENTERED TRAVERSALS *******************************************************************************/ // Traverse the vertices incident to a given face template class Traversor2FV { private: MAP& m ; Dart start ; Dart current ; public: Traversor2FV(MAP& map, Dart dart) : m(map), start(dart) {} Dart begin() { current = start ; return current ; } Dart end() { return NIL ; } ... ... @@ -140,11 +317,85 @@ public: if(current != NIL) { current = m.phi1(current) ; if(current == start) current = NIL ; } return current ; } } ; // Traverse the edges incident to a given face template class Traversor2FE { private: MAP& m ; Dart start ; Dart current ; public: Traversor2FE(MAP& map, Dart dart) : m(map), start(dart) {} Dart begin() { current = start ; return current ; } Dart end() { return NIL ; } Dart next() { if(current != NIL) { current = m.phi1(current) ; if(current == start) current = NIL ; } return current ; } } ; // Traverse the faces adjacent to a given face through sharing a common vertex template class Traversor2FFaV { private: MAP& m ; Dart start ; Dart current ; Dart stop ; public: Traversor2FFaV(MAP& map, Dart dart) : m(map) { start = m.alpha1(m.alpha1(dart)) ; current = start ; if(start == dart) { stop = m.alpha1(dart) ; start = next() ; } stop = dart ; if(m.isBoundaryMarked(start)) start = next() ; } Dart begin() { current = start ; return current ; } Dart end() { return NIL ; } Dart next() { if(current != NIL) { current = m.alpha1(current) ; if(current == stop) { Dart d = m.phi2(current) ; current = m.phi1(d) ; stop = m.phi_1(d) ; Dart d = m.phi1(current) ; current = m.alpha1(m.alpha1(d)) ; if(current == d) { stop = m.alpha1(d) ; return next() ; } stop = d ; if(m.isBoundaryMarked(current)) return next() ; } if(current == start) current = NIL ; ... ... @@ -153,6 +404,44 @@ public: } } ; // Traverse the faces adjacent to a given face through sharing a common edge template class Traversor2FFaE { private: MAP& m ; Dart start ; Dart current ; public: Traversor2FFaE(MAP& map, Dart dart) : m(map) { start = m.phi2(dart) ; while(start != NIL && m.isBoundaryMarked(start)) { start = m.phi2(m.phi1(m.phi2(start))) ; if(start == m.phi2(dart)) start = NIL ; } } Dart begin() { current = start ; return current ; } Dart end() { return NIL ; } Dart next() { if(current != NIL) { do { current = m.phi2(m.phi1(m.phi2(current))) ; } while(m.isBoundaryMarked(current)) ; if(current == start) current = NIL ; } return current ; } } ; } // namespace CGoGN #endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!