Hi,

I'm importing a STEP model, generated using a C++ program using
OpenCASCADE, consisting of triangular NURBS patches.  Of course, these
are really rectangular but each has one degenerate edge.

I got a lot of errors "Something wrong with edge loop".  It turns out
that GEdgeLoop::GEdgeLoop(const std::list<GEdge*> &cwire) will often
miss the degenerate edge.  For example, if the edge list contains AB,
BC, CA, CC in that order, then the edge loop will close as AB+BC+CA and
CC will be skipped.  We would fall through to the end of nextOne(),
which should never happen.

Thus nextOne() should check for a degenerate edge and process it before
moving on (in the same way that it already checks for seams). I've
attached a patch which does this.


diff -u -r gmsh-2.3.1-cvs-20090220-old/Geo/GEdgeLoop.cpp gmsh-2.3.1-cvs-20090220/Geo/GEdgeLoop.cpp
--- gmsh-2.3.1-cvs-20090220-old/Geo/GEdgeLoop.cpp	2008-12-29 23:02:55.000000000 +0000
+++ gmsh-2.3.1-cvs-20090220/Geo/GEdgeLoop.cpp	2009-03-02 13:15:06.000000000 +0000
@@ -47,6 +47,24 @@
     if(v1 == gv || v2 == gv) possibleChoices.push_back(ge);
     ++it;
   }
+  // Degenerate edges: don't miss them
+  it = possibleChoices.begin();
+  ite = possibleChoices.end();
+  while(it != ite){
+    GEdge *ge = *it;
+    GVertex *v1 = ge->getBeginVertex();
+    GVertex *v2 = ge->getEndVertex();
+    if(v1 == v2){
+      wire.erase(std::remove_if(wire.begin(), wire.end(), 
+                                std::bind2nd(std::equal_to<GEdge*>(), ge)), 
+                 wire.end());
+      if(v1 == gv) return GEdgeSigned(1, ge);   
+      if(v2 == gv) return GEdgeSigned(-1, ge);   
+      Msg::Error("Something wrong in edge loop");
+    }
+    ++it;
+  }
+  // Repeated edges: don't miss them
   it = possibleChoices.begin();
   ite = possibleChoices.end();
   while(it != ite){
_______________________________________________
gmsh mailing list
[email protected]
http://www.geuz.org/mailman/listinfo/gmsh

Reply via email to