]> OCCT Git - occt-copy.git/commitdiff
0028683: Wrong result of CUT operation
authoremv <emv@opencascade.com>
Tue, 25 Apr 2017 11:39:57 +0000 (14:39 +0300)
committeremv <emv@opencascade.com>
Fri, 28 Apr 2017 09:08:18 +0000 (12:08 +0300)
1. Partial porting of the patches for the issues #0026738 and #0028017:
   Careful treatment of the SD vertices created on the Face/Face intersection stage.

2. Avoid creation of the small section edges.

3. Test case for the issue.

4. Adjusting test cases for current behavior.

15 files changed:
src/BOPAlgo/BOPAlgo_PaveFiller.cdl
src/BOPAlgo/BOPAlgo_PaveFiller.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_8.cxx
src/BOPDS/BOPDS_DS.cdl
src/BOPDS/BOPDS_DS.cxx
tests/boolean/volumemaker/B9
tests/bugs/modalg_2/bug472_3
tests/bugs/modalg_6/bug28683 [new file with mode: 0644]
tests/draft/angle/M2
tests/offset/faces_type_i/C9
tests/offset/shape_type_i/B3

index 9922eaafe59de9eba04c53ae9d879a8d1217ab04..f0a1c7d3c8b884ca99c5279890a6277f9a041c4f 100644 (file)
@@ -157,6 +157,11 @@ is
     TreatVerticesEE(me:out) 
       is protected; 
 
+    MakeSDVerticesFF(me:out;
+      theDMVLV: DataMapOfIntegerListOfInteger from BOPCol;
+      theDMNewSD: out DataMapOfIntegerInteger from BOPCol)
+    is protected;
+
     MakeSplitEdges(me:out) 
       is protected;   
         
@@ -166,6 +171,12 @@ is
     MakePCurves(me:out) 
       is protected; 
   
+    MakeSDVertices(me:out;
+      theVertIndices : ListOfInteger from BOPCol;
+      theAddInterfs  : Boolean from Standard = Standard_True)
+    returns Integer from Standard
+    is protected;
+
     ProcessDE(me:out) 
       is protected;  
        
@@ -218,7 +229,8 @@ is
         nF2       : Integer from Standard; 
         theMI     : MapOfInteger from BOPCol; 
         theMVEF   : MapOfInteger from BOPCol; 
-        theMVTol  : out DataMapOfIntegerReal from BOPCol) 
+        theMVTol  : out DataMapOfIntegerReal from BOPCol;
+        aDMVLV    : out DataMapOfIntegerListOfInteger from BOPCol) 
       is protected;   
     ---Purpose: 
     -- Checks and puts paves from <theMVOn> on the curve <theNC>.
@@ -308,7 +320,8 @@ is
         theNC      : out Curve from BOPDS; 
         theMI      : MapOfInteger from BOPCol;
         theMVEF    : MapOfInteger from BOPCol;
-        theMVTol   : out DataMapOfIntegerReal from BOPCol)
+        theMVTol   : out DataMapOfIntegerReal from BOPCol;
+        aDMVLV     : out DataMapOfIntegerListOfInteger from BOPCol)
       is protected; 
     ---Purpose: 
     -- Checks and puts paves created in EF intersections on the curve <theNC>.
@@ -319,7 +332,8 @@ is
         theMI      : MapOfInteger from BOPCol;
         theNC      : out Curve from BOPDS; 
         theMVStick : MapOfInteger from BOPCol; 
-        theMVTol   : out DataMapOfIntegerReal from BOPCol)
+        theMVTol   : out DataMapOfIntegerReal from BOPCol;
+        aDMVLV     : out DataMapOfIntegerListOfInteger from BOPCol)
       is protected;  
     ---Purpose: 
     -- Puts stick paves on the curve <theNC>
@@ -360,6 +374,7 @@ is
         theNC     : out Curve from BOPDS; 
         theMI     : MapOfInteger from BOPCol;
         theMVTol  : out DataMapOfIntegerReal from BOPCol;
+        aDMVLV    : out DataMapOfIntegerListOfInteger from BOPCol;
         aType     : Integer from Standard = 0)
       is protected; 
     ---Purpose: 
@@ -416,12 +431,6 @@ is
       is protected; 
     ---Purpose: 
     -- Keeps data for post treatment 
-     
-    RefineFaceInfoOn(me:out) 
-      is protected; 
-    ---Purpose: 
-    -- Refines the state On for the all faces having 
-    -- state information 
 
     UpdateFaceInfo(me:out;
         theDME:out DataMapOfPaveBlockListOfPaveBlock from BOPDS; 
index 9052f46fdc8275b8e6eb0866a4efd2eeb54ff563..426ed2c6178813748e5a8b957f7c8f5e093bc337 100644 (file)
@@ -317,7 +317,8 @@ void BOPAlgo_PaveFiller::PerformInternal()
     return; 
   }
   //
