0024040: The result of CUT operation is not correct
authoremv <emv@opencascade.com>
Thu, 4 Jul 2013 10:19:17 +0000 (14:19 +0400)
committeremv <emv@opencascade.com>
Thu, 4 Jul 2013 10:19:17 +0000 (14:19 +0400)
Changed the way of getting point inside face for detecting same domain faces.
Adding test case for this fix

src/BOPTools/BOPTools_AlgoTools.cxx
tests/bugs/modalg_5/bug24040 [new file with mode: 0755]

index 6ac8976..893c57d 100644 (file)
@@ -840,7 +840,7 @@ static
                                                           Handle(BOPInt_Context)& theContext)
 {
   Standard_Boolean bFlag;
                                                           Handle(BOPInt_Context)& theContext)
 {
   Standard_Boolean bFlag;
-  Standard_Integer iP;
+  Standard_Integer iErr;
   Standard_Real aTolF1, aTolF2, aTol;
   gp_Pnt2d aP2D;
   gp_Pnt aP;
   Standard_Real aTolF1, aTolF2, aTol;
   gp_Pnt2d aP2D;
   gp_Pnt aP;
@@ -857,27 +857,22 @@ static
   //
   aTolF1=BRep_Tool::Tolerance(aF1);
   // 1
   //
   aTolF1=BRep_Tool::Tolerance(aF1);
   // 1
-  iP=0;
   aExp.Init(aF1, TopAbs_EDGE);
   for (; aExp.More(); aExp.Next()) {
     aE1=(*(TopoDS_Edge*)(&aExp.Current()));
     if (!BRep_Tool::Degenerated(aE1)) {
   aExp.Init(aF1, TopAbs_EDGE);
   for (; aExp.More(); aExp.Next()) {
     aE1=(*(TopoDS_Edge*)(&aExp.Current()));
     if (!BRep_Tool::Degenerated(aE1)) {
-      iP=1;
-      //break;
       Standard_Real aTolE = BRep_Tool::Tolerance(aE1);
       aTolF1 = (aTolE > aTolF1) ? aTolE : aTolF1;
     }
   }
       Standard_Real aTolE = BRep_Tool::Tolerance(aE1);
       aTolF1 = (aTolE > aTolF1) ? aTolE : aTolF1;
     }
   }
-  if (!iP) {
-    return bFlag;
-  }
-  //
   // 2
   aTolF2=BRep_Tool::Tolerance(aF2);
   aTol=aTolF1+aTolF2;
   //
   // 2
   aTolF2=BRep_Tool::Tolerance(aF2);
   aTol=aTolF1+aTolF2;
   //
-  BOPTools_AlgoTools3D::PointNearEdge(aE1, aF1, aP2D, aP, theContext);
-  bFlag=theContext->IsValidPointForFace(aP, aF2, aTol);
+  iErr = BOPTools_AlgoTools3D::PointInFace(aF1, aP, aP2D, theContext);
+  if (!iErr) {
+    bFlag=theContext->IsValidPointForFace(aP, aF2, aTol);
+  }
   //
   return bFlag;
 }
   //
   return bFlag;
 }
diff --git a/tests/bugs/modalg_5/bug24040 b/tests/bugs/modalg_5/bug24040
new file mode 100755 (executable)
index 0000000..8a9cd38
--- /dev/null
@@ -0,0 +1,25 @@
+puts "================"
+puts "OCC24040"
+puts "================"
+puts ""
+#######################################################################
+# The result of CUT operation is not correct
+#######################################################################
+
+restore [locate_data_file bug24040_b1.brep] b1
+restore [locate_data_file bug24040_b2.brep] b2
+
+bop b1 b2
+bopcut result
+
+#the result should be empty compound
+# Analysis of "nbshapes res"
+set nb_v_good 0
+set nb_e_good 0
+set nb_w_good 0
+set nb_f_good 0
+set nb_sh_good 0
+set nb_sol_good 0
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 1