]> OCCT Git - occt-copy.git/commitdiff
0021762: Integration of new Boolean Operation algorithm to OCCT.
authoremv <emv@opencascade.com>
Tue, 30 Oct 2012 06:06:14 +0000 (10:06 +0400)
committeremv <emv@opencascade.com>
Wed, 12 Dec 2012 11:51:13 +0000 (15:51 +0400)
Modifications:
1. Corrections in post treatment of section edges;
2. Corrections in the accordance with the bug 0023293;
3. Small corrections in the bopcheck and bopargcheck commands.

src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx
src/BOPAlgo/BOPAlgo_PaveFiller.cdl
src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx
src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx
src/BOPTest/BOPTest_CheckCommands.cxx
src/BOPTools/BOPTools_AlgoTools.cxx
src/BOPTools/BOPTools_AlgoTools2D.cdl
src/BOPTools/BOPTools_AlgoTools2D.cxx
src/BOPTools/BOPTools_AlgoTools3D.cxx

index a9e98a7341229f61043ff07dff65d58a9b51822e..bb20c714676c7413af644744067f5549a34ee90d 100644 (file)
@@ -318,7 +318,6 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
     BOPAlgo_CheckerSI aChecker;
     BOPCol_ListOfShape anArgs;
     anArgs.Append(aS);
-    anArgs.Append(aS);
     aChecker.SetArguments(anArgs);
     //
     aChecker.Perform();
index 5039f753e3e98b130c26fe83deb71e5bc6054144..39c5441bbbea93f01a3f0d96ff059a269ff901c7 100644 (file)
@@ -182,7 +182,8 @@ is
         theTolR3D:Real from Standard; 
         theNC:out Curve from BOPDS; 
         nF1:Integer from Standard; 
-        nF2:Integer from Standard) 
+        nF2:Integer from Standard; 
+        aMVB:out MapOfInteger from BOPCol) 
       is protected;  
 
     ExtendedTolerance(me:out; 
index 7cce7405ea894ac57038b54920c362622a5e6d8f..ca4791a40e7aa34f50e665dbf47973a743748a93 100644 (file)
     //
     aTolE=BRep_Tool::Tolerance(aE);
     aTolF=BRep_Tool::Tolerance(aF);
-    //modified by NIZHNY-EMV Fri Oct 21 14:38:48 2011
-    if (aTolE < 1.e-5) {
-      BRepAdaptor_Curve aBAC(aE);
-      if (aBAC.GetType() == GeomAbs_BSplineCurve) {
-        aTolE = 1.e-5;
-      }
-    }
-    //modified by NIZHNY-EMV Fri Oct 21 14:38:50 2011
     //
     BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE);
     aIt.Initialize(aLPB);
index 017e7af1386628d624e74c563b1aaaf9558e2679..7b9567ddc43ce2945dca96f02cc5b71f40a0ee88 100644 (file)
@@ -339,7 +339,7 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
       aNC.InitPaveBlock1();
       //
       //modified by NIZHNY-EMV Tue Sep 27 09:10:52 2011
-      PutPaveOnCurve(aMVOnIn, aTolR3D, aNC, nF1, nF2);
+      PutPaveOnCurve(aMVOnIn, aTolR3D, aNC, nF1, nF2, aMVB);
       //modified by NIZHNY-EMV Fri Feb 18 16:42:19 2011
       ProcessUnUsedVertices(nF1, nF2, aNC, aMVStick);
       //pkv/904/F7
@@ -375,15 +375,6 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
       //
       aLPB.Clear();
       aPB1->Update(aLPB, Standard_False);
-      //modified by NIZHNY-EMV Tue Oct 25 11:11:23 2011
-      Standard_Real aCurveTol;
-      aCurveTol = aTolR3D;
-      if (aCurveTol < 1.e-5) {
-        if (aIC.Type() == GeomAbs_BSplineCurve) {
-          aCurveTol = 1.e-5;
-        }
-      }
-      //modified by NIZHNY-EMV Tue Oct 25 11:11:25 2011
       //
       aItLPB.Initialize(aLPB);
       for (; aItLPB.More(); aItLPB.Next()) {
@@ -395,14 +386,15 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
           continue;
         }
         //modified by NIZHNY-EMV Mon Apr 09 11:36:31 2012
-        bExist=IsExistingPaveBlock(aPB, aNC, aCurveTol, aMPBOnIn);
+        bExist=IsExistingPaveBlock(aPB, aNC, aTolR3D, aMPBOnIn);
         if (bExist) {
+          aSC++;
           continue;
         }
         //
-        //bExist=IsExistingPaveBlock(aPB, aNC, aTolR3D, aLSE);
-        bExist=IsExistingPaveBlock(aPB, aNC, aCurveTol, aLSE);
+        bExist=IsExistingPaveBlock(aPB, aNC, aTolR3D, aLSE);
         if (bExist) {
+          aSC++;
           continue;
         }
         //