-  RefineFaceInfoOn();
+  myDS->ReleasePaveBlocks();
+  myDS->RefineFaceInfoOn();
   //
   MakePCurves();
   if (myErrorStatus) {
index 984d71ab3d171fd5e6d0bc8fc60596bba0ff3bc1..39b43446b288fbfec3019a555c784679f6956567 100644 (file)
 
 #include <Bnd_Box.hxx>
 
+#include <BRep_TVertex.hxx>
+#include <BRep_Tool.hxx>
+
+#include <TopoDS.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <BRepBndLib.hxx>
 
   void BOPAlgo_PaveFiller::PerformVV() 
 {
   Standard_Boolean bWithSubShape;
-  Standard_Integer n1, n2, iFlag, nX, n, aSize, i, j, k, aNbBlocks;
+  Standard_Integer n1, n2, iFlag, aSize, k, aNbBlocks;
   Handle(NCollection_BaseAllocator) aAllocator;
-  BOPCol_ListIteratorOfListOfInteger aItLI, aItLI2;
-  TopoDS_Vertex aVn;
-  BOPDS_ShapeInfo aSIn;
   //
   myErrorStatus=0;
   //
@@ -59,8 +60,6 @@
     return; 
   }
   //
-  aSIn.SetShapeType(TopAbs_VERTEX);
-  
   BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV();
   aVVs.SetIncrement(aSize);
   //
@@ -69,7 +68,6 @@
     NCollection_BaseAllocator::CommonBaseAllocator();
   BOPCol_IndexedDataMapOfIntegerListOfInteger aMILI(100, aAllocator);
   BOPCol_DataMapOfIntegerListOfInteger aMBlocks(100, aAllocator);
-  BOPCol_ListOfShape aLV(aAllocator);
   //
   // 1. Map V/LV
   for (; myIterator->More(); myIterator->Next()) {
   for (k=0; k<aNbBlocks; ++k) {
     const BOPCol_ListOfInteger& aLI=aMBlocks.Find(k);
     //
-    aLV.Clear();
-    aItLI.Initialize(aLI);
-    for (; aItLI.More(); aItLI.Next()) {
-      nX=aItLI.Value();
-      const TopoDS_Shape& aV=myDS->Shape(nX);
-      aLV.Append(aV);
-    }
-    //
-    BOPTools_AlgoTools::MakeVertex(aLV, aVn);
-    //
-    // Append new vertex to the DS
-    aSIn.SetShape(aVn);
-    n=myDS->Append(aSIn);
-    //
-    BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(n);
-    Bnd_Box& aBox=aSIDS.ChangeBox();
-    BRepBndLib::Add(aVn, aBox);
-    //
-    // Fill ShapesSD
-    aItLI.Initialize(aLI);
-    for (i=0; aItLI.More(); aItLI.Next(), ++i) {
-      n1=aItLI.Value();
-      myDS->AddShapeSD(n1, n);
-      //
-      aItLI2.Initialize(aLI);
-      for (j=0; aItLI2.More(); aItLI2.Next(), ++j) {
-        if (j>i) {
-          n2=aItLI2.Value();
-          //
-          myDS->AddInterf(n1, n2);
-          BOPDS_InterfVV& aVV=aVVs.Append1();
-          //
-          aVV.SetIndices(n1, n2);
-          aVV.SetIndexNew(n);
-        }
-      }
-    }
+    MakeSDVertices(aLI);
   }
   //
   BOPCol_DataMapIteratorOfDataMapOfIntegerInteger aItDMII;
   }
   //
   //-----------------------------------------------------scope t
-  aLV.Clear();
   aMBlocks.Clear();
   aMILI.Clear();
+}
+  //=======================================================================
+// function: MakeSDVertices
+// purpose: 
+//=======================================================================
+Standard_Integer BOPAlgo_PaveFiller::MakeSDVertices
+   (const BOPCol_ListOfInteger& theVertIndices,
+    const Standard_Boolean theAddInterfs)
+{
+  TopoDS_Vertex aVSD, aVn;
+  Standard_Integer nSD = -1;
+  BOPCol_ListIteratorOfListOfInteger aItLI(theVertIndices);
+  BOPCol_ListOfShape aLV;
+  for (; aItLI.More(); aItLI.Next()) {
+    Standard_Integer nX = aItLI.Value(), nSD1;
+    if (myDS->HasShapeSD(nX, nSD1)) {
+      const TopoDS_Shape& aVSD1 = myDS->Shape(nSD1);
+      if (nSD == -1) {
+        aVSD = TopoDS::Vertex(aVSD1);
+        nSD = nSD1;
+      }
+      else {
+        aLV.Append(aVSD1);
+      }
+    }
+    const TopoDS_Shape& aV = myDS->Shape(nX);
+    aLV.Append(aV);
+  }
+  BOPTools_AlgoTools::MakeVertex(aLV, aVn);
+  Standard_Integer nV;
+  if (nSD != -1) {
+    // update old SD vertex with new value
+    Handle(BRep_TVertex)& aTVertex =
+      reinterpret_cast<Handle(BRep_TVertex)&>(const_cast<Handle(TopoDS_TShape)&>(aVSD.TShape()));
+    aTVertex->Pnt(BRep_Tool::Pnt(aVn));
+    aTVertex->Tolerance(BRep_Tool::Tolerance(aVn));
+    aVn = aVSD;
+    nV = nSD;
+  }
+  else {
+    // Append new vertex to the DS
+    BOPDS_ShapeInfo aSIn;
+    aSIn.SetShapeType(TopAbs_VERTEX);
+    aSIn.SetShape(aVn);
+    nV = myDS->Append(aSIn);
+  }
+  BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nV);
+  Bnd_Box& aBox = aSIDS.ChangeBox();
+  BRepBndLib::Add(aVn, aBox);
+  aBox.SetGap(aBox.GetGap());
+  //
+  // Fill ShapesSD
+  BOPDS_VectorOfInterfVV& aVVs = myDS->InterfVV();
+  if (theAddInterfs)
+    aVVs.SetIncrement(theVertIndices.Extent());
+  //
+  aItLI.Initialize(theVertIndices);
+  for (; aItLI.More(); aItLI.Next()) {
+    Standard_Integer n1 = aItLI.Value();
+    myDS->AddShapeSD(n1, nV);
+    //
+    if (theAddInterfs) {
+      BOPCol_ListIteratorOfListOfInteger aItLI2 = aItLI;
+      aItLI2.Next();
+      for (; aItLI2.More(); aItLI2.Next()) {
+        Standard_Integer n2 = aItLI2.Value();
+        //
+        myDS->AddInterf(n1, n2);
+        BOPDS_InterfVV& aVV = aVVs.Append1();
+        //
+        aVV.SetIndices(n1, n2);
+        aVV.SetIndexNew(nV);
+      }
+    }
+  }
+  return nV;
 }
