]> OCCT Git - occt-copy.git/commitdiff
0028675: Invalid result of Boolean Cut operation when running with fuzzy value
authoremv <emv@opencascade.com>
Mon, 24 Apr 2017 06:04:42 +0000 (09:04 +0300)
committeremv <emv@opencascade.com>
Fri, 7 Jul 2017 07:03:45 +0000 (10:03 +0300)
Avoid small edges with empty list of PaveBlocks (removed edges) in the result (BOPAlgo_Builder::FillImagesEdges()).

src/BOPAlgo/BOPAlgo_Builder_1.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx
tests/bugs/modalg_2/bug497_3
tests/bugs/modalg_6/bug26954_3
tests/bugs/modalg_6/bug28675_1 [new file with mode: 0644]
tests/bugs/modalg_6/bug28675_2 [new file with mode: 0644]

index b710e618dc5eeba35b3cd7332f37eaace7a2d32b..99ddca309fd232c22ade62c0308d17ea3de12cd5 100644 (file)
 {
   myErrorStatus=0;
   //
-  Standard_Integer i, aNbPBP, nE, nSp, nSpR;
-  BOPDS_ListIteratorOfListOfPaveBlock aItPB;
-  //
-  const BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->PaveBlocksPool();
-  aNbPBP=aPBP.Extent();
-  for (i=0; i<aNbPBP; ++i) {
-    const BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
-    if (aLPB.Extent()) {
-      BOPCol_ListOfShape aLS(myAllocator);
+  Standard_Integer i, aNbS = myDS->NbSourceShapes();
+  for (i = 0; i < aNbS; ++i) {
+    const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
+    if (aSI.ShapeType() != TopAbs_EDGE) {
+      continue;
+    }
+    //
+    // Check if the pave blocks for the edge have been initialized
+    if (!aSI.HasReference()) {
+      continue;
+    }
+    //
+    const TopoDS_Shape& aE = aSI.Shape();
+    const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(i);
+    //
+    // Fill the images of the edge from the list of its pave blocks.
+    // The small edges, having no pave blocks, will have the empty list
+    // of images and, thus, will be avoided in the result.
+    BOPCol_ListOfShape *pLS = myImages.Bound(aE, BOPCol_ListOfShape());
+    //
+    BOPDS_ListIteratorOfListOfPaveBlock aItPB(aLPB);
+    for (; aItPB.More(); aItPB.Next()) {
+      const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
+      Handle(BOPDS_PaveBlock) aPBR = myDS->RealPaveBlock(aPB);
       //
-      const Handle(BOPDS_PaveBlock)& aPB1=aLPB.First();
-      nE=aPB1->OriginalEdge();
-      const TopoDS_Shape& aE=myDS->Shape(nE);
+      Standard_Integer nSpR = aPBR->Edge();
+      const TopoDS_Shape& aSpR = myDS->Shape(nSpR);
+      pLS->Append(aSpR);
+      myOrigins.Bind(aSpR, aE);
       //
-      aItPB.Initialize(aLPB);
-      for (; aItPB.More(); aItPB.Next()) {
-        const Handle(BOPDS_PaveBlock)& aPB=aItPB.Value();
-        Handle(BOPDS_PaveBlock) aPBR=myDS->RealPaveBlock(aPB);
-        //
-        nSpR=aPBR->Edge();
-        const TopoDS_Shape& aSpR=myDS->Shape(nSpR);
-        aLS.Append(aSpR);
-        myOrigins.Bind(aSpR, aE);
-        //
-        if (myDS->IsCommonBlockOnEdge(aPB)) {
-          nSp=aPB->Edge();
-          const TopoDS_Shape& aSp=myDS->Shape(nSp);
-          myShapesSD.Bind(aSp, aSpR);
-        }
+      if (myDS->IsCommonBlockOnEdge(aPB)) {
+        Standard_Integer nSp = aPB->Edge();
+        const TopoDS_Shape& aSp = myDS->Shape(nSp);
+        myShapesSD.Bind(aSp, aSpR);
       }
-      myImages.Bind(aE, aLS);
     }
   }
 }
index 4aeb55ab3ee6ccded080831f4ae78739c1cd34b6..9970247b081bc9281716a47834d1dfac6c7a2d34 100644 (file)
@@ -359,12 +359,19 @@ void BOPAlgo_PaveFiller::PerformEE()
       continue;
     }
     //
+    BOPDS_ListOfPaveBlock& aLPB1 = myDS->ChangePaveBlocks(nE1);
+    if (aLPB1.IsEmpty()) {
+      continue;
+    }
+    //
+    BOPDS_ListOfPaveBlock& aLPB2 = myDS->ChangePaveBlocks(nE2);
+    if (aLPB2.IsEmpty()) {
+      continue;
+    }
+    //
     const TopoDS_Edge& aE1=(*(TopoDS_Edge *)(&aSIE1.Shape()));
     const TopoDS_Edge& aE2=(*(TopoDS_Edge *)(&aSIE2.Shape()));
     //
-    BOPDS_ListOfPaveBlock& aLPB1=myDS->ChangePaveBlocks(nE1);
-    BOPDS_ListOfPaveBlock& aLPB2=myDS->ChangePaveBlocks(nE2);
-    //
     aIt1.Initialize(aLPB1);
     for (; aIt1.More(); aIt1.Next()) {
       Bnd_Box aBB1;
index 4b5bc902035aa1a9d7f41a96c3ae8f8e5c7f4dcb..f36d9096a11446255168212e13b1c17b61e54c02 100755 (executable)
@@ -1,6 +1,3 @@
-puts "TODO OCC25735 ALL: Faulty shapes in variables faulty_1 to"
-puts "TODO OCC26582 ALL: Error : The area of result shape is"
-
 puts "========="
 puts " OCC497 "
 puts "(case 3)"
@@ -15,9 +12,12 @@ checkshape a_1
 
 restore [locate_data_file OCC497f.brep] a_2
 checkshape a_2
+breducetolerance a_2
 
 bcut result a_1 a_2
 
-checkprops result -s 2471.48 
+checkprops result -s 2392.19 -v 7520.02
+checknbshapes result -shell 1 -solid 1
 checkshape result
 checkview -display result -2d -path ${imagedir}/${test_image}.png
+
index 8ebde566a7769e495b5b3a4a2e3c95a76a347901..d99a3f25f31e78971adccf6b52a22e13ea39e26d 100644 (file)
@@ -17,6 +17,6 @@ baddtools b2
 bfillds
 bbop result 0
 
-checkprops result -s 40.7799
+checkprops result -s 42.1078
 
 checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_6/bug28675_1 b/tests/bugs/modalg_6/bug28675_1
new file mode 100644 (file)
index 0000000..e56fa96
--- /dev/null
@@ -0,0 +1,27 @@
+puts "========"
+puts "OCC28675"
+puts "========"
+puts ""
+####################################################################
+# Invalid result of Boolean Cut operation when running with fuzzy value
+####################################################################
+
+restore [locate_data_file bug28675_shapes.brep] b
+explode b
+bfuzzyvalue 1.e-5
+bclearobjects
+bcleartools
+baddobjects b_1
+baddtools b_2
+bfillds
+bbop result 2
+
+checkshape result
+if {[regexp "Faulties" [bopargcheck result]]} {
+  puts "Error: the result of Cut operation is invalid"
+}
+
+checkprops result -s 63598.7 -v 246258
+checknbshapes result -edge 12 -face 6 -shell 1 -solid 1
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_6/bug28675_2 b/tests/bugs/modalg_6/bug28675_2
new file mode 100644 (file)
index 0000000..b1b88e2
--- /dev/null
@@ -0,0 +1,26 @@
+puts "========"
+puts "OCC28675"
+puts "========"
+puts ""
+####################################################################
+# Invalid result of Boolean Cut operation when running with fuzzy value
+####################################################################
+
+restore [locate_data_file bug28675_shapes.brep] b
+explode b
+bclearobjects
+bcleartools
+baddobjects b_1
+baddtools b_2
+bfillds
+bbop result 2
+
+checkshape result
+if {[regexp "Faulties" [bopargcheck result]]} {
+  puts "Error: the result of Cut operation is invalid"
+}
+
+checkprops result -s 63598.7 -v 246258
+checknbshapes result -edge 12 -face 6 -shell 1 -solid 1
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png