0024053: Section between plane and sphere is not correct
authoremv <emv@opencascade.com>
Thu, 4 Jul 2013 10:26:05 +0000 (14:26 +0400)
committeremv <emv@opencascade.com>
Thu, 4 Jul 2013 10:26:05 +0000 (14:26 +0400)
Small correction in splitting into intervals.
Adding test case for this fix

src/IntTools/IntTools_FaceFace.cxx
tests/bugs/modalg_5/bug24053 [new file with mode: 0755]

index 2ef5436..e546edd 100755 (executable)
@@ -983,9 +983,9 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
     }
   }//if((aType1==GeomAbs_SurfaceOfRevolution ...
   else if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Sphere) ||
-          (aType2==GeomAbs_Plane && aType1==GeomAbs_Sphere)) {
+           (aType2==GeomAbs_Plane && aType1==GeomAbs_Sphere)) {
     Standard_Integer i, j, aNbP;
-    Standard_Real aT, aT1, aT2, dT, aD2max, aD2, aEps, aT11, aT12;
+    Standard_Real aT1, aT2, dT, aD2max, aD2, aEps, aT11, aT12;
     //
     aNbLin=mySeqOfCurve.Length();
     aD2max=0.;
@@ -998,38 +998,37 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
       const Handle(Geom2d_Curve)& aC2D2=aIC.SecondCurve2d();
       //
       const Handle(Geom2d_BSplineCurve)& aBC2D1=
-       Handle(Geom2d_BSplineCurve)::DownCast(aC2D1);
+        Handle(Geom2d_BSplineCurve)::DownCast(aC2D1);
       const Handle(Geom2d_BSplineCurve)& aBC2D2=
-       Handle(Geom2d_BSplineCurve)::DownCast(aC2D2);
+        Handle(Geom2d_BSplineCurve)::DownCast(aC2D2);
       //
       if (aBC2D1.IsNull() && aBC2D2.IsNull()) {
-       return;
+        return;
       }
       //
       if (!aBC2D1.IsNull()) {
-       aT1=aBC2D1->FirstParameter();
-       aT2=aBC2D1->LastParameter();
+        aT1=aBC2D1->FirstParameter();
+        aT2=aBC2D1->LastParameter();
       }
       else {
-       aT1=aBC2D2->FirstParameter();
-       aT2=aBC2D2->LastParameter();
+        aT1=aBC2D2->FirstParameter();
+        aT2=aBC2D2->LastParameter();
       }
       //
       aEps=0.01*(aT2-aT1);
-      dT=(aT2-aT1)/(aNbP-1);
+      dT=(aT2-aT1)/aNbP;
       for (j=0; j<aNbP; ++j) {
-       aT=aT1+j*dT;
-       aT11=aT1+j*dT;
-       aT12=aT11+dT;
-       if (j==aNbP-1) {
-         aT12=aT2;
-       }
-       //
-       aD2=FindMaxSquareDistance(aT11, aT12, aEps, aC3D, aC2D1, aC2D2,
-                                 myHS1, myHS2, myFace1, myFace2, myContext);
-       if (aD2>aD2max) {
-         aD2max=aD2;
-       }
+        aT11=aT1+j*dT;
+        aT12=aT11+dT;
+        if (j==aNbP-1) {
+          aT12=aT2;
+        }
+        //
+        aD2=FindMaxSquareDistance(aT11, aT12, aEps, aC3D, aC2D1, aC2D2,
+                                  myHS1, myHS2, myFace1, myFace2, myContext);
+        if (aD2>aD2max) {
+          aD2max=aD2;
+        }
       }//for (j=0; j<aNbP; ++j) {
      
     }//for (i=1; i<=aNbLin; ++i) {
diff --git a/tests/bugs/modalg_5/bug24053 b/tests/bugs/modalg_5/bug24053
new file mode 100755 (executable)
index 0000000..46aeee1
--- /dev/null
@@ -0,0 +1,27 @@
+puts "============"
+puts "CR24053"
+puts "============"
+puts ""
+#######################################################################
+# Section between plane and sphere is not correct
+#######################################################################
+
+restore [locate_data_file bug24053_sphere.brep] b1
+restore [locate_data_file bug24053_plane.brep] b2
+
+bop b1 b2
+bopsection result
+
+set nb_v_good 3
+set nb_e_good 2
+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 6
+
+set length 17.2391
+
+set 2dviewer 1