index 41019ebc575f8d9c3962c0df157445caaae9cfbe..b240574332082ce74a37dc15f701e7f8b75245b1 100644 (file)
@@ -412,9 +412,6 @@ void BOPAlgo_PaveFiller::PerformEF()
     nF=aItMI.Value();
     myDS->UpdateFaceInfoIn(nF);
   }
-  // Refine FaceInfoOn to remove all formal pave blocks 
-  // made during EF processing 
-  //myDS->RefineFaceInfoOn();
   //-----------------------------------------------------scope t
   aMIEFC.Clear();
   aMVCPB.Clear();
index 09a51996ec5faef5189d7df24a4cf258c1fad249..2cdaa20e6673295821abbfb004044f0524d248c2 100644 (file)
@@ -67,6 +67,7 @@
 #include <BOPCol_DataMapOfIntegerReal.hxx>
 #include <BOPCol_NCVector.hxx>
 #include <BOPCol_Parallel.hxx>
+#include <BOPCol_MapOfShape.hxx>
 
 #include <BOPDS_Interf.hxx>
 #include <BOPDS_Iterator.hxx>
@@ -393,7 +394,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
   BOPCol_DataMapOfShapeInteger aMVI(100, aAllocator);
   BOPDS_DataMapOfPaveBlockListOfPaveBlock aDMExEdges(100, aAllocator);
   BOPCol_DataMapOfIntegerReal aMVTol(100, aAllocator);
-  BOPCol_DataMapOfIntegerInteger aDMI(100, aAllocator);
+  BOPCol_DataMapOfIntegerInteger aDMNewSD(100, aAllocator);
+  BOPCol_DataMapOfIntegerListOfInteger aDMVLV;
   BOPCol_DataMapOfIntegerListOfInteger aDMBV(100, aAllocator);
   BOPCol_DataMapIteratorOfDataMapOfIntegerReal aItMV;
   //
@@ -467,12 +469,12 @@ void BOPAlgo_PaveFiller::MakeBlocks()
       // DEBt
       aNC.InitPaveBlock1();
       //
-      PutPavesOnCurve(aMVOnIn, aTolR3D, aNC, nF1, nF2, aMI, aMVEF, aMVTol);
+      PutPavesOnCurve(aMVOnIn, aTolR3D, aNC, nF1, nF2, aMI, aMVEF, aMVTol, aDMVLV);
       //
-      PutStickPavesOnCurve(aF1, aF2, aMI, aNC, aMVStick, aMVTol);
+      PutStickPavesOnCurve(aF1, aF2, aMI, aNC, aMVStick, aMVTol, aDMVLV);
       //904/F7
       if (aNbC == 1) {
-        PutEFPavesOnCurve(aNC, aMI, aMVEF, aMVTol);
+        PutEFPavesOnCurve(aNC, aMI, aMVEF, aMVTol, aDMVLV);
       }
       //
       if (aIC.HasBounds()) {
@@ -596,21 +598,31 @@ void BOPAlgo_PaveFiller::MakeBlocks()
       const Handle(BRep_TVertex)& TV = 
         *((Handle(BRep_TVertex)*)&aV.TShape());
       TV->Tolerance(aTol);
+      // reset bnd box
+      BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV1);
+      Bnd_Box& aBoxDS=aSIDS.ChangeBox();
+      aBoxDS = Bnd_Box();
+      BRepBndLib::Add(aV, aBoxDS);
+      aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
+      //
+      if (aDMVLV.IsBound(nV1))
+        aDMVLV.UnBind(nV1);
     }
     //
     ProcessExistingPaveBlocks(i, aMPBOnIn, aDMBV, aMSCPB, aMVI, aMPBAdd);
   }//for (i=0; i<aNbFF; ++i) {
   // 
   // post treatment
