]> OCCT Git - occt-copy.git/commitdiff
0027746: Incomplete result of SECTION operation CR27746_CR0_691_FixS
authoremv <emv@opencascade.com>
Wed, 3 Aug 2016 07:58:06 +0000 (10:58 +0300)
committeremv <emv@opencascade.com>
Wed, 3 Aug 2016 07:58:06 +0000 (10:58 +0300)
1. Partial porting of the fix for the issue #0026560:
Function to compute subshape max tolerance has been added.
Fixed bounding box expanding at Face/Face step of boolean operation.

2. New test cases are created.

src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx
src/BRep/BRep_Tool.cdl
src/BRep/BRep_Tool.cxx
tests/boolean/volumemaker/B7
tests/boolean/volumemaker/C4
tests/bugs/modalg_6/bug27746_1 [new file with mode: 0644]
tests/bugs/modalg_6/bug27746_2 [new file with mode: 0644]
tests/bugs/modalg_6/bug27746_3 [new file with mode: 0644]

index 317793d2ad2146514ad790284f01c12492445aea..09a51996ec5faef5189d7df24a4cf258c1fad249 100644 (file)
@@ -306,6 +306,17 @@ void BOPAlgo_PaveFiller::PerformFF()
       //
       // Curves, Points 
       aFF.Init(aNbCurves, aNbPoints);
+
+      // Fix bounding box expanding coefficient.
+      Standard_Real aBoxExpandValue = aTolR3D;
+      if (aNbCurves > 0)
+      {
+        // Modify geometric expanding coefficient by topology value,
+        // since this bounging box used in sharing (vertex or edge).
+        Standard_Real aMaxVertexTol = Max (BRep_Tool::MaxTolerance(aFaceFace.Face1(), TopAbs_VERTEX),
+                                           BRep_Tool::MaxTolerance(aFaceFace.Face2(), TopAbs_VERTEX));
+        aBoxExpandValue += aMaxVertexTol;
+      }
       //
       // Curves
       BOPDS_VectorOfCurve& aVNC=aFF.ChangeCurves();
@@ -314,7 +325,7 @@ void BOPAlgo_PaveFiller::PerformFF()
         //
         const IntTools_Curve& aIC=aCvsX(i);
         const Handle(Geom_Curve)& aC3D= aIC.Curve();
-        bValid=IntTools_Tools::CheckCurve(aC3D, aTolR3D, aBox);
+        bValid=IntTools_Tools::CheckCurve(aC3D, aBoxExpandValue, aBox);
         if (bValid) {
           BOPDS_Curve& aNC=aVNC.Append1();
           aNC.SetCurve(aIC);
index c81e737b8af61f228ab9d05454d437bd75e3234c..d64d78bc72b5881c9e08f55ff06587449c7a7e51 100644 (file)
@@ -32,6 +32,7 @@ uses
     Curve    from Geom,
     Surface  from Geom,
     Shape    from GeomAbs,
+    ShapeEnum from TopAbs,
     
     Triangulation          from Poly,
     Polygon3D              from Poly,
@@ -605,5 +606,14 @@ is
     raises
        NullObject from Standard;
 
+    MaxTolerance(myclass;
+                 theShape    : Shape from TopoDS;
+                 theSubShape : ShapeEnum from TopAbs)
+    returns Real from Standard;
+    ---Purpose:
+    -- Returns the maximum tolerance of input shape subshapes.
+    -- @param theShape    - Shape to search tolerance.
+    -- @param theSubShape - Search subshape, only Face, Edge or Vertex are supported.
+
 end Tool;
 
index b20853c158a7925f39b5d298518adb36f339e26e..a9341840a9328c48461b2deab0513c7f43f2efe3 100644 (file)
@@ -1530,3 +1530,41 @@ Standard_Boolean IsPlane(const Handle(Geom_Surface)& aS)
   return bRet;
 }
 
