]> OCCT Git - occt.git/commitdiff
0032136: Modeling Algorithms - Boolean fuse fails and corrupts the argument-shape IR-2021-03-05
authoremv <emv@opencascade.com>
Thu, 4 Mar 2021 18:25:48 +0000 (21:25 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 5 Mar 2021 15:00:28 +0000 (18:00 +0300)
Avoid increasing tolerance of the vertex before the check on valid range is passed.

src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx
tests/bugs/modalg_7/bug32136 [new file with mode: 0644]
tests/evolved/voluved/HMC010

index 0756d6fa90fa12b3dca2ffc085a6f779e7996c27..1d22e9f9295253f6f8bd00f222ff815ae56d1040 100644 (file)
@@ -3035,28 +3035,29 @@ void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
     return;
   }
 
-  if (aDistVP > aTolV)
-  {
-    Standard_Integer nVn = UpdateVertex(nV, aDistVP + BOPTools_AlgoTools::DTolerance());
-    if (nVn != nV)
-    {
-      aPave.SetIndex(nVn);
-      nV = nVn;
-    }
-    aTolV = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV)));
-  }
-
   // Check if there will be valid range on the curve
   Standard_Real aFirst, aLast;
+  Standard_Real aNewTolV = Max(aTolV, aDistVP + BOPTools_AlgoTools::DTolerance());
   if (!BRepLib::FindValidRange(GeomAdaptor_Curve(aIC.Curve()), aIC.Tolerance(),
-                               aT[0], aP[0], aTolV,
-                               aT[1], aP[1], aTolV,
+                               aT[0], aP[0], aNewTolV,
+                               aT[1], aP[1], aNewTolV,
                                aFirst, aLast))
   {
     // No valid range
     return;
   }
 
+  if (aNewTolV > aTolV)
+  {
+    Standard_Integer nVn = UpdateVertex(nV, aNewTolV);
+    if (nVn != nV)
+    {
+      aPave.SetIndex(nVn);
+      nV = nVn;
+    }
+    aTolV = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV)));
+  }
+
   // Add closing pave to the curve
   BOPDS_Pave aNewPave;
   aNewPave.SetIndex(nV);
diff --git a/tests/bugs/modalg_7/bug32136 b/tests/bugs/modalg_7/bug32136
new file mode 100644 (file)
index 0000000..6b407fb
--- /dev/null
@@ -0,0 +1,34 @@
+puts "============================================================================================="
+puts "0032136: Modeling Algorithms - Boolean fuse fails and corrupts the argument-shape"
+puts "============================================================================================="
+puts ""
+
+restore [locate_data_file bug32136_obj.brep] s
+restore [locate_data_file bug32136_tools.brep] t
+
+bclearobjects
+bcleartools
+baddobjects s
+eval baddtools [explode t]
+bfillds
+bbop result 1
+
+checkshape result
+checknbshapes result -face 731 -shell 1 -solid 1 -t
+checkprops result -s 0.051066 -v 8.9084e-06
+
+foreach sh {result s} {
+  if {![regexp "This shape seems to be OK" [bopcheck $sh]]} {
+    puts "Error: the $sh shape is self-interfered"
+  }
+  checkmaxtol $sh -ref 5.e-6
+}
+
+foreach sh [explode t] {
+  if {![regexp "This shape seems to be OK" [bopcheck $sh]]} {
+    puts "Error: the $sh shape is self-interfered"
+  }
+  checkmaxtol $sh -ref 5.e-6
+}
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
index 017e1068fead52a1e5258acc673588fa253e7b8b..6ea24a3b5e4912f2375f6c05eb598b3b0f8ecf25 100644 (file)
@@ -18,7 +18,7 @@ if {[regexp "Faulties" [bopargcheck result]]} {
   puts "Error: bopargcheck has found some faulties in res2"
 }
 
-checkmaxtol result -ref 0.031968491076118669
+checkmaxtol result -ref 5.e-6
 
 smallview
 don result sw tw