-  myErrorStatus=PostTreatFF(aMSCPB, aMVI, aDMExEdges, aDMI, aAllocator);
+  MakeSDVerticesFF(aDMVLV, aDMNewSD);
+  myErrorStatus=PostTreatFF(aMSCPB, aMVI, aDMExEdges, aDMNewSD, aAllocator);
   if (myErrorStatus) {
     return;
   }
   //
   // update face info
-  UpdateFaceInfo(aDMExEdges, aDMI);
+  UpdateFaceInfo(aDMExEdges, aDMNewSD);
   //Update all pave blocks
-  UpdatePaveBlocks(aDMI);
+  UpdatePaveBlocks(aDMNewSD);
   //-----------------------------------------------------scope t
   aMF.Clear();
   aMVStick.Clear();
@@ -618,7 +630,31 @@ void BOPAlgo_PaveFiller::MakeBlocks()
   aMVOnIn.Clear();
   aDMExEdges.Clear();
   aMI.Clear();
-  aDMI.Clear();
+  aDMNewSD.Clear();
+}
+
+//=======================================================================
+//function : MakeSDVerticesFF
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::MakeSDVerticesFF
+  (const BOPCol_DataMapOfIntegerListOfInteger& theDMVLV,
+   BOPCol_DataMapOfIntegerInteger& theDMNewSD)
+{
+  // Create a new SD vertex for each group of coinciding vertices
+  // and put new substitutions to theDMNewSD.
+  BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItG(theDMVLV);
+  for (; aItG.More(); aItG.Next()) {
+    const BOPCol_ListOfInteger& aList = aItG.Value();
+    // make SD vertices w/o creation of interfs
+    Standard_Integer nSD = MakeSDVertices(aList, Standard_False);
+    // update theDMNewSD
+    BOPCol_ListIteratorOfListOfInteger aItL(aList);
+    for (; aItL.More(); aItL.Next()) {
+      Standard_Integer nV = aItL.Value();
+      theDMNewSD.Bind(nV, nSD);
+    }
+  }
 }
 
 //=======================================================================
@@ -629,7 +665,7 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
     (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
      BOPCol_DataMapOfShapeInteger& aMVI,
      BOPDS_DataMapOfPaveBlockListOfPaveBlock& aDMExEdges,
-     BOPCol_DataMapOfIntegerInteger& aDMI,
+     BOPCol_DataMapOfIntegerInteger& aDMNewSD,
      Handle(NCollection_BaseAllocator)& theAllocator)
 {
   Standard_Integer iRet, aNbS;
@@ -698,9 +734,27 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
   }
   //
   // 1 prepare arguments
+  BOPCol_MapOfShape anAddedSD;
   for (k=1; k<=aNbS; ++k) {
     const TopoDS_Shape& aS=theMSCPB.FindKey(k);
     aLS.Append(aS);
+    // add vertices-candidates for SD from the map aDMNewSD,
+    // so that they took part in fuse operation.
+    TopoDS_Iterator itV(aS);
+    for (; itV.More(); itV.Next()) {
+      const TopoDS_Shape& aVer = itV.Value();
+      const Standard_Integer *iVer = aMVI.Seek(aVer);
+      if (iVer) {
+        const Standard_Integer* pSD = aDMNewSD.Seek(*iVer);
+        if (pSD) {
+          const TopoDS_Shape& aVSD = myDS->Shape(*pSD);
+          if (anAddedSD.Add(aVSD)) {
+            aLS.Append(aVSD);
+            aMVI.Bind(aVSD, *pSD);
+          }
+        }
+      }
+    }
   }
   //
   // 2 Fuse shapes
@@ -723,6 +777,8 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
     aType=aSIx.ShapeType();
     //
     if (aType==TopAbs_VERTEX) {
+      Standard_Boolean bIntersectionPoint = theMSCPB.Contains(aSx);
+      //
       if (aPDS->HasShapeSD(nSx, nVSD)) {
         aV=aPDS->Shape(nVSD);
       }
@@ -740,14 +796,23 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
       else {
         iV=aMVI.Find(aV);
       }
-      // update FF interference
-      const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromKey(aSx);
-      iX=aCPB.IndexInterf();
-      iP=aCPB.Index();
-      BOPDS_InterfFF& aFF=aFFs(iX);
-      BOPDS_VectorOfPoint& aVNP=aFF.ChangePoints();
-      BOPDS_Point& aNP=aVNP(iP);
-      aNP.SetIndex(iV);
+      //
+      if (!bIntersectionPoint) {
+        // save SD connection
+        nSx = aMVI.Find(aSx);
+        aDMNewSD.Bind(nSx, iV);
+        myDS->AddShapeSD(nSx, iV);
+      }
+      else {
+        // update FF interference
+        const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromKey(aSx);
+        iX=aCPB.IndexInterf();
+        iP=aCPB.Index();
+        BOPDS_InterfFF& aFF=aFFs(iX);
+        BOPDS_VectorOfPoint& aVNP=aFF.ChangePoints();
+        BOPDS_Point& aNP=aVNP(iP);
+        aNP.SetIndex(iV);
+      }
     }//if (aType==TopAbs_VERTEX) {
     //
     else if (aType==TopAbs_EDGE) {
@@ -800,24 +865,7 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
           } 
         }
         //