@@ -959,12 +951,14 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
 {
   Standard_Boolean bVF;
   Standard_Integer nV, iFlag, nVn, j, aNbEP;
-  Standard_Real aT[2], aTmin, aTmax, aTV, aTol;
+  Standard_Real aT[2], aTmin, aTmax, aTV, aTol, aTolVnew;
   gp_Pnt aP[2];
   TopoDS_Vertex aVn;
   BOPDS_ListIteratorOfListOfPave aItLP;
   BOPDS_Pave aPn, aPMM[2];
   //
+  aTolVnew = Precision::Confusion();
+  //
   const IntTools_Curve& aIC=aNC.Curve();
   aIC.Bounds(aT[0], aT[1], aP[0], aP[1]);
   //
@@ -993,7 +987,7 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
   //
   for (j=0; j<2; ++j) {
     //if curve is closed, process only one bound
-    if (j && aP[1].IsEqual(aP[0], Precision::Confusion())) {
+    if (j && aP[1].IsEqual(aP[0], aTolVnew)) {
       continue;
     }
     //
@@ -1040,6 +1034,8 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
       aVn=(*(TopoDS_Vertex *)(&myDS->Shape(nVn)));
       BOPTools_AlgoTools::UpdateVertex (aIC, aT[j], aVn);
       //
+      aTolVnew = BRep_Tool::Tolerance(aVn);
+      //
       BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVn);
       Bnd_Box& aBoxDS=aSIDS.ChangeBox();
       BRepBndLib::Add(aVn, aBoxDS);
@@ -1059,7 +1055,8 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
                                           const Standard_Real aTolR3D,
                                           BOPDS_Curve& aNC,
                                           const Standard_Integer nF1,
-                                          const Standard_Integer nF2)
+                                          const Standard_Integer nF2,
+                                          BOPCol_MapOfInteger& aMVB)
 {
   Standard_Boolean bIsVertexOnLine, bInBothFaces;
   Standard_Integer nV;
@@ -1121,6 +1118,8 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
       BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
       Bnd_Box& aBoxDS=aSIDS.ChangeBox();
       BRepBndLib::Add(aV, aBoxDS);
+      //
+      aMVB.Add(nV);
     }
     //modified by NIZHNY-EMV Fri Sep 23 13:35:49 2011
   }
@@ -1654,6 +1653,10 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
     aItPB.Initialize(aMPBOnIn);
     for (; aItPB.More(); aItPB.Next()) {
       const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
+      if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) {
+        continue;
+      }
+      //
       if (aMPB.Contains(aPB)) {
         continue;
       }
@@ -1704,6 +1707,8 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
     return;
   }
   //
+  BOPDS_MapOfPaveBlock aMPB;
+  BOPDS_MapIteratorOfMapOfPaveBlock aItMPB;
   Standard_Integer nE;
   Handle(BOPDS_PaveBlock) aPBf;
   aPBf = aLPBC.First();
@@ -1792,16 +1797,35 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
         aCB->AddFace(nF2);
         //
         aPB->SetCommonBlock(aCB);
+        aMPB.Add(aPB);
       }
       aLPB1.Append(aPB);
     }
   }
   //update face info
   myDS->UpdateFaceInfoOn(nF1);
-  myDS->UpdateFaceInfoIn(nF1);
   //
   myDS->UpdateFaceInfoOn(nF2);
-  myDS->UpdateFaceInfoIn(nF2);
+  //
+  BOPDS_FaceInfo& aFI1 = myDS->ChangeFaceInfo(nF1);
+  BOPDS_FaceInfo& aFI2 = myDS->ChangeFaceInfo(nF2);
+  //
+  BOPDS_MapOfPaveBlock& aMPBOn1 = aFI1.ChangePaveBlocksOn();
+  BOPDS_MapOfPaveBlock& aMPBIn1 = aFI1.ChangePaveBlocksIn();
+  BOPDS_MapOfPaveBlock& aMPBOn2 = aFI2.ChangePaveBlocksOn();
+  BOPDS_MapOfPaveBlock& aMPBIn2 = aFI2.ChangePaveBlocksIn();
+  //
+  aItMPB.Initialize(aMPB);
+  for(; aItMPB.More(); aItMPB.Next()) {
+    const Handle(BOPDS_PaveBlock)& aPBnew = aItMPB.Value();
+    if (!aMPBOn1.Contains(aPBnew)) {
+      aMPBIn1.Add(aPBnew);
+    }
+    //
+    if (!aMPBOn2.Contains(aPBnew)) {
+      aMPBIn2.Add(aPBnew);
+    }
+  }
 }
 
 //modified by NIZHNY-EMV Wed Feb 15 10:08:44 2012
