diff --git a/vcg/complex/local_optimization/tri_edge_flip.h b/vcg/complex/local_optimization/tri_edge_flip.h index 7770c217..cbde176b 100644 --- a/vcg/complex/local_optimization/tri_edge_flip.h +++ b/vcg/complex/local_optimization/tri_edge_flip.h @@ -564,6 +564,10 @@ public: do { // go to the first border (if there is one) pos.NextE(); } while(pos != startpos && !pos.IsBorder()); + + // if a border is reached, set startpos here + if(pos.IsBorder()) + startpos = pos; do { VertexPointer v = pos.VFlip(); @@ -580,6 +584,10 @@ public: do { // go to the first border (if there is one) pos.NextE(); } while(pos != startpos && !pos.IsBorder()); + + // if a border is reached, set startpos here + if(pos.IsBorder()) + startpos = pos; do { VertexPointer v = pos.VFlip();