-        if (!aNbLPBx) {
-          aE=aSx;
-          //
-          if (!aMVI.IsBound(aE)) {
-            aSI.SetShapeType(aType);
-            aSI.SetShape(aE);
-            iE=myDS->Append(aSI);
-            aMVI.Bind(aE, iE);
-          }
-          else {
-            iE=aMVI.Find(aE);
-          }
-          // append new PaveBlock to aLPBC
-          aPB1->SetEdge(iE);
-          aLPBC.Append(aPB1);
-        } // if (!aNbLPBx) {
-        //
-        else {
+        if (aNbLPBx) {
           aItLPB.Initialize(aLPBx);
           if (bOld) {
             aPave1[0] = aPB1->Pave1();
@@ -862,7 +910,7 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
               const BOPDS_Pave& aP1 = !j ? aPB1->Pave1() : aPB1->Pave2();
               if (aP1.Parameter() == aPave[j].Parameter() && 
                   aP1.Index() != iV) {
-                aDMI.Bind(aP1.Index(), iV);
+                aDMNewSD.Bind(aP1.Index(), iV);
                 myDS->AddShapeSD(aP1.Index(), iV);
               }
               //
@@ -899,6 +947,18 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
       }
     }//else if (aType==TopAbs_EDGE)
   }//for (; aItLS.More(); aItLS.Next()) {
+  //
+  // Update SD for vertices that did not participate in operation
+  BOPCol_DataMapOfIntegerInteger::Iterator itDM(aDMNewSD);
+  for (; itDM.More(); itDM.Next())
+  {
+    const Standard_Integer* pSD = aDMNewSD.Seek(itDM.Value());
+    if (pSD)
+    {
+      itDM.ChangeValue() = *pSD;
+      myDS->AddShapeSD(itDM.Key(), *pSD);
+    }
+  }
   return iRet;
 }
 
@@ -1324,7 +1384,8 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
    const Standard_Integer nF2,
    const BOPCol_MapOfInteger& aMI,
    const BOPCol_MapOfInteger& aMVEF,
-   BOPCol_DataMapOfIntegerReal& aMVTol)
+   BOPCol_DataMapOfIntegerReal& aMVTol,
+   BOPCol_DataMapOfIntegerListOfInteger& aDMVLV)
 {
   Standard_Boolean bInBothFaces;
   Standard_Integer nV;
@@ -1336,7 +1397,7 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
   aIt.Initialize(aMVEF);
   for (; aIt.More(); aIt.Next()) {
     nV=aIt.Value();
-    PutPaveOnCurve(nV, aTolR3D, aNC, aMI, aMVTol, 2);
+    PutPaveOnCurve(nV, aTolR3D, aNC, aMI, aMVTol, aDMVLV, 2);
   }
   //Put all other vertices
   aIt.Initialize(aMVOnIn);
@@ -1365,7 +1426,7 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
       }
     }
     //
-    PutPaveOnCurve(nV, aTolR3D, aNC, aMI, aMVTol, 1);
+    PutPaveOnCurve(nV, aTolR3D, aNC, aMI, aMVTol, aDMVLV, 1);
   }
 }
 
@@ -1516,7 +1577,8 @@ void BOPAlgo_PaveFiller::GetEFPnts
   (BOPDS_Curve& aNC,
    const BOPCol_MapOfInteger& aMI,
    const BOPCol_MapOfInteger& aMVEF,
-   BOPCol_DataMapOfIntegerReal& aMVTol)
+   BOPCol_DataMapOfIntegerReal& aMVTol,
+   BOPCol_DataMapOfIntegerListOfInteger& aDMVLV)
 {
   if (!aMVEF.Extent()) {
     return;
@@ -1554,7 +1616,7 @@ void BOPAlgo_PaveFiller::GetEFPnts
     Standard_Integer aNbPoints = aProjPT.NbPoints();
     if (aNbPoints) {
       aDist = aProjPT.LowerDistance();
-      PutPaveOnCurve(nV, aDist, aNC, aMI, aMVTol);
+      PutPaveOnCurve(nV, aDist, aNC, aMI, aMVTol, aDMVLV);
     }
   }
 }
@@ -1569,7 +1631,8 @@ void BOPAlgo_PaveFiller::GetEFPnts
    const BOPCol_MapOfInteger& aMI,
    BOPDS_Curve& aNC,
    const BOPCol_MapOfInteger& aMVStick,
