Browse Source

yet another fix to boundary_loop

Former-commit-id: 4376cb1be4eeffee882e704b31b9dfba6f6565e7
Daniele Panozzo 10 years ago
parent
commit
848a36b998
1 changed files with 7 additions and 1 deletions
  1. 7 1
      include/igl/boundary_loop.cpp

+ 7 - 1
include/igl/boundary_loop.cpp

@@ -63,10 +63,16 @@ IGL_INLINE void igl::boundary_loop(
           if (F(fid,1) == v) vLoc = 1;
           if (F(fid,1) == v) vLoc = 1;
           if (F(fid,2) == v) vLoc = 2;
           if (F(fid,2) == v) vLoc = 2;
 
 
+          int vPrev = F(fid,(vLoc + F.cols()-1) % F.cols());
           int vNext = F(fid,(vLoc + 1) % F.cols());
           int vNext = F(fid,(vLoc + 1) % F.cols());
 
 
           newBndEdge = false;
           newBndEdge = false;
-          if (unvisited[vNext] && TT(fid,vLoc) < 0)
+          if (unvisited[vPrev] && TT(fid,(vLoc+2) % F.cols()) < 0)
+          {
+            next = vPrev;
+            newBndEdge = true;
+          }
+          else if (unvisited[vNext] && TT(fid,vLoc) < 0)
           {
           {
             next = vNext;
             next = vNext;
             newBndEdge = true;
             newBndEdge = true;