+//=======================================================================
+//function : MaxTolerance
+//purpose  : 
+//=======================================================================
+Standard_Real BRep_Tool::MaxTolerance (const TopoDS_Shape& theShape,
+                                       const TopAbs_ShapeEnum theSubShape)
+{
+  Standard_Real aTol = 0.0;
+
+  // Explorer Shape-Subshape.
+  TopExp_Explorer anExpSS(theShape, theSubShape);
+  if (theSubShape == TopAbs_FACE)
+  {
+    for( ; anExpSS.More() ;  anExpSS.Next() )
+    {
+      const TopoDS_Shape& aCurrentSubShape = anExpSS.Current();
+      aTol = Max(aTol, Tolerance(TopoDS::Face(aCurrentSubShape)));
+    }
+  }
+  else if (theSubShape == TopAbs_EDGE)
+  {
+    for( ; anExpSS.More() ;  anExpSS.Next() )
+    {
+      const TopoDS_Shape& aCurrentSubShape = anExpSS.Current();
+      aTol = Max(aTol, Tolerance(TopoDS::Edge(aCurrentSubShape)));
+    }
+  }
+  else if (theSubShape == TopAbs_VERTEX)
+  {
+    for( ; anExpSS.More() ;  anExpSS.Next() )
+    {
+      const TopoDS_Shape& aCurrentSubShape = anExpSS.Current();
+      aTol = Max(aTol, Tolerance(TopoDS::Vertex(aCurrentSubShape)));
+    }
+  }
+
+  return aTol;
+}
index a6e96335410d3dd7a81ae46c29bb63f36f364eba..4f8d70b3e48b1e077f15dbbcfbe2adc5690de365 100644 (file)
@@ -1,7 +1,9 @@
 # test script on make volume operation
 # plane
 
+puts "TODO OCC26560 ALL: Faulty shapes in variables faulty_1 to faulty_"
 puts "TODO OCC26020 ALL: Error: bopcheck failed"
+puts "TODO OCC26560 ALL: Error : The area of the resulting shape is"
 
 # planar face 
 plane pln_f1 18.855982726712998 17.500000000800412 0 -0.96152394764524818 -0.27472112788189063 0
index 35302436f31d7019bf596ff72fdf8521bfd24f46..bcdf92574aeaa0eef9c4a862e57997adb7e79ce2 100644 (file)
@@ -1,6 +1,9 @@
 # test script on make volume operation
 # cylinder plane
 
+puts "TODO OCC26737 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC26737 ALL: Error: bopcheck failed"
+
 # planar face 
 plane pln_f1 0 515 1.1102230246251565e-015 0 -1 -1.1102230246251565e-016
 erase pln_f1
diff --git a/tests/bugs/modalg_6/bug27746_1 b/tests/bugs/modalg_6/bug27746_1
new file mode 100644 (file)
index 0000000..55d16ed
--- /dev/null
@@ -0,0 +1,25 @@
+puts "========"
+puts "OCC27746"
+puts "========"
+puts ""
+#################################################
+# Incomplete result of SECTION operation
+#################################################
+
+restore [locate_data_file bug27746_first.brep] b1
+restore [locate_data_file bug27746_second.brep] b2
+
+settolerance b2 1.e-7
+fixshape b2 b2
+
+bclearobjects
+bcleartools
+baddobjects b1
+baddtools b2
+bfillds
+bbop result 4
+
+regexp {nb alone Vertices : ([-0-9.+eE]+)} [checksection result] full nbv
+if { $nbv > 4 } { puts "Error : Section is incorrect" }
+
+set length 88.2082
\ No newline at end of file
diff --git a/tests/bugs/modalg_6/bug27746_2 b/tests/bugs/modalg_6/bug27746_2
new file mode 100644 (file)
index 0000000..e04bb09
--- /dev/null
@@ -0,0 +1,26 @@
+puts "========"
+puts "OCC27746"
+puts "========"
+puts ""
+#################################################
+# Incomplete result of SECTION operation
+#################################################
+
+restore [locate_data_file bug27746_first.brep] b1
+restore [locate_data_file bug27746_second.brep] b2
+
+explode b1 f; compound b1_60 b1_61 b1
+explode b2 f; compound b2_14 b2_18 b2
+donly b1 b2
+
+bclearobjects
+bcleartools
+baddobjects b1
+baddtools b2
+bfillds
+bbop result 4
+
+regexp {nb alone Vertices : ([-0-9.+eE]+)} [checksection result] full nbv
+if { $nbv != 2 } { puts "Error : Section is incorrect" }
+
+set length 4.39869
\ No newline at end of file
diff --git a/tests/bugs/modalg_6/bug27746_3 b/tests/bugs/modalg_6/bug27746_3
new file mode 100644 (file)
index 0000000..885d6ef
--- /dev/null
@@ -0,0 +1,26 @@
+puts "========"
+puts "OCC27746"
+puts "========"
+puts ""
+#################################################
+# Incomplete result of SECTION operation
+#################################################
+
+restore [locate_data_file bug27746_first.brep] b1
+restore [locate_data_file bug27746_second.brep] b2
+
+explode b1 f; compound b1_60 b1_61 b1
+explode b2 f; compound b2_21 b2_37 b2
+donly b1 b2
+
+bclearobjects
+bcleartools
+baddobjects b1
+baddtools b2
+bfillds
+bbop result 4
+
+regexp {nb alone Vertices : ([-0-9.+eE]+)} [checksection result] full nbv
+if { $nbv != 2 } { puts "Error : Section is incorrect" }
+
+set length 4.39869
\ No newline at end of file