-   BOPCol_DataMapOfIntegerReal& aMVTol)
+   BOPCol_DataMapOfIntegerReal& aMVTol,
+   BOPCol_DataMapOfIntegerListOfInteger& aDMVLV)
 {
   BOPCol_MapOfInteger aMV;
   aMV.Assign(aMVStick);
@@ -1632,7 +1695,7 @@ void BOPAlgo_PaveFiller::GetEFPnts
         // The intersection curve aIC is vanishing curve (the crease)
         aD=sqrt(aD2);
         //
-        PutPaveOnCurve(nV, aD, aNC, aMI, aMVTol);
+        PutPaveOnCurve(nV, aD, aNC, aMI, aMVTol, aDMVLV);
       }
     }//for (jVU=1; jVU=aNbVU; ++jVU) {
   }
@@ -1752,6 +1815,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
    BOPDS_Curve& aNC,
    const BOPCol_MapOfInteger& aMI,
    BOPCol_DataMapOfIntegerReal& aMVTol,
+   BOPCol_DataMapOfIntegerListOfInteger& aDMVLV,
    const Standard_Integer iCheckExtend)
 {
   Standard_Boolean bIsVertexOnLine;
@@ -1772,23 +1836,42 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
   if (bIsVertexOnLine) {
     // check if aPB contains the parameter aT
     Standard_Boolean bExist;
-    Standard_Integer nVToUpdate;
-    Standard_Real aPTol, aDist, aTolVNew, aTolV2, aDTol;
-    TopoDS_Vertex aVToUpdate;
-    gp_Pnt aP1, aP2;
+    Standard_Integer nVUsed;
+    Standard_Real aPTol, aDTol;
     //
-    aTolV2 = 0.;
     aDTol = 1.e-12;
     //
     GeomAdaptor_Curve aGAC(aIC.Curve());
     aPTol = aGAC.Resolution(aTolR3D);
     //
-    bExist = aPB->ContainsParameter(aT, aPTol, nVToUpdate);
+    bExist = aPB->ContainsParameter(aT, aPTol, nVUsed);
     if (bExist) {
       // use existing pave
-      aP1 = BRep_Tool::Pnt(aV);
-      aTolV2 = BRep_Tool::Tolerance(aV);
-      aVToUpdate = (*(TopoDS_Vertex *)(&myDS->Shape(nVToUpdate)));
+      BOPCol_ListOfInteger* pList = aDMVLV.ChangeSeek(nVUsed);
+      if (!pList) {
+        pList = aDMVLV.Bound(nVUsed, BOPCol_ListOfInteger());
+        pList->Append(nVUsed);
+        if (!aMVTol.IsBound(nVUsed)) {
+          const TopoDS_Vertex& aVUsed = (*(TopoDS_Vertex *)(&myDS->Shape(nVUsed)));
+          aTolV = BRep_Tool::Tolerance(aVUsed);
+          aMVTol.Bind(nVUsed, aTolV);
+        }
+      }
+      // avoid repeated elements in the list
+      BOPCol_ListIteratorOfListOfInteger aItLI(*pList);
+      for (; aItLI.More(); aItLI.Next()) {
+        if (aItLI.Value() == nV) {
+          break;
+        }
+      }
+      if (!aItLI.More()) {
+        pList->Append(nV);
+      }
+      // save initial tolerance for the vertex
+      if (!aMVTol.IsBound(nV)) {
+        aTolV = BRep_Tool::Tolerance(aV);
+        aMVTol.Bind(nV, aTolV);
+      }
     }
     else {
       // add new pave
@@ -1797,33 +1880,28 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
       aPave.SetParameter(aT);
       aPB->AppendExtPave(aPave);
       //
-      aP1 = aGAC.Value(aT);
-      nVToUpdate = nV;
-      aVToUpdate = aV;
-    }
-    //
-    aTolV = BRep_Tool::Tolerance(aVToUpdate);
-    aP2 = BRep_Tool::Pnt(aVToUpdate);
-    aDist = aP1.Distance(aP2);
-    aTolVNew = aDist - aTolV2;
-    //
-    if (aTolVNew > aTolV) {
-      BRep_Builder aBB;
-      aBB.UpdateVertex(aVToUpdate, aTolVNew+aDTol);
-      //
-      if (!aMVTol.IsBound(nVToUpdate)) {
-        aMVTol.Bind(nVToUpdate, aTolV);
+      gp_Pnt aP1 = aGAC.Value(aT);
+      aTolV = BRep_Tool::Tolerance(aV);
+      gp_Pnt aP2 = BRep_Tool::Pnt(aV);
+      Standard_Real aDist = aP1.Distance(aP2);
+      if (aDist > aTolV) {
+        BRep_Builder().UpdateVertex(aV, aDist + aDTol);
+        //
+        if (!aMVTol.IsBound(nV)) {
+          aMVTol.Bind(nV, aTolV);
+        }
+        //
+        BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
+        Bnd_Box& aBoxDS=aSIDS.ChangeBox();
+        BRepBndLib::Add(aV, aBoxDS);
+        aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
       }
-      // 
-      BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVToUpdate);
-      Bnd_Box& aBoxDS=aSIDS.ChangeBox();
-      BRepBndLib::Add(aVToUpdate, aBoxDS);
     }
   }
 }
 
 //=======================================================================
