0031023: Fillet regression in OCCT 7.4 from 7.3
authorjgv <jgv@opencascade.com>
Fri, 20 Sep 2019 10:52:10 +0000 (13:52 +0300)
committerapn <apn@opencascade.com>
Tue, 22 Oct 2019 12:15:50 +0000 (15:15 +0300)
Modify local static function ReorderFaces to be able to process multiple-faces-connecting vertices.

src/ChFi3d/ChFi3d_Builder_1.cxx
tests/bugs/modalg_7/bug31023 [new file with mode: 0644]

index 45c19ee..a1b00c5 100644 (file)
@@ -89,7 +89,8 @@ static void ReorderFaces(TopoDS_Face&         theF1,
                          TopoDS_Face&         theF2,
                          const TopoDS_Face&   theFirstFace,
                          const TopoDS_Edge&   thePrevEdge,
-                         const TopoDS_Vertex& theCommonVertex)
+                         const TopoDS_Vertex& theCommonVertex,
+                         const ChFiDS_Map&    theEFmap)
 {
   if (theF1.IsSame(theFirstFace))
     return;
@@ -99,25 +100,42 @@ static void ReorderFaces(TopoDS_Face&         theF1,
     return;
   }
 
-  TopTools_IndexedDataMapOfShapeListOfShape VEmapFirst, VEmap;
-  TopExp::MapShapesAndAncestors(theFirstFace, TopAbs_VERTEX, TopAbs_EDGE, VEmapFirst);
-  TopExp::MapShapesAndAncestors(theF1, TopAbs_VERTEX, TopAbs_EDGE, VEmap);
-
-  const TopTools_ListOfShape& ElistFirst = VEmapFirst.FindFromKey(theCommonVertex);
-  const TopTools_ListOfShape& Elist      = VEmap.FindFromKey(theCommonVertex);
-  TopTools_ListIteratorOfListOfShape itlfirst(ElistFirst);
-  for (; itlfirst.More(); itlfirst.Next())
+  //Loop until find <theF1> or <theF2>
+  Standard_Boolean ToExchange = Standard_False;
+  TopoDS_Edge PrevEdge = thePrevEdge, CurEdge;
+  TopoDS_Face PrevFace = theFirstFace, CurFace;
+  for (;;)
   {
-    const TopoDS_Shape& anEdge = itlfirst.Value();
-    if (anEdge.IsSame(thePrevEdge))
-      continue;
-    TopTools_ListIteratorOfListOfShape itl(Elist);
-    for(; itl.More(); itl.Next())
-      if (anEdge.IsSame(itl.Value()))
-        return;
+    TopTools_IndexedDataMapOfShapeListOfShape VEmap;
+    TopExp::MapShapesAndAncestors(PrevFace, TopAbs_VERTEX, TopAbs_EDGE, VEmap);
+    const TopTools_ListOfShape& Elist = VEmap.FindFromKey(theCommonVertex);
+    if (PrevEdge.IsSame(Elist.First()))
+      CurEdge = TopoDS::Edge(Elist.Last());
+    else
+      CurEdge = TopoDS::Edge(Elist.First());
+
+    const TopTools_ListOfShape& Flist = theEFmap.FindFromKey(CurEdge);
+    if (PrevFace.IsSame(Flist.First()))
+      CurFace = TopoDS::Face(Flist.Last());
+    else
+      CurFace = TopoDS::Face(Flist.First());
+
+    if (CurFace.IsSame(theF1))
+      break;
+    else if (CurFace.IsSame(theF2))
+    {
+      ToExchange = Standard_True;
+      break;
+    }
+
+    PrevEdge = CurEdge;
+    PrevFace = CurFace;
   }
 
-  TopoDS_Face TmpFace = theF1; theF1 = theF2; theF2 = TmpFace;
+  if (ToExchange)
+  {
+    TopoDS_Face TmpFace = theF1; theF1 = theF2; theF2 = TmpFace;
+  }
 }
 
 static void ConcatCurves(TColGeom_SequenceOfCurve& theCurves,
@@ -944,7 +962,7 @@ Standard_Boolean ChFi3d_Builder::PerformElement(const Handle(ChFiDS_Spine)& Spin
            Spine->SetEdges(Ec);
             TopoDS_Face CurF1, CurF2;
             ChFi3d_conexfaces(Ec,CurF1,CurF2,myEFMap);
-            ReorderFaces(CurF1, CurF2, FirstFace, PrevEdge, CommonVertex);
+            ReorderFaces(CurF1, CurF2, FirstFace, PrevEdge, CommonVertex, myEFMap);
             myEdgeFirstFace.Bind(Ec, CurF1);
             if (Offset > 0)
             {
@@ -1030,7 +1048,7 @@ Standard_Boolean ChFi3d_Builder::PerformElement(const Handle(ChFiDS_Spine)& Spin
              Spine->PutInFirst(Ec);
               TopoDS_Face CurF1, CurF2;
               ChFi3d_conexfaces(Ec,CurF1,CurF2,myEFMap);
-              ReorderFaces(CurF1, CurF2, FirstFace, PrevEdge, CommonVertex);
+              ReorderFaces(CurF1, CurF2, FirstFace, PrevEdge, CommonVertex, myEFMap);
               myEdgeFirstFace.Bind(Ec, CurF1);
               if (Offset > 0)
               {
diff --git a/tests/bugs/modalg_7/bug31023 b/tests/bugs/modalg_7/bug31023
new file mode 100644 (file)
index 0000000..d03a6f3
--- /dev/null
@@ -0,0 +1,22 @@
+puts "=================================================================="
+puts "OCC31023: Fillet regression in OCCT 7.4 from 7.3"
+puts "=================================================================="
+puts ""
+
+brestore [locate_data_file bug31023.brep] a
+
+explode a e
+
+blend result a 0.1 a_25 0.1 a_26
+
+checkshape result
+
+checknbshapes result -face 26 -wire 26 -edge 60 -vertex 34
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 27.1174