]> OCCT Git - occt-copy.git/commitdiff
0026841: Boolean operation "bsection" produce invalid result on the attached cases
authornbv <nbv@opencascade.com>
Mon, 14 Dec 2015 14:14:52 +0000 (17:14 +0300)
committernbv <nbv@opencascade.com>
Mon, 14 Dec 2015 14:14:52 +0000 (17:14 +0300)
Porting the fix to OCCT 6.7.0

src/IntTools/IntTools_FaceFace.cxx
src/IntWalk/IntWalk_IWalking_1.gxx

index 9117d57f411fd3801236b45606d584f4eb17b0f9..e8cbbc33ea0a5bb2e589390dbb8434ad9384f3ef 100644 (file)
@@ -842,7 +842,11 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
   aType2=myHS2->Surface().GetType();
   //
   bCase1=((aType1==GeomAbs_Plane && aType2==GeomAbs_SurfaceOfExtrusion) ||
-         (aType2==GeomAbs_Plane && aType1==GeomAbs_SurfaceOfExtrusion));
+               (aType2==GeomAbs_Plane && aType1==GeomAbs_SurfaceOfExtrusion));
+
+  bCase1 = bCase1 || ((aType1==GeomAbs_Cylinder && aType2==GeomAbs_BSplineSurface) ||
+                           (aType2==GeomAbs_Cylinder && aType1==GeomAbs_BSplineSurface));
+
   //
   if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder) {
     if (aNbLin==2){ 
@@ -1220,9 +1224,9 @@ reapprox:;
     DumpWLine(aWLineX);
 #endif
     //
-    if(!myListOfPnts.IsEmpty()) {
-      bAvoidLineConstructor = Standard_True;
-    }
+    //if(!myListOfPnts.IsEmpty()) {
+    //  bAvoidLineConstructor = Standard_True;
+    //}
 
     Standard_Integer nbp = aWLine->NbPnts();
     const IntSurf_PntOn2S& p1 = aWLine->Point(1);
index 44959e2e87a98db4849d39d26b27aeb3b793727b..167c529ec203978f8ae28ca1254d9f66df612d96 100644 (file)
@@ -1638,14 +1638,14 @@ Standard_Boolean IntWalk_IWalking::
   if(aNbPoints >= theMinNbPoints)
     return Standard_True;
 
-  const Standard_Real aU1bFirst = theASurf1->FirstUParameter();
-  const Standard_Real aU1bLast = theASurf1->LastUParameter();
-  const Standard_Real aU2bFirst = theASurf2->FirstUParameter();
-  const Standard_Real aU2bLast = theASurf2->LastUParameter();
-  const Standard_Real aV1bFirst = theASurf1->FirstVParameter();
-  const Standard_Real aV1bLast = theASurf1->LastVParameter();
-  const Standard_Real aV2bFirst = theASurf2->FirstVParameter();
-  const Standard_Real aV2bLast = theASurf2->LastVParameter();
+  //const Standard_Real aU1bFirst = theASurf1->FirstUParameter();
+  //const Standard_Real aU1bLast = theASurf1->LastUParameter();
+  //const Standard_Real aU2bFirst = theASurf2->FirstUParameter();
+  //const Standard_Real aU2bLast = theASurf2->LastUParameter();
+  //const Standard_Real aV1bFirst = theASurf1->FirstVParameter();
+  //const Standard_Real aV1bLast = theASurf1->LastVParameter();
+  //const Standard_Real aV2bFirst = theASurf2->FirstVParameter();
+  //const Standard_Real aV2bLast = theASurf2->LastVParameter();
 
   Standard_Integer aLastPoint = theToPoint;
   
@@ -1667,28 +1667,28 @@ Standard_Boolean IntWalk_IWalking::
       line->Value(lp).Parameters(U1l, V1l, U2l, V2l);
 
       U1prec = 0.5*(U1f+U1l);
-      if(U1prec < aU1bFirst)
-        U1prec = aU1bFirst;
-      if(U1prec > aU1bLast)
-        U1prec = aU1bLast;
+      //if(U1prec < aU1bFirst)
+      //  U1prec = aU1bFirst;
+      //if(U1prec > aU1bLast)
+      //  U1prec = aU1bLast;
 
       V1prec = 0.5*(V1f+V1l);
-      if(V1prec < aV1bFirst)
-        V1prec = aV1bFirst;
-      if(V1prec > aV1bLast)
-        V1prec = aV1bLast;
+      //if(V1prec < aV1bFirst)
+      //  V1prec = aV1bFirst;
+      //if(V1prec > aV1bLast)
+      //  V1prec = aV1bLast;
 
       U2prec = 0.5*(U2f+U2l);
-      if(U2prec < aU2bFirst)
-        U2prec = aU2bFirst;
-      if(U2prec > aU2bLast)
-        U2prec = aU2bLast;
+      //if(U2prec < aU2bFirst)
+      //  U2prec = aU2bFirst;
+      //if(U2prec > aU2bLast)
+      //  U2prec = aU2bLast;
 
       V2prec = 0.5*(V2f+V2l);
-      if(V2prec < aV2bFirst)
-        V2prec = aV2bFirst;
-      if(V2prec > aV2bLast)
-        V2prec = aV2bLast;
+      //if(V2prec < aV2bFirst)
+      //  V2prec = aV2bFirst;
+      //if(V2prec > aV2bLast)
+      //  V2prec = aV2bLast;
 
       Standard_Boolean aStatus = Standard_False;
       Standard_Integer aNbIter = 5;
@@ -1725,6 +1725,17 @@ Standard_Boolean IntWalk_IWalking::
 
       if(aStatus)
       {
+        //const Standard_Real aU1Rf = !theASurf1->IsUPeriodic() ? aU1bFirst : Min(U1f, aU1bFirst);
+
+        const Standard_Real aU1bFirst = Min(U1f, U1l);
+        const Standard_Real aU1bLast = Max(U1f, U1l);
+        const Standard_Real aU2bFirst = Min(U2f, U2l);
+        const Standard_Real aU2bLast = Max(U2f, U2l);
+        const Standard_Real aV1bFirst = Min(V1f, V1l);
+        const Standard_Real aV1bLast = Max(V1f, V1l);
+        const Standard_Real aV2bFirst = Min(V2f, V2l);
+        const Standard_Real aV2bLast = Max(V2f, V2l);
+
         if(U1prec < aU1bFirst)
           U1prec = aU1bFirst;
         if(U1prec > aU1bLast)