-//function : ProcessOldPaveBlocks
+//function : ProcessExistingPaveBlocks
 //purpose  : 
 //=======================================================================
 void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
@@ -2189,9 +2267,9 @@ Standard_Boolean BOPAlgo_PaveFiller::CheckPlanes
 //purpose  : 
 //=======================================================================
 void BOPAlgo_PaveFiller::UpdatePaveBlocks
-  (const BOPCol_DataMapOfIntegerInteger& aDMI)
+  (const BOPCol_DataMapOfIntegerInteger& aDMNewSD)
 {
-  if (aDMI.IsEmpty()) {
+  if (aDMNewSD.IsEmpty()) {
     return;
   }
   //
@@ -2221,10 +2299,10 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
         aPB->Range(aT[0], aT[1]);
         //
         for (j = 0; j < 2; ++j) {
-          if (aDMI.IsBound(nV[j])) {
+          if (aDMNewSD.IsBound(nV[j])) {
             BOPDS_Pave aPave;
             //
-            nV[j] = aDMI.Find(nV[j]);
+            nV[j] = aDMNewSD.Find(nV[j]);
             aPave.SetIndex(nV[j]);
             aPave.SetParameter(aT[j]);
             //
index 1d5c773139037f67e639e265f4a0cc09392676b5..d857eec9dee9d5ac2a82be39dcda700379da71fc 100644 (file)
@@ -706,47 +706,6 @@ void BOPAlgo_PaveFiller::MakePCurves()
   //======================================================
 }
 //=======================================================================
-// function: RefineFaceInfoOn
-// purpose: 
-//=======================================================================
-void BOPAlgo_PaveFiller::RefineFaceInfoOn() 
-{
-  Standard_Integer aNbPBP;
-  //
-  myErrorStatus=0;
-  //
-  BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
-  aNbPBP=aPBP.Extent();
-  if(!aNbPBP) {
-    return;
-  }
-  //
-  Standard_Boolean bV1, bV2;
-  Standard_Integer i, nV1, nV2, aNbPB;
-  Handle(BOPDS_PaveBlock) aPB;
-  //
-  for (i=0; i<aNbPBP; ++i) {
-    BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
-    //
-    aNbPB=aLPB.Extent();
-    if (aNbPB==1) {
-      aPB=aLPB.First();
-      aPB->Indices(nV1, nV2);
-      bV1=myDS->IsNewShape(nV1);
-      bV2=myDS->IsNewShape(nV2);
-      //
-      if (!(bV1 || bV2)) {
-        if (!myDS->IsCommonBlock(aPB)) {
-          // the PB seems to be untouced
-          aLPB.Clear();
-          continue;
-        }
-      }//if (!(bV1 || bV2)) {
-    }//if (aNbPB==1) {
-  }//for (i=0; i<aNbPBP; ++i) {
-  myDS->RefineFaceInfoOn();
-}
-//=======================================================================
 //function : UpdateVertices
 //purpose  : update tolerances of vertices comparing extremities of
 //           3d and 2d curves
index 156237ddaf2a9c1a8e6821e0438e9cd428e2aced..ed229bbfb8e06efe6f2f49726ec8147a37f01477 100644 (file)
@@ -98,6 +98,8 @@ void BOPAlgo_PaveFiller::ProcessDE()
           //
           // 2.
           BOPDS_ListOfPaveBlock& aLPBD=myDS->ChangePaveBlocks(nE);
+          if (aLPBD.IsEmpty())
+            continue;
           aPBD=aLPBD.First();
           //
           FillPaves(nV, nE, nF, aLPBOut, aPBD);
@@ -224,7 +226,7 @@ void BOPAlgo_PaveFiller::ProcessDE()
       aPB->SetEdge(nSp);
     }
     else {
-      //aPB->SetEdge(nDE);
+      myDS->ChangeShapeInfo(nDE).SetReference(-1);
       aLPB.Clear();
       break;
     }
index 9a3da4e3137540567e587dc03a2a52c708f72d4b..94b1193d3580120abab2657c53bf517e2d79d4c7 100644 (file)
@@ -660,6 +660,10 @@ is
     SetDefaultTolerances(me:out);
     ---Purpose: Reverts the tolerance values of unchanged entities to default values.
 
+    ReleasePaveBlocks(me:out);
+    ---Purpose:
+    -- Clears information about PaveBlocks for the untouched edges.
+
 fields  
     myAllocator        : BaseAllocator from BOPCol is protected;
     myArguments        : ListOfShape from BOPCol is protected;   
index 5190db51624af5436494d7022bdb469fbd706088..d3364dcf668ae78c48f4429f3d17ee8a5796a64c 100644 (file)
@@ -2380,3 +2380,47 @@ void BOPDS_DS::InitPaveBlocksForVertex(const Standard_Integer theNV)
     }
   }
 }