index e0dfec065a94c67b74b7b9fe07b3cb193b9bc240..21301950f509622308f8ee0fed6e87ccfabf5b29 100644 (file)
@@ -735,7 +735,7 @@ Standard_Integer NbWaysOut(const BOPAlgo_ListOfEdgeInfo& aLEInfo)
   }
   //
   BOPTools_AlgoTools2D::CurveOnSurface (anEdge, myFace, aC2D, 
-                                    aFirst, aLast, aToler, Standard_True);
+                                    aFirst, aLast, aToler);
   dt=2.*Tolerance2D(aV, aGAS);
   //
   //modified by NIZHNY-EMV Wed Aug 03 11:34:58 2011
@@ -851,7 +851,7 @@ Standard_Real Angle (const gp_Dir2d& aDir2D)
   aIt.Initialize(myEdges);
   for(; aIt.More(); aIt.Next()) {
     const TopoDS_Edge& aE=(*(TopoDS_Edge *)&aIt.Value());
-    BOPTools_AlgoTools2D::CurveOnSurface(aE, myFace, aC2D, aTolE, Standard_True);
+    BOPTools_AlgoTools2D::CurveOnSurface(aE, myFace, aC2D, aTolE);
     aBB.UpdateEdge(aE, aC2D, myFace, aTolE);
   }
 }
index 362a7d5b56a6f894fb65fde77a669f55356dc08d..698bbbc3100372ada623087254b07bb922402b70 100644 (file)
@@ -99,7 +99,6 @@ Standard_Integer bopcheck (Draw_Interpretor& di, Standard_Integer n,  const char
   BOPAlgo_CheckerSI aChecker;
   BOPCol_ListOfShape anArgs;
   anArgs.Append(aS);
-  anArgs.Append(aS);
   aChecker.SetArguments(anArgs);
   //
   aChecker.Perform();
index 8ae6e5586032b2c6872da1a0fb838c7b44637aa9..effc76fa4dce04a61231a96ce2799458c816c369 100644 (file)
@@ -1338,7 +1338,7 @@ static
       BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aFFWD);
       BOPTools_AlgoTools2D::CurveOnSurface(aE, aFFWD, aC2D, 
                                        aOutFirst, aOutLast, 
-                                       aOutTol, Standard_True);
+                                       aOutTol);
       }
     //
     if (aC3DE->IsPeriodic()) {
index 74c2bc7b8a5e3a800e3a6a01898b39e1822de27a..fda77b18d5b05b9a5cf07f0c3daeded84227ee7e 100644 (file)
@@ -65,13 +65,11 @@ is
               aE:  Edge from TopoDS; 
               aF:  Face from TopoDS; 
               aC    : out Curve from Geom2d; 
-              aToler: out Real from Standard; 
-              aTrim3d:Boolean from Standard); 
+              aToler: out Real from Standard); 
           ---Purpose:  
           --- Get P-Curve <aC>  for the edge <aE> on surface <aF> . 
           --- If the P-Curve does not exist, build  it using Make2D(). 
           --- [aToler] - reached tolerance 
-          --- [aTrim3d] - trimming flag. 
           ---
     CurveOnSurface  (myclass; 
               aE:  Edge from TopoDS; 
@@ -79,15 +77,13 @@ is
               aC    : out Curve from Geom2d; 
               aFirst: out Real from Standard; 
               aLast : out Real from Standard; 
-              aToler: out Real from Standard; 
-              aTrim3d:Boolean from Standard); 
+              aToler: out Real from Standard); 
                       
           ---Purpose: 
           --- Get P-Curve <aC>  for the edge <aE> on surface <aF> . 
           --- If the P-Curve does not exist, build  it using Make2D(). 
           --- [aFirst, aLast] - range of the P-Curve    
           --- [aToler] - reached tolerance 
-          --- [aTrim3d] - trimming flag. 
           ---
     HasCurveOnSurface  (myclass;  
               aE:  Edge from TopoDS; 
@@ -156,13 +152,11 @@ is
               aC    : out Curve from Geom2d;
               aFirst: out Real from Standard; 
               aLast : out Real from Standard; 
-              aToler: out Real from Standard; 
-              aTrim3d:Boolean from Standard);            
+              aToler: out Real from Standard);            
           ---Purpose:   
           --- Make P-Curve <aC> for the edge <aE> on surface <aF> . 
           --- [aFirst, aLast] - range of the P-Curve    
           --- [aToler] - reached tolerance 
-          --- [aTrim3d] - trimming flag. 
           --- 
           
     MakeCurveOnSurface        (myclass;  
@@ -171,8 +165,7 @@ is
               aC    : out Curve from Geom2d;
               aFirst: out Real from Standard; 
               aLast : out Real from Standard; 
-              aToler: out Real from Standard; 
-              aTrim3d:Boolean from Standard);             
+              aToler: out Real from Standard);             
           ---Purpose:   
           --- Same  as   Make2D() 
           ---
