]> OCCT Git - occt-copy.git/commitdiff
0030422: Random behaviour of BRepAdaptor_CompCurve CR30422
authorifv <igor.feoktistov@opencascade.com>
Thu, 19 Aug 2021 12:05:53 +0000 (15:05 +0300)
committerifv <igor.feoktistov@opencascade.com>
Thu, 19 Aug 2021 12:05:53 +0000 (15:05 +0300)
BRepTools/BRepTools_WireExplorer.cxx - replace MapOfShape vmap by IndexedMapOfShape
to avoid random behavior of algorithm

src/BRepTools/BRepTools_WireExplorer.cxx

index 4a71206512ed54556dd3a6a5d717155abd724b4a..ca2c028916af72254e4ff9b405dccca859b73216 100644 (file)
@@ -226,7 +226,8 @@ void  BRepTools_WireExplorer::Init(const TopoDS_Wire& W,
   }
 
   // map of vertices to know if the wire is open
-  TopTools_MapOfShape vmap;
+  //TopTools_MapOfShape vmap;
+  TopTools_IndexedMapOfShape vmap;
   //  map of infinite edges
   TopTools_MapOfShape anInfEmap;
 
@@ -255,14 +256,16 @@ void  BRepTools_WireExplorer::Init(const TopoDS_Wire& W,
       // add or remove in the vertex map
       V1.Orientation(TopAbs_FORWARD);
       if (!vmap.Add(V1))
-        vmap.Remove(V1);
+        //vmap.Remove(V1);
+      vmap.RemoveKey(V1);
     }
 
     if (!V2.IsNull())
     {
       V2.Orientation(TopAbs_REVERSED);
       if (!vmap.Add(V2))
-        vmap.Remove(V2);
+        //vmap.Remove(V2);
+      vmap.RemoveKey(V2);
     }
 
     if (V1.IsNull() || V2.IsNull())
@@ -294,13 +297,24 @@ void  BRepTools_WireExplorer::Init(const TopoDS_Wire& W,
   }
 
   // if vmap is not empty the wire is open, let us find the first vertex
+  V1.Nullify();
+  V2.Nullify();
   if (!vmap.IsEmpty()) {
-    TopTools_MapIteratorOfMapOfShape itt(vmap);
-    while (itt.Key().Orientation() != TopAbs_FORWARD) {
-      itt.Next();
-      if (!itt.More()) break;
+    //TopTools_MapIteratorOfMapOfShape itt(vmap);
+    //while (itt.Key().Orientation() != TopAbs_FORWARD) {
+    //  itt.Next();
+    //  if (!itt.More()) break;
+    //}
+    //if (itt.More()) V1 = TopoDS::Vertex(itt.Key());
+    Standard_Integer ind = 0;
+    for (ind = 1; ind <= vmap.Extent(); ++ind)
+    {
+      if (vmap(ind).Orientation() == TopAbs_FORWARD)
+      {
+        V1 = TopoDS::Vertex(vmap(ind));
+        break;
+      }
     }
-    if (itt.More()) V1 = TopoDS::Vertex(itt.Key());
   }
   else {
     //   The wire is infinite Try to find the first vertex. It may be NULL.