+
+//=======================================================================
+//function : ReleasePaveBlocks
+//purpose  :
+//=======================================================================
+void BOPDS_DS::ReleasePaveBlocks()
+{
+  // It is necessary to remove the reference to PaveBlocks for the untouched
+  // edges to avoid creation of the same images for them.
+  // Pave blocks for this reference should be cleared.
+  // This will allow to differ the small edges, for which it is
+  // impossible to build pave block from the normal edges for which the
+  // pave block have been created, but stayed untouched.
+  // The small edge, for which no pave blocks have been created,
+  // should be avoided in the result, thus the reference to empty list
+  // of pave blocks will stay to mark the edge as Deleted.
+
+  BOPDS_VectorOfListOfPaveBlock& aPBP = ChangePaveBlocksPool();
+  Standard_Integer aNbPBP = aPBP.Extent();
+  if (!aNbPBP) {
+    return;
+  }
+  //
+  for (Standard_Integer i = 0; i < aNbPBP; ++i) {
+    BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
+    if (aLPB.Extent() == 1) {
+      const Handle(BOPDS_PaveBlock)& aPB = aLPB.First();
+      if (!IsCommonBlock(aPB)) {
+        Standard_Integer nV1, nV2;
+        aPB->Indices(nV1, nV2);
+        if (!IsNewShape(nV1) && !IsNewShape(nV2)) {
+          // Both vertices are original, thus the PB is untouched.
+          // Remove reference for the original edge
+          Standard_Integer nE = aPB->OriginalEdge();
+          if (nE >= 0) {
+            ChangeShapeInfo(nE).SetReference(-1);
+          }
+          // Clear contents of the list
+          aLPB.Clear();
+        }
+      }
+    }
+  }
+}
index 4bedb2a81842bb1e9fcd934137c94cd2d1d25a09..644a6677e20f129cf25ce1d95d97e9c7afcaf123 100644 (file)
@@ -3,7 +3,7 @@
 
 puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
 puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 Linux: Error : The area of the resulting shape is"
+puts "TODO OCC26020 ALL: Error : The area of the resulting shape is"
 
 # planar face 
 plane pln_f1 32.294537607197917 1.8096910201742288e-014 -39.176406819310692 -0.77162458338772011 -6.6613381477509373e-016 -0.63607822027776384
@@ -53,5 +53,5 @@ mkface f9 pln_f9 -1000000 1000000 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7 f8 f9
 
-set square 2.20868e+013
+set square 0
 
index 6c16aa9224d28886dd7a35ad841108365f22a25b..d1bb1af541569e1528602c6908e709296a1a0e67 100755 (executable)
@@ -1,4 +1,5 @@
 puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC25917 ALL: Error : The square of result shape is"
 puts "========================"
 puts " OCC472 "
 puts "(case 3)"
diff --git a/tests/bugs/modalg_6/bug28683 b/tests/bugs/modalg_6/bug28683
new file mode 100644 (file)
index 0000000..f7f56b9
--- /dev/null
@@ -0,0 +1,16 @@
+puts "========"
+puts "OCC28683"
+puts "========"
+puts ""
+####################################################################################
+## Wrong result of CUT operation
+####################################################################################
+
+restore [locate_data_file bug28683_shapes.brep] b
+explode b
+bcut result b_1 b_2
+donly result
+checkshape result
+checknbshapes result -vertex 6 -edge 6 -wire 1 -face 1
+
+set square 1.82492
index d9d52c5314431da62370c86747e324af8b0ee72a..acf1a28a1d6a80e404da6f9f1aba5aea1c1c67e6 100644 (file)
@@ -2,7 +2,7 @@
 # Date : 02 Dec 98
 
 puts "TODO OCC22803 All: Error: The tolerance of the resulting shape is too big"
-#puts "TODO OCC23511 Linux: The area of the resulting shape is 186543"
+puts "TODO OCC23511 ALL: The area of the resulting shape is "
 
 restore [locate_data_file CFE903_pro12ggx.rle] base
 
index 30efb80b0608ed8029d229888559e43921f01be2..52c8bef68081baba2be53224ebeaef809ea0ae6a 100644 (file)
@@ -1,5 +1,8 @@
-puts "TODO OCC23748 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC23547 ALL: Error : The volume of the resulting shape is"
+#puts "TODO OCC23748 ALL: Faulty shapes in variables faulty_1 to faulty_"
+#puts "TODO OCC23547 ALL: Error : The volume of the resulting shape is"
+puts "TODO OCC23748 ALL: ERROR. offsetperform operation not done."
+puts "TODO OCC23748 ALL: TEST INCOMPLETE"
+
 psphere s 15 270
 
 OFFSETSHAPE 1 {s_2} $calcul $type
index d6974ba2f312fad0d62aeaa1a90871647a99b880..1c26604b46aee445a369b019a480b1f11173c392 100644 (file)
@@ -1,7 +1,7 @@
 puts "TODO ?OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_"
 puts "TODO ?OCC23068 ALL: Error : The area of face "
 puts "TODO OCC23068 ALL: Error : The volume of the resulting shape "
-puts "TODO OCC25406 ALL: Error: bsection of the result and s is not equal to zero"
+#puts "TODO OCC25406 ALL: Error: bsection of the result and s is not equal to zero"
 
 psphere s 15 -90 60 270