index 93bd916ad47f055f03a2009c627fc6f5959a1529..ce2ed21278005cc4455eda9ecff81ba641c30f42 100755 (executable)
@@ -81,7 +81,7 @@ static
   }
   
 
-  BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolPC, Standard_True);
+  BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolPC);
   
   aTolEdge=BRep_Tool::Tolerance(aE);
 
@@ -141,7 +141,7 @@ static
   Handle(Geom2d_Curve) aC2D;
   Standard_Real aToler, aFirst, aLast;
 
-  BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler, Standard_True); 
+  BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler); 
   aC2D->D0(aParameter, aP2D);
   U=aP2D.X();
   V=aP2D.Y();
@@ -155,12 +155,11 @@ static
   void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE,
                                          const TopoDS_Face& aF,
                                          Handle(Geom2d_Curve)& aC2D,
-                                         Standard_Real& aToler,
-                                         const Standard_Boolean trim3d)
+                                         Standard_Real& aToler)
 {
   Standard_Real aFirst, aLast; 
 
-  BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler, trim3d); 
+  BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler); 
 
   return;
 }
@@ -173,8 +172,7 @@ static
                                          Handle(Geom2d_Curve)& aC2D,
                                          Standard_Real& aFirst,
                                          Standard_Real& aLast,
-                                         Standard_Real& aToler,
-                                         const Standard_Boolean trim3d)
+                                         Standard_Real& aToler)
 {
   Standard_Boolean aHasOld;
   Handle(Geom2d_Curve) C2D;
@@ -185,7 +183,7 @@ static
     return;
   }
 
-  BOPTools_AlgoTools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler, trim3d);
+  BOPTools_AlgoTools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler);
   aC2D=C2D;
   return;
 }
@@ -431,7 +429,7 @@ static
     return;
   }
   //
-  BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolE, Standard_True);
+  BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolE);
   aBB.UpdateEdge(aE, aC2D, aF, aTolE);
   //
   return;
@@ -446,8 +444,7 @@ static
                                  Handle(Geom2d_Curve)& aC2D,
                                  Standard_Real& aFirst,
                                  Standard_Real& aLast,
-                                 Standard_Real& aToler,
-                                 const Standard_Boolean trim3d)
+                                 Standard_Real& aToler)
 {
   Standard_Boolean aLocIdentity;
   Standard_Real f3d, l3d;
@@ -463,7 +460,7 @@ static
     return;
   }
 
-  Handle(Geom_Curve) C3D3, C3D2, C3D;
+  Handle(Geom_Curve) C3D2, C3D;
   C3D = BRep_Tool::Curve(aE, aLoc, f3d, l3d);
   //
   if (C3D.IsNull()) { 
@@ -480,17 +477,9 @@ static
       DownCast(C3D->Transformed(aLoc.Transformation()));
   }
   
-  if (trim3d) {
-    
-    C3D3=C3D2;
-  }
-  
-  else {
-    C3D3=C3D2;
-  }
   //
   aToler=.5*BRep_Tool::Tolerance(aE);
-  BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D3, f3d, l3d, aC2D, aToler);
+  BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D2, f3d, l3d, aC2D, aToler);
   //
   aFirst = f3d; 
   aLast  = l3d;
@@ -693,10 +682,9 @@ Standard_Boolean CheckEdgeLength (const TopoDS_Edge& E)
                                              Handle(Geom2d_Curve)& aC2D,
                                              Standard_Real& aFirst,
                                              Standard_Real& aLast,
-                                             Standard_Real& aToler,
-                                             const Standard_Boolean trim3d)
+                                             Standard_Real& aToler)
 {
-  BOPTools_AlgoTools2D::Make2D(aE, aF, aC2D, aFirst, aLast, aToler, trim3d);
+  BOPTools_AlgoTools2D::Make2D(aE, aF, aC2D, aFirst, aLast, aToler);
 }
 
 //=======================================================================
index e1513e89d767070bd117915e9b8898fb63a7892f..3a445c1e99adc16c85340a9c4a87847f5fb5c90b 100644 (file)
@@ -235,7 +235,7 @@ static
   Handle(Geom_Surface) aS1=BRep_Tool::Surface(aF1);
   
   Handle(Geom2d_Curve)aC2D1;
-  BOPTools_AlgoTools2D::CurveOnSurface(aE, aF1, aC2D1, aTolPC, Standard_True);
+  BOPTools_AlgoTools2D::CurveOnSurface(aE, aF1, aC2D1, aTolPC);
 
   aC2D1->D0(aT, aP2D);
   U=aP2D.X();