]> OCCT Git - occt-copy.git/commitdiff
0026619: Tolerances of operands are modified using bop
authormsv <msv@opencascade.com>
Wed, 21 Oct 2015 09:36:03 +0000 (12:36 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 23 Dec 2015 07:33:43 +0000 (10:33 +0300)
0026796: The result of General Fuse operation is self-intersecting shape

The fix forces creation of new sub-shapes (vertex, edge) when the tolerance of some sub-shape of an argument is to be increased.

This new behavior is turned off by default. It can be turned on using two ways:
1) Setting 'locking' flag of the arguments.
2) Calling the method SetNonDestructive(Standard_True) of the API classes.

Various bug fixes in the algorithm:
- Compute correct tolerance values for intersections of type Line/Line, Line/Plane, Plane/Plane.
- In case of Line/Plane intersection check if line's vertices lie on the plane.
- Do not allow decreasing of the tolerance value of the Line/Line intersection vertex.
- In IntTools_EdgeEdge, call the method FindParameters with proper 3D tolerance of the curve.
- Force making copy of a degenerated edge if its vertex is touched but no 2D intersection with other curves is found.
- Remove pave blocks both ends of which became referring to the same vertex after vertices substitution.
- Avoid exception in IntTools_Context::IsVertexOnLine if Extrema is not done.
- Reduce tolerance of vertex/edge using actual distances to interfered shapes if it was increased due to line/line, line/plane, or plane/plane small intersection angle.
- Update tolerance of edges to reach all representations in a common block.
- In V-E intersections, check if a vertex hits beyond shrunk range, in such case create V-V interference.
- Do not put a section edge to the result if it becomes to be a micro edge after updating its vertex.
- Correctly make vertices same-domain during the work of MakeBlocks.
- Decrease shrunk range at least on a Precision::Confusion() in addition to vertex tolerance.
- Add Confusion to bounding boxes of new shapes in DS
- Add tolerance Precision::Confusion() to compare distances of touching cases to fix regressions.

TODO marks have been removed from (or modified in) the following test cases (Improvements):
boolean bsection M3 N2 R2
boolean gdml_private B6 C2 C6 G7 I6 F6 J1 J4 M7 N1 N8 N9 O3 O4 O6 O8 O9 P1 P2 P5 Q1 Q3 Q5 S9 T2 U4 U5 U9 ZB5 ZB6 ZC1 ZC5 ZD3 ZD6 ZD7 ZH2 ZH5 ZI2 ZI5 ZI7 ZI9 ZJ3 ZJ4 ZJ7 F8 I6 G1
boolean volumemaker A5 A6 B3 B4 B7 B9 D3 D4 D7 F1
boolean bopcut_2d D5
bugs modalg_5 bug25043
bugs modalg_2 bug472_1 bug472_2 bug472_3

Test cases updated because they are still bad but can be accepted as non-regression:
boolean volumemaker C4 A3 A7 E6
bugs modalg_1 bug10232
boolean bsection N2

Put new TODO in the scripts:
bugs modalg_5 bug25232_9
bugs modalg_6 bug26619
bugs modalg_1 buc60462_2
bugs modalg_4 bug772

For the following tests the result in fix became better, so take fix result as the reference:
bugs modalg_5 bug24628
bugs modalg_6 bug26954_3
boolean volumemaker A4 B5 B6 C3 C8 D2 D5 F2
bugs modalg_2 bug472_2
bugs modalg_1 buc60776_1

- Add the method SetNonDestructive to API classes of user level

144 files changed:
src/BOPAlgo/BOPAlgo_BOP.cxx
src/BOPAlgo/BOPAlgo_Builder.cxx
src/BOPAlgo/BOPAlgo_Builder.hxx
src/BOPAlgo/BOPAlgo_Builder_1.cxx
src/BOPAlgo/BOPAlgo_Builder_2.cxx
src/BOPAlgo/BOPAlgo_Builder_3.cxx
src/BOPAlgo/BOPAlgo_CheckerSI.cxx
src/BOPAlgo/BOPAlgo_CheckerSI.hxx
src/BOPAlgo/BOPAlgo_MakerVolume.cxx
src/BOPAlgo/BOPAlgo_PaveFiller.cxx
src/BOPAlgo/BOPAlgo_PaveFiller.hxx
src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx [new file with mode: 0644]
src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_4.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/BOPAlgo/BOPAlgo_PaveFiller_9.cxx
src/BOPAlgo/BOPAlgo_Tools.cxx
src/BOPAlgo/BOPAlgo_Tools.hxx
src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx
src/BOPAlgo/FILES
src/BOPDS/BOPDS_CommonBlock.cxx
src/BOPDS/BOPDS_CommonBlock.hxx
src/BOPDS/BOPDS_CoupleOfPaveBlocks.hxx
src/BOPDS/BOPDS_DS.cxx
src/BOPDS/BOPDS_DS.hxx
src/BOPDS/BOPDS_Interf.hxx
src/BOPTest/BOPTest_APICommands.cxx
src/BOPTest/BOPTest_BOPCommands.cxx
src/BOPTest/BOPTest_Objects.cxx
src/BOPTest/BOPTest_Objects.hxx
src/BOPTest/BOPTest_OptionCommands.cxx
src/BOPTest/BOPTest_PartitionCommands.cxx
src/BOPTools/BOPTools_AlgoTools.cxx
src/BOPTools/BOPTools_AlgoTools.hxx
src/BOPTools/BOPTools_AlgoTools_1.cxx
src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx
src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx
src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.hxx
src/IntTools/IntTools_BeanFaceIntersector.cxx
src/IntTools/IntTools_Context.cxx
src/IntTools/IntTools_Context.hxx
src/IntTools/IntTools_EdgeEdge.cxx
src/IntTools/IntTools_EdgeEdge.hxx
src/IntTools/IntTools_EdgeFace.cxx
src/IntTools/IntTools_FaceFace.cxx
src/IntTools/IntTools_FaceFace.hxx
src/IntTools/IntTools_ShrunkRange.cxx
src/IntTools/IntTools_Tools.cxx
src/IntTools/IntTools_Tools.hxx
src/QABugs/QABugs_19.cxx
tests/boolean/bopcut_2d/D5
tests/boolean/bsection/M3
tests/boolean/bsection/N2
tests/boolean/bsection/R2
tests/boolean/gdml_private/B6
tests/boolean/gdml_private/C2
tests/boolean/gdml_private/C6
tests/boolean/gdml_private/F6
tests/boolean/gdml_private/F8
tests/boolean/gdml_private/G1
tests/boolean/gdml_private/G7
tests/boolean/gdml_private/H7
tests/boolean/gdml_private/I6
tests/boolean/gdml_private/J1
tests/boolean/gdml_private/J4
tests/boolean/gdml_private/M7
tests/boolean/gdml_private/N1
tests/boolean/gdml_private/N8
tests/boolean/gdml_private/N9
tests/boolean/gdml_private/O1
tests/boolean/gdml_private/O3
tests/boolean/gdml_private/O4
tests/boolean/gdml_private/O6
tests/boolean/gdml_private/O8
tests/boolean/gdml_private/O9
tests/boolean/gdml_private/P1
tests/boolean/gdml_private/P2
tests/boolean/gdml_private/P5
tests/boolean/gdml_private/Q1
tests/boolean/gdml_private/Q3
tests/boolean/gdml_private/Q5
tests/boolean/gdml_private/S9
tests/boolean/gdml_private/T2
tests/boolean/gdml_private/U4
tests/boolean/gdml_private/U5
tests/boolean/gdml_private/U9
tests/boolean/gdml_private/ZB5
tests/boolean/gdml_private/ZB6
tests/boolean/gdml_private/ZC1
tests/boolean/gdml_private/ZC5
tests/boolean/gdml_private/ZD3
tests/boolean/gdml_private/ZD6
tests/boolean/gdml_private/ZD7
tests/boolean/gdml_private/ZH2
tests/boolean/gdml_private/ZH5
tests/boolean/gdml_private/ZI2
tests/boolean/gdml_private/ZI5
tests/boolean/gdml_private/ZI7
tests/boolean/gdml_private/ZI9
tests/boolean/gdml_private/ZJ3
tests/boolean/gdml_private/ZJ4
tests/boolean/gdml_private/ZJ7
tests/boolean/volumemaker/A3
tests/boolean/volumemaker/A4
tests/boolean/volumemaker/A5
tests/boolean/volumemaker/A6
tests/boolean/volumemaker/A7
tests/boolean/volumemaker/B3
tests/boolean/volumemaker/B4
tests/boolean/volumemaker/B5
tests/boolean/volumemaker/B6
tests/boolean/volumemaker/B7
tests/boolean/volumemaker/B9
tests/boolean/volumemaker/C2
tests/boolean/volumemaker/C3
tests/boolean/volumemaker/C4
tests/boolean/volumemaker/C8
tests/boolean/volumemaker/C9
tests/boolean/volumemaker/D1
tests/boolean/volumemaker/D2
tests/boolean/volumemaker/D3
tests/boolean/volumemaker/D4
tests/boolean/volumemaker/D5
tests/boolean/volumemaker/D7
tests/boolean/volumemaker/E6
tests/boolean/volumemaker/F1
tests/boolean/volumemaker/F2
tests/bugs/modalg_1/buc60462_2
tests/bugs/modalg_1/buc60776_1
tests/bugs/modalg_1/bug10232
tests/bugs/modalg_2/bug472_1
tests/bugs/modalg_2/bug472_2
tests/bugs/modalg_2/bug472_3
tests/bugs/modalg_4/bug772
tests/bugs/modalg_5/bug24628
tests/bugs/modalg_5/bug25043
tests/bugs/modalg_5/bug25232_9
tests/bugs/modalg_6/bug26619 [new file with mode: 0644]
tests/bugs/modalg_6/bug26954_3

index f4da3cabe869bbd734737596143d7ebb6169aa6e..392cbc72dc0c67e5a453db6191e116213192c044 100644 (file)
@@ -375,6 +375,7 @@ void BOPAlgo_BOP::Perform()
   pPF->SetRunParallel(myRunParallel);
   pPF->SetProgressIndicator(myProgressIndicator);
   pPF->SetFuzzyValue(myFuzzyValue);
+  pPF->SetNonDestructive(myNonDestructive);
   //
   pPF->Perform();
   //
index 6240147948461f729cad7ae02b2145d09b7d80db..1f0a76e757e69fa797dd7bf9fcb3b41a3f367e9f 100644 (file)
 #include <Standard_ErrorHandler.hxx>
 #include <Standard_Failure.hxx>
 #include <TopoDS_Compound.hxx>
-#include <TopoDS_Shape.hxx>
+#include <BRep_Builder.hxx>
+
+#include <BOPCol_IndexedMapOfShape.hxx>
+
+#include <BOPDS_ShapeInfo.hxx>
+#include <BOPDS_DS.hxx>
+
+#include <BOPTools_AlgoTools.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 
+
 //=======================================================================
 //function : 
 //purpose  : 
@@ -43,7 +51,8 @@ BOPAlgo_Builder::BOPAlgo_Builder()
   myShapesSD(100, myAllocator),
   mySplits(100, myAllocator),
   myOrigins(100, myAllocator),
-  myFuzzyValue(0.)
+  myFuzzyValue(0.),
+  myNonDestructive(Standard_False)
 {
 }
 //=======================================================================
@@ -63,7 +72,8 @@ BOPAlgo_Builder::BOPAlgo_Builder
   myShapesSD(100, myAllocator),
   mySplits(100, myAllocator),
   myOrigins(100, myAllocator),
-  myFuzzyValue(0.)
+  myFuzzyValue(0.),
+  myNonDestructive(Standard_False)
 {
 }
 //=======================================================================
@@ -192,6 +202,22 @@ Standard_Real BOPAlgo_Builder::FuzzyValue() const
   return myFuzzyValue;
 }
 //=======================================================================
+//function : SetNonDestructive
+//purpose  : 
+//=======================================================================
+void BOPAlgo_Builder::SetNonDestructive(const Standard_Boolean theFlag)
+{
+  myNonDestructive = theFlag;
+}
+//=======================================================================
+//function : NonDestructive
+//purpose  : 
+//=======================================================================
+Standard_Boolean BOPAlgo_Builder::NonDestructive() const
+{
+  return myNonDestructive;
+}
+//=======================================================================
 // function: CheckData
 // purpose: 
 //=======================================================================
@@ -259,6 +285,7 @@ void BOPAlgo_Builder::Perform()
   pPF->SetRunParallel(myRunParallel);
   pPF->SetProgressIndicator(myProgressIndicator);
   pPF->SetFuzzyValue(myFuzzyValue);
+  pPF->SetNonDestructive(myNonDestructive);
   //
   pPF->Perform();
   //
@@ -272,6 +299,8 @@ void BOPAlgo_Builder::Perform()
 void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
 {
   myEntryPoint=0;
+  myNonDestructive = theFiller.NonDestructive();
+  myFuzzyValue = theFiller.FuzzyValue();
   PerformInternal(theFiller);
 }
 //=======================================================================
@@ -406,17 +435,30 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
   PostTreat();
   
 }
-//
-// myErrorStatus
-// 
-// 0  - Ok
-// 
 //=======================================================================
 //function : PostTreat
 //purpose  : 
 //=======================================================================
 void BOPAlgo_Builder::PostTreat()
 {
-  BOPTools_AlgoTools::CorrectTolerances(myShape, 0.05, myRunParallel);
-  BOPTools_AlgoTools::CorrectShapeTolerances(myShape, myRunParallel);
+  Standard_Integer i, aNbS;
+  TopAbs_ShapeEnum aType;
+  BOPCol_IndexedMapOfShape aMA;
+  if (myPaveFiller->NonDestructive()) {
+    // MapToAvoid
+    aNbS=myDS->NbSourceShapes();
+    for (i=0; i<aNbS; ++i) {
+      const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
+      aType=aSI.ShapeType();
+      if (aType==TopAbs_VERTEX ||
+          aType==TopAbs_EDGE||
+          aType==TopAbs_FACE) {
+        const TopoDS_Shape& aS=aSI.Shape();
+        aMA.Add(aS);
+      }
+    }
+  }
+  //
+  BOPTools_AlgoTools::CorrectTolerances(myShape, aMA, 0.05, myRunParallel);
+  BOPTools_AlgoTools::CorrectShapeTolerances(myShape, aMA, myRunParallel);
 }
index c98a8f0c3b666ab121148aad319a660121f5846f..2a229a0cc28a6df545fd20764664054fce128030 100644 (file)
@@ -64,7 +64,7 @@ Standard_EXPORT virtual ~BOPAlgo_Builder();
   Standard_EXPORT virtual void SetArguments (const BOPCol_ListOfShape& theLS);
   
   Standard_EXPORT const BOPCol_ListOfShape& Arguments() const;
-  
+
   Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
   
   Standard_EXPORT virtual void PerformWithFiller (const BOPAlgo_PaveFiller& theFiller);
@@ -99,7 +99,18 @@ Standard_EXPORT virtual ~BOPAlgo_Builder();
   //! Returns the additional tolerance
   Standard_EXPORT Standard_Real FuzzyValue() const;
 
+  //! Sets the flag that defines the mode of treatment.
+  //! In non-destructive mode the argument shapes are not modified. Instead
+  //! a copy of a sub-shape is created in the result if it is needed to be updated.
+  //! This flag is taken into account if internal PaveFiller is used only.
+  //! In the case of calling PerformWithFiller the corresponding flag of that PaveFiller
+  //! is in force.
+  Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag);
 
+  //! Returns the flag that defines the mode of treatment.
+  //! In non-destructive mode the argument shapes are not modified. Instead
+  //! a copy of a sub-shape is created in the result if it is needed to be updated.
+  Standard_EXPORT Standard_Boolean NonDestructive() const;
 
 
 protected:
@@ -162,7 +173,7 @@ protected:
   BOPCol_DataMapOfShapeListOfShape mySplits;
   BOPCol_DataMapOfShapeShape myOrigins;
   Standard_Real myFuzzyValue;
-
+  Standard_Boolean myNonDestructive;
 
 private:
 
index 0801e1a7e96a64b79cee30d6767b673777b0658e..b710e618dc5eeba35b3cd7332f37eaace7a2d32b 100644 (file)
@@ -86,7 +86,7 @@
       aItPB.Initialize(aLPB);
       for (; aItPB.More(); aItPB.Next()) {
         const Handle(BOPDS_PaveBlock)& aPB=aItPB.Value();
-        const Handle(BOPDS_PaveBlock)& aPBR=myDS->RealPaveBlock(aPB);
+        Handle(BOPDS_PaveBlock) aPBR=myDS->RealPaveBlock(aPB);
         //
         nSpR=aPBR->Edge();
         const TopoDS_Shape& aSpR=myDS->Shape(nSpR);
index a303a7bbb4119854f5c03c433593ed5a74bf0285..b17734d7adccf02998a8aaed2f8906705cbe7150 100644 (file)
@@ -208,10 +208,10 @@ class BOPAlgo_VFI : public BOPAlgo_Algo {
   }
   //
   virtual void Perform() {
-    Standard_Real aT1, aT2;
+    Standard_Real aT1, aT2, dummy;
     //
     BOPAlgo_Algo::UserBreak();
-    myFlag=myContext->ComputeVF(myV, myF, aT1, aT2);
+    myFlag = myContext->ComputeVF(myV, myF, aT1, aT2, dummy);
   }
   //
  protected:
@@ -405,8 +405,10 @@ void BOPAlgo_Builder::BuildSplitFaces()
       aLE.Append(aSp);
     }
     //
-    BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane (aLE, aFF);
-    //
+    if (!myPaveFiller->NonDestructive()) {
+      // speed up for planar faces
+      BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane (aLE, aFF);
+    }
     // 3 Build split faces
     BOPAlgo_BuilderFace& aBF=aVBF.Append1();
     aBF.SetFace(aF);
index 81b59ab05f7da854da93da30269f5dd77aa0d927..d7438acbac9e5ca78dce870caa5c5bd6e5048228 100644 (file)
@@ -581,6 +581,7 @@ void BOPAlgo_Builder::FillIn3DParts
         }
         Bnd_Box aBox;
         BRepBndLib::Add(aSx, aBox);
+        aBox.SetGap(aBox.GetGap() + Precision::Confusion());
         //
         BOPAlgo_ShapeBox& aSB=aVSB.Append1();
         aSB.SetShape(aSx);
index b8252eb0153732709b8d492b3c17e92784417d53..9c35a3c95c1d74011b8b196e799b1546a268fc07 100644 (file)
@@ -70,22 +70,6 @@ void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel)
   }
 }
 //=======================================================================
-//function : SetNonDestructive
-//purpose  : 
-//=======================================================================
-void BOPAlgo_CheckerSI::SetNonDestructive(const Standard_Boolean theFlag)
-{
-  myNonDestructive=theFlag;
-}
-//=======================================================================
-//function : NonDestructive
-//purpose  : 
-//=======================================================================
-Standard_Boolean BOPAlgo_CheckerSI::NonDestructive() const 
-{
-  return myNonDestructive;
-}
-//=======================================================================
 //function : Init
 //purpose  : 
 //=======================================================================
index 6e649aa1110e6e00514dfd4e40b845771fb5804a..acb766278d45fb3f0254e886fe68e8c1a5a3a792 100644 (file)
@@ -50,21 +50,6 @@ Standard_EXPORT virtual ~BOPAlgo_CheckerSI();
   //! 4 - V/V, V/E, E/E, V/F and E/F;
   //! 5 - all interferences, default value.
   Standard_EXPORT void SetLevelOfCheck (const Standard_Integer theLevel);
-  
-  //! Sets the flag <theFlag> that defines
-  //! the mode of the treatment:
-  //! the copy of the argument when theFlag is true
-  //! the argument itself  when theFlag is false
-  Standard_EXPORT void SetNonDestructive (const Standard_Boolean theFlag);
-  
-  //! Returns the flag that defines the
-  //! mode of the treatment:
-  //! true when the copy of the argument is used
-  //! false when the argument itself  is used
-  Standard_EXPORT Standard_Boolean NonDestructive() const;
-
-
-
 
 protected:
 
@@ -81,7 +66,6 @@ protected:
 
 
   Standard_Integer myLevelOfCheck;
-  Standard_Boolean myNonDestructive;
   BOPCol_DataMapOfShapeShape myNewOldMap;
 
 
index 1743a0d5c8b2bb96f3291b449196769909af9fd4..b596db01541e33053525354b38172ef6f23b6a98 100644 (file)
@@ -100,6 +100,7 @@ void BOPAlgo_MakerVolume::Perform()
   pPF->SetRunParallel(myRunParallel);
   pPF->SetProgressIndicator(myProgressIndicator);
   pPF->SetFuzzyValue(myFuzzyValue);
+  pPF->SetNonDestructive(myNonDestructive);
   pPF->Perform();
   //
   myEntryPoint = 1;
index 1141abb47a297a847921f7b662b7f9a5ec7ad382..d2d0b158bad2ca04bb610eb76e4b46c865746e4f 100644 (file)
@@ -42,6 +42,8 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
 {
   myDS=NULL;
   myIterator=NULL;
+  myNonDestructive=Standard_False;
+  myIsPrimary=Standard_True;
 }
 //=======================================================================
 //function : 
@@ -55,6 +57,8 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
 {
   myDS=NULL;
   myIterator=NULL;
+  myNonDestructive=Standard_False;
+  myIsPrimary=Standard_True;
 }
 //=======================================================================
 //function : ~
@@ -65,6 +69,38 @@ BOPAlgo_PaveFiller::~BOPAlgo_PaveFiller()
   Clear();
 }
 //=======================================================================
+//function : SetNonDestructive
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::SetNonDestructive(const Standard_Boolean bFlag)
+{
+  myNonDestructive=bFlag;
+}
+//=======================================================================
+//function : NonDestructive
+//purpose  : 
+//=======================================================================
+Standard_Boolean BOPAlgo_PaveFiller::NonDestructive()const 
+{
+  return myNonDestructive;
+}
+//=======================================================================
+//function : SetIsPrimary
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::SetIsPrimary(const Standard_Boolean bFlag)
+{
+  myIsPrimary=bFlag;
+}
+//=======================================================================
+//function : IsPrimary
+//purpose  : 
+//=======================================================================
+Standard_Boolean BOPAlgo_PaveFiller::IsPrimary()const 
+{
+  return myIsPrimary;
+}
+//=======================================================================
 //function : Clear
 //purpose  : 
 //=======================================================================
@@ -175,6 +211,9 @@ void BOPAlgo_PaveFiller::Init()
   // 3 myContext
   myContext=new IntTools_Context;
   //
+  // 4 NonDestructive flag
+  SetNonDestructive();
+  //
   myErrorStatus=0;
 }
 //=======================================================================
@@ -224,34 +263,42 @@ void BOPAlgo_PaveFiller::PerformInternal()
     return; 
   }
   //
+  UpdatePaveBlocksWithSDVertices();
   myDS->UpdatePaveBlocks();
   // 11
   PerformEE();
   if (myErrorStatus) {
     return; 
   }
+  UpdatePaveBlocksWithSDVertices();
   // 02
   PerformVF();
   if (myErrorStatus) {
     return; 
   }
+  UpdatePaveBlocksWithSDVertices();
   // 12
   PerformEF();
   if (myErrorStatus) {
     return; 
   }
+  UpdatePaveBlocksWithSDVertices();
   //
-  MakeSplitEdges();
+  // 22
+  PerformFF();
   if (myErrorStatus) {
     return; 
   }
   //
-  // 22
-  PerformFF();
+  UpdateBlocksWithSharedVertices();
+  //
+  MakeSplitEdges();
   if (myErrorStatus) {
     return; 
   }
   //
+  UpdatePaveBlocksWithSDVertices();
+  //
   MakeBlocks();
   if (myErrorStatus) {
     return; 
@@ -268,7 +315,6 @@ void BOPAlgo_PaveFiller::PerformInternal()
   if (myErrorStatus) {
     return; 
   }
-  //
   // 03
   PerformVZ();
   if (myErrorStatus) {
index 62399568f9535c6c22a92687955385c9b7d7bce5..ab440e4ae1bc183557ca13bbe701ca6d7e76dbd2 100644 (file)
@@ -50,13 +50,13 @@ class IntTools_Context;
 class BOPDS_DS;
 class BOPAlgo_SectionAttribute;
 class BOPDS_PaveBlock;
+class BOPDS_CommonBlock;
 class TopoDS_Vertex;
 class gp_Pnt;
 class BOPDS_Curve;
 class TopoDS_Face;
 
 
-
 class BOPAlgo_PaveFiller  : public BOPAlgo_Algo
 {
 public:
@@ -65,7 +65,8 @@ public:
 
   
   Standard_EXPORT BOPAlgo_PaveFiller();
-Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
+
+  Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
   
   Standard_EXPORT BOPAlgo_PaveFiller(const BOPCol_BaseAllocator& theAllocator);
   
@@ -83,6 +84,16 @@ Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
   
   Standard_EXPORT void SetSectionAttribute (const BOPAlgo_SectionAttribute& theSecAttr);
   
+  //! Sets the flag that defines the mode of treatment.
+  //! In non-destructive mode the argument shapes are not modified. Instead
+  //! a copy of a sub-shape is created in the result if it is needed to be updated.
+  Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag);
+  
+  //! Returns the flag that defines the mode of treatment.
+  //! In non-destructive mode the argument shapes are not modified. Instead
+  //! a copy of a sub-shape is created in the result if it is needed to be updated.
+  Standard_EXPORT Standard_Boolean NonDestructive() const;
+
   Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
   
   //! Sets the additional tolerance
@@ -96,7 +107,14 @@ Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
 
 protected:
 
-  
+  //! Sets non-destructive mode automatically if an argument 
+  //! contains a locked sub-shape (see TopoDS_Shape::Locked()).
+  Standard_EXPORT void SetNonDestructive();
+     
+  Standard_EXPORT void SetIsPrimary(const Standard_Boolean theFlag);
+   
+  Standard_EXPORT Standard_Boolean IsPrimary() const;
+
   Standard_EXPORT virtual void PerformInternal();
   
   Standard_EXPORT virtual void Clear();
@@ -134,6 +152,8 @@ protected:
   Standard_EXPORT void MakeBlocks();
   
   Standard_EXPORT void MakePCurves();
+
+  Standard_EXPORT void MakeSDVertices(const BOPCol_ListOfInteger& theVertIndices);
   
   Standard_EXPORT void ProcessDE();
   
@@ -231,7 +251,7 @@ protected:
   
 
   //! Treatment of vertices that were created in EE intersections.
-  Standard_EXPORT void TreatNewVertices (const BOPCol_IndexedDataMapOfShapeInteger& theMVI, BOPCol_IndexedDataMapOfShapeListOfShape& theImages);
+  Standard_EXPORT void TreatNewVertices(const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, BOPCol_IndexedDataMapOfShapeListOfShape& theImages);
   
 
   //! Put paves on the curve <aBC> in case when <aBC>
@@ -276,6 +296,28 @@ protected:
   //! in the map <theDMI>.
   Standard_EXPORT void UpdatePaveBlocks (const BOPCol_DataMapOfIntegerInteger& theDMI);
 
+  //! Updates tolerance vertex nV due to V/E interference.
+  //! It always creates new vertex if nV is from arguments.
+  //! @return  DS index of updated vertex.
+  Standard_EXPORT Standard_Integer UpdateVertex(const Standard_Integer nV,
+                                                const Standard_Real aTolNew);
+   
+  Standard_EXPORT void UpdatePaveBlocksWithSDVertices();
+
+  Standard_EXPORT void UpdateCommonBlocksWithSDVertices();
+   
+  Standard_EXPORT void UpdateBlocksWithSharedVertices();
+   
+  Standard_EXPORT Standard_Boolean EstimatePaveOnCurve(const Standard_Integer nV,
+                                                       const BOPDS_Curve& theNC,
+                                                       const Standard_Real theTolR3D);
+      
+  Standard_EXPORT void UpdateEdgeTolerance(const Standard_Integer nE,
+                                           const Standard_Real aTolNew);
+
+  Standard_EXPORT void RemovePaveBlocks(const BOPCol_MapOfInteger theEdges);
+
+  Standard_EXPORT void CorrectToleranceOfSE();
 
   BOPCol_ListOfShape myArguments;
   BOPDS_PDS myDS;
@@ -283,6 +325,8 @@ protected:
   Handle(IntTools_Context) myContext;
   BOPAlgo_SectionAttribute mySectionAttribute;
   Standard_Real myFuzzyValue;
+  Standard_Boolean myNonDestructive;
+  Standard_Boolean myIsPrimary;
 
 
 private:
index 418bdaef9e926cbb76fdd7e996732c9126ebb31f..1780f1f186a58222b306c734ebefd46b5796ddf3 100644 (file)
@@ -20,6 +20,7 @@
 #include <BOPAlgo_PaveFiller.hxx>
 #include <BOPAlgo_SectionAttribute.hxx>
 #include <BOPAlgo_Tools.hxx>
+#include <BOPCol_DataMapOfIntegerInteger.hxx>
 #include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
 #include <BOPCol_ListOfShape.hxx>
 #include <BOPCol_MapOfInteger.hxx>
 #include <BOPDS_VectorOfInterfVV.hxx>
 #include <BOPTools_AlgoTools.hxx>
 #include <BRepBndLib.hxx>
+#include <BRep_TVertex.hxx>
+#include <BRep_Tool.hxx>
 #include <gp_Pnt.hxx>
 #include <IntTools_Context.hxx>
 #include <NCollection_BaseAllocator.hxx>
+#include <Precision.hxx>
+#include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
 #include <TopoDS_Vertex.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;
   //
@@ -58,8 +60,6 @@ void BOPAlgo_PaveFiller::PerformVV()
     return; 
   }
   //
-  aSIn.SetShapeType(TopAbs_VERTEX);
-  
   BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV();
   aVVs.SetIncrement(aSize);
   //
@@ -68,7 +68,6 @@ void BOPAlgo_PaveFiller::PerformVV()
     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()) {
@@ -91,47 +90,80 @@ void BOPAlgo_PaveFiller::PerformVV()
   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);
-    //
-    // Appennd 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;
+  //
+  BOPCol_DataMapOfIntegerInteger& aDMII=myDS->ShapesSD();
+  aItDMII.Initialize(aDMII);
+  for (; aItDMII.More(); aItDMII.Next()) {
+    n1=aItDMII.Key();
+    myDS->InitPaveBlocksForVertex(n1);
   }
   //
   //-----------------------------------------------------scope t
-  aLV.Clear();
   aMBlocks.Clear();
   aMILI.Clear();
 }
+
+//=======================================================================
+// function: PerformVV
+// purpose: 
+//=======================================================================
+void BOPAlgo_PaveFiller::MakeSDVertices(const BOPCol_ListOfInteger& theVertIndices)
+{
+  TopoDS_Vertex aVSD, aVn;
+  BOPCol_ListIteratorOfListOfInteger aItLI(theVertIndices);
+  BOPCol_ListOfShape aLV;
+  for (; aItLI.More(); aItLI.Next()) {
+    Standard_Integer nX = aItLI.Value();
+    Standard_Integer nSD;
+    if (myDS->HasShapeSD(nX, nSD)) {
+      aVSD = TopoDS::Vertex(myDS->Shape(nSD));
+    }
+    const TopoDS_Shape& aV = myDS->Shape(nX);
+    aLV.Append(aV);
+  }
+  BOPTools_AlgoTools::MakeVertex(aLV, aVn);
+  if (!aVSD.IsNull()) {
+    // 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));
+  }
+  //
+  // Append new vertex to the DS
+  BOPDS_ShapeInfo aSIn;
+  aSIn.SetShapeType(TopAbs_VERTEX);
+  aSIn.SetShape(aVn);
+  Standard_Integer n = myDS->Append(aSIn);
+  //
+  BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(n);
+  Bnd_Box& aBox = aSIDS.ChangeBox();
+  BRepBndLib::Add(aVn, aBox);
+  aBox.SetGap(aBox.GetGap() + Precision::Confusion());
+  //
+  // Fill ShapesSD
+  BOPDS_VectorOfInterfVV& aVVs = myDS->InterfVV();
+  aVVs.SetIncrement(theVertIndices.Extent());
+  //
+  aItLI.Initialize(theVertIndices);
+  for (; aItLI.More(); aItLI.Next()) {
+    Standard_Integer n1 = aItLI.Value();
+    myDS->AddShapeSD(n1, n);
+    //
+    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(n);
+    }
+  }
+}
diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx
new file mode 100644 (file)
index 0000000..9587ecc
--- /dev/null
@@ -0,0 +1,232 @@
+// Created by: Peter KURNEV
+// Copyright (c) 2010-2014 OPEN CASCADE SAS
+// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
+//                         EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and / or modify it
+// under the terms of the GNU Lesser General Public version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <BOPAlgo_PaveFiller.hxx>
+
+#include <Precision.hxx>
+
+#include <gp_Pnt.hxx>
+#include <Bnd_Box.hxx>
+
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Edge.hxx>
+
+#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepBndLib.hxx>
+
+#include <BOPDS_ShapeInfo.hxx>
+#include <BOPDS_VectorOfListOfPaveBlock.hxx>
+#include <BOPDS_MapOfCommonBlock.hxx>
+#include <BOPDS_ListOfPaveBlock.hxx>
+#include <BOPDS_CommonBlock.hxx>
+#include <BOPDS_DS.hxx>
+
+//=======================================================================
+//function : SetNonDestructive
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::SetNonDestructive() 
+{
+  if (!myIsPrimary || myNonDestructive) {
+    return;
+  }
+  //
+  Standard_Boolean bFlag;
+  BOPCol_ListIteratorOfListOfShape aItLS;
+  //
+  bFlag=Standard_False;
+  aItLS.Initialize(myArguments);
+  for(; aItLS.More() && (!bFlag); aItLS.Next()) {
+    const TopoDS_Shape& aS=aItLS.Value();
+    bFlag=aS.Locked();
+  }
+  myNonDestructive=bFlag;
+}
+//=======================================================================
+//function : UpdateEdgeTolerance
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
+                                              const Standard_Real aTol)
+{
+  Standard_Boolean bIsNewShape, bHasShapeSD;
+  Standard_Integer nV, nVx;
+  Standard_Real aTolV;
+  BRep_Builder aBB;
+  BOPCol_ListIteratorOfListOfInteger aIt;
+  //
+  BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
+  const BOPCol_ListOfInteger& aLI=aSIE.SubShapes();
+  //
+  if (myNonDestructive) {
+    bIsNewShape=myDS->IsNewShape(nE);
+    if (!bIsNewShape) {
+      return;
+    }
+    //
+    aIt.Initialize(aLI);
+    for (; aIt.More(); aIt.Next()) {
+      nV = aIt.Value();
+      bHasShapeSD=myDS->HasShapeSD(nV, nVx);
+      if (bHasShapeSD) {
+        continue;
+      }
+      bIsNewShape=myDS->IsNewShape(nV);
+      if (!bIsNewShape) {
+        return;
+      }
+    }
+  }
+  //
+  const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
+  aBB.UpdateEdge(aE, aTol);
+  Bnd_Box& aBoxE=aSIE.ChangeBox();
+  BRepBndLib::Add(aE, aBoxE);
+  aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
+  //
+  aIt.Initialize(aLI);
+  for (; aIt.More(); aIt.Next()) {
+    nV = aIt.Value();
+    bHasShapeSD=myDS->HasShapeSD(nV, nVx);
+    if (bHasShapeSD) {
+      nV=nVx;
+    }
+    const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
+    aTolV = BRep_Tool::Tolerance(aV);
+    if (aTolV < aTol) {
+      aBB.UpdateVertex(aV, aTol);
+      BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
+      Bnd_Box& aBoxV = aSIV.ChangeBox();
+      BRepBndLib::Add(aV, aBoxV);
+      aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
+    }
+  }
+}
+//=======================================================================
+//function : UpdateVertex
+//purpose  : 
+//=======================================================================
+Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
+  (const Standard_Integer nV,
+   const Standard_Real aTolNew)
+{
+  Standard_Integer nVNew;
+  Standard_Real aTolV;
+  BRep_Builder aBB;
+  
+  nVNew = nV;
+  if (myDS->IsNewShape(nVNew) || 
+      myDS->HasShapeSD(nV, nVNew) ||
+      !myNonDestructive) {
+    // nV is a new vertex, it has SD or non-destructive mode is not in force
+    const TopoDS_Vertex& aVSD = *(TopoDS_Vertex*)&myDS->Shape(nVNew);
+    aTolV = BRep_Tool::Tolerance(aVSD);
+    if (aTolV < aTolNew) {
+      aBB.UpdateVertex(aVSD, aTolNew);
+      BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew);
+      Bnd_Box& aBoxV = aSIV.ChangeBox();
+      BRepBndLib::Add(aVSD, aBoxV);
+      aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
+    }
+    return nVNew;
+  }
+  //
+  // nV is old vertex
+  const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
+  aTolV = BRep_Tool::Tolerance(aV);
+  //
+  // create new vertex
+  TopoDS_Vertex aVNew;
+  gp_Pnt aPV = BRep_Tool::Pnt(aV);
+  aBB.MakeVertex(aVNew, aPV, Max(aTolV, aTolNew));
+  //
+  // append new vertex to DS
+  BOPDS_ShapeInfo aSIV;
+  aSIV.SetShapeType(TopAbs_VERTEX);
+  aSIV.SetShape(aVNew);
+  nVNew = myDS->Append(aSIV);
+  //
+  // bounding box for the new vertex
+  BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew);
+  Bnd_Box& aBoxDS = aSIDS.ChangeBox();
+  BRepBndLib::Add(aVNew, aBoxDS);
+  aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
+  //
+  // add vertex to SD map
+  myDS->AddShapeSD(nV, nVNew);
+  //
+  myDS->InitPaveBlocksForVertex(nV);
+  //
+  return nVNew;
+}
+//=======================================================================
+//function : UpdatePaveBlocksWithSDVertices
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices()
+{
+  myDS->UpdatePaveBlocksWithSDVertices();
+}
+//=======================================================================
+//function : UpdateCommonBlocksWithSDVertices
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
+{
+  if (!myNonDestructive) {
+    UpdatePaveBlocksWithSDVertices();
+    return;
+  }
+  Standard_Integer aNbPBP;
+  //
+  BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
+  aNbPBP=aPBP.Extent();
+  if(!aNbPBP) {
+    return;
+  }
+  //
+  Standard_Integer i, nV1, nV2;
+  Standard_Real aTolV;
+  BOPDS_MapOfCommonBlock aMCB;
+  BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+  Handle(BOPDS_PaveBlock) aPB;
+  // 
+  aTolV = Precision::Confusion();
+  //
+  for (i=0; i<aNbPBP; ++i) {
+    BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
+    aItPB.Initialize(aLPB);
+    for (; aItPB.More(); aItPB.Next()) {
+      aPB=aItPB.Value();
+      const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
+      if (aCB.IsNull()) {
+        continue;
+      }
+      //
+      if (aMCB.Add(aCB)) {
+        myDS->SortPaveBlocks(aCB);
+        aPB->Indices(nV1, nV2);
+        UpdateVertex(nV1, aTolV);
+        UpdateVertex(nV2, aTolV);
+        myDS->UpdateCommonBlockWithSDVertices(aCB);
+      }
+    }
+  }
+  UpdatePaveBlocksWithSDVertices();
+}
index a8ce76a0a60d9cfdd126796d517720fb9a858610..3658d3df718ab99009a7a0bf79f9e331bf93ab89 100644 (file)
 #include <BOPDS_PassKey.hxx>
 #include <BOPDS_PaveBlock.hxx>
 #include <BOPDS_VectorOfInterfVE.hxx>
+#include <BOPTools_AlgoTools.hxx>
 #include <BRep_Builder.hxx>
 #include <BRep_Tool.hxx>
 #include <BRepBndLib.hxx>
 #include <gp_Pnt.hxx>
 #include <IntTools_Context.hxx>
+#include <IntTools_Tools.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Face.hxx>
 #include <TopoDS_Vertex.hxx>
+#include <Precision.hxx>
 
 //=======================================================================
 //class    : BOPAlgo_VertexEdgeEdge
@@ -48,7 +51,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
 
   BOPAlgo_VertexEdge() : 
     BOPAlgo_Algo(),
-    myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.) {
+    myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.), myTolVNew(-1.) {
   };
   //
   virtual ~BOPAlgo_VertexEdge(){
@@ -74,15 +77,15 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
     myV=aV;
   }
   //
-  const TopoDS_Vertex& Vertex()const {
-    return myV;
-  }
-  //
   void SetEdge(const TopoDS_Edge& aE) {
     myE=aE;
   }
   //
-  const TopoDS_Edge& Edge()const {
+  const TopoDS_Vertex& Vertex() const {
+    return myV;
+  }
+  //
+  const TopoDS_Edge& Edge() const {
     return myE;
   }
   //
@@ -94,6 +97,10 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
     return myT;
   }
   //
+  Standard_Real VertexNewTolerance()const {
+    return myTolVNew;
+  }
+  //
   void SetContext(const Handle(IntTools_Context)& aContext) {
     myContext=aContext;
   }
@@ -104,7 +111,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
   //
   virtual void Perform() {
     BOPAlgo_Algo::UserBreak();
-    myFlag=myContext->ComputeVE (myV, myE, myT);
+    myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew);
   };
   //
  protected:
@@ -113,6 +120,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
   Standard_Integer myIVx;
   Standard_Integer myFlag;
   Standard_Real myT;
+  Standard_Real myTolVNew;
   TopoDS_Vertex myV;
   TopoDS_Edge myE;
   Handle(IntTools_Context) myContext;
@@ -140,15 +148,16 @@ void BOPAlgo_PaveFiller::PerformVE()
 {
   Standard_Boolean bJustAdd;
   Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx,  k, aNbVE;
-  Standard_Real aT, aTolE, aTolV;
+  Standard_Real aT, aT1, aT2, aTS1, aTS2;
   BOPDS_Pave aPave;
   BOPDS_PassKey aPK;
   BOPDS_MapOfPassKey aMPK;
-  BRep_Builder aBB;
   BOPAlgo_VectorOfVertexEdge aVVE;
   //
   myErrorStatus=0;
   //
+  FillShrunkData(TopAbs_VERTEX, TopAbs_EDGE);
+  //
   myIterator->Initialize(TopAbs_VERTEX, TopAbs_EDGE);
   iSize=myIterator->ExpectedLength();
   if (!iSize) {
@@ -188,6 +197,12 @@ void BOPAlgo_PaveFiller::PerformVE()
       continue;
     }
     //
+    const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(nE);
+    if (aLPB.IsEmpty() || !aLPB.First()->HasShrunkData()) {
+      // this is a micro edge, ignore it
+      continue;
+    }
+    //
     const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape())); 
     const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx))); 
     //
@@ -211,29 +226,50 @@ void BOPAlgo_PaveFiller::PerformVE()
     if (!iFlag) {
       aVESolver.Indices(nV, nE, nVx);
       aT=aVESolver.Parameter();
-      const TopoDS_Vertex& aV=aVESolver.Vertex();
-      const TopoDS_Edge& aE=aVESolver.Edge();
+      // 
+      // check if vertex hits beyond shrunk range, in such case create V-V interf
+      const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(nE);
+      const Handle(BOPDS_PaveBlock)& aPB = aLPB.First();
+      Bnd_Box aBox;
+      aPB->Range(aT1, aT2);
+      aPB->ShrunkData(aTS1, aTS2, aBox);
+      IntTools_Range aPaveR[2] = { IntTools_Range(aT1, aTS1), IntTools_Range(aTS2, aT2) };
+      Standard_Real aTol = Precision::Confusion();
+      Standard_Boolean isOnPave = Standard_False;
+      for (Standard_Integer i = 0; i < 2; i++) {
+        if (IntTools_Tools::IsOnPave1(aT, aPaveR[i], aTol)) {
+          Standard_Integer nV1 = (i == 0 ? aPB->Pave1().Index() : aPB->Pave2().Index());
+          if (!myDS->HasInterf(nV, nV1)) {
+            BOPCol_ListOfInteger aLI;
+            aLI.Append(nV);
+            aLI.Append(nV1);
+            MakeSDVertices(aLI);
+          }
+          isOnPave = Standard_True;
+          break;
+        }
+      }
+      if (isOnPave)
+        continue;
+      //
       // 1
       BOPDS_InterfVE& aVE=aVEs.Append1();
       aVE.SetIndices(nV, nE);
       aVE.SetParameter(aT);
       // 2
       myDS->AddInterf(nV, nE);
-      // 3
-      BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE);
-      Handle(BOPDS_PaveBlock)& aPB=*((Handle(BOPDS_PaveBlock)*)&aLPB.First());
-      // 
+      //
+      // 3 update vertex V/E if necessary
+      Standard_Real aTolVNew = aVESolver.VertexNewTolerance();
+      nVx=UpdateVertex(nV, aTolVNew);
+      //4
+      if (myDS->IsNewShape(nVx)) {
+        aVE.SetIndexNew(nVx);
+      }
+      //5 append ext pave to pave block
       aPave.SetIndex(nVx);
       aPave.SetParameter(aT);
       aPB->AppendExtPave(aPave);
-      aTolV = BRep_Tool::Tolerance(aV);
-      aTolE = BRep_Tool::Tolerance(aE);
-      if ( aTolV < aTolE) {
-        aBB.UpdateVertex(aV, aTolE);
-        BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVx);
-        Bnd_Box& aBoxDS=aSIDS.ChangeBox();
-        BRepBndLib::Add(aV, aBoxDS);
-      }
     }
   }//for (k=0; k < aNbVE; ++k) {
 } 
index bbad799819aa008d7886cf2202a9c0bd00908e39..cf54ded8a084ea52668b5607988f66003b64a062 100644 (file)
 #include <BOPDS_PaveBlock.hxx>
 #include <BOPDS_VectorOfInterfEE.hxx>
 #include <BOPTools_AlgoTools.hxx>
-#include <BRep_Builder.hxx>
+
 #include <BRep_Tool.hxx>
 #include <BRepBndLib.hxx>
 #include <BRepTools.hxx>
+#include <BRepAdaptor_Curve.hxx>
 #include <GeomAPI_ProjectPointOnCurve.hxx>
 #include <gp_Pnt.hxx>
 #include <IntTools_CommonPrt.hxx>
 #include <TopoDS_Face.hxx>
 #include <TopoDS_Vertex.hxx>
 
-//
-//
-//
-//
-//
-//
 /////////////////////////////////////////////////////////////////////////
 //=======================================================================
 //class    : BOPAlgo_EdgeEdge
@@ -239,7 +234,8 @@ class BOPAlgo_PVE {
   }
   //
   void Perform() {
-    myFlag=myContext->ComputeVE (myV, myE, myT);
+    Standard_Real dummy;
+    myFlag = myContext->ComputeVE(myV, myE, myT, dummy);
   };
   //
  protected:
@@ -392,7 +388,19 @@ void BOPAlgo_PaveFiller::PerformEE()
                    aR21(aT21, aTS21), aR22(aTS22, aT22);
     //
     const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
-    aNbCPrts=aCPrts.Length();
+    aNbCPrts = aCPrts.Length();
+    //
+    Standard_Boolean bLineLine = Standard_False;
+    if (aNbCPrts) {
+      const TopoDS_Edge& aOE1 = *(TopoDS_Edge*)&myDS->Shape(nE1);
+      const TopoDS_Edge& aOE2 = *(TopoDS_Edge*)&myDS->Shape(nE2);
+      //
+      BRepAdaptor_Curve aBAC1(aOE1), aBAC2(aOE2);
+      //
+      bLineLine = (aBAC1.GetType() == GeomAbs_Line &&
+                   aBAC2.GetType() == GeomAbs_Line);
+    }
+    //
     for (i=1; i<=aNbCPrts; ++i) {
       const IntTools_CommonPrt& aCPart=aCPrts(i);
       //
@@ -448,10 +456,19 @@ void BOPAlgo_PaveFiller::PerformEE()
           }
           //
           BOPTools_AlgoTools::MakeNewVertex(aE1, aT1, aE2, aT2, aVnew);
+          Standard_Real aTolVnew = BRep_Tool::Tolerance(aVnew);
+          if (bLineLine) {
+            // increase tolerance for Line/Line intersection, but do not update 
+            // the vertex till its intersection with some other shape
+            Standard_Real aTol = (aCR1.Last() - aCR1.First()) / 2.;
+            if (aTol > aTolVnew) {
+              aTolVnew = aTol;
+            }
+          }
           // <-LXBR
           {
             Standard_Integer nVS[2], iFound;
-            Standard_Real aTolVx, aTolVnew, aD2, aDT2;
+            Standard_Real aTolVx, aD2, aDT2;
             BOPCol_MapOfInteger aMV;
             gp_Pnt aPnew, aPx;
             //
@@ -469,7 +486,6 @@ void BOPAlgo_PaveFiller::PerformEE()
               nVS[j]=nV[3];
             }
             //
-            aTolVnew=BRep_Tool::Tolerance(aVnew);
             aPnew=BRep_Tool::Pnt(aVnew);
             //
             for (Standard_Integer k1=0; k1<=j; ++k1) {
@@ -503,6 +519,7 @@ void BOPAlgo_PaveFiller::PerformEE()
           //
           aCPB.SetPaveBlocks(aPB1, aPB2);
           aCPB.SetIndexInterf(iX);
+          aCPB.SetTolerance(aTolVnew);
           aMVCPB.Add(aVnew, aCPB);
         }//case TopAbs_VERTEX: 
           break;
@@ -571,7 +588,7 @@ void BOPAlgo_PaveFiller::PerformEE()
   aMPBToUpdate.Clear();
 }
 //=======================================================================
-//function : PerformVertices
+//function : PerformVerticesEE
 //purpose  : 
 //=======================================================================
 Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
@@ -603,17 +620,8 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
   BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
   //
   // 1 prepare arguments
-  //
-  // <- DEB
-  for (i=1; i<=aNbV; ++i) {
-    const TopoDS_Shape& aS=theMVCPB.FindKey(i);
-    const BOPDS_CoupleOfPaveBlocks& aCPB=theMVCPB.FindFromIndex(i);
-    iV=aCPB.IndexInterf();
-    aMVI.Add(aS, iV);
-  }
-  //
   // 2 Fuse vertices
-  TreatNewVertices(aMVI, aImages);
+  TreatNewVertices(theMVCPB, aImages);
   //
   // 3 Add new vertices to myDS; 
   //   connect indices to CPB structure
@@ -628,6 +636,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
     BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(iV);
     Bnd_Box& aBox=aSIDS.ChangeBox();
     BRepBndLib::Add(aV, aBox);
+    aBox.SetGap(aBox.GetGap() + Precision::Confusion());
     //
     aItLS.Initialize(aLVSD);
     for (; aItLS.More(); aItLS.Next()) {
@@ -729,33 +738,30 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
 //purpose  : 
 //=======================================================================
 void BOPAlgo_PaveFiller::TreatNewVertices
-  (const BOPCol_IndexedDataMapOfShapeInteger& aMapVI,
+(const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
    BOPCol_IndexedDataMapOfShapeListOfShape& myImages)
 {
   Standard_Integer  i, aNbV;//, aNbVSD;
   Standard_Real aTol;
   TopoDS_Vertex aVnew;
-  TopoDS_Shape aVF;
   BOPCol_IndexedMapOfShape aMVProcessed;
   BOPCol_MapOfInteger aMFence;
   BOPCol_ListIteratorOfListOfInteger aIt;
-  BOPCol_IndexedDataMapOfShapeListOfShape aDMVLV;
+  NCollection_Vector<BOPCol_ListOfShape> aVecOfLVSD;
   //
-  BOPCol_BoxBndTreeSelector aSelector;
   BOPCol_BoxBndTree aBBTree;
   NCollection_UBTreeFiller <Standard_Integer, 
                             Bnd_Box> aTreeFiller(aBBTree);
   BOPAlgo_VectorOfTNV aVTNV;
   //
-  aNbV = aMapVI.Extent();
+  aNbV = theMVCPB.Extent();
   for (i=1; i<=aNbV; ++i) {
-    const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMapVI.FindKey(i));
+    const TopoDS_Vertex& aV = *((TopoDS_Vertex*)&theMVCPB.FindKey(i));
     Bnd_Box aBox;
     //
-    aTol=BRep_Tool::Tolerance(aV);
-    aBox.SetGap(aTol);
+    aTol = theMVCPB.FindFromIndex(i).Tolerance();
     aBox.Add(BRep_Tool::Pnt(aV));
-    aBox.Enlarge(aTol);
+    aBox.SetGap(aTol);
     //
     aTreeFiller.Add(i, aBox);
     //
@@ -806,14 +812,8 @@ void BOPAlgo_PaveFiller::TreatNewVertices
         break; // from for(;;) 
       }
       //
-      aLIP.Clear();
-      aItLIP.Initialize(aLIP1);
-      for(; aItLIP.More(); aItLIP.Next()) {
-        aIP=aItLIP.Value();
-        aLIP.Append(aIP);
-        aLIPC.Append(aIP);
-      }
-      aLIP1.Clear();
+      aLIP = aLIP1;
+      aLIPC.Append(aLIP1); // items of aLIP1 are moved to aLIPC
     }// for(;;) {
     //
     aItLIP.Initialize(aLIPC);
@@ -822,23 +822,15 @@ void BOPAlgo_PaveFiller::TreatNewVertices
       const TopoDS_Vertex& aVP=aVTNV(aIP-1).Vertex(); 
       aLVSD.Append(aVP);
     }
-    aVF=aLVSD.First();
-    aDMVLV.Add(aVF, aLVSD);
+    aVecOfLVSD.Append(aLVSD);
   }// for (i=1; i<=aNbV; ++i) {
 
   // Make new vertices
-  aNbV = aDMVLV.Extent();
-  for (i = 1; i <= aNbV; ++i) {
-    const TopoDS_Shape& aV = aDMVLV.FindKey(i);
-    const BOPCol_ListOfShape& aLVSD = aDMVLV(i);
-    if (aLVSD.IsEmpty()) {
-      myImages.Add(aV, aLVSD);
-    }
-    else {
-      BOPCol_ListOfShape* pLVSD=(BOPCol_ListOfShape*)&aLVSD;
-      BOPTools_AlgoTools::MakeVertex(*pLVSD, aVnew);
-      myImages.Add(aVnew, aLVSD);
-    } 
+  aNbV = aVecOfLVSD.Size();
+  for (i = 0; i < aNbV; ++i) {
+    const BOPCol_ListOfShape& aLVSD = aVecOfLVSD(i);
+    BOPTools_AlgoTools::MakeVertex(aLVSD, aVnew);
+    myImages.Add(aVnew, aLVSD);
   }
 }
 //=======================================================================
@@ -891,8 +883,8 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
                                        Handle(BOPDS_PaveBlock)& aPB,
                                        BOPDS_MapOfPaveBlock& aMPBToUpdate)
 {
-  Standard_Integer aNbPnt, nE;
-  gp_Pnt aP;
+  Standard_Integer nE, nVx, nVSD, iFlag;
+  Standard_Real aT, aTolVNew;
   //
   nE = aPB->OriginalEdge();
   //
@@ -909,60 +901,44 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
     return;
   }
   //
-  if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) {
+  if (aPB->Pave1().Index() == nV || 
+      aPB->Pave2().Index() == nV) {
     return;
   }
   //
-  const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
-  const TopoDS_Edge&   aE = *(TopoDS_Edge*)  &myDS->Shape(nE);
-  aP=BRep_Tool::Pnt(aV);
+  nVx = nV;
+  if (myDS->HasShapeSD(nV, nVSD)) {
+    nVx = nVSD;
+  }
   //
-  GeomAPI_ProjectPointOnCurve& aProjector=myContext->ProjPC(aE);
-  aProjector.Perform(aP);
+  const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nVx);
+  const TopoDS_Edge&   aE = *(TopoDS_Edge*)  &myDS->Shape(nE);
   //
-  aNbPnt = aProjector.NbPoints();
-  if (aNbPnt) {
-    Standard_Real aT, aDist;
-    //Standard_Integer i;
-    BRep_Builder aBB;
+  iFlag = myContext->ComputeVE(aV, aE, aT, aTolVNew);
+  if (iFlag == 0 || iFlag == -4) {
     BOPDS_Pave aPave;
     //
-    aDist=aProjector.LowerDistance();
-    aT=aProjector.LowerDistanceParameter();
     //
     BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
     aVEs.SetIncrement(10);
+    // 1
     BOPDS_InterfVE& aVE=aVEs.Append1();
     aVE.SetIndices(nV, nE);
     aVE.SetParameter(aT);
-    //
+    // 2
     myDS->AddInterf(nV, nE);
     //
-    aBB.UpdateVertex(aV, aDist);
-    BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
-    Bnd_Box& aBox=aSIDS.ChangeBox();
-    BRepBndLib::Add(aV, aBox);
-    //
-    aPave.SetIndex(nV);
+    // 3 update vertex V/E if necessary
+    nVx=UpdateVertex(nV, aTolVNew);
+    // 4
+    if (myDS->IsNewShape(nVx)) {
+      aVE.SetIndexNew(nVx);
+    }
+    // 5 append ext pave to pave block
+    aPave.SetIndex(nVx);
     aPave.SetParameter(aT);
     aPB->AppendExtPave(aPave);
     //
     aMPBToUpdate.Add(aPB);
   }
 }
-
- /*
-  // DEBf
-  { 
-    TopoDS_Compound aCx;
-    BRep_Builder aBBx;
-    aBBx.MakeCompound(aCx);
-    aItMVCPB.Initialize(theMVCPB);
-    for (; aItMVCPB.More(); aItMVCPB.Next()) {
-      const TopoDS_Shape& aS=aItMVCPB.Key();
-      aBBx.Add(aCx, aS);
-    }
-    BRepTools::Write(aCx, "cx");
-  }
-  // DEBt
-  */
index c43f8ba50eb5e2965f600a366a2d97f87aece641..902f52590c469e0e35e8ea40df4372304c7826ae 100644 (file)
@@ -54,7 +54,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
   BOPAlgo_VertexFace() : 
     BOPAlgo_Algo(),
     myIV(-1), myIF(-1), myIVx(-1), 
-    myFlag(-1), myT1(-1.),  myT2(-1.) {
+    myFlag(-1), myT1(-1.),  myT2(-1.), myTolVNew(-1.) {
   }
   //
   virtual ~BOPAlgo_VertexFace(){
@@ -102,6 +102,10 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
     aT2=myT2;
   }
   //
+  Standard_Real VertexNewTolerance()const {
+    return myTolVNew;
+  }
+  //
   void SetContext(const Handle(IntTools_Context)& aContext) {
     myContext=aContext;
   }
@@ -112,7 +116,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
   //
   virtual void Perform() {
     BOPAlgo_Algo::UserBreak();
-    myFlag=myContext->ComputeVF(myV, myF, myT1, myT2);
+    myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew);
   }
   //
  protected:
@@ -122,6 +126,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
   Standard_Integer myFlag;
   Standard_Real myT1;
   Standard_Real myT2;
+  Standard_Real myTolVNew;
   TopoDS_Vertex myV;
   TopoDS_Face myF;
   Handle(IntTools_Context) myContext;
@@ -149,8 +154,7 @@ void BOPAlgo_PaveFiller::PerformVF()
 {
   Standard_Boolean bJustAdd;
   Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, aNbVF, k;
-  Standard_Real aT1, aT2, aTolF, aTolV;
-  BRep_Builder aBB;
+  Standard_Real aT1, aT2;
   BOPAlgo_VectorOfVertexFace aVVF; 
   //
   myErrorStatus=0;
@@ -214,27 +218,25 @@ void BOPAlgo_PaveFiller::PerformVF()
       //
       aVertexFace.Indices(nV, nF, nVx);
       aVertexFace.Parameters(aT1, aT2);
-      const TopoDS_Vertex& aV=aVertexFace.Vertex();
-      const TopoDS_Face& aF=aVertexFace.Face();
       // 1
       BOPDS_InterfVF& aVF=aVFs.Append1();
       aVF.SetIndices(nVx, nF);
       aVF.SetUV(aT1, aT2);
       // 2
       myDS->AddInterf(nVx, nF);
-      // 3
+      //
+      // 3 update vertex V/F if necessary
+      Standard_Real aTolVNew = aVertexFace.VertexNewTolerance();
+      nVx=UpdateVertex(nVx, aTolVNew);
+      //
+      // 4
+      if (myDS->IsNewShape(nVx)) {
+        aVF.SetIndexNew(nVx);
+      }
+      // 5 update FaceInfo
       BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
       BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
       aMVIn.Add(nVx);
-      // 4
-      aTolV = BRep_Tool::Tolerance(aV);
-      aTolF = BRep_Tool::Tolerance(aF);
-      if (aTolV < aTolF) {
-        aBB.UpdateVertex(aV, aTolF);
-        BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx);
-        Bnd_Box& aBoxV = aSIV.ChangeBox();
-        BRepBndLib::Add(aV, aBoxV);
-      }
     }//for (k=0; k < aNbVF; ++k) {
   }// if (iSize) {
   else {
@@ -252,7 +254,7 @@ void BOPAlgo_PaveFiller::PerformVF()
 void BOPAlgo_PaveFiller::TreatVerticesEE()
 {
   Standard_Integer i, aNbS,aNbEEs, nF, nV, iFlag;
-  Standard_Real aT1, aT2;
+  Standard_Real aT1, aT2, dummy;
   BOPCol_ListIteratorOfListOfInteger aItLI;
   Handle(NCollection_BaseAllocator) aAllocator;
   //
@@ -313,7 +315,7 @@ void BOPAlgo_PaveFiller::TreatVerticesEE()
     if (!aMVOn.Contains(nV)) {
       const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nV))); 
       const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF))); 
-      iFlag=myContext->ComputeVF(aV, aF, aT1, aT2);
+      iFlag = myContext->ComputeVF(aV, aF, aT1, aT2, dummy);
       if (!iFlag) {
         // 1
         BOPDS_InterfVF& aVF=aVFs.Append1();
index 3f9824a2640c557e6647be70b780b95945f7473d..8c40a99cc54bc83df63ae4c1f67c33c398529615 100644 (file)
@@ -16,6 +16,8 @@
 // commercial license or contractual agreement.
 
 
+#include <Precision.hxx>
+
 #include <Bnd_Box.hxx>
 #include <BOPAlgo_PaveFiller.hxx>
 #include <BOPAlgo_SectionAttribute.hxx>
@@ -23,6 +25,7 @@
 #include <BOPCol_MapOfInteger.hxx>
 #include <BOPCol_NCVector.hxx>
 #include <BOPCol_Parallel.hxx>
+#include <BOPCol_DataMapOfShapeReal.hxx>
 #include <BOPDS_CommonBlock.hxx>
 #include <BOPDS_CoupleOfPaveBlocks.hxx>
 #include <BOPDS_Curve.hxx>
 #include <IntTools_Range.hxx>
 #include <IntTools_SequenceOfCommonPrts.hxx>
 #include <IntTools_Tools.hxx>
+#include <TopoDS.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Face.hxx>
 #include <TopoDS_Vertex.hxx>
 
-//
-//
-//
-//
-//
-//
-//
-//
-//
 //=======================================================================
 //class    : BOPAlgo_EdgeFace
 //purpose  : 
@@ -159,7 +154,6 @@ void BOPAlgo_PaveFiller::PerformEF()
   TopAbs_ShapeEnum aType;
   BOPDS_ListIteratorOfListOfPaveBlock aIt;
   BOPAlgo_VectorOfEdgeFace aVEdgeFace; 
-  BRep_Builder aBB;
   //-----------------------------------------------------scope f
   //
   aAllocator=NCollection_BaseAllocator::CommonBaseAllocator();
@@ -272,7 +266,17 @@ void BOPAlgo_PaveFiller::PerformEF()
     const BOPCol_MapOfInteger& aMIFIn=aFI.VerticesIn();
     //~~~
     const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeFace.CommonParts();
-    aNbCPrts=aCPrts.Length();
+    aNbCPrts = aCPrts.Length();
+    //
+    Standard_Boolean bLinePlane = Standard_False;
+    if (aNbCPrts) {
+      BRepAdaptor_Curve aBAC(aE);
+      BRepAdaptor_Surface aBAS(aF, Standard_False);
+      //
+      bLinePlane = (aBAC.GetType() == GeomAbs_Line &&
+                    aBAS.GetType() == GeomAbs_Plane);
+    }
+
     for (i=1; i<=aNbCPrts; ++i) {
       const IntTools_CommonPrt& aCPart=aCPrts(i);
       aType=aCPart.Type();
@@ -294,7 +298,8 @@ void BOPAlgo_PaveFiller::PerformEF()
           bIsOnPave[0]=IntTools_Tools::IsInRange(aR1, aR, aTolToDecide); 
           bIsOnPave[1]=IntTools_Tools::IsInRange(aR2, aR, aTolToDecide); 
           //
-          if (bIsOnPave[0] && bIsOnPave[1]) {
+          if ((bIsOnPave[0] && bIsOnPave[1]) || 
+              (bLinePlane && (bIsOnPave[0] || bIsOnPave[1]))) {
             bV[0]=CheckFacePaves(nV[0], aMIFOn, aMIFIn);
             bV[1]=CheckFacePaves(nV[1], aMIFOn, aMIFIn);
             if (bV[0] && bV[1]) {
@@ -318,10 +323,23 @@ void BOPAlgo_PaveFiller::PerformEF()
               if (bV[j]) {
                 const TopoDS_Vertex& aV=
                   (*(TopoDS_Vertex *)(&myDS->Shape(nV[j])));
-                BOPTools_AlgoTools::UpdateVertex(aE, aT, aV);
-                BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV[j]);
-                Bnd_Box& aBoxDS=aSIDS.ChangeBox();
-                BRepBndLib::Add(aV, aBoxDS);
+                //
+                Standard_Real f, l, aTolVnew, aDistPP, aTolPC, aTolV;
+                //
+                const Handle(Geom_Curve)& aCur = BRep_Tool::Curve(aE, f, l);
+                //
+                gp_Pnt aP1 = BRep_Tool::Pnt(aV);
+                gp_Pnt aP2 = aCur->Value(aT);
+                //
+                
+                aDistPP=aP1.Distance(aP2);
+                
+                aTolPC=Precision::PConfusion();
+                aTolV=BRep_Tool::Tolerance(aV);
+                if (aDistPP > (aTolV+aTolPC)) {
+                  aTolVnew=Max(aTolE, aDistPP);
+                  UpdateVertex(nV[j], aTolVnew);
+              }
               }
               else {
                 bIsOnPave[j] = ForceInterfVF(nV[j], nF);
@@ -334,16 +352,22 @@ void BOPAlgo_PaveFiller::PerformEF()
               continue;
             }
             //
+            Standard_Real aTolVnew = BRep_Tool::Tolerance(aVnew);
+            aTolVnew = Max(aTolVnew, Max(aTolE, aTolF));
+            BRep_Builder().UpdateVertex(aVnew, aTolVnew);
+            if (bLinePlane) {
+              // increase tolerance for Line/Plane intersection, but do not update 
+              // the vertex till its intersection with some other shape
+              IntTools_Range aCR = aCPart.Range1();
+              aTolVnew = Max(aTolVnew, (aCR.Last() - aCR.First()) / 2.);
+            }
+            //
             const gp_Pnt& aPnew = BRep_Tool::Pnt(aVnew);
-            Standard_Real aTolV = BRep_Tool::Tolerance(aVnew);
-            aTolV = Max(aTolV, Max(aTolE, aTolF));
             //
-            if (!myContext->IsPointInFace(aPnew, aF, aTolV)) {
+            if (!myContext->IsPointInFace(aPnew, aF, aTolVnew)) {
               continue;
             }
             //
-            aBB.UpdateVertex(aVnew, aTolV);
-            //
             aMIEFC.Add(nF);
             // 1
             BOPDS_InterfEF& aEF=aEFs.Append1();
@@ -357,6 +381,7 @@ void BOPAlgo_PaveFiller::PerformEF()
             //
             aCPB.SetPaveBlocks(aPB, aPB);
             aCPB.SetIndexInterf(iX);
+            aCPB.SetTolerance(aTolVnew);
             aMVCPB.Add(aVnew, aCPB);
           }
         }
@@ -375,11 +400,6 @@ void BOPAlgo_PaveFiller::PerformEF()
             myDS->AddInterf(nE, nF);
             break;
           }
-          //update tolerance of edge if needed
-          if (aTolE < aTolF) {
-            myDS->UpdateEdgeTolerance(nE, aTolF);
-            aTolE = aTolF;
-          }
           aEF.SetCommonPart(aCPart);
           // 2
           myDS->AddInterf(nE, nF);
@@ -417,7 +437,7 @@ void BOPAlgo_PaveFiller::PerformEF()
   ////aAllocator.Nullify();
 }
 //=======================================================================
-//function : PerformVertices1
+//function : PerformVerticesEF
 //purpose  : 
 //=======================================================================
 Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
@@ -433,7 +453,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
   }
   //
   Standard_Integer nVx, nVSD, iV, iErr, nE, iFlag, iX, i, aNbPBLI;
-  Standard_Real aT;
+  Standard_Real aT, dummy;
   TopoDS_Shape aV;
   BOPCol_ListIteratorOfListOfShape aItLS;
   BOPCol_ListIteratorOfListOfInteger aItLI;
@@ -445,17 +465,28 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
   BOPCol_DataMapOfShapeInteger aMVI(100, theAllocator);
   BOPDS_IndexedDataMapOfPaveBlockListOfInteger aMPBLI(100, theAllocator);
   BOPAlgo_PaveFiller aPF(theAllocator); 
+  BOPCol_DataMapOfShapeReal aMVIniTol;
   //
   aSI.SetShapeType(TopAbs_VERTEX);
   BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF();
   //
   // 1 prepare arguments
   for (i=1; i<=aNbV; ++i) {
-    const TopoDS_Shape& aS=theMVCPB.FindKey(i);
-    aLS.Append(aS);
+    const TopoDS_Vertex& aV = TopoDS::Vertex(theMVCPB.FindKey(i));
+    aLS.Append(aV);
+    // if an enlarged tolerance is associated with the vertex then update it 
+    // remembering its initial tolerance
+    Standard_Real aTolEnlarged = theMVCPB.FindFromIndex(i).Tolerance();
+    Standard_Real aIniTol = BRep_Tool::Tolerance(aV);
+    if (aTolEnlarged > aIniTol) {
+      aMVIniTol.Bind(aV, aIniTol);
+      BRep_Builder().UpdateVertex(aV, aTolEnlarged);
+    }
   }
   //
   // 2 Fuse vertices
+  aPF.SetIsPrimary(Standard_False);
+  aPF.SetNonDestructive(myNonDestructive);
   aPF.SetArguments(aLS);
   aPF.Perform();
   iErr=aPF.ErrorStatus();
@@ -465,7 +496,58 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
   }
   aPDS=aPF.PDS();
   //
+  // Recompute common vertex for each SD group containing enlarged vertex;
+  // for that first fill in the map of SD vertex -> its counterparts
+  BOPCol_IndexedDataMapOfShapeListOfShape aImages;
+  aItLS.Initialize(aLS);
+  for (; aItLS.More(); aItLS.Next()) {
+    const TopoDS_Shape& aVx = aItLS.Value();
+    nVx = aPDS->Index(aVx);
+    //
+    if (aPDS->HasShapeSD(nVx, nVSD)) {
+      aV = aPDS->Shape(nVSD);
+    }
+    else {
+      aV = aVx;
+    }
+    BOPCol_ListOfShape* pLst = aImages.ChangeSeek(aV);
+    if (!pLst) {
+      pLst = &aImages.ChangeFromIndex(aImages.Add(aV, BOPCol_ListOfShape()));
+    }
+    pLst->Append(aVx);
+  }
   // 3 Add new vertices to theDS; 
+  for (i = 1; i <= aImages.Extent(); i++) {
+    TopoDS_Vertex aV = TopoDS::Vertex(aImages.FindKey(i));
+    const BOPCol_ListOfShape& aLVSD = aImages.FindFromIndex(i);
+    Standard_Boolean isReset = Standard_False;
+    BOPCol_ListIteratorOfListOfShape it(aLVSD);
+    for (; it.More(); it.Next()) {
+      const TopoDS_Vertex& aVx = TopoDS::Vertex(it.Value());
+      const Standard_Real* pTolIni = aMVIniTol.Seek(aVx);
+      if (pTolIni) {
+        // reset enlarged vertex tolerance to the initial value
+        reinterpret_cast<BRep_TVertex*>(aVx.TShape().operator->())->Tolerance(*pTolIni);
+        isReset = Standard_True;
+      }
+    }
+    TopoDS_Vertex aVnew = aV;
+    if (isReset && aLVSD.Extent() > 1) {
+      // make new vertex again
+      BOPTools_AlgoTools::MakeVertex(aLVSD, aVnew);
+    }
+    // index of new vertex in theDS -> iV
+    aSI.SetShape(aVnew);
+    iV = myDS->Append(aSI);
+    //
+    BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(iV);
+    Bnd_Box& aBox = aSIDS.ChangeBox();
+    BRepBndLib::Add(aVnew, aBox);
+    aBox.SetGap(aBox.GetGap() + Precision::Confusion());
+    //
+    aMVI.Bind(aV, iV);
+  }
+  //
   // 4 Map PaveBlock/ListOfVertices to add to this PaveBlock ->aMPBLI
   aItLS.Initialize(aLS);
   for (; aItLS.More(); aItLS.Next()) {
@@ -478,20 +560,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
     else {
       aV=aVx;
     }
-    // index of new vertex in theDS -> iV
-    if (!aMVI.IsBound(aV)) {
-      aSI.SetShape(aV);
-      iV=myDS->Append(aSI);
-      //
-      BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(iV);
-      Bnd_Box& aBox=aSIDS.ChangeBox();
-      BRepBndLib::Add(aV, aBox);
-      //
-      aMVI.Bind(aV, iV);
-    }
-    else {
-      iV=aMVI.Find(aV);
-    }
+    iV = aMVI.Find(aV);
     //
     BOPDS_CoupleOfPaveBlocks &aCPB=theMVCPB.ChangeFromKey(aVx);
     aCPB.SetIndex(iV);
@@ -527,7 +596,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
       nVx=aItLI.Value();
       const TopoDS_Vertex& aVx=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
       //
-      iFlag=myContext->ComputeVE (aVx, aE, aT);
+      iFlag=myContext->ComputeVE (aVx, aE, aT, dummy);
       if (!iFlag) {
         aPave.SetIndex(nVx);
         aPave.SetParameter(aT);
@@ -535,7 +604,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
       }
     }
   }
-  // 6  Split PaveBlocksa
+  // 6  Split PaveBlocks
   for (i=1; i<=aNbPBLI; ++i) {
     Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
     nE=aPB->OriginalEdge();
@@ -620,46 +689,37 @@ Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF
    const Standard_Integer nF)
 {
   Standard_Boolean bRet;
+  Standard_Integer iFlag, nVx;
+  Standard_Real U, V, aTolVNew;
   //
   bRet = Standard_False;
   const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
   const TopoDS_Face&   aF = *(TopoDS_Face*)  &myDS->Shape(nF);
   //
-  GeomAPI_ProjectPointOnSurf& aProj = myContext->ProjPS(aF);
-  const gp_Pnt& aP = BRep_Tool::Pnt(aV);
-  aProj.Perform(aP);
-  if (!aProj.IsDone()) {
-    return bRet;
-  }
-  Standard_Real aDist, U, V;
-  //
-  aDist=aProj.LowerDistance();
-  aProj.LowerDistanceParameters(U, V);
+  iFlag = myContext->ComputeVF(aV, aF, U, V, aTolVNew);
+  if (iFlag == 0 || iFlag == -2) {
+    bRet=!bRet;
   //
-  gp_Pnt2d aP2d(U, V);
-  bRet = myContext->IsPointInFace (aF, aP2d);
-  if (bRet) {
-    //Standard_Integer i;
-    BRep_Builder aBB;
-    //
     BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
     aVFs.SetIncrement(10);
+    // 1
     BOPDS_InterfVF& aVF=aVFs.Append1();
+    //
     aVF.SetIndices(nV, nF);
     aVF.SetUV(U, V);
-    //
+    // 2
     myDS->AddInterf(nV, nF);
     //
-    aBB.UpdateVertex(aV, aDist);
-    BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
-    Bnd_Box& aBoxDS=aSIDS.ChangeBox();
-    BRepBndLib::Add(aV, aBoxDS);
+    // 3 update vertex V/F if necessary
+    nVx=UpdateVertex(nV, aTolVNew);
+    // 4
+    if (myDS->IsNewShape(nVx)) {
+      aVF.SetIndexNew(nVx);
+    }
     //
     BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
     BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
-    aMVIn.Add(nV);
+    aMVIn.Add(nVx);
   }
-  //
   return bRet;
 }
-
index bab10df97bee7f6db8dbf86d63c029bce94e2563..e195bb1e983860208cecf55f332cd7edc9482752 100644 (file)
 #include <BOPDS_ShapeInfo.hxx>
 #include <BOPDS_VectorOfCurve.hxx>
 #include <BOPDS_VectorOfPoint.hxx>
+#include <BOPTools.hxx>
 #include <BOPTools_AlgoTools.hxx>
 #include <BOPTools_AlgoTools3D.hxx>
 #include <BRep_Builder.hxx>
 #include <BRep_Tool.hxx>
+#include <BRep_TEdge.hxx>
 #include <BRepAdaptor_Curve.hxx>
 #include <BRepAdaptor_Surface.hxx>
 #include <BRepBndLib.hxx>
@@ -58,6 +60,7 @@
 #include <gp_Pnt.hxx>
 #include <IntSurf_ListOfPntOn2S.hxx>
 #include <IntSurf_PntOn2S.hxx>
+#include <IntTools.hxx>
 #include <IntTools_Context.hxx>
 #include <IntTools_Curve.hxx>
 #include <IntTools_EdgeFace.hxx>
@@ -70,6 +73,7 @@
 #include <Precision.hxx>
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
 #include <TopoDS_Compound.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Face.hxx>
@@ -181,7 +185,7 @@ void BOPAlgo_PaveFiller::PerformFF()
   Standard_Boolean bToSplit, bTangentFaces;
   Standard_Integer nF1, nF2, aNbCurves, aNbPoints, i, aNbLP;
   Standard_Integer aNbFaceFace, k;
-  Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF;
+  Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF, aTolReal;
   BRepAdaptor_Surface aBAS1, aBAS2;
   BOPCol_MapOfInteger aMI;
   BOPAlgo_VectorOfFaceFace aVFaceFace;
@@ -204,22 +208,21 @@ void BOPAlgo_PaveFiller::PerformFF()
     const TopoDS_Face& aF1=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
     const TopoDS_Face& aF2=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
     //
+    if (aMI.Add(nF1)) {
+      myDS->UpdateFaceInfoOn(nF1);
+      myDS->UpdateFaceInfoIn(nF1);
+    }
+    if (aMI.Add(nF2)) {
+      myDS->UpdateFaceInfoOn(nF2);
+      myDS->UpdateFaceInfoIn(nF2);
+    }
+    //
     aBAS1.Initialize(aF1, Standard_False);
     aBAS2.Initialize(aF2, Standard_False);
-    //
     if (aBAS1.GetType() == GeomAbs_Plane && 
         aBAS2.GetType() == GeomAbs_Plane) {
       Standard_Boolean bToIntersect;
       //
-      if (aMI.Add(nF1)) {
-        myDS->UpdateFaceInfoOn(nF1);
-        myDS->UpdateFaceInfoIn(nF1);
-      }
-      if (aMI.Add(nF2)) {
-        myDS->UpdateFaceInfoOn(nF2);
-        myDS->UpdateFaceInfoIn(nF2);
-      }
-      //
       bToIntersect = CheckPlanes(nF1, nF2);
       if (!bToIntersect) {
         myDS->AddInterf(nF1, nF2);
@@ -264,11 +267,15 @@ void BOPAlgo_PaveFiller::PerformFF()
     if (bIsDone) {
       aTolR3D=aFaceFace.TolReached3d();
       aTolR2D=aFaceFace.TolReached2d();
+      aTolReal = aFaceFace.TolReal();
       bTangentFaces=aFaceFace.TangentFaces();
       //
       if (aTolR3D < aTolFF){
         aTolR3D=aTolFF;
       }
+      if (aTolReal < aTolFF) {
+        aTolReal = aTolFF;
+      }
       if (aTolR2D < 1.e-7){
         aTolR2D=1.e-7;
       }
@@ -290,6 +297,7 @@ void BOPAlgo_PaveFiller::PerformFF()
       //
       aFF.SetTolR3D(aTolR3D);
       aFF.SetTolR2D(aTolR2D);
+      aFF.SetTolReal(aTolReal);
       aFF.SetTangentFaces(bTangentFaces);
       //
       // Curves, Points 
@@ -525,10 +533,11 @@ void BOPAlgo_PaveFiller::MakeBlocks()
               const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
               aTolE = BRep_Tool::Tolerance(aE);
               if (aTolR3D > aTolE) {
-                myDS->UpdateEdgeTolerance(nE, aTolR3D);
+                UpdateEdgeTolerance(nE, aTolR3D);
               }
               bInBothFaces = Standard_False;
-            } else {
+            } 
+            else {
               bInBothFaces = (aFI1.PaveBlocksOn().Contains(aPBOut) ||
                               aFI1.PaveBlocksIn().Contains(aPBOut))&&
                              (aFI2.PaveBlocksOn().Contains(aPBOut) ||
@@ -594,6 +603,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
   if (myErrorStatus) {
     return;
   }
+  // reduce tolerances of section edges where it is appropriate
+  CorrectToleranceOfSE();
   //
   // update face info
   UpdateFaceInfo(aDMExEdges, aDMI);
@@ -630,19 +641,20 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
   //
   Standard_Boolean bHasPaveBlocks, bOld;
   Standard_Integer iErr, nSx, nVSD, iX, iP, iC, j, nV, iV = 0, iE, k;
-  Standard_Integer jx, aNbLPBx;
-  Standard_Real aT;
+  Standard_Integer aNbLPBx;
   TopAbs_ShapeEnum aType;
   TopoDS_Shape aV, aE;
   BOPCol_ListIteratorOfListOfShape aItLS;
   BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
   BOPDS_PDS aPDS;
   Handle(BOPDS_PaveBlock) aPB1;
-  BOPDS_Pave aPave[2], aPave1[2];
+  BOPDS_Pave aPave[2];
   BOPDS_ShapeInfo aSI;
   //
   BOPCol_ListOfShape aLS(theAllocator);
   BOPAlgo_PaveFiller aPF(theAllocator);
+  aPF.SetIsPrimary(Standard_False);
+  aPF.SetNonDestructive(myNonDestructive);
   //
   BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
   //
@@ -756,7 +768,7 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
         else {
           aSI.SetShapeType(aType);
           aSI.SetShape(aSx);
-          iE=myDS->Append(aSI);
+          iE = myDS->Append(aSI);
           //
           aPB1->SetEdge(iE);
         }
@@ -767,8 +779,21 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
         BOPDS_Curve& aNC=aVNC(iC);
         BOPDS_ListOfPaveBlock& aLPBC=aNC.ChangePaveBlocks();
         //
-        const BOPDS_ListOfPaveBlock& aLPBx=aPDS->PaveBlocks(nSx);
-        aNbLPBx=aLPBx.Extent();
+        // check if edge occured to be micro edge;
+        // note we check not the edge aSx itself, but its image in aPDS
+        const BOPDS_ListOfPaveBlock& aLPBx = aPDS->PaveBlocks(nSx);
+        aNbLPBx = aLPBx.Extent();
+        if (aPDS->HasPaveBlocks(nSx) &&
+            (aNbLPBx == 0 || (aNbLPBx == 1 && !aLPBx.First()->HasShrunkData()))) {
+          BOPDS_ListIteratorOfListOfPaveBlock it(aLPBC);
+          for (; it.More(); it.Next()) {
+            if (it.Value() == aPB1) {
+              aLPBC.Remove(it);
+              break;
+            }
+          }
+          continue;
+        }
         //
         if (bOld && !aNbLPBx) {
           aDMExEdges.ChangeFind(aPB1).Append(aPB1);
@@ -805,10 +830,6 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
         //
         else {
           aItLPB.Initialize(aLPBx);
-          if (bOld) {
-            aPave1[0] = aPB1->Pave1();
-            aPave1[1] = aPB1->Pave2();
-          }
           for (; aItLPB.More(); aItLPB.Next()) {
             const Handle(BOPDS_PaveBlock)& aPBx=aItLPB.Value();
             const Handle(BOPDS_PaveBlock) aPBRx=aPDS->RealPaveBlock(aPBx);
@@ -817,33 +838,18 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
             aPave[0]=aPBx->Pave1();
             aPave[1]=aPBx->Pave2();
             for (j=0; j<2; ++j) {
-              jx = 0;
-              if (bOld) {
-                aT = aPave[j].Parameter();
-                if (aT == aPave1[0].Parameter()) {
-                  jx = 1;
-                } else if (aT == aPave1[1].Parameter()) {
-                  jx = 2;
-                }
-                //
-                if (jx) {
-                  iV = aPave1[jx-1].Index();
-                }
-              } 
-              if (!jx) {
-                nV=aPave[j].Index();
-                aV=aPDS->Shape(nV);
-                //
-                if (!aMVI.IsBound(aV)) {
-                  // index of new vertex in theDS -> iV
-                  aSI.SetShapeType(TopAbs_VERTEX);
-                  aSI.SetShape(aV);
-                  iV=myDS->Append(aSI);
-                  aMVI.Bind(aV, iV);
-                }
-                else {
-                  iV=aMVI.Find(aV);
-                }
+              nV = aPave[j].Index();
+              aV = aPDS->Shape(nV);
+              //
+              if (!aMVI.IsBound(aV)) {
+                // index of new vertex in theDS -> iV
+                aSI.SetShapeType(TopAbs_VERTEX);
+                aSI.SetShape(aV);
+                iV = myDS->Append(aSI);
+                aMVI.Bind(aV, iV);
+              }
+              else {
+                iV = aMVI.Find(aV);
               }
               const BOPDS_Pave& aP1 = !j ? aPB1->Pave1() : aPB1->Pave2();
               if (aP1.Parameter() == aPave[j].Parameter() && 
@@ -863,6 +869,14 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
               aSI.SetShape(aE);
               iE=myDS->Append(aSI);
               aMVI.Bind(aE, iE);
+              // update real edge tolerance according to distances in common block if any
+              if (aPDS->IsCommonBlock(aPBx)) {
+                const Handle(BOPDS_CommonBlock)& aCB = aPDS->CommonBlock(aPBx);
+                Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, aPDS, aPF.Context());
+                if (aFF.TolReal() < aTol) {
+                  aFF.SetTolReal(aTol);
+                }
+              }
             }
             else {
               iE=aMVI.Find(aE);
@@ -1035,14 +1049,13 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
 //function : IsExistingVertex
 //purpose  : 
 //=======================================================================
-  Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
-    (const gp_Pnt& aP,
-     const Standard_Real theTolR3D,
-     const BOPCol_MapOfInteger& aMVOnIn)const
+Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
+  (const gp_Pnt& aP,
+   const Standard_Real theTolR3D,
+   const BOPCol_MapOfInteger& aMVOnIn)const
 {
   Standard_Boolean bRet;
   Standard_Integer nV, iFlag;
-  Standard_Real aTolV;
   gp_Pnt aPV;
   Bnd_Box aBoxP;
   BOPCol_MapIteratorOfMapOfInteger aIt;
@@ -1054,14 +1067,10 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
   //
   aIt.Initialize(aMVOnIn);
   for (; aIt.More(); aIt.Next()) {
-    Bnd_Box aBoxV;
-    //
     nV=aIt.Value();
-    const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nV)));
-    aPV=BRep_Tool::Pnt(aV);
-    aTolV=BRep_Tool::Tolerance(aV);
-    aBoxV.Add(aP);
-    aBoxV.Enlarge(aTolV);
+    const BOPDS_ShapeInfo& aSIV=myDS->ShapeInfo(nV);
+    const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&aSIV.Shape()));
+    const Bnd_Box& aBoxV=aSIV.Box();
     //
     if (!aBoxP.IsOut(aBoxV)) {
       iFlag=BOPTools_AlgoTools::ComputeVV(aV, aP, theTolR3D);
@@ -1076,11 +1085,11 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
 //function : IsExistingPaveBlock
 //purpose  : 
 //=======================================================================
-  Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
-    (const Handle(BOPDS_PaveBlock)& thePB,
-     const BOPDS_Curve& theNC,
-     const Standard_Real theTolR3D,
-     const BOPCol_ListOfInteger& theLSE)
+Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
+  (const Handle(BOPDS_PaveBlock)& thePB,
+   const BOPDS_Curve& theNC,
+   const Standard_Real theTolR3D,
+   const BOPCol_ListOfInteger& theLSE)
 {
   Standard_Boolean bRet=Standard_True;
   //
@@ -1103,6 +1112,8 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
   aItLI.Initialize(theLSE);
   for (; aItLI.More(); aItLI.Next()) {
     nE=aItLI.Value();
+    if (nE < 0)
+      continue;
     const BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
     const Bnd_Box& aBoxE=aSIE.Box();
     if (!aBoxE.IsOut(aBoxPm)) {
@@ -1159,6 +1170,8 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
     const Handle(BOPDS_PaveBlock)& aPB = theMPBOnIn(i);
     aPB->Indices(nV21, nV22);
     nSp=aPB->Edge();
+    if (nSp < 0)
+      continue;
     const BOPDS_ShapeInfo& aSISp=myDS->ChangeShapeInfo(nSp);
     const TopoDS_Edge& aSp=(*(TopoDS_Edge *)(&aSISp.Shape()));
     const Bnd_Box& aBoxSp=aSISp.Box();
@@ -1288,6 +1301,7 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
       BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVn);
       Bnd_Box& aBoxDS=aSIDS.ChangeBox();
       BRepBndLib::Add(aVn, aBoxDS);
+      aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
       //
       aLVB.Append(nVn);
     }
@@ -1418,9 +1432,10 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance
 //function : GetEFPnts
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_PaveFiller::GetEFPnts(const Standard_Integer nF1,
-                                     const Standard_Integer nF2,
-                                     IntSurf_ListOfPntOn2S& aListOfPnts)
+void BOPAlgo_PaveFiller::GetEFPnts
+  (const Standard_Integer nF1,
+   const Standard_Integer nF2,
+   IntSurf_ListOfPntOn2S& aListOfPnts)
 {
   Standard_Integer nE, nF, nFOpposite, aNbEFs, i;
   Standard_Real U1, U2, V1, V2, f, l;
@@ -1625,11 +1640,11 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance
 //function : GetStickVertices
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1,
-                                            const Standard_Integer nF2,
-                                            BOPCol_MapOfInteger& aMVStick,
-                                            BOPCol_MapOfInteger& aMVEF,
-                                            BOPCol_MapOfInteger& aMI)
+void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1,
+                                          const Standard_Integer nF2,
+                                          BOPCol_MapOfInteger& aMVStick,
+                                          BOPCol_MapOfInteger& aMVEF,
+                                          BOPCol_MapOfInteger& aMI)
 {
   Standard_Integer nS1, nS2, nVNew, aTypeInt, i;
   //
@@ -1799,6 +1814,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
       BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVToUpdate);
       Bnd_Box& aBoxDS=aSIDS.ChangeBox();
       BRepBndLib::Add(aVToUpdate, aBoxDS);
+      aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
     }
   }
 }
@@ -1807,7 +1823,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
 //function : ProcessOldPaveBlocks
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
+void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
     (const Standard_Integer theInt,
      const BOPDS_IndexedMapOfPaveBlock& aMPBOnIn,
      const BOPCol_DataMapOfIntegerListOfInteger& aDMBV,
@@ -1819,7 +1835,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
     return;
   }
   //
-  Standard_Real aT;
+  Standard_Real aT, dummy;
   Standard_Integer i, nV, nE, iC, aNbPB, iFlag;
   BOPCol_ListIteratorOfListOfInteger aItLI;
   BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItBV;
@@ -1857,6 +1873,9 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
         if (aMPB.Contains(aPB)) {
           continue;
         }
+        if (myDS->ShapeInfo(aPB->OriginalEdge()).HasFlag()) { // skip degenerated edges
+          continue;
+        }
         //
         nE = aPB->Edge();
         const BOPDS_ShapeInfo& aSIE = myDS->ShapeInfo(nE);
@@ -1868,7 +1887,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
         //
         const TopoDS_Edge& aE = *(TopoDS_Edge*)&aSIE.Shape();
         //
-        iFlag = myContext->ComputeVE(aV, aE, aT);
+        iFlag = myContext->ComputeVE(aV, aE, aT, dummy);
         if (!iFlag) {
           aMPB.Add(aPB);
           PreparePostTreatFF(theInt, iC, aPB, aMSCPB, aMVI, aLPBC);
@@ -1881,11 +1900,11 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
 //function : UpdateExistingPaveBlocks
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
-    (const Handle(BOPDS_PaveBlock)& aPBf,
-     BOPDS_ListOfPaveBlock& aLPB,
-     const Standard_Integer nF1,
-     const Standard_Integer nF2) 
+void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
+  (const Handle(BOPDS_PaveBlock)& aPBf,
+   BOPDS_ListOfPaveBlock& aLPB,
+   const Standard_Integer nF1,
+   const Standard_Integer nF2) 
 {
   Standard_Integer nE;
   Standard_Boolean bCB;
@@ -1967,7 +1986,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
         myDS->SetCommonBlock(aPB2n, aCB);
         myDS->ChangePaveBlocks(nE).Append(aPB2n);
       }
-      aCB->AddFaces(aFaces);
+      aCB->SetFaces(aFaces);
       myDS->SortPaveBlocks(aCB);
       //
       const Handle(BOPDS_PaveBlock)& aPBNew = aCB->PaveBlocks().First();
@@ -2043,7 +2062,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
 // function: PutClosingPaveOnCurve
 // purpose:
 //=======================================================================
-  void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
+void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
 {
   Standard_Boolean bIsClosed, bHasBounds, bAdded;
   Standard_Integer nVC, j;
@@ -2098,7 +2117,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
 //function : PreparePostTreatFF
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_PaveFiller::PreparePostTreatFF
+void BOPAlgo_PaveFiller::PreparePostTreatFF
     (const Standard_Integer aInt,
      const Standard_Integer aCur,
      const Handle(BOPDS_PaveBlock)& aPB,
@@ -2170,7 +2189,7 @@ Standard_Boolean BOPAlgo_PaveFiller::CheckPlanes
 //purpose  : 
 //=======================================================================
 void BOPAlgo_PaveFiller::UpdatePaveBlocks
-  (const BOPCol_DataMapOfIntegerInteger& aDMI)
+(const BOPCol_DataMapOfIntegerInteger& aDMI)
 {
   if (aDMI.IsEmpty()) {
     return;
@@ -2181,25 +2200,28 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
   Standard_Boolean bCB, bRebuild;
   BOPDS_ListIteratorOfListOfPaveBlock aItPB;
   BOPDS_MapOfPaveBlock aMPB;
+  BOPCol_MapOfInteger aMicroEdges;
   //
-  BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
+  BOPDS_VectorOfListOfPaveBlock& aPBP = myDS->ChangePaveBlocksPool();
   aNbPBP = aPBP.Extent();
-  for (i=0; i<aNbPBP; ++i) {
-    BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
+  for (i = 0; i < aNbPBP; ++i) {
+    BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
     //
     aItPB.Initialize(aLPB);
     for (; aItPB.More(); aItPB.Next()) {
-      Handle(BOPDS_PaveBlock) aPB=aItPB.Value();
-      const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
+      Handle(BOPDS_PaveBlock) aPB = aItPB.Value();
+      const Handle(BOPDS_CommonBlock)& aCB = myDS->CommonBlock(aPB);
       bCB = !aCB.IsNull();
       if (bCB) {
-        aPB=aCB->PaveBlock1();
+        aPB = aCB->PaveBlock1();
       }
       //
       if (aMPB.Add(aPB)) {
         bRebuild = Standard_False;
         aPB->Indices(nV[0], nV[1]);
         aPB->Range(aT[0], aT[1]);
+        // remember the fact if the edge had different vertices before substitution
+        Standard_Boolean wasRegularEdge = (nV[0] != nV[1]);
         //
         for (j = 0; j < 2; ++j) {
           if (aDMI.IsBound(nV[j])) {
@@ -2212,13 +2234,28 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
             bRebuild = Standard_True;
             if (!j) {
               aPB->SetPave1(aPave);
-            } else {
+            }
+            else {
               aPB->SetPave2(aPave);
             }
           }
         }
         //
         if (bRebuild) {
+          Standard_Boolean isDegEdge = myDS->ShapeInfo(aPB->Edge()).HasFlag();
+          if (wasRegularEdge && !isDegEdge && nV[0] == nV[1]) {
+            // now edge has the same vertex on both ends;
+            // check if it is not a regular closed curve.
+            const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(aPB->Edge()));
+            const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV[0]));
+            Standard_Real aLength = IntTools::Length(aE);
+            Standard_Real aTolV = BRep_Tool::Tolerance(aV);
+            if (aLength <= aTolV * 2.) {
+              // micro edge, so mark it for removal
+              aMicroEdges.Add(aPB->Edge());
+              continue;
+            }
+          }
           nSp = SplitEdge(aPB->OriginalEdge(), nV[0], aT[0], nV[1], aT[1]);
           if (bCB) {
             aCB->SetEdge(nSp);
@@ -2231,7 +2268,87 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
     }// for (; aItPB.More(); aItPB.Next()) {
   }// for (i=0; i<aNbPBP; ++i) {
   aMPB.Clear();
+
+  if (aMicroEdges.Extent())
+    RemovePaveBlocks(aMicroEdges);
 }
+//=======================================================================
+//function : RemovePaveBlocks
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::RemovePaveBlocks(const BOPCol_MapOfInteger theEdges)
+{
+  // Remove all pave blocks referring to input edges:
+  //
+  // 1. from the Pave Blocks Pool
+  BOPDS_VectorOfListOfPaveBlock& aPBP = myDS->ChangePaveBlocksPool();
+  Standard_Integer aNbPBP = aPBP.Extent(), i;
+  for (i = 0; i < aNbPBP; ++i) {
+    BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
+    //
+    BOPDS_ListIteratorOfListOfPaveBlock aItPB(aLPB);
+    while (aItPB.More()) {
+      const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
+      if (theEdges.Contains(aPB->Edge()))
+        aLPB.Remove(aItPB);
+      else
+        aItPB.Next();
+    }
+  }
+
+  // 2. from Face Info and section curves
+  BOPCol_MapOfInteger aMPassed;
+  BOPDS_VectorOfInterfFF& aFFs = myDS->InterfFF();
+  Standard_Integer aNbFF = aFFs.Extent(), j;
+  for (i = 0; i < aNbFF; ++i) {
+    BOPDS_InterfFF& aFF = aFFs(i);
+    Standard_Integer nF1, nF2;
+    aFF.Indices(nF1, nF2);
+    //
+    // rebuild pave block maps of face info
+    for (j = 0; j < 2; j++) {
+      Standard_Integer nF = (j == 0 ? nF1 : nF2);
+      if (!aMPassed.Add(nF))
+        continue;
+      BOPDS_FaceInfo& aFI = myDS->ChangeFaceInfo(nF);
+      BOPDS_IndexedMapOfPaveBlock* aIMPB[] = { &aFI.ChangePaveBlocksIn(),
+        &aFI.ChangePaveBlocksOn(), &aFI.ChangePaveBlocksSc() };
+      for (Standard_Integer k = 0; k < 3; k++) {
+        Standard_Integer aNbPB = aIMPB[k]->Extent(), m;
+        for (m = 1; m <= aNbPB; ++m) {
+          const Handle(BOPDS_PaveBlock)& aPB = aIMPB[k]->FindKey(m);
+          if (theEdges.Contains(aPB->Edge()))
+            break;
+        }
+        if (m <= aNbPB) {
+          BOPDS_IndexedMapOfPaveBlock aMPBCopy = *aIMPB[k];
+          aIMPB[k]->Clear();
+          for (m = 1; m <= aNbPB; ++m) {
+            const Handle(BOPDS_PaveBlock)& aPB = aMPBCopy(m);
+            if (!theEdges.Contains(aPB->Edge()))
+              aIMPB[k]->Add(aPB);
+          }
+        }
+      }
+    }
+    // remove from Section pave blocks
+    BOPDS_VectorOfCurve& aVNC = aFF.ChangeCurves();
+    Standard_Integer aNbC = aVNC.Extent();
+    for (j = 0; j < aNbC; ++j) {
+      BOPDS_Curve& aNC = aVNC(j);
+      BOPDS_ListOfPaveBlock& aLPB = aNC.ChangePaveBlocks();
+      BOPDS_ListIteratorOfListOfPaveBlock aItPB(aLPB);
+      while (aItPB.More()) {
+        const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
+        if (theEdges.Contains(aPB->Edge()))
+          aLPB.Remove(aItPB);
+        else
+          aItPB.Next();
+      }
+    }
+  }
+}
+
 //=======================================================================
 //function : ToleranceFF
 //purpose  : Computes the TolFF according to the tolerance value and 
@@ -2264,3 +2381,201 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
     aTolFF =  Max(aTolFF, 5.e-6);
   }
 }
+//=======================================================================
+//function : UpdateBlocksWithSharedVertices
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdateBlocksWithSharedVertices()
+{
+  if (!myNonDestructive) {
+    return;
+  }
+  //
+  myErrorStatus=0;
+  //
+  Standard_Integer aNbFF;
+  //
+  BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
+  aNbFF=aFFs.Extent();
+  if (!aNbFF) {
+    return;
+  }
+  //
+  Standard_Boolean bOnCurve, bHasShapeSD;
+  Standard_Integer i, nF1, nF2, aNbC, j, nV, nVSD;
+  Standard_Real aTolR3D, aTolV;
+  BOPCol_MapOfInteger aMF;
+  //
+  for (i=0; i<aNbFF; ++i) {
+    BOPDS_InterfFF& aFF=aFFs(i);
+    //
+    BOPDS_VectorOfCurve& aVC=aFF.ChangeCurves();
+    aNbC=aVC.Extent();
+    if (!aNbC) {
+      continue;
+    }
+    //
+    aFF.Indices(nF1, nF2);
+    aTolR3D=aFF.TolR3D();
+    //
+    if (aMF.Add(nF1)) {
+      myDS->UpdateFaceInfoOn(nF1);
+    }
+    if (aMF.Add(nF2)) {
+      myDS->UpdateFaceInfoOn(nF2);
+    }
+    //
+    // Collect old vertices that are shared for nF1, nF2 ->aMI;
+    BOPCol_MapOfInteger aMI;
+    BOPCol_MapIteratorOfMapOfInteger aItMI;
+    //
+    BOPDS_FaceInfo& aFI1=myDS->ChangeFaceInfo(nF1);
+    BOPDS_FaceInfo& aFI2=myDS->ChangeFaceInfo(nF2);
+    //
+    const BOPCol_MapOfInteger& aMVOn1=aFI1.VerticesOn();
+    const BOPCol_MapOfInteger& aMVIn1=aFI1.VerticesIn();
+    const BOPCol_MapOfInteger& aMVOn2=aFI2.VerticesOn();
+    const BOPCol_MapOfInteger& aMVIn2=aFI2.VerticesIn();
+    //
+    for (j=0; j<2; ++j) {
+      const BOPCol_MapOfInteger& aMV1=(!j) ? aMVOn1 : aMVIn1;
+      aItMI.Initialize(aMV1);
+      for (; aItMI.More(); aItMI.Next()) {
+        nV=aItMI.Value();
+        if (myDS->IsNewShape(nV)) {
+          continue;
+        }
+        if (aMVOn2.Contains(nV) || aMVIn2.Contains(nV)) {
+          aMI.Add(nV);
+        }
+      }
+    }
+    //
+    // Try to put vertices aMI on curves
+    for (j=0; j<aNbC; ++j) {
+      BOPDS_Curve& aNC=aVC.ChangeValue(j);
+      //const IntTools_Curve& aIC=aNC.Curve();
+      //
+      aItMI.Initialize(aMI);
+      for (; aItMI.More(); aItMI.Next()) {
+        nV=aItMI.Value();
+        //
+        bHasShapeSD=myDS->HasShapeSD(nV, nVSD);
+        if (bHasShapeSD) {
+          continue;
+        }
+        //
+        bOnCurve=EstimatePaveOnCurve(nV, aNC, aTolR3D);
+        if (!bOnCurve) {
+          continue;
+        }
+        //
+        const TopoDS_Vertex& aV=*((TopoDS_Vertex *)&myDS->Shape(nV));
+        aTolV=BRep_Tool::Tolerance(aV);
+        //
+        UpdateVertex(nV, aTolV);
+      }
+    }//for (j=0; j<aNbC; ++j) {
+  }//for (i=0; i<aNbFF; ++i) {
+  //
+  UpdateCommonBlocksWithSDVertices();
+}
+//=======================================================================
+//function : EstimatePaveOnCurve
+//purpose  : 
+//=======================================================================
+Standard_Boolean BOPAlgo_PaveFiller::EstimatePaveOnCurve
+  (const Standard_Integer nV,
+   const BOPDS_Curve& aNC,
+   const Standard_Real aTolR3D)
+{
+  Standard_Boolean bIsVertexOnLine;
+  Standard_Real aT;
+  //
+  const TopoDS_Vertex& aV=*((TopoDS_Vertex *)&myDS->Shape(nV));
+  const IntTools_Curve& aIC=aNC.Curve();
+  //
+  bIsVertexOnLine=myContext->IsVertexOnLine(aV, aIC, aTolR3D, aT);
+  return bIsVertexOnLine;
+}
+
+//=======================================================================
+//function : CorrectToleranceOfSE
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::CorrectToleranceOfSE()
+{
+  BOPDS_VectorOfInterfFF& aFFs = myDS->InterfFF();
+  NCollection_IndexedDataMap<Standard_Integer,BOPDS_ListOfPaveBlock> aMVIPBs;
+  //
+  // iterate on all sections F-F
+  Standard_Integer aNb = aFFs.Extent(), i;
+  for (i = 0; i < aNb; ++i) {
+    const BOPDS_InterfFF& aFF = aFFs(i);
+    Standard_Real aTolR3D = aFF.TolR3D();
+    Standard_Real aTolReal = aFF.TolReal();
+    if (aTolReal < aTolR3D) {
+      // tolerance of intersection has been increased, so process this intersection
+      const BOPDS_VectorOfCurve& aVNC = aFF.Curves();
+      Standard_Integer aNbC = aVNC.Extent(), k;
+      for (k = 0; k < aNbC; ++k) {
+        const BOPDS_Curve& aNC = aVNC(k);
+        const BOPDS_ListOfPaveBlock& aLPB = aNC.PaveBlocks();
+        BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB);
+        for (; aItLPB.More(); aItLPB.Next()) {
+          const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
+          Standard_Integer nE;
+          if (!aPB->HasEdge(nE)) {
+            continue;
+          }
+          const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(nE));
+          Standard_Real aTolE = BRep_Tool::Tolerance(aE);
+          if (aTolReal < aTolE) {
+            // reduce edge tolerance
+            reinterpret_cast<BRep_TEdge*>(aE.TShape().operator->())->Tolerance(aTolReal);
+          }
+
+          // fill in the map vertex index - pave blocks
+          Handle(BOPDS_PaveBlock) aPBR = myDS->RealPaveBlock(aPB);
+          for (Standard_Integer j=0; j < 2; j++) {
+            Standard_Integer nV = (j == 0 ? aPBR->Pave1().Index() : aPBR->Pave2().Index());
+            BOPDS_ListOfPaveBlock *pPBList = aMVIPBs.ChangeSeek(nV);
+            if (!pPBList) {
+              pPBList = &aMVIPBs.ChangeFromIndex(aMVIPBs.Add(nV, BOPDS_ListOfPaveBlock()));
+            }
+            pPBList->Append(aPBR);
+          }
+        }
+      }
+    }
+  }
+  // try to reduce tolerances of connected vertices
+  aNb = aMVIPBs.Extent();
+  for (i = 1; i <= aNb; ++i) {
+    Standard_Integer nV = aMVIPBs.FindKey(i);
+    const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV));
+    gp_Pnt aP = BRep_Tool::Pnt(aV);
+    //
+    // compute the maximal distance from the vertex to the adjacent edges
+    Standard_Real aMaxTol = 0.;
+    const BOPDS_ListOfPaveBlock& aLPB = aMVIPBs.FindFromIndex(i);
+    BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB);
+    for (; aItLPB.More(); aItLPB.Next()) {
+      const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
+      Standard_Integer nE = aPB->Edge();
+      const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(nE));
+      const BOPDS_Pave& aPave = (aPB->Pave1().Index() == nV ? aPB->Pave1() : aPB->Pave2());
+      BRepAdaptor_Curve aC(aE);
+      gp_Pnt aPonE = aC.Value(aPave.Parameter());
+      Standard_Real aDist = aP.Distance(aPonE);
+      aDist += BRep_Tool::Tolerance(aE);
+      if (aDist > aMaxTol) {
+        aMaxTol = aDist;
+      }
+    }
+    Standard_Real aTolV = BRep_Tool::Tolerance(aV);
+    if (aMaxTol < aTolV) {
+      reinterpret_cast<BRep_TVertex*>(aV.TShape().operator->())->Tolerance(aMaxTol);
+    }
+  }
+}
index dd7002dd10c1da6c1638d9c44f25e0766f6cbe66..96118337e0db90a7e9465a2bb3e108b950590908 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <BOPAlgo_PaveFiller.hxx>
 #include <BOPAlgo_SectionAttribute.hxx>
+#include <BOPAlgo_Tools.hxx>
 #include <BOPCol_IndexedMapOfShape.hxx>
 #include <BOPCol_NCVector.hxx>
 #include <BOPCol_Parallel.hxx>
 #include <Geom_Plane.hxx>
 #include <Geom_RectangularTrimmedSurface.hxx>
 #include <Geom_Surface.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
+#include <GeomAPI_ProjectPointOnSurf.hxx>
 #include <gp_Pnt.hxx>
 #include <IntTools_Context.hxx>
+#include <IntTools_Tools.hxx>
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Face.hxx>
 #include <TopoDS_Vertex.hxx>
@@ -74,6 +79,7 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo  {
     BOPAlgo_Algo() {
     myT1=0.;
     myT2=0.;
+    myTol = 0.;
   }
   //
   virtual ~BOPAlgo_SplitEdge() {
@@ -116,13 +122,27 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo  {
     return myBox;
   }
   //
+  Standard_Real Tolerance() const {
+    return myTol;
+  }
+  //
+  void SetDS(const BOPDS_PDS theDS) {
+    myDS = theDS;
+  }
+  //
+  void SetContext(const Handle(IntTools_Context)& aContext) {
+    myContext = aContext;
+  }
+  //
   virtual void Perform () {
     BOPAlgo_Algo::UserBreak();
+    myTol = BOPAlgo_Tools::ComputeToleranceOfCB(myCB, myDS, myContext);
     BOPTools_AlgoTools::MakeSplitEdge(myE, 
                                       myV1, myT1, 
                                       myV2, myT2, 
                                       myESp);
-    BRepBndLib::Add(myESp, myBox);  
+    BRepBndLib::Add(myESp, myBox);
+    myBox.SetGap(myBox.GetGap() + Precision::Confusion());
   }
   //
  protected:
@@ -138,19 +158,26 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo  {
   // <-
   TopoDS_Edge myESp;
   Bnd_Box myBox;
+  Standard_Real myTol;
+  //
+  BOPDS_PDS   myDS;
+  Handle(IntTools_Context) myContext;
 };
 //
 //=======================================================================
 typedef BOPCol_NCVector
   <BOPAlgo_SplitEdge> BOPAlgo_VectorOfSplitEdge; 
 //
-typedef BOPCol_Functor 
+typedef BOPCol_ContextFunctor
   <BOPAlgo_SplitEdge,
-  BOPAlgo_VectorOfSplitEdge> BOPAlgo_SplitEdgeFunctor;
+  BOPAlgo_VectorOfSplitEdge,
+  Handle(IntTools_Context),
+  IntTools_Context> BOPAlgo_SplitEdgeFunctor;
 //
-typedef BOPCol_Cnt 
+typedef BOPCol_ContextCnt
   <BOPAlgo_SplitEdgeFunctor,
-  BOPAlgo_VectorOfSplitEdge> BOPAlgo_SplitEdgeCnt;
+  BOPAlgo_VectorOfSplitEdge,
+  Handle(IntTools_Context)> BOPAlgo_SplitEdgeCnt;
 //
 //=======================================================================
 //class    : BOPAlgo_MPC
@@ -342,13 +369,17 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
   Standard_Boolean bCB, bV1, bV2;
   Standard_Integer i, nE, nV1, nV2, nSp, aNbPB, aNbVBSE, k;
   Standard_Real aT1, aT2;
-  BOPDS_ListIteratorOfListOfPaveBlock aItPB, aItPBCB;
+  BOPDS_ListIteratorOfListOfPaveBlock aItPB;
   Handle(BOPDS_PaveBlock) aPB;
   BOPDS_MapOfPaveBlock aMPB(100);
   TopoDS_Vertex aV1, aV2;
   TopoDS_Edge aE;
   BOPAlgo_VectorOfSplitEdge aVBSE;
   
+  //
+  UpdateCommonBlocksWithSDVertices();
+  //
+  aNbPBP=aPBP.Extent();
   //
   for (i=0; i<aNbPBP; ++i) {
     BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
@@ -359,17 +390,31 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
       aPB->Indices(nV1, nV2);
       bV1=myDS->IsNewShape(nV1);
       bV2=myDS->IsNewShape(nV2);
+      bCB=myDS->IsCommonBlock(aPB);
       //
-      if (!(bV1 || bV2)) {
-        nE=aPB->OriginalEdge();
-        aPB->SetEdge(nE);
-        continue;
+      if (!(bV1 || bV2)) { // no new vertices here
+        if (!myNonDestructive || (myNonDestructive && !bCB)) {
+          nE = aPB->OriginalEdge();
+          aPB->SetEdge(nE);
+          if (!myNonDestructive && bCB) {
+            const Handle(BOPDS_CommonBlock)& aCB = myDS->CommonBlock(aPB);
+            Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, myDS, myContext);
+            myDS->UpdateEdgeTolerance(nE, aTol);
+          }
+          continue;
+        }
       }
     }
     //
     aItPB.Initialize(aLPB);
     for (; aItPB.More(); aItPB.Next()) {
       aPB=aItPB.Value();
+      nE=aPB->OriginalEdge();
+      const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
+      if (aSIE.HasFlag()){
+        continue;
+      }
+      //
       const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
       bCB=!aCB.IsNull();
       if (bCB) {
@@ -398,6 +443,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
         if (bCB) {
           aBSE.SetCommonBlock(aCB);
         }
+        aBSE.SetDS(myDS);
         aBSE.SetProgressIndicator(myProgressIndicator);
       }
     } // for (; aItPB.More(); aItPB.Next()) {
@@ -405,7 +451,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
   //
   aNbVBSE=aVBSE.Extent();
   //======================================================
-  BOPAlgo_SplitEdgeCnt::Perform(myRunParallel, aVBSE);
+  BOPAlgo_SplitEdgeCnt::Perform(myRunParallel, aVBSE, myContext);
   //======================================================
   //
   BOPDS_ShapeInfo aSI;
@@ -427,6 +473,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
     nSp=myDS->Append(aSI);
     //
     if (!aCBk.IsNull()) {
+      myDS->UpdateEdgeTolerance(nSp, aBSE.Tolerance());
       aCBk->SetEdge(nSp);
     }
     else {
@@ -434,6 +481,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
     }
   }
 }
+
 //=======================================================================
 // function: SplitEdge
 // purpose: 
@@ -466,6 +514,7 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
   //
   Bnd_Box& aBox=aSI.ChangeBox();
   BRepBndLib::Add(aSp, aBox);
+  aBox.SetGap(aBox.GetGap() + Precision::Confusion());
   //
   nSp=myDS->Append(aSI);
   return nSp;
@@ -659,6 +708,10 @@ void BOPAlgo_PaveFiller::RefineFaceInfoOn()
         if (!myDS->IsCommonBlock(aPB)) {
           // the PB seems to be untouced
           aLPB.Clear();
+          Standard_Integer nE = aPB->OriginalEdge();
+          if (nE >= 0) {
+            myDS->ChangeShapeInfo(nE).SetReference(-1);
+          }
           continue;
         }
       }//if (!(bV1 || bV2)) {
@@ -715,6 +768,10 @@ void UpdateVertices(const TopoDS_Edge& aE,
 //=======================================================================
 void BOPAlgo_PaveFiller::Prepare()
 {
+  if (myNonDestructive) {
+    // do not allow storing pcurves in original edges if non-destructive mode is on
+    return;
+  }
   TopAbs_ShapeEnum aType[] = {
     TopAbs_VERTEX,
     TopAbs_EDGE,
index ae4ca2ef11f999a04d49c847f431e0755261dd1a..f56505a47c5b81ec2b892deaf8f0815e824d9019 100644 (file)
@@ -88,18 +88,17 @@ void BOPAlgo_PaveFiller::ProcessDE()
           // 1. Find PaveBlocks that are go through nV for nF
           FindPaveBlocks(nV, nF, aLPBOut);
           aNbPB=aLPBOut.Extent();
-          if (!aNbPB) {
-            continue;
+          if (aNbPB) {
+            //
+            // 2.
+            BOPDS_ListOfPaveBlock& aLPBD = myDS->ChangePaveBlocks(nE);
+            aPBD = aLPBD.First();
+            //
+            FillPaves(nV, nE, nF, aLPBOut, aPBD);
+            //
+            myDS->UpdatePaveBlock(aPBD);
           }
           //
-          // 2.
-          BOPDS_ListOfPaveBlock& aLPBD=myDS->ChangePaveBlocks(nE);
-          aPBD=aLPBD.First();
-          //
-          FillPaves(nV, nE, nF, aLPBOut, aPBD);
-          //
-          myDS->UpdatePaveBlock(aPBD);
-          //
           MakeSplitEdge(nE, nF);
           //
           aLPBOut.Clear();
@@ -330,8 +329,6 @@ void BOPAlgo_PaveFiller::ProcessDE()
       aPBD->AppendExtPave1(aPave);
     }
   }//for (; aItLPB.More(); aItLPB.Next()) {
-  //
-  myDS->UpdatePaveBlock(aPBD);
 }
 //=======================================================================
 // function:  MakeSplitEdge1
index 324863bbb0cde38a7108fe8bd02dcfe6ad7244db..27459f1f5dace3ab9b00777dfcc6e2120f0b577e 100644 (file)
@@ -108,13 +108,12 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
   }
   //
   Standard_Boolean bJustAdd;
-  Standard_Integer i, iEnd, nS[2], nE, nV1, nV2, aNbVSD, k, iWrn;
+  Standard_Integer i, nS[2], nE, nV1, nV2, aNbVSD, k, iWrn;
   Standard_Real aT1, aT2, aTS1, aTS2;
   BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
   BOPCol_MapOfInteger aMI; 
   BOPAlgo_VectorOfShrunkRange aVSD;
-  //
-  iEnd=(aType2==TopAbs_EDGE) ? 2 : 1;
+  TopAbs_ShapeEnum aType[2] = { aType1, aType2 };
   //
   for (; myIterator->More(); myIterator->Next()) {
     myIterator->Value(nS[0], nS[1], bJustAdd);
@@ -122,9 +121,9 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
       continue;
     }
     //
-    for (i=0; i<iEnd; ++i) {
+    for (i=0; i < 2; ++i) {
       nE=nS[i];
-      if (!aMI.Add(nE)) {
+      if (aType[i] != TopAbs_EDGE || !aMI.Add(nE)) {
         continue;
       }
       //
index 7d3b5cc7fab802edded160cdfcd88758cdc77469..d2b43bc07deabdf45ceced202e008234e0d4fa51 100644 (file)
 #include <BOPDS_IndexedMapOfPaveBlock.hxx>
 #include <BOPDS_MapOfPaveBlock.hxx>
 #include <BOPDS_PaveBlock.hxx>
+#include <IntTools_Context.hxx>
+#include <BRep_Tool.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
+#include <GeomAPI_ProjectPointOnSurf.hxx>
 
 //=======================================================================
 //function : MakeBlocksCnx
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_Tools::MakeBlocksCnx(const BOPCol_IndexedDataMapOfIntegerListOfInteger& aMILI,
-                                    BOPCol_DataMapOfIntegerListOfInteger& aMBlocks,
-                                    const Handle(NCollection_BaseAllocator)& aAllocator)
+void BOPAlgo_Tools::MakeBlocksCnx(const BOPCol_IndexedDataMapOfIntegerListOfInteger& aMILI,
+                                  BOPCol_DataMapOfIntegerListOfInteger& aMBlocks,
+                                  const Handle(NCollection_BaseAllocator)& aAllocator)
 {
   Standard_Integer aNbV, nV, aNbVS, nVP, nVx, aNbVP, aNbEC, k, i, j;
   BOPCol_ListIteratorOfListOfInteger aItLI;
 //function : FillMap
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_Tools::FillMap(const Standard_Integer n1,
-                              const Standard_Integer n2,
-                              BOPCol_IndexedDataMapOfIntegerListOfInteger& aMILI,
-                              const Handle(NCollection_BaseAllocator)& aAllocator)
+void BOPAlgo_Tools::FillMap(const Standard_Integer n1,
+                            const Standard_Integer n2,
+                            BOPCol_IndexedDataMapOfIntegerListOfInteger& aMILI,
+                            const Handle(NCollection_BaseAllocator)& aAllocator)
 {
   if (aMILI.Contains(n1)) {
     BOPCol_ListOfInteger& aLI=aMILI.ChangeFromKey(n1);
 //function : FillMap
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_Tools::FillMap(const Handle(BOPDS_PaveBlock)& aPB1,
-                              const Handle(BOPDS_PaveBlock)& aPB2,
-                              BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMPBLPB,
-                              const Handle(NCollection_BaseAllocator)& aAllocator)
+void BOPAlgo_Tools::FillMap(const Handle(BOPDS_PaveBlock)& aPB1,
+                            const Handle(BOPDS_PaveBlock)& aPB2,
+                            BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMPBLPB,
+                            const Handle(NCollection_BaseAllocator)& aAllocator)
 {
   if (aMPBLPB.Contains(aPB1)) {
     BOPDS_ListOfPaveBlock& aLPB=aMPBLPB.ChangeFromKey(aPB1);
 //function : FillMap
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_Tools::FillMap(const Handle(BOPDS_PaveBlock)& aPB,
-                              const Standard_Integer nF,
-                              BOPDS_IndexedDataMapOfPaveBlockListOfInteger& aMPBLI,
-                              const Handle(NCollection_BaseAllocator)& aAllocator)
+void BOPAlgo_Tools::FillMap(const Handle(BOPDS_PaveBlock)& aPB,
+                            const Standard_Integer nF,
+                            BOPDS_IndexedDataMapOfPaveBlockListOfInteger& aMPBLI,
+                            const Handle(NCollection_BaseAllocator)& aAllocator)
 {
   if (aMPBLI.Contains(aPB)) {
     BOPCol_ListOfInteger& aLI=aMPBLI.ChangeFromKey(aPB);
 //function : MakeBlocks
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_Tools::MakeBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMILI,
-                                 BOPDS_DataMapOfIntegerListOfPaveBlock& aMBlocks,
-                                 const Handle(NCollection_BaseAllocator)& aAllocator)
+void BOPAlgo_Tools::MakeBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMILI,
+                               BOPDS_DataMapOfIntegerListOfPaveBlock& aMBlocks,
+                               const Handle(NCollection_BaseAllocator)& aAllocator)
 {
   Standard_Integer aNbV,  aNbVS, aNbVP, aNbEC, k, i, j;
   BOPDS_ListIteratorOfListOfPaveBlock aItLI;
 //function : PerformCommonBlocks
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_Tools::PerformCommonBlocks(BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMPBLPB,
-                                          const Handle(NCollection_BaseAllocator)& aAllocator,
-                                          BOPDS_PDS& pDS)
+void BOPAlgo_Tools::PerformCommonBlocks(BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMPBLPB,
+                                        const Handle(NCollection_BaseAllocator)& aAllocator,
+                                        BOPDS_PDS& pDS)
 {
   Standard_Integer aNbCB;
   //
 //function : PerformCommonBlocks
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_Tools::PerformCommonBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& aMPBLI,
-                                          const Handle(NCollection_BaseAllocator)& ,//aAllocator
-                                          BOPDS_PDS& pDS)
+void BOPAlgo_Tools::PerformCommonBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& aMPBLI,
+                                        const Handle(NCollection_BaseAllocator)& ,//aAllocator
+                                        BOPDS_PDS& pDS)
 {
   Standard_Integer nF, i, aNb;
   BOPCol_ListIteratorOfListOfInteger aItLI;
     }
     //
     const BOPCol_ListOfInteger& aLI=aMPBLI.FindFromKey(aPB);
+    BOPCol_ListOfInteger aNewFaces;
+    const BOPCol_ListOfInteger& anOldFaces = aCB->Faces();
     aItLI.Initialize(aLI);
     for (; aItLI.More(); aItLI.Next()) {
       nF=aItLI.Value();
-      aCB->AddFace(nF);
+      // the both lists aLI and anOldFaces are expected to be short,
+      // so we can allow to run nested loop here
+      BOPCol_ListIteratorOfListOfInteger it(anOldFaces);
+      for (; it.More(); it.Next()) {
+        if (it.Value() == nF)
+          break;
+      }
+      if (!it.More()) {
+        aNewFaces.Append(nF);
+      }
     }
+    aCB->AppendFaces(aNewFaces);
     pDS->SetCommonBlock(aPB, aCB);
   }
 }
+//=======================================================================
+//function : ComputeToleranceOfCB
+//purpose  : 
+//=======================================================================
+Standard_Real BOPAlgo_Tools::ComputeToleranceOfCB
+                   (const Handle(BOPDS_CommonBlock)& theCB,
+                    const BOPDS_PDS theDS,
+                    const Handle(IntTools_Context)& theContext)
+{
+  Standard_Real aTolMax = 0.;
+  if (theCB.IsNull()) {
+    return aTolMax;
+  }
+  //
+  const Handle(BOPDS_PaveBlock)& aPBR = theCB->PaveBlock1();
+  Standard_Integer nE = aPBR->OriginalEdge();
+  const TopoDS_Edge& aEOr = *(TopoDS_Edge*)&theDS->Shape(nE);
+  aTolMax = BRep_Tool::Tolerance(aEOr);
+  //
+  const BOPDS_ListOfPaveBlock& aLPB = theCB->PaveBlocks();
+  const BOPCol_ListOfInteger& aLFI = theCB->Faces();
+  //
+  if ((aLPB.Extent() < 2) && aLFI.IsEmpty()) {
+    return aTolMax;
+  }
+  //
+  const Standard_Integer aNbPnt = 11;
+  Standard_Real aTol, aT, aT1, aT2, aDt;
+  gp_Pnt aP;
+  //
+  const Handle(Geom_Curve)& aC3D = BRep_Tool::Curve(aEOr, aT1, aT2);
+  //
+  aPBR->Range(aT1, aT2);
+  aDt = (aT2 - aT1) / (aNbPnt + 1);
+  //
+  // compute max tolerance for common blocks on edges
+  if (aLPB.Extent() > 1) {
+    // compute max distance between edges
+    BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+    GeomAPI_ProjectPointOnCurve aProjPC;
+    //
+    aItPB.Initialize(aLPB);
+    for (; aItPB.More(); aItPB.Next()) {
+      const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
+      if (aPB == aPBR) {
+        continue;
+      }
+      //
+      nE = aPB->OriginalEdge();
+      const TopoDS_Edge& aE = *(TopoDS_Edge*)&theDS->Shape(nE);
+      aTol = BRep_Tool::Tolerance(aE);
+      //
+      aProjPC = theContext->ProjPC(aE);
+      //
+      aT = aT1;
+      for (Standard_Integer i=1; i <= aNbPnt; i++) {
+        aT += aDt;
+        aC3D->D0(aT, aP);
+        aProjPC.Perform(aP);
+        if (aProjPC.NbPoints()) {
+          Standard_Real aTolNew = aTol + aProjPC.LowerDistance();
+          if (aTolNew > aTolMax) {
+            aTolMax = aTolNew;
+          }
+        }
+      }
+    }
+  }
+  //
+  // compute max tolerance for common blocks on faces
+  if (aLFI.Extent()) {
+    Standard_Integer nF;
+    GeomAPI_ProjectPointOnSurf aProjPS;
+    BOPCol_ListIteratorOfListOfInteger aItLI;
+    //
+    aItLI.Initialize(aLFI);
+    for (; aItLI.More(); aItLI.Next()) {
+      nF = aItLI.Value();
+      const TopoDS_Face& aF = *(TopoDS_Face*)&theDS->Shape(nF);
+      aTol = BRep_Tool::Tolerance(aF);
+      //
+      aProjPS = theContext->ProjPS(aF);
+      //
+      aT = aT1;
+      for (Standard_Integer i=1; i <= aNbPnt; i++) {
+        aT += aDt;
+        aC3D->D0(aT, aP);
+        aProjPS.Perform(aP);
+        if (aProjPS.NbPoints()) {
+          Standard_Real aTolNew = aTol + aProjPS.LowerDistance();
+          if (aTolNew > aTolMax) {
+            aTolMax = aTolNew;
+          }
+        }
+      }
+    }
+  }
+  //
+  return aTolMax;
+}
index 47c4cb67edf1b5f6d026fdf4e0d8223b9726a892..698dadc5a7caedb9dac187fc5fdb77177c55d531 100644 (file)
@@ -29,6 +29,8 @@
 #include <BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx>
 
 class BOPDS_PaveBlock;
+class BOPDS_CommonBlock;
+class IntTools_Context;
 
 class BOPAlgo_Tools 
 {
@@ -51,6 +53,11 @@ public:
   
   Standard_EXPORT static void PerformCommonBlocks (const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theMBlocks, const BOPCol_BaseAllocator& theAllocator, BOPDS_PDS& pDS);
 
+  Standard_EXPORT static Standard_Real ComputeToleranceOfCB
+                                        (const Handle(BOPDS_CommonBlock)& theCB,
+                                         const BOPDS_PDS theDS,
+                                         const Handle(IntTools_Context)& theContext);
+
 };
 
 #endif // _BOPAlgo_Tools_HeaderFile
index cff7ceddbb8280fc1a4aadc7eb2c4ee8f7bb6aaf..2147bec3700e6bb79fb4139e74358710be40f01c 100644 (file)
@@ -160,8 +160,6 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
   const BOPCol_ListOfShape& myEdges=aCB.Shapes();
   //
   // 1.Filling mySmartMap
-  BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane(myEdges, myFace);
-  //
   aIt.Initialize(myEdges);
   for(; aIt.More(); aIt.Next()) {
     const TopoDS_Edge& aE=(*(TopoDS_Edge *)&aIt.Value());
index 61be71ef132df3e12ac810f8d9914756c0fff4ad..fd7ca3e9da1ad6158c4e65e8c926f5bb1d5c64c3 100644 (file)
@@ -42,6 +42,7 @@ BOPAlgo_PaveFiller_7.cxx
 BOPAlgo_PaveFiller_8.cxx
 BOPAlgo_PaveFiller_9.cxx
 BOPAlgo_PaveFiller_10.cxx
+BOPAlgo_PaveFiller_11.cxx
 BOPAlgo_PBOP.hxx
 BOPAlgo_PBuilder.hxx
 BOPAlgo_PPaveFiller.hxx
@@ -64,4 +65,4 @@ BOPAlgo_WireSplitter.hxx
 BOPAlgo_WireSplitter.lxx
 BOPAlgo_WireSplitter_1.cxx
 BOPAlgo_CellsBuilder.cxx
-BOPAlgo_CellsBuilder.hxx
\ No newline at end of file
+BOPAlgo_CellsBuilder.hxx
index a7f6b75cb5853b37ebd495a124fe63965b8ac0de..db84c3dae810b3ad1f3e63691ccf2d6954feffd7 100644 (file)
@@ -72,11 +72,19 @@ IMPLEMENT_STANDARD_RTTIEXT(BOPDS_CommonBlock,MMgt_TShared)
 // function:  AddFaces
 // purpose: 
 //=======================================================================
-  void BOPDS_CommonBlock::AddFaces(const BOPCol_ListOfInteger& aLF)
+  void BOPDS_CommonBlock::SetFaces(const BOPCol_ListOfInteger& aLF)
 {
   myFaces=aLF;
 }
 //=======================================================================
+// function:  AppendFaces
+// purpose: 
+//=======================================================================
+void BOPDS_CommonBlock::AppendFaces(BOPCol_ListOfInteger& aLF)
+{
+  myFaces.Append(aLF);
+}
+  //=======================================================================
 // function:  Faces
 // purpose: 
 //=======================================================================
index 2a84edd1d3df2fa38cb1058ef700f7fa40dd7088..520d5e0a4e1b91f647ff243b554bd8fff36a37dc 100644 (file)
@@ -73,11 +73,16 @@ public:
   
 
   //! Modifier
-  //! Adds the list of indices of faces <aLF>
-  //! to the list of indices of faces
+  //! Sets the list of indices of faces <aLF>
   //! of the common block
-  Standard_EXPORT void AddFaces (const BOPCol_ListOfInteger& aLF);
-  
+  Standard_EXPORT void SetFaces (const BOPCol_ListOfInteger& aLF);
+
+  //! Modifier
+  //! Appends the list of indices of faces <aLF>
+  //! to the list of indices of faces
+  //! of the common block (the input list is emptied)
+  Standard_EXPORT void AppendFaces(BOPCol_ListOfInteger& aLF);
+
 
   //! Selector
   //! Returns the list of pave blocks
index e2a4fcd4a9e7ac2dad53052108a80a12d40127d5..259c34ad1e2f55b5f9080c0ade4878bcab25ca35 100644 (file)
@@ -32,10 +32,11 @@ class BOPDS_CoupleOfPaveBlocks {
   /**
    * Constructor
    */
-  BOPDS_CoupleOfPaveBlocks() {
-    myIndex=-1;
-    myIndexInterf=-1;
-  }
+  BOPDS_CoupleOfPaveBlocks() :
+    myIndexInterf(-1),
+    myIndex(-1),
+    myTolerance(0)
+  {}
   //
   /**
    * Constructor
@@ -45,9 +46,11 @@ class BOPDS_CoupleOfPaveBlocks {
    *  secondt pave block
    */
   BOPDS_CoupleOfPaveBlocks(const Handle(BOPDS_PaveBlock)& thePB1,
-                          const Handle(BOPDS_PaveBlock)& thePB2) {
-    myIndex=-1;
-    myIndexInterf=-1;
+    const Handle(BOPDS_PaveBlock)& thePB2) :
+    myIndexInterf(-1),
+    myIndex(-1),
+    myTolerance(0)
+  {
     SetPaveBlocks(thePB1, thePB2);
   }
   //
@@ -153,11 +156,26 @@ class BOPDS_CoupleOfPaveBlocks {
   const Handle(BOPDS_PaveBlock)& PaveBlock2()const {
     return myPB[1];
   }
+
+  /**
+  * Sets the tolerance associated with this couple
+  */
+  void SetTolerance(const Standard_Real theTol) {
+    myTolerance = theTol;
+  }
   //
+  /**
+  * Returns the tolerance associated with this couple
+  */
+  Standard_Real Tolerance()const {
+    return myTolerance;
+  }
+
  protected:
   Standard_Integer myIndexInterf;
   Standard_Integer myIndex;
   Handle(BOPDS_PaveBlock) myPB[2];
+  Standard_Real    myTolerance;
 };
 //
 #endif
index 06655899340a89ec64ad23e08d9f972660daed7b..a89cad8dc1737b5d682a7d5b212ce250d852d5b9 100644 (file)
 #include <TopoDS_Iterator.hxx>
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Vertex.hxx>
+#include <BOPCol_MapOfShape.hxx>
+#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
 
 #include <algorithm>
 //
-//
-//
-//
-//
-//
-//
-//
-static
-  inline void ResetShape(const TopoDS_Shape& aS);
-
-static
-  inline void ResetShapes(const TopoDS_Shape& aS);
 
 static
   void TotalShapes(const TopoDS_Shape& aS, 
-                   Standard_Integer& aNbS);
+                   Standard_Integer& aNbS,
+                   BOPCol_MapOfShape& aMS);
 
 static
   Standard_Real ComputeParameter(const TopoDS_Vertex& aV,
@@ -97,6 +88,7 @@ BOPDS_DS::BOPDS_DS()
   myMapPBCB(100, myAllocator),
   myFaceInfoPool(0, myAllocator),
   myShapesSD(100, myAllocator),
+  myMapVE(100, myAllocator),
   myInterfTB(100, myAllocator),
   myInterfVV(0, myAllocator),
   myInterfVE(0, myAllocator),
@@ -129,6 +121,7 @@ BOPDS_DS::BOPDS_DS(const Handle(NCollection_BaseAllocator)& theAllocator)
   myMapPBCB(100, myAllocator),
   myFaceInfoPool(0, myAllocator),
   myShapesSD(100, myAllocator),
+  myMapVE(100, myAllocator),
   myInterfTB(100, myAllocator),
   myInterfVV(0, myAllocator),
   myInterfVE(0, myAllocator),
@@ -171,6 +164,7 @@ void BOPDS_DS::Clear()
   myPaveBlocksPool.Clear();
   myFaceInfoPool.Clear();
   myShapesSD.Clear();
+  myMapVE.Clear();
   myMapPBCB.Clear();
   myInterfTB.Clear();
   myInterfVV.Clear();
@@ -338,7 +332,6 @@ Standard_Integer BOPDS_DS::Index(const TopoDS_Shape& theS)const
   }
   return iRet;
 }
-
 //=======================================================================
 //function : Init
 //purpose  : 
@@ -347,13 +340,14 @@ void BOPDS_DS::Init()
 {
   Standard_Integer i1, i2, j, aI, aNb, aNbS, aNbE, aNbSx;
   Standard_Integer n1, n2, n3, nV, nW, nE, aNbF;
-  Standard_Real aTol, aFuzz;
+  Standard_Real aTol, aFuzz, aTolAdd;
   TopAbs_ShapeEnum aTS;
   TopoDS_Iterator aItS;
   BOPCol_ListIteratorOfListOfInteger aIt1, aIt2, aIt3;
   BOPCol_ListIteratorOfListOfShape aIt;
   BOPDS_IndexRange aR;
   Handle(NCollection_BaseAllocator) aAllocator;
+  BOPCol_MapOfShape aMS;
   //
   // 1 Append Source Shapes
   aNb=myArguments.Extent();
@@ -363,21 +357,17 @@ void BOPDS_DS::Init()
   //
   myRanges.SetIncrement(aNb);
   //
-  aIt.Initialize(myArguments);
-  for (; aIt.More(); aIt.Next()) {
-    const TopoDS_Shape& aSx=aIt.Value();
-    ResetShapes(aSx);
-  }
-  //
   aNbS=0;
   aIt.Initialize(myArguments);
   for (; aIt.More(); aIt.Next()) {
     const TopoDS_Shape& aSx=aIt.Value();
     //
     aNbSx=0;
-    TotalShapes(aSx, aNbSx);
+    TotalShapes(aSx, aNbSx, aMS);
+    //
     aNbS=aNbS+aNbSx;
   }
+  aMS.Clear();
   //
   myLines.SetIncrement(2*aNbS);
   //-----------------------------------------------------scope_1 f
@@ -406,7 +396,8 @@ void BOPDS_DS::Init()
   }
   //
   aFuzz = myFuzzyValue / 2.;
-  myNbSourceShapes=NbShapes();
+  aTolAdd = Precision::Confusion();
+  myNbSourceShapes = NbShapes();
   //
   // 2 Bounding Boxes
   //
@@ -415,7 +406,6 @@ void BOPDS_DS::Init()
     BOPDS_ShapeInfo& aSI=ChangeShapeInfo(j);
     //
     const TopoDS_Shape& aS=aSI.Shape();
-    ResetShape(aS);
     //
     aTS=aSI.ShapeType();
     //
@@ -427,12 +417,12 @@ void BOPDS_DS::Init()
       const Handle(BRep_TVertex)& TV = 
         *((Handle(BRep_TVertex)*)&aV.TShape());
       aTol = TV->Tolerance();
-      //
+      // TODO: non-destructive
       myToleranceMap.Bind(j, aTol);
       aTol += aFuzz;
       TV->Tolerance(aTol);
       //
-      aBox.SetGap(aTol);
+      aBox.SetGap(aTol + aTolAdd);
       aBox.Add(aP);
     }
   }
@@ -449,7 +439,7 @@ void BOPDS_DS::Init()
       const Handle(BRep_TEdge)& TE = 
         *((Handle(BRep_TEdge)*)&aE.TShape());
       aTol = TE->Tolerance();
-      //
+      // TODO: non-destructive
       myToleranceMap.Bind(j, aTol);
       aTol += aFuzz;
       TE->Tolerance(aTol);
@@ -514,6 +504,7 @@ void BOPDS_DS::Init()
         Bnd_Box& aBx=aSIV.ChangeBox();
         aBox.Add(aBx);
       }
+      aBox.SetGap(aBox.GetGap() + aTolAdd);
       ++aNbE;
     }
   }
@@ -533,7 +524,7 @@ void BOPDS_DS::Init()
       const Handle(BRep_TFace)& TF = 
         *((Handle(BRep_TFace)*)&aF.TShape());
       aTol = TF->Tolerance();
-      //
+      // TODO: non-destructive
       myToleranceMap.Bind(j, aTol);
       aTol += aFuzz;
       TF->Tolerance(aTol);
@@ -589,6 +580,7 @@ void BOPDS_DS::Init()
         aLW.Append(nV);
       }
       aMI.Clear();
+      aBox.SetGap(aBox.GetGap() + aTolAdd);
       ++aNbF;
     }//if (aTS==TopAbs_FACE) {
   }//for (j=0; j<myNbSourceShapes; ++j) {
@@ -647,6 +639,54 @@ void BOPDS_DS::Init()
   }//for (j=0; j<myNbSourceShapes; ++j) {
   //
   aMI.Clear();
+  //-----------------------------------------------------
+  //
+  for (nE=0; nE<myNbSourceShapes; ++nE) {
+    BOPDS_ShapeInfo& aSI=ChangeShapeInfo(nE);
+    if (aSI.ShapeType()!=TopAbs_EDGE) {
+      continue;
+    }
+    //
+    const BOPCol_ListOfInteger& aLV=aSI.SubShapes(); 
+    aIt1.Initialize(aLV);
+    for (; aIt1.More(); aIt1.Next()) {
+      nV=aIt1.Value();
+      if (myMapVE.IsBound(nV)) {
+        BOPCol_ListOfInteger& aLE=myMapVE.ChangeFind(nV);
+        aLE.Append(nE);
+      }
+      else {
+        BOPCol_ListOfInteger aLE(myAllocator);
+        //
+        aLE.Append(nE);
+        myMapVE.Bind(nV, aLE);
+      }
+    }
+  }
+  //
+  BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItDMILI; 
+  aItDMILI.Initialize(myMapVE);
+  for(; aItDMILI.More(); aItDMILI.Next()) { 
+    BOPCol_MapOfInteger aMFence;
+    BOPCol_ListOfInteger aLEx;
+    //
+    nV=aItDMILI.Key();
+    BOPCol_ListOfInteger& aLE=aItDMILI.ChangeValue();
+    aIt1.Initialize(aLE);
+    for (; aIt1.More(); aIt1.Next()) {
+      nE=aIt1.Value();
+      if(aMFence.Add(nE)) {
+        aLEx.Append(nE);
+      }
+    }
+    //
+    aLE.Clear();
+    aIt1.Initialize(aLEx);
+    for (; aIt1.More(); aIt1.Next()) {
+      nE=aIt1.Value();
+      aLE.Append(nE);
+    }
+  }
   //-----------------------------------------------------scope_1 t
   // 3 myPaveBlocksPool
   // 4. myFaceInfoPool
@@ -822,6 +862,7 @@ const BOPDS_ListOfPaveBlock& BOPDS_DS::PaveBlocks
   }
   return sLPB;
 }
+
 //=======================================================================
 //function : ChangePaveBlocks
 //purpose  : 
@@ -993,12 +1034,7 @@ void BOPDS_DS::UpdatePaveBlock(const Handle(BOPDS_PaveBlock)& thePB)
     aPB=aItPB.ChangeValue();
     if (aPB==thePB) {
       aPB->Update(aLPBN);
-      //
-      aItPBN.Initialize(aLPBN);
-      for (; aItPBN.More(); aItPBN.Next()) {
-        Handle(BOPDS_PaveBlock)& aPBN=aItPBN.ChangeValue();
-        aLPB.Append(aPBN);
-      }
+      aLPB.Append(aLPBN);
       aLPB.Remove(aItPB);
       break;
     }
@@ -1113,7 +1149,7 @@ void BOPDS_DS::UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB)
       //
       aCBx=new BOPDS_CommonBlock;
       aCBx->AddPaveBlocks(aLPBxN);
-      aCBx->AddFaces(aLF);
+      aCBx->SetFaces(aLF);
       //
       aItPB.Initialize(aLPBxN);
       for (; aItPB.More(); aItPB.Next()) {
@@ -1375,6 +1411,9 @@ void BOPDS_DS::FaceInfoIn(const Standard_Integer theF,
     BOPDS_InterfVF& aVF=aVFs(i);
     if(aVF.Contains(theF)) {
       nV=aVF.OppositeIndex(theF);
+      if (HasShapeSD(nV, nVSD)) {
+        nV=nVSD;
+      }
       theMI.Add(nV);
     }
   }
@@ -1808,7 +1847,6 @@ Standard_Boolean BOPDS_DS::IsSubShape
 
   return bRet;
 }
-
 //=======================================================================
 // function: Paves
 // purpose:
@@ -1854,7 +1892,6 @@ void BOPDS_DS::Paves(const Standard_Integer theEdge,
     theLP.Append(pPaves(i));
   }
 }
-
 //=======================================================================
 // function: UpdateTolerance
 // purpose:
@@ -1872,6 +1909,7 @@ void BOPDS_DS::UpdateEdgeTolerance(const Standard_Integer nE,
   BOPDS_ShapeInfo& aSIE=ChangeShapeInfo(nE);
   Bnd_Box& aBoxE=aSIE.ChangeBox();
   BRepBndLib::Add(aE, aBoxE);
+  aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
   //
   const BOPCol_ListOfInteger& aLI = aSIE.SubShapes();
   aIt.Initialize(aLI);
@@ -1884,58 +1922,29 @@ void BOPDS_DS::UpdateEdgeTolerance(const Standard_Integer nE,
       BOPDS_ShapeInfo& aSIV = ChangeShapeInfo(nV);
       Bnd_Box& aBoxV = aSIV.ChangeBox();
       BRepBndLib::Add(aV, aBoxV);
+      aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
     }
   }
 }
-
 //=======================================================================
 //function : TotalShapes
 //purpose  : 
 //=======================================================================
 void TotalShapes(const TopoDS_Shape& aS, 
-                 Standard_Integer& aNbS)
+                 Standard_Integer& aNbS,
+                 BOPCol_MapOfShape& aMS)
 {
-  TopoDS_Shape *pS;
-  //
-  pS=(TopoDS_Shape *)&aS;
-  if (!pS->Checked()) {
+  if (aMS.Add(aS)) {
     TopoDS_Iterator aIt;
-    //
-    pS->Checked(1);
     ++aNbS;
     aIt.Initialize(aS);
     for (; aIt.More(); aIt.Next()) {
       const TopoDS_Shape& aSx=aIt.Value();
-      TotalShapes(aSx, aNbS);
+      TotalShapes(aSx, aNbS, aMS);
     }
   }
 }
-//=======================================================================
-//function : ResetShape
-//purpose  : 
-//=======================================================================
-void ResetShape(const TopoDS_Shape& aS) 
-{
-  TopoDS_Shape *pS;
-  //
-  pS=(TopoDS_Shape *)&aS;
-  pS->Checked(0);
-}
-//=======================================================================
-//function : ResetShape
-//purpose  : 
-//=======================================================================
-void ResetShapes(const TopoDS_Shape& aS) 
-{
-  TopoDS_Iterator aIt;
-  //
-  ResetShape(aS);
-  aIt.Initialize(aS);
-  for (; aIt.More(); aIt.Next()) {
-    const TopoDS_Shape& aSx=aIt.Value();
-    ResetShape(aSx);
-  }
-}
+
 //=======================================================================
 //function : ComputeParameter
 //purpose  : 
@@ -2283,3 +2292,84 @@ void CollectEdges(const BOPDS_DS& theDS,
     }
   }
 }
+
+//=======================================================================
+//function : UpdatePaveBlocksWithSDVertices
+//purpose  : 
+//=======================================================================
+void BOPDS_DS::UpdatePaveBlocksWithSDVertices()
+{
+  Standard_Integer i, aNbPBP;
+  BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+  //
+  BOPDS_VectorOfListOfPaveBlock& aPBP=myPaveBlocksPool;
+  //
+  aNbPBP=aPBP.Size();
+  for (i = 0; i < aNbPBP; ++i) {
+    BOPDS_ListOfPaveBlock& aLPB = aPBP(i); 
+    //
+    aItPB.Initialize(aLPB);
+    for (; aItPB.More(); aItPB.Next()) {
+      Handle(BOPDS_PaveBlock)& aPB = aItPB.ChangeValue();
+      UpdatePaveBlockWithSDVertices(aPB);
+    }// for (; aItPB.More(); aItPB.Next()) {
+  }// for (i = 0; i < aNbPBP; ++i) {
+}
+//=======================================================================
+//function : UpdatePaveBlockWithSDVertices
+//purpose  : 
+//=======================================================================
+void BOPDS_DS::UpdatePaveBlockWithSDVertices
+  (const Handle(BOPDS_PaveBlock)& thePB)
+{
+  Standard_Integer nV1, nV2;
+  BOPDS_Pave aPave1, aPave2;
+  //
+  aPave1 = thePB->Pave1();
+  aPave2 = thePB->Pave2();
+  //
+  nV1 = aPave1.Index();
+  nV2 = aPave2.Index();
+  //
+  if (HasShapeSD(nV1, nV1)) {
+    aPave1.SetIndex(nV1);
+    thePB->SetPave1(aPave1);
+  }
+  //
+  if (HasShapeSD(nV2, nV2)) {
+    aPave2.SetIndex(nV2);
+    thePB->SetPave2(aPave2);
+  }
+}
+//=======================================================================
+//function : UpdateCommonBlockWithSDVertices
+//purpose  : 
+//=======================================================================
+void BOPDS_DS::UpdateCommonBlockWithSDVertices
+  (const Handle(BOPDS_CommonBlock)& theCB)
+{
+  const BOPDS_ListOfPaveBlock& aLPB = theCB->PaveBlocks();
+  BOPDS_ListIteratorOfListOfPaveBlock aItPB(aLPB);
+  for (; aItPB.More(); aItPB.Next()) {
+    const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
+    UpdatePaveBlockWithSDVertices(aPB);
+  }
+}
+//=======================================================================
+//function : InitPaveBlocksForVertex
+//purpose  : 
+//=======================================================================
+void BOPDS_DS::InitPaveBlocksForVertex(const Standard_Integer theNV)
+{
+  Standard_Integer nE;
+  BOPCol_ListIteratorOfListOfInteger aItLE;
+  //
+  if (myMapVE.IsBound(theNV)) {
+    const BOPCol_ListOfInteger& aLE=myMapVE.Find(theNV);
+    aItLE.Initialize(aLE);
+    for (; aItLE.More(); aItLE.Next()) {
+      nE=aItLE.Value();
+      ChangePaveBlocks(nE);
+    }
+  }
+}
index e88e6ac828b821e50e07fd09603448482eff4638..86985ea626703de9ed6edb359a391736f0b89d79 100644 (file)
@@ -29,6 +29,7 @@
 #include <BOPDS_DataMapOfPaveBlockCommonBlock.hxx>
 #include <BOPDS_VectorOfFaceInfo.hxx>
 #include <BOPCol_DataMapOfIntegerInteger.hxx>
+#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
 #include <BOPDS_MapOfPassKey.hxx>
 #include <BOPDS_VectorOfInterfVV.hxx>
 #include <BOPDS_VectorOfInterfVE.hxx>
@@ -439,7 +440,13 @@ Standard_EXPORT virtual ~BOPDS_DS();
 
   //! Updates tolerance of the sub-shapes of the shape with index <theIndex>.
   Standard_EXPORT void UpdateEdgeTolerance (const Standard_Integer theIndex, const Standard_Real theTolerance);
-  
+
+  Standard_EXPORT void UpdatePaveBlocksWithSDVertices();
+
+  Standard_EXPORT void UpdateCommonBlockWithSDVertices(const Handle(BOPDS_CommonBlock)& theCB);
+
+  Standard_EXPORT void InitPaveBlocksForVertex(const Standard_Integer theNV);
+
   //! Sets the extended tolerance
     void SetFuzzyValue (const Standard_Real theFuzz);
   
@@ -458,7 +465,8 @@ protected:
 
   //! Initializes the pave blocks for the shape with index theIndex
   Standard_EXPORT void InitPaveBlocks (const Standard_Integer theIndex);
-  
+
+  Standard_EXPORT void UpdatePaveBlockWithSDVertices(const Handle(BOPDS_PaveBlock)& thePB);
 
   //! Initializes the state of face with index theIndex
   Standard_EXPORT void InitFaceInfo (const Standard_Integer theIndex);
@@ -483,6 +491,7 @@ protected:
   BOPDS_DataMapOfPaveBlockCommonBlock myMapPBCB;
   BOPDS_VectorOfFaceInfo myFaceInfoPool;
   BOPCol_DataMapOfIntegerInteger myShapesSD;
+  BOPCol_DataMapOfIntegerListOfInteger myMapVE;
   BOPDS_MapOfPassKey myInterfTB;
   BOPDS_VectorOfInterfVV myInterfVV;
   BOPDS_VectorOfInterfVE myInterfVE;
index 5fc69d3c7440f6fd81849e3aecb1a2f66b1a98de..5a42949e9125a2e0c36c5972b4a4064e05da8e5b 100644 (file)
@@ -496,6 +496,7 @@ class BOPDS_InterfFF  : public BOPDS_Interf {
       myTangentFaces(Standard_False),
       myTolR3D(1.e-7),
       myTolR2D(1.e-7),
+      myTolReal(1.e-7),
       myCurves(0, myAllocator),
       myPoints(0, myAllocator) 
   {
@@ -595,6 +596,25 @@ class BOPDS_InterfFF  : public BOPDS_Interf {
   Standard_Real TolR2D()const {
     return myTolR2D;
   }
+  /**
+  * Modifier
+  * Sets the value of real not increased 3D tolerance
+  * @param theTol
+  *   3D tolerance
+  */
+  void SetTolReal(const Standard_Real theTol) {
+    myTolReal = theTol;
+  }
+  //
+  /**
+  * Selector
+  * Returns the value of real not increased 3D tolerance
+  * @return
+  *   3D tolerance
+  */
+  Standard_Real TolReal()const {
+    return myTolReal;
+  }
   //
   /**
    * Selector
@@ -640,6 +660,7 @@ class BOPDS_InterfFF  : public BOPDS_Interf {
   Standard_Boolean myTangentFaces;
   Standard_Real myTolR3D;
   Standard_Real myTolR2D;
+  Standard_Real myTolReal;
   BOPDS_VectorOfCurve myCurves;
   BOPDS_VectorOfPoint myPoints;
 };
index fc460fa4b08d41e84e9e76b317ad8983beceadcf..2f37a8145d8200280697ae9df7b42fa5f7b3b2dd 100644 (file)
@@ -66,7 +66,7 @@ Standard_Integer bapibop(Draw_Interpretor& di,
   }
   //
   char buf[128];
-  Standard_Boolean bRunParallel;
+  Standard_Boolean bRunParallel, bNonDestructive;
   Standard_Integer iErr, iOp;
   Standard_Real aFuzzyValue;
   BRepAlgoAPI_Common aCommon;
@@ -115,6 +115,7 @@ Standard_Integer bapibop(Draw_Interpretor& di,
   //
   bRunParallel=BOPTest_Objects::RunParallel();
   aFuzzyValue=BOPTest_Objects::FuzzyValue();
+  bNonDestructive = BOPTest_Objects::NonDestructive();
   //
   if (aOp!=BOPAlgo_CUT21) {
     pBuilder->SetArguments(aLS);
@@ -127,6 +128,7 @@ Standard_Integer bapibop(Draw_Interpretor& di,
   //
   pBuilder->SetRunParallel(bRunParallel);
   pBuilder->SetFuzzyValue(aFuzzyValue);
+  pBuilder->SetNonDestructive(bNonDestructive);
   //
   pBuilder->Build(); 
   iErr=pBuilder->ErrorStatus();
@@ -159,7 +161,7 @@ Standard_Integer bapibuild(Draw_Interpretor& di,
   }
   //
   char buf[128];
-  Standard_Boolean bRunParallel;
+  Standard_Boolean bRunParallel, bNonDestructive;
   Standard_Integer iErr;
   Standard_Real aFuzzyValue;
   BRepAlgoAPI_BuilderAlgo aBuilder;
@@ -173,10 +175,12 @@ Standard_Integer bapibuild(Draw_Interpretor& di,
   //
   bRunParallel=BOPTest_Objects::RunParallel();
   aFuzzyValue=BOPTest_Objects::FuzzyValue();
+  bNonDestructive = BOPTest_Objects::NonDestructive();
   //
   aBuilder.SetArguments(aLS);
   aBuilder.SetRunParallel(bRunParallel);
   aBuilder.SetFuzzyValue(aFuzzyValue);
+  aBuilder.SetNonDestructive(bNonDestructive);
   //
   aBuilder.Build(); 
   iErr=aBuilder.ErrorStatus();
index f6ec755650968a53f7590bff2db57e5dffa8c265..631ce39a5c3aa4f0233aba92bbe0a2faa01d2c85 100644 (file)
@@ -119,7 +119,7 @@ Standard_Integer bop(Draw_Interpretor& di,
                      const char** a)
 {
   char buf[32];
-  Standard_Boolean bRunParallel;
+  Standard_Boolean bRunParallel, bNonDestructive;
   Standard_Integer iErr;
   Standard_Real aTol;
   TopoDS_Shape aS1, aS2;
@@ -140,6 +140,7 @@ Standard_Integer bop(Draw_Interpretor& di,
   //
   aTol=BOPTest_Objects::FuzzyValue();
   bRunParallel=BOPTest_Objects::RunParallel();
+  bNonDestructive = BOPTest_Objects::NonDestructive();
   //
   aLC.Append(aS1);
   aLC.Append(aS2);
@@ -155,6 +156,7 @@ Standard_Integer bop(Draw_Interpretor& di,
   pPF->SetArguments(aLC);
   pPF->SetFuzzyValue(aTol);
   pPF->SetRunParallel(bRunParallel);
+  pPF->SetNonDestructive(bNonDestructive);
   //
   pPF->Perform();
   iErr=pPF->ErrorStatus();
@@ -395,7 +397,7 @@ Standard_Integer  bsection(Draw_Interpretor& di,
   }
   // 
   char buf[80];
-  Standard_Boolean bRunParallel, bApp, bPC1, bPC2;
+  Standard_Boolean bRunParallel, bNonDestructive, bApp, bPC1, bPC2;
   Standard_Integer i, iErr;
   Standard_Real aTol;
   //
@@ -404,6 +406,7 @@ Standard_Integer  bsection(Draw_Interpretor& di,
   bPC2 = Standard_True;
   aTol = BOPTest_Objects::FuzzyValue(); 
   bRunParallel = BOPTest_Objects::RunParallel();
+  bNonDestructive = BOPTest_Objects::NonDestructive();
   //
   for (i = 4; i < n; ++i) {
     if (!strcmp(a[i], "-n2d")) {
@@ -429,6 +432,7 @@ Standard_Integer  bsection(Draw_Interpretor& di,
   //
   aSec.SetFuzzyValue(aTol);
   aSec.SetRunParallel(bRunParallel);
+  aSec.SetNonDestructive(bNonDestructive);
   //
   aSec.Build();
   iErr=aSec.ErrorStatus();
@@ -456,7 +460,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
                        const BOPAlgo_Operation aOp)
 {
   char buf[32];
-  Standard_Boolean bRunParallel;
+  Standard_Boolean bRunParallel, bNonDestructive;
   Standard_Integer iErr;
   TopoDS_Shape aS1, aS2;
   BOPCol_ListOfShape aLC;
@@ -479,6 +483,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
   // 
   aTol=BOPTest_Objects::FuzzyValue();
   bRunParallel = BOPTest_Objects::RunParallel();
+  bNonDestructive = BOPTest_Objects::NonDestructive();
   //
   Handle(NCollection_BaseAllocator)aAL=
     NCollection_BaseAllocator::CommonBaseAllocator();
@@ -489,6 +494,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
   aPF.SetArguments(aLC);
   aPF.SetFuzzyValue(aTol); 
   aPF.SetRunParallel(bRunParallel);
+  aPF.SetNonDestructive(bNonDestructive);
   //
   aPF.Perform();
   iErr=aPF.ErrorStatus();
@@ -724,7 +730,7 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
   //
   const char* usage = "Type mkvolume without arguments for the usage of the command.\n";
   //
-  Standard_Boolean bToIntersect, bRunParallel, bCompounds;
+  Standard_Boolean bToIntersect, bRunParallel, bNonDestructive, bCompounds;
   Standard_Integer i;
   Standard_Real aTol;
   TopoDS_Shape aS;
@@ -732,6 +738,7 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
   //
   aTol = BOPTest_Objects::FuzzyValue();
   bRunParallel = BOPTest_Objects::RunParallel();
+  bNonDestructive = BOPTest_Objects::NonDestructive();
   //
   bToIntersect = Standard_True;
   bCompounds = Standard_False;
@@ -781,6 +788,7 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
   aMV.SetIntersect(bToIntersect);
   aMV.SetRunParallel(bRunParallel);
   aMV.SetFuzzyValue(aTol);
+  aMV.SetNonDestructive(bNonDestructive);
   //
   aMV.Perform();
   if (aMV.ErrorStatus()) {
index 027c4323b9e52329cf051c456fbc059fe203ec01..338806d6d331e6af2d767a0a4d515570973d42ac 100644 (file)
@@ -50,7 +50,8 @@ class BOPTest_Session {
     //
     myBuilder=myBuilderDefault;
     myRunParallel=Standard_False;
-    myFuzzyValue=0.;
+    myNonDestructive = Standard_False;
+    myFuzzyValue = 0.;
   };
   //
   // Clear
@@ -114,6 +115,14 @@ class BOPTest_Session {
     return myFuzzyValue;
   };
   //
+  void SetNonDestructive(const Standard_Boolean theFlag) {
+    myNonDestructive = theFlag;
+  };
+  //
+  Standard_Boolean NonDestructive()const {
+    return myNonDestructive;
+  };
+  //
 protected:
   //
   BOPTest_Session(const BOPTest_Session&);
@@ -128,6 +137,7 @@ protected:
   BOPCol_ListOfShape myShapes;
   BOPCol_ListOfShape myTools;
   Standard_Boolean myRunParallel;
+  Standard_Boolean myNonDestructive;
   Standard_Real myFuzzyValue;
 };
 //
@@ -282,6 +292,22 @@ Standard_Real BOPTest_Objects::FuzzyValue()
   return GetSession().FuzzyValue();
 }
 //=======================================================================
+//function : SetNonDestructive
+//purpose  : 
+//=======================================================================
+void BOPTest_Objects::SetNonDestructive(const Standard_Boolean theFlag)
+{
+  GetSession().SetNonDestructive(theFlag);
+}
+//=======================================================================
+//function : NonDestructive
+//purpose  : 
+//=======================================================================
+Standard_Boolean BOPTest_Objects::NonDestructive()
+{
+  return GetSession().NonDestructive();
+}
+//=======================================================================
 //function : Allocator1
 //purpose  : 
 //=======================================================================
index b63245864bef8545c7eb593a5c301ec0775f7875..5283f15582d2457ff4ef8dd06a777191dbf5e87f 100644 (file)
@@ -71,6 +71,10 @@ public:
   
   Standard_EXPORT static Standard_Real FuzzyValue();
 
+  Standard_EXPORT static void SetNonDestructive(const Standard_Boolean theFlag);
+
+  Standard_EXPORT static Standard_Boolean NonDestructive();
+
 
 
 
index afae57c9e387774007c2863d6c2c0b2f5a487d80..cd603d3712f7cf5bb700808f5dcb0e2120e9b94d 100644 (file)
@@ -22,8 +22,8 @@
 #include <string.h>
 static Standard_Integer boptions (Draw_Interpretor&, Standard_Integer, const char**); 
 static Standard_Integer brunparallel (Draw_Interpretor&, Standard_Integer, const char**); 
-static Standard_Integer bfuzzyvalue (Draw_Interpretor&, Standard_Integer, const char**); 
-static Standard_Integer bparallelmode(Draw_Interpretor&, Standard_Integer, const char**);
+static Standard_Integer bnondestructive(Draw_Interpretor&, Standard_Integer, const char**);
+static Standard_Integer bfuzzyvalue(Draw_Interpretor&, Standard_Integer, const char**);
 
 //=======================================================================
 //function : OptionCommands
@@ -37,13 +37,10 @@ void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
   // Chapter's name
   const char* g = "BOPTest commands";
   // Commands  
-  theCommands.Add("boptions", "use boptions" , __FILE__, boptions, g);
+  theCommands.Add("boptions", "use boptions, shows current value of BOP options" , __FILE__, boptions, g);
   theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
-  theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value" , __FILE__, bfuzzyvalue, g);
-  theCommands.Add("bparallelmode", 
-    "bparallelmode [1/0] : show / set parallel mode for boolean operations", 
-                  __FILE__, bparallelmode, g);
-
+  theCommands.Add("bnondestructive", "use bnondestructive [0/1]", __FILE__, bnondestructive, g);
+  theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value", __FILE__, bfuzzyvalue, g);
 }
 //=======================================================================
 //function : boptions
@@ -59,14 +56,17 @@ Standard_Integer boptions(Draw_Interpretor& di,
   }
   //
   char buf[128];
-  Standard_Boolean bRunParallel;
+  Standard_Boolean bRunParallel, bNonDestructive;
   Standard_Real aFuzzyValue;
   //
   bRunParallel=BOPTest_Objects::RunParallel();
-  aFuzzyValue=BOPTest_Objects::FuzzyValue();
+  bNonDestructive = BOPTest_Objects::NonDestructive();
+  aFuzzyValue = BOPTest_Objects::FuzzyValue();
   
   Sprintf(buf, " RunParallel: %d\n",  bRunParallel);
   di << buf;
+  Sprintf(buf, " NonDestructive: %d\n", bNonDestructive);
+  di << buf;
   Sprintf(buf, " FuzzyValue : %lf\n", aFuzzyValue);
   di << buf;
   //
@@ -125,29 +125,29 @@ Standard_Integer brunparallel(Draw_Interpretor& di,
   return 0;
 }
 //=======================================================================
-//function : bparallelmode
+//function : bnondestructive
 //purpose  : 
 //=======================================================================
-Standard_Integer bparallelmode(Draw_Interpretor& di, 
-                               Standard_Integer n, 
-                               const char** a)
+Standard_Integer bnondestructive(Draw_Interpretor& di,
+  Standard_Integer n,
+  const char** a)
 {
-  Standard_Boolean bRunParallel;
-  //
-  if (n == 2)  {
-    bRunParallel=(Standard_Boolean)Draw::Atoi(a[1]);
-    BOPTest_Objects::SetRunParallel(bRunParallel);
-    if (bRunParallel) {
-      di << "Parallel mode for boolean operations has been enabled";
-    }
-    else  {
-      di << "Parallel mode for boolean operations has been disabled";
-    }
+  if (n != 2) {
+    di << " use bnondestructive [0/1]\n";
+    return 0;
   }
-  else  {
-    bRunParallel=BOPTest_Objects::RunParallel();
-    di << "Parallel mode state for boolean operations: " 
-      << (bRunParallel? "enabled" : "disabled");
+  //
+  Standard_Integer iX;
+  Standard_Boolean bNonDestructive;
+  //
+  iX = Draw::Atoi(a[1]);
+  if (iX<0 || iX>1) {
+    di << " Wrong value.\n";
+    return 0;
   }
+  //
+  bNonDestructive = (Standard_Boolean)(iX);
+  BOPTest_Objects::SetNonDestructive(bNonDestructive);
+  //
   return 0;
 }
index fa414052cb2c4a520a17c87ebbdf72b058492695..57181309529fc9bb53f71a053badeaad4dff5bde 100644 (file)
@@ -66,7 +66,7 @@ Standard_Integer bfillds(Draw_Interpretor& di,
   }
   //
   char buf[32];
-  Standard_Boolean bRunParallel, bShowTime;
+  Standard_Boolean bRunParallel, bNonDestructive, bShowTime;
   Standard_Integer i, aNbS, iErr;
   Standard_Real aTol;
   BOPCol_ListIteratorOfListOfShape aIt;
@@ -81,7 +81,8 @@ Standard_Integer bfillds(Draw_Interpretor& di,
   bShowTime = Standard_False;
   //
   bRunParallel=BOPTest_Objects::RunParallel();
-  aTol=BOPTest_Objects::FuzzyValue();
+  bNonDestructive = BOPTest_Objects::NonDestructive();
+  aTol = BOPTest_Objects::FuzzyValue();
   //
   for (i=1; i<n; ++i) {
     if (!strcmp(a[i], "-t")) {
@@ -107,6 +108,7 @@ Standard_Integer bfillds(Draw_Interpretor& di,
   //
   aPF.SetArguments(aLC);
   aPF.SetRunParallel(bRunParallel);
+  aPF.SetNonDestructive(bNonDestructive);
   aPF.SetFuzzyValue(aTol);
   //
   OSD_Timer aTimer;
index e5add863a2ff9c62ce6dfbe70b421270b7860c30..67d46d8344c3e47103b524496bf0b8d3fc6069e0 100644 (file)
@@ -962,7 +962,7 @@ Standard_Boolean BOPTools_AlgoTools::AreFacesSameDomain
   }
   // 2
   aTolF2=BRep_Tool::Tolerance(aF2);
-  aTol=aTolF1+aTolF2;
+  aTol = aTolF1 + aTolF2 + Precision::Confusion();
   //
   iErr = BOPTools_AlgoTools3D::PointInFace(aF1, aP, aP2D,
                                            theContext);
@@ -1461,7 +1461,7 @@ Standard_Integer BOPTools_AlgoTools::ComputeVV(const TopoDS_Vertex& aV1,
   //
   aTolV1=BRep_Tool::Tolerance(aV1);
   
-  aTolSum=aTolV1+aTolP2;
+  aTolSum = aTolV1 + aTolP2 + Precision::Confusion();
   aTolSum2=aTolSum*aTolSum;
   //
   aP1=BRep_Tool::Pnt(aV1);
@@ -1484,7 +1484,7 @@ Standard_Integer BOPTools_AlgoTools::ComputeVV(const TopoDS_Vertex& aV1,
   //
   aTolV1=BRep_Tool::Tolerance(aV1);
   aTolV2=BRep_Tool::Tolerance(aV2);
-  aTolSum=aTolV1+aTolV2;
+  aTolSum = aTolV1 + aTolV2 + Precision::Confusion();
   aTolSum2=aTolSum*aTolSum;
   //
   aP1=BRep_Tool::Pnt(aV1);
@@ -1500,7 +1500,7 @@ Standard_Integer BOPTools_AlgoTools::ComputeVV(const TopoDS_Vertex& aV1,
 // function: MakeVertex
 // purpose : 
 //=======================================================================
-void BOPTools_AlgoTools::MakeVertex(BOPCol_ListOfShape& aLV,
+void BOPTools_AlgoTools::MakeVertex(const BOPCol_ListOfShape& aLV,
                                     TopoDS_Vertex& aVnew)
 {
   Standard_Integer aNb;
index a071f835725545667b90859dc629b12e1f26f7d9..2c58b9f5c04cfc294efafe9019f590e565c5d892 100644 (file)
@@ -56,7 +56,7 @@ public:
   
   Standard_EXPORT static Standard_Integer ComputeVV (const TopoDS_Vertex& aV1, const TopoDS_Vertex& aV2);
   
-  Standard_EXPORT static void MakeVertex (BOPCol_ListOfShape& aLV, TopoDS_Vertex& aV);
+  Standard_EXPORT static void MakeVertex (const BOPCol_ListOfShape& aLV, TopoDS_Vertex& aV);
   
   Standard_EXPORT static void MakeEdge (const IntTools_Curve& theCurve, const TopoDS_Vertex& theV1, const Standard_Real theT1, const TopoDS_Vertex& theV2, const Standard_Real theT2, const Standard_Real theTolR3D, TopoDS_Edge& theE);
   
@@ -177,18 +177,27 @@ public:
   //! accepted for correction.  If real value of the tolerance
   //! will be greater than  <aTolMax>, the correction does not
   //! perform.
-  Standard_EXPORT static void CorrectTolerances (const TopoDS_Shape& theS, const Standard_Real theTolMax = 0.0001, const Standard_Boolean theRunParallel = Standard_False);
-  
+  Standard_EXPORT static void CorrectTolerances
+              (const TopoDS_Shape& theS, 
+               const BOPCol_IndexedMapOfShape& theMapToAvoid,
+               const Standard_Real theTolMax = 0.0001,
+               const Standard_Boolean theRunParallel = Standard_False);
 
   //! Provides valid values of tolerances for the shape <theS>
   //! in  terms of BRepCheck_InvalidCurveOnSurface.
-  Standard_EXPORT static void CorrectCurveOnSurface (const TopoDS_Shape& theS, const Standard_Real theTolMax = 0.0001, const Standard_Boolean theRunParallel = Standard_False);
-  
+  Standard_EXPORT static void CorrectCurveOnSurface
+              (const TopoDS_Shape& theS,
+               const BOPCol_IndexedMapOfShape& theMapToAvoid,
+               const Standard_Real theTolMax = 0.0001,
+               const Standard_Boolean theRunParallel = Standard_False);
 
   //! Provides valid values of tolerances for the shape <theS>
   //! in  terms of BRepCheck_InvalidPointOnCurve.
-  Standard_EXPORT static void CorrectPointOnCurve (const TopoDS_Shape& theS, const Standard_Real theTolMax = 0.0001, const Standard_Boolean theRunParallel = Standard_False);
-  
+  Standard_EXPORT static void CorrectPointOnCurve
+              (const TopoDS_Shape& theS,
+               const BOPCol_IndexedMapOfShape& theMapToAvoid,
+               const Standard_Real theTolMax = 0.0001,
+               const Standard_Boolean theRunParallel = Standard_False);
 
   //! Make a vertex using 3D-point <aP1> and 3D-tolerance value <aTol>
   Standard_EXPORT static void MakeNewVertex (const gp_Pnt& aP1, const Standard_Real aTol, TopoDS_Vertex& aNewVertex);
@@ -260,8 +269,10 @@ public:
   
 
   //! Corrects tolerance values of the sub-shapes of the shape <theS> if needed.
-  Standard_EXPORT static void CorrectShapeTolerances (const TopoDS_Shape& theS, const Standard_Boolean theRunParallel = Standard_False);
-  
+  Standard_EXPORT static void CorrectShapeTolerances
+              (const TopoDS_Shape& theS,
+               const BOPCol_IndexedMapOfShape& theMapToAvoid,
+               const Standard_Boolean theRunParallel = Standard_False);
 
   //! Retutns dimension of the shape <theS>.
   Standard_EXPORT static Standard_Integer Dimension (const TopoDS_Shape& theS);
index 98544e394f88e70b9522758fe3bcea13e40ff5aa..c1d9beae5f6ada00b72d5c8c145ba4360321b37b 100644 (file)
 //
 static 
   void CheckEdge (const TopoDS_Edge& E,
-                  const Standard_Real aMaxTol);
+                  const Standard_Real aMaxTol,
+                  const BOPCol_IndexedMapOfShape& aMapToAvoid);
 static 
   void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
                              const TopoDS_Face& S,
-                             const Standard_Real aMaxTol);
+                             const Standard_Real aMaxTol,
+                             const BOPCol_IndexedMapOfShape& aMapToAvoid);
 static 
   Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
                             const Adaptor3d_Curve& Other,
@@ -105,15 +107,23 @@ static
                             Standard_Real& aNewTolerance);
 
 static
-  void CorrectVertexTolerance(const TopoDS_Edge& aE);
+  void CorrectVertexTolerance(const TopoDS_Edge& aE,
+                              const BOPCol_IndexedMapOfShape& aMapToAvoid);
 
 static
-  void CorrectWires(const TopoDS_Face& aF);
+  void CorrectWires(const TopoDS_Face& aF,
+                    const BOPCol_IndexedMapOfShape& aMapToAvoid);
 
 
 
 static
-  void UpdateEdges(const TopoDS_Face& aF);
+  void UpdateEdges(const TopoDS_Face& aF,
+                   const BOPCol_IndexedMapOfShape& aMapToAvoid);
+
+static
+  void UpdateShape(const TopoDS_Shape& aS,
+                   const Standard_Real aTol,
+                   const BOPCol_IndexedMapOfShape& aMapToAvoid);
 
 static 
   Standard_Real IntersectCurves2d(const gp_Pnt& aPV,
@@ -131,7 +141,7 @@ static
 class BOPTools_CPC {
  public:
   BOPTools_CPC()
-    : myMaxTol(1.e-7) {
+    : myMaxTol(1.e-7), mypMapToAvoid(0L) {
   }
   //
   ~BOPTools_CPC() {
@@ -153,13 +163,19 @@ class BOPTools_CPC {
     return myMaxTol;
   }
   //
+  void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
+    mypMapToAvoid = &aMapToAvoid;
+  }
+  //
   void Perform() {
-    CheckEdge(myEdge, myMaxTol);
+    Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
+    CheckEdge(myEdge, myMaxTol, *mypMapToAvoid);
   }
   
  protected:
   Standard_Real myMaxTol;
   TopoDS_Edge myEdge;
+  const BOPCol_IndexedMapOfShape* mypMapToAvoid;
 };
 //
 //=======================================================================
@@ -179,7 +195,7 @@ typedef BOPCol_Cnt
 //=======================================================================
 class BOPTools_CWT {
  public:
-  BOPTools_CWT() {
+  BOPTools_CWT() : mypMapToAvoid(0L) {
   }
   //
   ~BOPTools_CWT() {
@@ -189,12 +205,18 @@ class BOPTools_CWT {
     myFace=aF;
   }
   //
+  void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
+    mypMapToAvoid = &aMapToAvoid;
+  }
+  //
   void Perform() {
-    CorrectWires(myFace);
+    Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
+    CorrectWires(myFace, *mypMapToAvoid);
   }
   //
  protected:
   TopoDS_Face myFace;
+  const BOPCol_IndexedMapOfShape* mypMapToAvoid;
 };
 //=======================================================================
 typedef BOPCol_NCVector<BOPTools_CWT> BOPTools_VectorOfCWT; 
@@ -214,7 +236,7 @@ typedef BOPCol_Cnt
 class BOPTools_CDT {
  public:
   BOPTools_CDT() 
-    : myMaxTol(1.e-7) {
+    : myMaxTol(1.e-7), mypMapToAvoid(0L) {
   }
   //
   ~BOPTools_CDT() {
@@ -232,14 +254,20 @@ class BOPTools_CDT {
     myMaxTol=aMaxTol;
   }
   //
+  void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
+    mypMapToAvoid = &aMapToAvoid;
+  }
+  //
   void Perform() {
-    CorrectEdgeTolerance (myEdge, myFace, myMaxTol);
+    Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
+    CorrectEdgeTolerance (myEdge, myFace, myMaxTol, *mypMapToAvoid);
   }
   //
  protected:
   Standard_Real myMaxTol;
   TopoDS_Edge myEdge;
   TopoDS_Face myFace;
+  const BOPCol_IndexedMapOfShape* mypMapToAvoid;
 };
 //=======================================================================
 typedef BOPCol_NCVector<BOPTools_CDT> BOPTools_VectorOfCDT; 
@@ -258,7 +286,7 @@ typedef BOPCol_Cnt
 //=======================================================================
 class BOPTools_CVT {
  public:
-  BOPTools_CVT() {
+  BOPTools_CVT() : mypMapToAvoid(0L) {
   }
   //
   ~BOPTools_CVT() {
@@ -268,12 +296,18 @@ class BOPTools_CVT {
     myEdge=aE;
   }
   //
+  void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
+    mypMapToAvoid = &aMapToAvoid;
+  }
+  //
   void Perform() {
-    CorrectVertexTolerance(myEdge);
+    Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
+    CorrectVertexTolerance(myEdge, *mypMapToAvoid);
   }
   //
  protected:
   TopoDS_Edge myEdge;
+  const BOPCol_IndexedMapOfShape* mypMapToAvoid;
 };
 //
 //=======================================================================
@@ -293,7 +327,7 @@ typedef BOPCol_Cnt
 //=======================================================================
 class BOPTools_CET {
  public:
-  BOPTools_CET() {
+  BOPTools_CET() : mypMapToAvoid(0L) {
   }
   //
   ~BOPTools_CET() {
@@ -303,12 +337,18 @@ class BOPTools_CET {
     myFace=aF;
   }
   //
+  void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
+    mypMapToAvoid = &aMapToAvoid;
+  }
+  //
   void Perform() {
-    UpdateEdges(myFace);
+    Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
+    UpdateEdges(myFace, *mypMapToAvoid);
   }
   //
  protected:
   TopoDS_Face myFace;
+  const BOPCol_IndexedMapOfShape* mypMapToAvoid;
 };
 //=======================================================================
 typedef BOPCol_NCVector<BOPTools_CET> BOPTools_VectorOfCET; 
@@ -330,11 +370,12 @@ typedef BOPCol_Cnt
 //=======================================================================
 void BOPTools_AlgoTools::CorrectTolerances
   (const TopoDS_Shape& aShape,
+   const BOPCol_IndexedMapOfShape& aMapToAvoid,
    const Standard_Real aMaxTol,
    const Standard_Boolean bRunParallel)
 {
-  BOPTools_AlgoTools::CorrectPointOnCurve(aShape, aMaxTol, bRunParallel);
-  BOPTools_AlgoTools::CorrectCurveOnSurface(aShape, aMaxTol, bRunParallel);
+  BOPTools_AlgoTools::CorrectPointOnCurve(aShape, aMapToAvoid, aMaxTol, bRunParallel);
+  BOPTools_AlgoTools::CorrectCurveOnSurface(aShape, aMapToAvoid, aMaxTol, bRunParallel);
 }
 //
 //=======================================================================
@@ -343,6 +384,7 @@ void BOPTools_AlgoTools::CorrectTolerances
 //=======================================================================
 void BOPTools_AlgoTools::CorrectPointOnCurve
   (const TopoDS_Shape& aS,
+   const BOPCol_IndexedMapOfShape& aMapToAvoid,
    const Standard_Real aMaxTol,
    const Standard_Boolean bRunParallel)
 {
@@ -355,6 +397,7 @@ void BOPTools_AlgoTools::CorrectPointOnCurve
     BOPTools_CPC& aCPC=aVCPC.Append1();
     aCPC.SetEdge(aE);
     aCPC.SetMaxTol(aMaxTol);
+    aCPC.SetMapToAvoid(aMapToAvoid);
   }
   //
   //======================================================
@@ -367,6 +410,7 @@ void BOPTools_AlgoTools::CorrectPointOnCurve
 //=======================================================================
 void BOPTools_AlgoTools::CorrectCurveOnSurface
   (const TopoDS_Shape& aS,
+   const BOPCol_IndexedMapOfShape& aMapToAvoid,
    const Standard_Real aMaxTol,
    const Standard_Boolean bRunParallel)
 {
@@ -380,6 +424,7 @@ void BOPTools_AlgoTools::CorrectCurveOnSurface
     //
     BOPTools_CWT& aCWT=aVCWT.Append1();
     aCWT.SetFace(aF);
+    aCWT.SetMapToAvoid(aMapToAvoid);
     //
     aExpE.Init(aF, TopAbs_EDGE);
     for (; aExpE.More(); aExpE.Next()) {
@@ -389,6 +434,7 @@ void BOPTools_AlgoTools::CorrectCurveOnSurface
       aCDT.SetEdge(aE);
       aCDT.SetFace(aF);
       aCDT.SetMaxTol(aMaxTol);
+      aCDT.SetMapToAvoid(aMapToAvoid);
     }
   }
   //
@@ -404,6 +450,7 @@ void BOPTools_AlgoTools::CorrectCurveOnSurface
 //=======================================================================
 void BOPTools_AlgoTools::CorrectShapeTolerances
   (const TopoDS_Shape& aShape,
+   const BOPCol_IndexedMapOfShape& aMapToAvoid,
    const Standard_Boolean bRunParallel)
 { 
   TopExp_Explorer aExp;
@@ -415,6 +462,7 @@ void BOPTools_AlgoTools::CorrectShapeTolerances
     const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExp.Current();
     BOPTools_CVT& aCVT=aVCVT.Append1();
     aCVT.SetEdge(aE);
+    aCVT.SetMapToAvoid(aMapToAvoid);
   }
   //
   //======================================================
@@ -426,6 +474,7 @@ void BOPTools_AlgoTools::CorrectShapeTolerances
     const TopoDS_Face& aF = *(TopoDS_Face*)&aExp.Current();
     BOPTools_CET& aCET=aVCET.Append1();
     aCET.SetFace(aF);
+    aCET.SetMapToAvoid(aMapToAvoid);
   }
   //
   //======================================================
@@ -438,7 +487,8 @@ void BOPTools_AlgoTools::CorrectShapeTolerances
 // purpose :  Correct tolerances for Vertices on Edge 
 //=======================================================================
 void CheckEdge (const TopoDS_Edge& Ed, 
-                const Standard_Real aMaxTol)
+                const Standard_Real aMaxTol,
+                const BOPCol_IndexedMapOfShape& aMapToAvoid)
 {
   Standard_Real aTolE, aTol, aD2, aNewTolerance, dd;
   gp_Pnt aPC;
@@ -490,7 +540,7 @@ void CheckEdge (const TopoDS_Edge& Ed,
               if (aD2 > aTol) {
                 aNewTolerance=sqrt(aD2)+dd;
                 if (aNewTolerance<aMaxTol)
-                  TV->UpdateTolerance(aNewTolerance);
+                  UpdateShape(aV, aNewTolerance, aMapToAvoid);
               }
             }
             aItPR.Next();
@@ -512,7 +562,7 @@ void CheckEdge (const TopoDS_Edge& Ed,
             if (aD2 > aTol) {
               aNewTolerance=sqrt(aD2)+dd;
               if (aNewTolerance<aMaxTol) 
-                TV->UpdateTolerance(aNewTolerance);
+                UpdateShape(aV, aNewTolerance, aMapToAvoid);
             }
           }
         }
@@ -525,7 +575,8 @@ void CheckEdge (const TopoDS_Edge& Ed,
 // Function : CorrectWires
 // purpose : 
 //=======================================================================
-void CorrectWires(const TopoDS_Face& aFx)
+void CorrectWires(const TopoDS_Face& aFx,
+                  const BOPCol_IndexedMapOfShape& aMapToAvoid)
 {
   Standard_Boolean bIsPeriodic; 
   Standard_Integer i, aNbV;
@@ -600,10 +651,8 @@ void CorrectWires(const TopoDS_Face& aFx)
       }// for (; aIt1.More(); aIt1.Next()) {
     }// for (; aIt.More(); aIt.Next()) {
     if (aD2max>aTol2) {
-      BRep_Builder aBB;
-      //
       aTol=sqrt(aD2max);
-      aBB.UpdateVertex(aV, aTol);
+      UpdateShape(aV, aTol, aMapToAvoid);
     }
   }// for (i=1; i<=aNbV; ++i) {
 }
@@ -673,7 +722,8 @@ Standard_Real IntersectCurves2d(const gp_Pnt& aPV,
 //=======================================================================
 void CorrectEdgeTolerance (const TopoDS_Edge& myShape, 
                            const TopoDS_Face& S,
-                           const Standard_Real aMaxTol)
+                           const Standard_Real aMaxTol,
+                           const BOPCol_IndexedMapOfShape& aMapToAvoid)
 {
   // 
   // 1. Minimum of conditions to Perform
@@ -812,9 +862,8 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
                       Tol, SameParameter, aNewTol);
         if (ok) {
           if (aNewTol<aMaxTol) {
-            TE->UpdateTolerance(aNewTol+Delta); 
-            //
-            CorrectVertexTolerance(myShape);
+            UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
+            CorrectVertexTolerance(myShape, aMapToAvoid);
           }
         }
         
@@ -825,8 +874,8 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
           ok = Validate(myHCurve->Curve(),ACS,Tol,SameParameter, aNewTol);
           if (ok) {
             if (aNewTol<aMaxTol) {
-              TE->UpdateTolerance(aNewTol+Delta);
-              CorrectVertexTolerance(myShape);
+              UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
+              CorrectVertexTolerance(myShape, aMapToAvoid);
             } 
           }
         }
@@ -881,8 +930,8 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
                                         Tol,Standard_True, aNewTol); 
         if (okx) {
           if (aNewTol<aMaxTol) {
-            TE->UpdateTolerance(aNewTol+Delta);
-            CorrectVertexTolerance(myShape);
+            UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
+            CorrectVertexTolerance(myShape, aMapToAvoid);
           }
         }
       }
@@ -893,7 +942,8 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
 //function : CorrectVertexTolerance
 //purpose  : 
 //=======================================================================
-void CorrectVertexTolerance(const TopoDS_Edge& aE)
+void CorrectVertexTolerance(const TopoDS_Edge& aE,
+                            const BOPCol_IndexedMapOfShape& aMapToAvoid)
 {
   Standard_Real aTolE, aTolV;
   TopoDS_Iterator aIt;
@@ -904,8 +954,7 @@ void CorrectVertexTolerance(const TopoDS_Edge& aE)
     const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aIt.Value());
     aTolV=BRep_Tool::Tolerance(aV);
     if (aTolV<aTolE) {
-      Handle(BRep_TVertex)& aTV= *((Handle(BRep_TVertex)*)&aV.TShape());
-      aTV->UpdateTolerance(aTolE);
+      UpdateShape(aV, aTolE, aMapToAvoid);
     }
   }
 }
@@ -1027,11 +1076,11 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
 // Function : UpdateEdges
 // purpose : 
 //=======================================================================
-void UpdateEdges(const TopoDS_Face& aF)
+void UpdateEdges(const TopoDS_Face& aF,
+                 const BOPCol_IndexedMapOfShape& aMapToAvoid)
 {
   Standard_Real aTolF, aTolE, aTolV;
   TopoDS_Iterator aItF, aItW, aItE;
-  BRep_Builder aBB;
   //
   aTolE=aTolF= BRep_Tool::Tolerance(aF);
   aItF.Initialize(aF);
@@ -1043,22 +1092,46 @@ void UpdateEdges(const TopoDS_Face& aF)
         const TopoDS_Edge& aE=*((TopoDS_Edge*)&aItW.Value());
         aTolE = BRep_Tool::Tolerance(aE);
         if (aTolE < aTolF) {
-          aBB.UpdateEdge(aE, aTolF);
+          UpdateShape(aE, aTolF, aMapToAvoid);
           aTolE = aTolF;
         }
-        //UpdateVertices(aE);
       }
     }
     else {
       const TopoDS_Vertex& aV=*(TopoDS_Vertex*)&aItF.Value();
       aTolV = BRep_Tool::Tolerance(aV);
       if (aTolV < aTolE) {
-        aBB.UpdateVertex(aV, aTolF);
+        UpdateShape(aV, aTolF, aMapToAvoid);
       }
     }
   }
 }
 //=======================================================================
+//function : UpdateShape
+//purpose  : 
+//=======================================================================
+void UpdateShape(const TopoDS_Shape& aS,
+                 const Standard_Real aTol,
+                 const BOPCol_IndexedMapOfShape& aMapToAvoid)
+{
+  if (aMapToAvoid.Contains(aS)) {
+    return;
+  }
+  //
+  TopAbs_ShapeEnum aType;
+  BRep_Builder aBB;
+  //
+  aType=aS.ShapeType();
+  if (aType==TopAbs_EDGE) {
+    const TopoDS_Edge& aE = *((TopoDS_Edge*)&aS);
+    aBB.UpdateEdge(aE, aTol);
+  }
+  else if (aType==TopAbs_VERTEX) {
+   const TopoDS_Vertex& aV = *((TopoDS_Vertex*)&aS);
+   aBB.UpdateVertex(aV, aTol); 
+  }
+}
+//=======================================================================
 // Function : ComputeTolerance
 // purpose : 
 //=======================================================================
index a725fb5aa41b60d27d284e744fb232cc77ea9329..225c41b8199fb8ef2f2555e055cb0cbdbdc6f463 100644 (file)
@@ -305,6 +305,7 @@ void BRepAlgoAPI_BooleanOperation::Build()
     myDSFiller->SetRunParallel(myRunParallel);
     myDSFiller->SetProgressIndicator(myProgressIndicator);
     myDSFiller->SetFuzzyValue(myFuzzyValue);
+    myDSFiller->SetNonDestructive(myNonDestructive);
     //
     SetAttributes();
     //
index 97a8257dd6edc37ce2e0e3a0919d4d692fce49f0..da28188c061200f6f7f8d63e9ad59c548bce32d3 100644 (file)
@@ -28,7 +28,8 @@ BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
   myEntryType(1),
   myDSFiller(NULL),
   myBuilder(NULL),
-  myFuzzyValue(0.)
+  myFuzzyValue(0.),
+  myNonDestructive(Standard_False)
 {}
 //=======================================================================
 // function: 
@@ -40,7 +41,8 @@ BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo
   BRepAlgoAPI_Algo(),
   myEntryType(0),
   myBuilder(NULL),
-  myFuzzyValue(0.)
+  myFuzzyValue(0.),
+  myNonDestructive(Standard_False)
 {
   BOPAlgo_PaveFiller* pPF=(BOPAlgo_PaveFiller*)&aPF;
   myDSFiller=pPF;
@@ -70,6 +72,22 @@ Standard_Real BRepAlgoAPI_BuilderAlgo::FuzzyValue() const
   return myFuzzyValue;
 }
 //=======================================================================
+//function : SetNonDestructive
+//purpose  : 
+//=======================================================================
+void BRepAlgoAPI_BuilderAlgo::SetNonDestructive(const Standard_Boolean theFlag)
+{
+  myNonDestructive = theFlag;
+}
+//=======================================================================
+//function : NonDestructive
+//purpose  : 
+//=======================================================================
+Standard_Boolean BRepAlgoAPI_BuilderAlgo::NonDestructive() const
+{
+  return myNonDestructive;
+}
+//=======================================================================
 //function : Clear
 //purpose  : 
 //=======================================================================
@@ -125,6 +143,7 @@ void BRepAlgoAPI_BuilderAlgo::Build()
     myDSFiller->SetRunParallel(myRunParallel);
     myDSFiller->SetProgressIndicator(myProgressIndicator);
     myDSFiller->SetFuzzyValue(myFuzzyValue);
+    myDSFiller->SetNonDestructive(myNonDestructive);
     //
     myDSFiller->Perform();
     iErr=myDSFiller->ErrorStatus();
index c0c9e7c22e44d1da0339d2d63a503f7dc550e9e8..9ed9b27f9075629bd74376cde926957b70d5c060 100644 (file)
@@ -51,7 +51,17 @@ Standard_EXPORT virtual ~BRepAlgoAPI_BuilderAlgo();
   
   //! Returns the additional tolerance
   Standard_EXPORT Standard_Real FuzzyValue() const;
-  
+
+  //! Sets the flag that defines the mode of treatment.
+  //! In non-destructive mode the argument shapes are not modified. Instead
+  //! a copy of a sub-shape is created in the result if it is needed to be updated.
+  Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag);
+
+  //! Returns the flag that defines the mode of treatment.
+  //! In non-destructive mode the argument shapes are not modified. Instead
+  //! a copy of a sub-shape is created in the result if it is needed to be updated.
+  Standard_EXPORT Standard_Boolean NonDestructive() const;
+
   //! Sets the arguments
   Standard_EXPORT void SetArguments (const TopTools_ListOfShape& theLS);
   
@@ -101,6 +111,7 @@ protected:
   BOPAlgo_PPaveFiller myDSFiller;
   BOPAlgo_PBuilder myBuilder;
   Standard_Real myFuzzyValue;
+  Standard_Boolean myNonDestructive;
   TopTools_ListOfShape myArguments;
 
 
index 9c9f7be9c5590c3e5290b9f1372b2156bd7487cf..bc879f520f32f0ff346ec2118ea42c414ab8e284 100644 (file)
@@ -200,7 +200,7 @@ IntTools_BeanFaceIntersector::IntTools_BeanFaceIntersector(const BRepAdaptor_Cur
 {
   myCurve = theCurve;
   
-  myCriteria = myBeanTolerance + myFaceTolerance;
+  myCriteria = myBeanTolerance + myFaceTolerance + Precision::Confusion();
   myCurveResolution = myCurve.Resolution(myCriteria);
 
   mySurface = theSurface;
@@ -220,7 +220,7 @@ void IntTools_BeanFaceIntersector::Init(const TopoDS_Edge& theEdge,
   myBeanTolerance = BRep_Tool::Tolerance(theEdge);
   myFaceTolerance = BRep_Tool::Tolerance(theFace);
   
-  myCriteria = myBeanTolerance + myFaceTolerance;
+  myCriteria = myBeanTolerance + myFaceTolerance + Precision::Confusion();
   myCurveResolution = myCurve.Resolution(myCriteria);
 
   SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(), 
@@ -243,7 +243,7 @@ void IntTools_BeanFaceIntersector::Init(const BRepAdaptor_Curve&   theCurve,
   myBeanTolerance = theBeanTolerance;
   myFaceTolerance = theFaceTolerance;
   
-  myCriteria = myBeanTolerance + myFaceTolerance;
+  myCriteria = myBeanTolerance + myFaceTolerance + Precision::Confusion();
   myCurveResolution = myCurve.Resolution(myCriteria);
   
   SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(), 
@@ -1018,14 +1018,24 @@ void IntTools_BeanFaceIntersector::ComputeLinePlane()
   if(myUMinParameter > u || u > myUMaxParameter || myVMinParameter > v || v > myVMaxParameter) {
     return;
   }
-
-  Standard_Real t1 = Max(myFirstParameter, t-myCriteria);
-  Standard_Real t2 = Min(myLastParameter, t+myCriteria);
+  //
+  // compute correct range on the edge
+  Standard_Real anAngle, aDt;
+  gp_Dir aDL, aDP;
+  //
+  aDL = L.Position().Direction();
+  aDP = P.Position().Direction();
+  anAngle = Abs(M_PI_2 - aDL.Angle(aDP));
+  //
+  aDt = IntTools_Tools::ComputeIntRange
+      (myBeanTolerance, myFaceTolerance, anAngle);
+  //
+  Standard_Real t1 = Max(myFirstParameter, t - aDt);
+  Standard_Real t2 = Min(myLastParameter,  t + aDt);
   IntTools_Range aRange(t1, t2);
   myResults.Append(aRange);
  
   return;
-
 }
 
 
index 08395ed180daacabb7b8653d632b3cca919e8a7c..a84b20cbb9669dd3e529eb7474981fca141a24a9 100644 (file)
@@ -500,7 +500,7 @@ Standard_Integer IntTools_Context::ComputePE
   aDist=aProjector.LowerDistance();
   //
   aTolE2=BRep_Tool::Tolerance(aE2);
-  aTolSum=aTolP1+aTolE2;
+  aTolSum = aTolP1 + aTolE2 + Precision::Confusion();
   //
   aT=aProjector.LowerDistanceParameter();
   if (aDist > aTolSum) {
@@ -515,7 +515,8 @@ Standard_Integer IntTools_Context::ComputePE
 Standard_Integer IntTools_Context::ComputeVE
   (const TopoDS_Vertex& aV1, 
    const TopoDS_Edge&   aE2,
-   Standard_Real& aT)
+   Standard_Real& aParam,
+   Standard_Real& aTolVnew)
 {
   if (BRep_Tool::Degenerated(aE2)) {
     return -1;
@@ -538,29 +539,29 @@ Standard_Integer IntTools_Context::ComputeVE
   }
   //
   aDist=aProjector.LowerDistance();
-
-  // tolerance of check for coincidence is sum of tolerances of edge and vertex 
-  // extended by additional Precision::Confusion() to allow for interference where
-  // it is very close but not fit to tolerance (see #24108)
+  //
   aTolV1=BRep_Tool::Tolerance(aV1);
   aTolE2=BRep_Tool::Tolerance(aE2);
   aTolSum = aTolV1 + aTolE2 + Precision::Confusion();
   //
-  aT=aProjector.LowerDistanceParameter();
+  aTolVnew=aDist+aTolE2;
+  //
+  aParam=aProjector.LowerDistanceParameter();
   if (aDist > aTolSum) {
     return -4;
   }
   return 0;
 }
 //=======================================================================
-//function : ComputeVS
+//function : ComputeVF
 //purpose  : 
 //=======================================================================
 Standard_Integer IntTools_Context::ComputeVF
   (const TopoDS_Vertex& aV1, 
    const TopoDS_Face&   aF2,
    Standard_Real& U,
-   Standard_Real& V)
+   Standard_Real& V,
+   Standard_Real& aTolVnew)
 {
   Standard_Real aTolV1, aTolF2, aTolSum, aDist;
   gp_Pnt aP;
@@ -578,10 +579,13 @@ Standard_Integer IntTools_Context::ComputeVF
   // 2. Check the distance between the projection point and 
   //    the original point
   aDist=aProjector.LowerDistance();
-
+  //
   aTolV1=BRep_Tool::Tolerance(aV1);
   aTolF2=BRep_Tool::Tolerance(aF2);
-  aTolSum=aTolV1+aTolF2;
+  //
+  aTolSum = aTolV1 + aTolF2 + Precision::Confusion();
+  aTolVnew = aDist + aTolF2;
+  //
   if (aDist > aTolSum) {
     // the distance is too large
     return -2;
@@ -860,14 +864,16 @@ Standard_Boolean IntTools_Context::IsVertexOnLine
           Extrema_ExtPC anExt2(aPv, aGAC, 1.e-10);
           Standard_Real aMinDist = RealLast();
           Standard_Integer aMinIdx = -1;
-          for (Standard_Integer anIdx = 1; anIdx <= anExt2.NbExt(); anIdx++)
-          {
-            if ( anExt2.IsMin(anIdx) &&
-                 anExt2.SquareDistance(anIdx) < aMinDist )
+          if (anExt2.IsDone()) {
+            for (Standard_Integer anIdx = 1; anIdx <= anExt2.NbExt(); anIdx++)
+            {
+              if ( anExt2.IsMin(anIdx) &&
+                   anExt2.SquareDistance(anIdx) < aMinDist )
               {
                 aMinDist = anExt2.SquareDistance(anIdx);
                 aMinIdx = anIdx;
               }
+            }
           }
           if (aMinIdx != -1)
           {
@@ -912,14 +918,16 @@ Standard_Boolean IntTools_Context::IsVertexOnLine
           Extrema_ExtPC anExt2(aPv, aGAC, 1.e-10);
           Standard_Real aMinDist = RealLast();
           Standard_Integer aMinIdx = -1;
-          for (Standard_Integer anIdx = 1; anIdx <= anExt2.NbExt(); anIdx++)
-          {
-            if ( anExt2.IsMin(anIdx) &&
-                 anExt2.SquareDistance(anIdx) < aMinDist )
+          if (anExt2.IsDone()) {
+            for (Standard_Integer anIdx = 1; anIdx <= anExt2.NbExt(); anIdx++)
+            {
+              if ( anExt2.IsMin(anIdx) &&
+                   anExt2.SquareDistance(anIdx) < aMinDist )
               {
                 aMinDist = anExt2.SquareDistance(anIdx);
                 aMinIdx = anIdx;
               }
+            }
           }
           if (aMinIdx != -1)
           {
index 80c13490d9b4089c185a63e0f5aeb6d52c1b576f..16e6621c840f1ae7332355259f8826798db14fb5 100644 (file)
@@ -112,27 +112,35 @@ Standard_EXPORT virtual  ~IntTools_Context();
   
 
   //! Computes parameter of the vertex aV on
-  //! the edge aE.
+  //! the edge aE and new increased value of vertex tolerance.
   //! Returns zero if the distance between vertex
   //! and edge is less than sum of tolerances,
   //! otherwise and for following conditions returns
-  //! negative value
-  //! 1. the edge is degenerated (-1)
-  //! 2. the edge does not contain 3d curve and pcurves (-2)
+  //! negative value: <br>
+  //! 1. the edge is degenerated (-1) <br>
+  //! 2. the edge does not contain 3d curve and pcurves (-2) <br>
   //! 3. projection algorithm failed (-3)
-  Standard_EXPORT Standard_Integer ComputeVE (const TopoDS_Vertex& aV, const TopoDS_Edge& aE, Standard_Real& aT);
-  
+  Standard_EXPORT Standard_Integer ComputeVE (const TopoDS_Vertex& aV,
+                                              const TopoDS_Edge& aE,
+                                              Standard_Real& aParam,
+                                              Standard_Real& aTolVnew);
+
 
   //! Computes UV parameters of the vertex aV on face aF
+  //! and new increased value of vertex tolerance.
   //! Returns zero if the distance between vertex and face is
   //! less than or equal the sum of tolerances and the projection
   //! point lays inside boundaries of the face.
-  //! For following conditions returns negative value
-  //! 1. projection algorithm failed (-1)
-  //! 2. distance is more than sum of tolerances (-2)
+  //! For following conditions returns negative value <br>
+  //! 1. projection algorithm failed (-1) <br>
+  //! 2. distance is more than sum of tolerances (-2) <br>
   //! 3. projection point out or on the boundaries of face (-3)
-  Standard_EXPORT Standard_Integer ComputeVF (const TopoDS_Vertex& aV, const TopoDS_Face& aF, Standard_Real& U, Standard_Real& V);
-  
+  Standard_EXPORT Standard_Integer ComputeVF (const TopoDS_Vertex& aV,
+                                              const TopoDS_Face& aF,
+                                              Standard_Real& U,
+                                              Standard_Real& V,
+                                              Standard_Real& aTolVnew);
+
 
   //! Returns the state of the point aP2D
   //! relative to face aF
index 095fb507a24c90894ab153f5dd0670e0a64c4ba5..b27f96ce3f97c6759b4b2dce424fd2a28124d2cc 100644 (file)
@@ -30,6 +30,7 @@
 #include <IntTools_CommonPrt.hxx>
 #include <IntTools_EdgeEdge.hxx>
 #include <IntTools_Range.hxx>
+#include <IntTools_Tools.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Iterator.hxx>
 
@@ -157,8 +158,9 @@ void IntTools_EdgeEdge::Prepare()
     mySwap = Standard_True;
   }
   //
-  myTol1 = myCurve1.Tolerance();
-  myTol2 = myCurve2.Tolerance();
+  Standard_Real aTolAdd = Precision::Confusion() / 2.;
+  myTol1 = myCurve1.Tolerance() + aTolAdd;
+  myTol2 = myCurve2.Tolerance() + aTolAdd;
   myTol = myTol1 + myTol2;
   //
   if (iCT1 != 0 || iCT2 != 0) {
@@ -321,7 +323,7 @@ void IntTools_EdgeEdge::FindSolutions(const IntTools_Range& theR1,
     bThin = ((aT12 - aT11) < myRes1) ||
       (aB1.IsXThin(myTol) && aB1.IsYThin(myTol) && aB1.IsZThin(myTol));
     //
-    bOut = !FindParameters(myCurve2, aTB21, aTB22, myRes2, myPTol2, 
+    bOut = !FindParameters(myCurve2, aTB21, aTB22, myTol2, myRes2, myPTol2, 
                            myResCoeff2, aB1, aT21, aT22);
     if (bOut || bThin) {
       break;
@@ -338,7 +340,7 @@ void IntTools_EdgeEdge::FindSolutions(const IntTools_Range& theR1,
     bThin = ((aT22 - aT21) < myRes2) ||
       (aB2.IsXThin(myTol) && aB2.IsYThin(myTol) && aB2.IsZThin(myTol));
     //
-    bOut = !FindParameters(myCurve1, aTB11, aTB12, myRes1, myPTol1, 
+    bOut = !FindParameters(myCurve1, aTB11, aTB12, myTol1, myRes1, myPTol1,
                            myResCoeff1, aB2, aT11, aT12);
     //
     if (bOut || bThin) {
@@ -439,7 +441,8 @@ void IntTools_EdgeEdge::FindSolutions(const IntTools_Range& theR1,
 //=======================================================================
 Standard_Boolean IntTools_EdgeEdge::FindParameters(const BRepAdaptor_Curve& theBAC,
                                                    const Standard_Real aT1, 
-                                                   const Standard_Real aT2, 
+                                                   const Standard_Real aT2,
+                                                   const Standard_Real theTol,
                                                    const Standard_Real theRes,
                                                    const Standard_Real thePTol,
                                                    const Standard_Real theResCoeff,
@@ -450,18 +453,17 @@ Standard_Boolean IntTools_EdgeEdge::FindParameters(const BRepAdaptor_Curve& theB
   Standard_Boolean bRet;
   Standard_Integer aC, i, k;
   Standard_Real aCf, aDiff, aDt, aT, aTB, aTOut, aTIn;
-  Standard_Real aDist, aDistP, aDistTol, aTol;
+  Standard_Real aDist, aDistP, aDistTol;
   gp_Pnt aP;
   Bnd_Box aCBx;
   //
   bRet = Standard_False;
   aCf = 0.6180339887498948482045868343656;// =0.5*(1.+sqrt(5.))/2.;
   aDt = theRes;
-  aTol = theBAC.Tolerance();
   aDistP = 0.;
-  aDistTol = Precision::PConfusion();
+  aDistTol = 1e-9;
   aCBx = theCBox;
-  aCBx.Enlarge(aTol);
+  aCBx.Enlarge(theTol);
   //
   const Handle(Geom_Curve)& aCurve = theBAC.Curve().Curve();
   const GeomAbs_CurveType aCurveType = theBAC.GetType();
@@ -476,7 +478,7 @@ Standard_Boolean IntTools_EdgeEdge::FindParameters(const BRepAdaptor_Curve& theB
     while (aC*(aT-aTB) >= 0) {
       theBAC.D0(aTB, aP);
       aDist = PointBoxDistance(theCBox, aP);
-      if (aDist > aTol) {
+      if (aDist > theTol) {
         if (fabs(aDist - aDistP) < aDistTol) {
           aDt = Resolution(aCurve, aCurveType, theResCoeff, (++k)*aDist);
         } else {
@@ -867,8 +869,16 @@ void IntTools_EdgeEdge::ComputeLineLine()
     return;
   }
   //
-  aCommonPrt.SetRange1(aT1 - myTol, aT1 + myTol);
-  aCommonPrt.AppendRange2(aT2 - myTol, aT2 + myTol);
+  // compute correct range on the edges
+  Standard_Real anAngle, aDt1, aDt2;
+  //
+  anAngle = aD1.Angle(aD2);
+  //
+  aDt1 = IntTools_Tools::ComputeIntRange(myTol1, myTol2, anAngle);
+  aDt2 = IntTools_Tools::ComputeIntRange(myTol2, myTol1, anAngle);
+  //
+  aCommonPrt.SetRange1(aT1 - aDt1, aT1 + aDt1);
+  aCommonPrt.AppendRange2(aT2 - aDt2, aT2 + aDt2);
   aCommonPrt.SetType(TopAbs_VERTEX);
   aCommonPrt.SetVertexParameter1(aT1);
   aCommonPrt.SetVertexParameter2(aT2);
index 83f6dff6647535e245c4296d87d25ac3ab1dcc09..bc8c852f64933aa8cc4d863d0df8e7dc19139a0b 100644 (file)
@@ -47,48 +47,51 @@ public:
   
 
   //! Empty contructor
-    IntTools_EdgeEdge();
-~IntTools_EdgeEdge();
-  
+  IntTools_EdgeEdge();
+
+  //! Destructor
+  ~IntTools_EdgeEdge();
 
   //! Contructor
-    IntTools_EdgeEdge(const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2);
+  IntTools_EdgeEdge(const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2);
   
 
   //! Contructor
-    IntTools_EdgeEdge(const TopoDS_Edge& theEdge1, const Standard_Real aT11, const Standard_Real aT12, const TopoDS_Edge& theEdge2, const Standard_Real aT21, const Standard_Real aT22);
+  IntTools_EdgeEdge(const TopoDS_Edge& theEdge1, const Standard_Real aT11,
+      const Standard_Real aT12, const TopoDS_Edge& theEdge2, 
+      const Standard_Real aT21, const Standard_Real aT22);
   
 
   //! Sets the first edge
-    void SetEdge1 (const TopoDS_Edge& theEdge);
+  void SetEdge1(const TopoDS_Edge& theEdge);
   
 
   //! Sets the first edge and its range
-    void SetEdge1 (const TopoDS_Edge& theEdge, const Standard_Real aT1, const Standard_Real aT2);
+  void SetEdge1(const TopoDS_Edge& theEdge, const Standard_Real aT1, const Standard_Real aT2);
   
 
   //! Sets the range for the first edge
-    void SetRange1 (const IntTools_Range& theRange1);
+  void SetRange1(const IntTools_Range& theRange1);
   
 
   //! Sets the range for the first edge
-    void SetRange1 (const Standard_Real aT1, const Standard_Real aT2);
+  void SetRange1(const Standard_Real aT1, const Standard_Real aT2);
   
 
   //! Sets the second edge
-    void SetEdge2 (const TopoDS_Edge& theEdge);
+  void SetEdge2(const TopoDS_Edge& theEdge);
   
 
   //! Sets the first edge and its range
-    void SetEdge2 (const TopoDS_Edge& theEdge, const Standard_Real aT1, const Standard_Real aT2);
+  void SetEdge2(const TopoDS_Edge& theEdge, const Standard_Real aT1, const Standard_Real aT2);
   
 
   //! Sets the range for the second edge
-    void SetRange2 (const IntTools_Range& theRange);
+  void SetRange2(const IntTools_Range& theRange);
   
 
   //! Sets the range for the second edge
-    void SetRange2 (const Standard_Real aT1, const Standard_Real aT2);
+  void SetRange2(const Standard_Real aT1, const Standard_Real aT2);
   
 
   //! Performs the intersection between edges
@@ -96,11 +99,11 @@ public:
   
 
   //! Returns TRUE if common part(s) is(are) found
-    Standard_Boolean IsDone() const;
+  Standard_Boolean IsDone() const;
   
 
   //! Returns common parts
-    const IntTools_SequenceOfCommonPrts& CommonParts() const;
+  const IntTools_SequenceOfCommonPrts& CommonParts() const;
 
 
 
@@ -110,7 +113,7 @@ protected:
   
 
   //! Checks the data
-    void CheckData();
+  void CheckData();
   
 
   //! Prepares the data
@@ -122,36 +125,50 @@ protected:
   
 
   //! Intermediate function
-  Standard_EXPORT void FindSolutions (IntTools_SequenceOfRanges& theRanges1, IntTools_SequenceOfRanges& theRanges2, Standard_Boolean& bSplit2);
+  Standard_EXPORT void FindSolutions (IntTools_SequenceOfRanges& theRanges1, 
+    IntTools_SequenceOfRanges& theRanges2, Standard_Boolean& bSplit2);
   
 
   //! Looking for the exact intersection ranges
-  Standard_EXPORT void FindSolutions (const IntTools_Range& theR1, const IntTools_Range& theR2, const Bnd_Box& theBox2, IntTools_SequenceOfRanges& theRanges1, IntTools_SequenceOfRanges& theRanges2);
+  Standard_EXPORT void FindSolutions (const IntTools_Range& theR1, 
+    const IntTools_Range& theR2, const Bnd_Box& theBox2,
+    IntTools_SequenceOfRanges& theRanges1, IntTools_SequenceOfRanges& theRanges2);
   
 
   //! Merges found solutions
-  Standard_EXPORT void MergeSolutions (const IntTools_SequenceOfRanges& theRanges1, const IntTools_SequenceOfRanges& theRanges2, const Standard_Boolean bSplit2);
+  Standard_EXPORT void MergeSolutions (const IntTools_SequenceOfRanges& theRanges1, 
+    const IntTools_SequenceOfRanges& theRanges2, const Standard_Boolean bSplit2);
   
 
   //! Looking for the range of the edge whick is in the box
-  Standard_EXPORT static Standard_Boolean FindParameters (const BRepAdaptor_Curve& theBAC, const Standard_Real aT1, const Standard_Real aT2, const Standard_Real theRes, const Standard_Real thePTol, const Standard_Real theResCoeff, const Bnd_Box& theCBox, Standard_Real& aTB1, Standard_Real& aTB2);
+  Standard_EXPORT static Standard_Boolean FindParameters(const BRepAdaptor_Curve& theBAC,
+    const Standard_Real aT1, const Standard_Real aT2, const Standard_Real theTol,
+    const Standard_Real theRes, const Standard_Real thePTol,
+    const Standard_Real theResCoeff, const Bnd_Box& theCBox,
+    Standard_Real& aTB1, Standard_Real& aTB2);
   
 
   //! Checks if edges coincide on the ranges
-  Standard_EXPORT Standard_Integer CheckCoincidence (const Standard_Real aT11, const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22, const Standard_Real theCriteria, const Standard_Real theCurveRes1);
+  Standard_EXPORT Standard_Integer CheckCoincidence (const Standard_Real aT11,
+    const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22,
+    const Standard_Real theCriteria, const Standard_Real theCurveRes1);
   
 
   //! Adds common part of the given type to myCommonParts
-  Standard_EXPORT void AddSolution (const Standard_Real aT11, const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22, const TopAbs_ShapeEnum theType);
+  Standard_EXPORT void AddSolution (const Standard_Real aT11, const Standard_Real aT12,
+    const Standard_Real aT21, const Standard_Real aT22, const TopAbs_ShapeEnum theType);
   
 
   //! Looking for the minimal distance between edges on the ranges
-  Standard_EXPORT void FindBestSolution (const Standard_Real aT11, const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22, Standard_Real& aT1, Standard_Real& aT2);
+  Standard_EXPORT void FindBestSolution (const Standard_Real aT11, const Standard_Real aT12,
+    const Standard_Real aT21, const Standard_Real aT22,
+    Standard_Real& aT1, Standard_Real& aT2);
   
 
   //! Checks is there an intersection between edges on the given ranges
   //! (for nearly conicident edges)
-  Standard_EXPORT Standard_Boolean IsIntersection (const Standard_Real aT11, const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22);
+  Standard_EXPORT Standard_Boolean IsIntersection (const Standard_Real aT11,
+    const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22);
 
 
   TopoDS_Edge myEdge1;
@@ -175,20 +192,10 @@ protected:
   Standard_Integer myErrorStatus;
   IntTools_SequenceOfCommonPrts myCommonParts;
 
-
 private:
 
-
-
-
-
 };
 
-
 #include <IntTools_EdgeEdge.lxx>
 
-
-
-
-
 #endif // _IntTools_EdgeEdge_HeaderFile
index a03518e59198cb593bd1bd5964fb8e6193cc88e4..90a397c5f79a7b2a7599bce67a963f6bc359b52c 100644 (file)
@@ -284,7 +284,7 @@ void IntTools_EdgeFace::Prepare()
     myCriteria=1.5*myTolE+myTolF;
   }
   else {
-    myCriteria=myTolE+myTolF;
+    myCriteria = myTolE + myTolF + Precision::Confusion();
   }
   // 2.a myTmin, myTmax
   myTmin=myRange.First();
@@ -1236,7 +1236,7 @@ void IntTools_EdgeFace::Perform()
       myCriteria=1.5*myTolE+myTolF;
   }
   else {
-    myCriteria=myTolE+myTolF;
+    myCriteria = myTolE + myTolF + Precision::Confusion();
   }
   
   myTmin=myRange.First();
index 32e748335749099353faf57f07a44c26b50da196..bbd68793f0048e2477530f4e235146d1c6d928ca 100644 (file)
@@ -151,12 +151,15 @@ static
 
 static void  PerformPlanes(const Handle(GeomAdaptor_HSurface)& theS1, 
                            const Handle(GeomAdaptor_HSurface)& theS2, 
+                           const Standard_Real TolF1,
+                           const Standard_Real TolF2,
                            const Standard_Real TolAng, 
                            const Standard_Real TolTang, 
                            const Standard_Boolean theApprox1,
                            const Standard_Boolean theApprox2,
                            IntTools_SequenceOfCurves& theSeqOfCurve, 
-                           Standard_Boolean& theTangentFaces);
+                           Standard_Boolean& theTangentFaces,
+                           Standard_Real& TolReached3d);
 
 static Standard_Boolean ClassifyLin2d(const Handle(GeomAdaptor_HSurface)& theS, 
                                       const gp_Lin2d& theLin2d, 
@@ -225,6 +228,7 @@ IntTools_FaceFace::IntTools_FaceFace()
   myHS2 = new GeomAdaptor_HSurface ();
   myTolReached2d=0.; 
   myTolReached3d=0.;
+  myTolReal = 0.;
   SetParameters(Standard_True, Standard_True, Standard_True, 1.e-07);
   
 }
@@ -293,6 +297,14 @@ Standard_Real IntTools_FaceFace::TolReached3d() const
   return myTolReached3d;
 }
 //=======================================================================
+//function : TolReal
+//purpose  : 
+//=======================================================================
+Standard_Real IntTools_FaceFace::TolReal() const
+{
+  return myTolReal;
+}
+//=======================================================================
 //function : Lines
 //purpose  : return lines of intersection
 //=======================================================================
@@ -341,7 +353,7 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
   const Standard_Real Tolang = 1.e-8;
   const Standard_Real aTolF1=BRep_Tool::Tolerance(theF1);
   const Standard_Real aTolF2=BRep_Tool::Tolerance(theF2);
-  const Standard_Real aTolSum = aTolF1 + aTolF2;
+  const Standard_Real aTolSum = aTolF1 + aTolF2 + Precision::Confusion();
   Standard_Real aHigh = 0.0;
 
   const BRepAdaptor_Surface aBAS1(theF1), aBAS2(theF2);
@@ -424,6 +436,7 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
   mySeqOfCurve.Clear();
   myTolReached2d=0.;
   myTolReached3d=0.;
+  myTolReal = 0.;
   myIsDone = Standard_False;
   myNbrestr=0;//?
 
@@ -469,7 +482,7 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
   const Standard_Real aTolF1=BRep_Tool::Tolerance(myFace1);
   const Standard_Real aTolF2=BRep_Tool::Tolerance(myFace2);
 
-  Standard_Real TolArc = aTolF1 + aTolF2;
+  Standard_Real TolArc = aTolF1 + aTolF2 + Precision::Confusion();
   Standard_Real TolTang = TolArc;
 
   const Standard_Boolean isFace1Quad = (aType1 == GeomAbs_Cylinder ||
@@ -493,8 +506,10 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
     //
     Standard_Real TolAng = 1.e-8;
     //
-    PerformPlanes(myHS1, myHS2, TolAng, TolTang, myApprox1, myApprox2, 
-                  mySeqOfCurve, myTangentFaces);
+    PerformPlanes(myHS1, myHS2, 
+                  aTolF1, aTolF2, TolAng, TolTang, 
+                  myApprox1, myApprox2, 
+                  mySeqOfCurve, myTangentFaces, myTolReached3d);
     //
     myIsDone = Standard_True;
     
@@ -502,13 +517,16 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
       const Standard_Integer NbLinPP = mySeqOfCurve.Length();
       if(NbLinPP) {
         Standard_Real aTolFMax;
-        myTolReached3d = 1.e-7;
         aTolFMax=Max(aTolF1, aTolF2);
-        if (aTolFMax>myTolReached3d) {
-          myTolReached3d=aTolFMax;
+        myTolReal = Precision::Confusion();
+        if (aTolFMax > myTolReal) {
+          myTolReal = aTolFMax;
+        }
+        if (aTolFMax > myTolReached3d) {
+          myTolReached3d = aTolFMax;
         }
         //
-        myTolReached2d = myTolReached3d;
+        myTolReached2d = myTolReal;
 
         if (bReverse) {
           Handle(Geom2d_Curve) aC2D1, aC2D2;
@@ -778,7 +796,7 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
 //function :ComputeTolReached3d 
 //purpose  : 
 //=======================================================================
-  void IntTools_FaceFace::ComputeTolReached3d()
+void IntTools_FaceFace::ComputeTolReached3d()
 {
   Standard_Integer aNbLin;
   GeomAbs_SurfaceType aType1, aType2;
@@ -825,9 +843,10 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
   Standard_Real aDMax = ComputeTolerance();
   if (aDMax > myTolReached3d)
   {
-      myTolReached3d = aDMax;
-    }
+    myTolReached3d = aDMax;
   }
+  myTolReal = myTolReached3d;
+}
 
 //=======================================================================
 //function : MakeCurve
@@ -2686,12 +2705,15 @@ Standard_Boolean ApproxWithPCurves(const gp_Cylinder& theCyl,
 //=======================================================================
 void  PerformPlanes(const Handle(GeomAdaptor_HSurface)& theS1, 
                     const Handle(GeomAdaptor_HSurface)& theS2, 
+                    const Standard_Real TolF1, 
+                    const Standard_Real TolF2, 
                     const Standard_Real TolAng, 
                     const Standard_Real TolTang, 
                     const Standard_Boolean theApprox1,
                     const Standard_Boolean theApprox2,
                     IntTools_SequenceOfCurves& theSeqOfCurve, 
-                    Standard_Boolean& theTangentFaces)
+                    Standard_Boolean& theTangentFaces,
+                    Standard_Real& TolReached3d)
 {
 
   gp_Pln aPln1 = theS1->Surface().Plane();
@@ -2774,7 +2796,17 @@ void  PerformPlanes(const Handle(GeomAdaptor_HSurface)& theS1,
   }
 
   theSeqOfCurve.Append(aCurve);
+  //
+  // computation of the tolerance reached
+  Standard_Real anAngle, aDt;
+  gp_Dir aD1, aD2;
+  //
+  aD1 = aPln1.Position().Direction();
+  aD2 = aPln2.Position().Direction();
+  anAngle = aD1.Angle(aD2);
+  //
+  aDt = IntTools_Tools::ComputeIntRange(TolF1, TolF2, anAngle);
+  TolReached3d = sqrt(aDt*aDt + TolF1*TolF1);
 }
 
 //=======================================================================
index 412be1ccfaaa1296e0e516debc22fbf39ac4cef1..ba557356a6935b7f207e511e5c67ec215acdcbdf 100644 (file)
@@ -72,10 +72,14 @@ public:
   Standard_EXPORT const IntTools_SequenceOfPntOn2Faces& Points() const;
   
 
-  //! Returns tolerance reached during approximation.
+  //! Returns tolerance reached during approximation,
+  //! and possibly increased to cover more area due to a small angle between surfaces.
   //! If approximation was not done, returns zero.
   Standard_EXPORT Standard_Real TolReached3d() const;
-  
+
+  //! Returns tolerance reached during approximation, without any increase.
+  //! If approximation was not done, returns zero.
+  Standard_EXPORT Standard_Real TolReal() const;
 
   //! Returns tolerance reached during approximation.
   //! If approximation was not done, returns zero.
@@ -92,7 +96,7 @@ public:
 
   //! Returns True if faces are tangent
   Standard_EXPORT Standard_Boolean TangentFaces() const;
-  
+
 
   //! Provides post-processing the result lines.
   //! <bToSplit> - the flag.
@@ -141,6 +145,7 @@ private:
   Standard_Integer myNbrestr;
   Standard_Real myTolReached2d;
   Standard_Real myTolReached3d;
+  Standard_Real myTolReal;
   Standard_Boolean myApprox;
   Standard_Boolean myApprox1;
   Standard_Boolean myApprox2;
index f2caef1e5b3f3880d6ac682f6e01ac7bd93e5aa7..31a45edd5393439c55d47faa890cfbada3924460 100644 (file)
@@ -137,7 +137,7 @@ void IntTools_ShrunkRange::SetShrunkRange(const Standard_Real aT1,
 void IntTools_ShrunkRange::Perform()
 {
   Standard_Real aCF, aCL, aTolE, aTolV1;
-  Standard_Real aTolV2, t1, t11, t1C, t2, t12, t2C;
+  Standard_Real aTolV2, t1, t11, t1C, t2, t12, t2C, dummy;
   Standard_Real aCoeff1, aCoeff2, aTol1, aTol2, dt1, dt2, aR, anEps;
   Standard_Integer pri;
   Standard_Boolean bInf1, bInf2, bAppr;
@@ -187,8 +187,8 @@ void IntTools_ShrunkRange::Perform()
     return;
   }
   //
-  aTol1 = aTolV1+aTolE;
-  aTol2 = aTolV2+aTolE;
+  aTol1 = Max(aTolV1, aTolE);
+  aTol2 = Max(aTolV2, aTolE);
   //
   aCoeff1 = (aTolE>0.05) ? 1. : 2.;
   aCoeff2 = aCoeff1;
@@ -214,9 +214,11 @@ void IntTools_ShrunkRange::Perform()
     //
     if (fabs(aTV1-aCF)<aEps) {
       aCoeff1=1.;
+      aTol1 += Precision::Confusion();
     }
     if (fabs(aTV2-aCL)<aEps) {
       aCoeff2=1.;
+      aTol2 += Precision::Confusion();
     }
   }
   //
@@ -346,7 +348,7 @@ void IntTools_ShrunkRange::Perform()
         BRepBuilderAPI_MakeVertex aMV1(aP1L);
         const TopoDS_Vertex& aV1L=aMV1.Vertex();
         //
-        pri=myCtx->ComputeVE (aV1L, myEdge, t1C);
+        pri = myCtx->ComputeVE(aV1L, myEdge, t1C, dummy);
         //
         if (pri==-3) {
           myErrorStatus=4;
@@ -446,7 +448,7 @@ void IntTools_ShrunkRange::Perform()
         BRepBuilderAPI_MakeVertex aMV2(aP2L);
         const TopoDS_Vertex& aV2L=aMV2.Vertex();
         //
-        pri=myCtx->ComputeVE (aV2L, myEdge, t2C);
+        pri = myCtx->ComputeVE(aV2L, myEdge, t2C, dummy);
         //
         if (pri==-3) {
           myErrorStatus=5;
@@ -474,7 +476,7 @@ void IntTools_ShrunkRange::Perform()
   myTS2=t2C;
   //
   // BndBox
-  Standard_Real ddx=aTolE;//1.e-12;
+  Standard_Real ddx = aTolE + Precision::Confusion();
   BndLib_Add3dCurve::Add (aBAC, t1C, t2C, ddx, myBndBox);
 }
 /////////////////////////////////////////////////////////////////////////
index f00026c8165f65cfbcc46363cf473d1ca309a128..21a029aad1ef1f6bf18855f5a519feed99151044 100644 (file)
@@ -676,7 +676,7 @@ Standard_Boolean IntTools_Tools::IsOnPave1(const Standard_Real aTR,
   //
   aT1=aCPRange.First();
   aT2=aCPRange.Last();
-  bIsOnPave=(aTR>=aT1 && aTR<=aT1);
+  bIsOnPave=(aTR>=aT1 && aTR<=aT2);
   if (bIsOnPave) {
     return bIsOnPave;
   }
@@ -802,3 +802,28 @@ Standard_Boolean IntTools_Tools::ComputeTolerance
   //
   return Standard_True;
 }
+
+//=======================================================================
+// Function : ComputeIntRange
+// purpose : 
+//=======================================================================
+Standard_Real IntTools_Tools::ComputeIntRange(const Standard_Real theTol1,
+                                              const Standard_Real theTol2,
+                                              const Standard_Real theAngle)
+{
+  Standard_Real aDt;
+  //
+  if (Abs(M_PI_2 - theAngle) < Precision::Angular()) {
+    aDt = theTol2;
+  }
+  else {
+    Standard_Real a1, a2, anAngle;
+    //
+    anAngle = (theAngle > M_PI_2) ? (M_PI - theAngle) : theAngle;
+    a1 = theTol1 * tan(M_PI_2 - anAngle);
+    a2 = theTol2 / sin(anAngle);
+    aDt = a1 + a2;
+  }
+  //
+  return aDt;
+}
index 83b87b270ab35e3ab74922524ae6aa70c111058d..7fbf7d338a238e4b83aafac43f90e6fb3ed03e6e 100644 (file)
@@ -163,6 +163,11 @@ public:
   Standard_EXPORT static Standard_Boolean ComputeTolerance (const Handle(Geom_Curve)& theCurve3D, const Handle(Geom2d_Curve)& theCurve2D, const Handle(Geom_Surface)& theSurf, const Standard_Real theFirst, const Standard_Real theLast, Standard_Real& theMaxDist, Standard_Real& theMaxPar);
 
 
+  //! Computes the correct Intersection range for 
+  //! Line/Line, Line/Plane and Plane/Plane intersections
+  Standard_EXPORT static Standard_Real ComputeIntRange(const Standard_Real theTol1,
+                                                       const Standard_Real theTol2,
+                                                       const Standard_Real theAngle);
 
 
 protected:
index 0c3de0cea89592de88787d83decc00bca50b6f66..195acb1f45c0740529605435ab149f94607a7bb3 100644 (file)
@@ -130,14 +130,18 @@ static Standard_Integer OCC23237 (Draw_Interpretor& di, Standard_Integer /*argc*
   }
  
   int aNbEnters = 0;
-  Standard_Real aPerfMeter_CPUtime = 0., aTimer_ElapsedTime = aTM.ElapsedTime();
+  Standard_Real aPerfMeter_CPUtime = 0., aTimer_CPUTime = 0., aS;
+  Standard_Integer aM, aH;
+  aTM.Show(aS, aM, aH, aTimer_CPUTime);
 
   perf_get_meter("TestMeter", &aNbEnters, &aPerfMeter_CPUtime);
+  perf_init_meter("TestMeter");
 
-  Standard_Real aTimeDiff = (fabs(aTimer_ElapsedTime - aPerfMeter_CPUtime) / aTimer_ElapsedTime);
+  Standard_Real aTimeDiff = (fabs(aTimer_CPUTime - aPerfMeter_CPUtime) / aTimer_CPUTime);
 
   printf("\nMeasurement results (%d cycles):\n", count);
-  printf("\nOSD_PerfMeter CPU time: %lf\nOSD_Timer elapsed time: %lf\n", aPerfMeter_CPUtime, aTimer_ElapsedTime);
+  printf("\nOSD_PerfMeter CPU time: %lf\nOSD_Timer CPU time: %lf\n",
+    aPerfMeter_CPUtime, aTimer_CPUTime);
   printf("Time delta is: %.3lf %%\n", aTimeDiff * 100);
 
   if (aTimeDiff > 0.2)
@@ -2413,14 +2417,14 @@ static Standard_Integer OCC25043 (Draw_Interpretor& theDI,
         }
         else 
         {
-          theDI << "Info. Faulty shape if found in source shape\n";
+          theDI << "Info. Faulty shape is found in source shape\n";
         }
       }
     }
   }
   else 
   {
-    theDI << "Error. Problems are not detected. Test is not performed.";
+    theDI << "Problems are not detected. Test is not performed.";
   }
 
   return 0;
index e4b5e756e7462943ff6f1f9ee8a5e63fae000039..08dcaa59b2f0066a1ecc4b27730ef51ef2f71e1c 100644 (file)
@@ -1,5 +1,3 @@
-puts "TODO #23876 ALL: Error: The command cannot be built"
-
 restore [locate_data_file case_9_edge.brep] a
 restore [locate_data_file case_9_wire3.brep] b
 settolerance a 0.1
index 458d8477592656a7c29e144844a332e70cbfd81b..a4009ec9bb6e2d7fe072a77626b4f68b23ce700a 100644 (file)
@@ -44,4 +44,4 @@ donly a_1 a_2
 bsection result a_1 a_2
 
 checkprops result -l 22.2575
-checksection result
\ No newline at end of file
+checksection result
index 892bf4ec408f4e7685111a077f065355536839e7..adc91503a6ae8768d3a02329c0ba3fa0e5197961 100644 (file)
@@ -1,9 +1,7 @@
-puts "TODO #OCC26814 ALL: Error : The length of result shape is"
-
 restore [locate_data_file lh3d_px1.brep] a
 plane p 0 0 0 1 0 0
 mkface f p
 bsection result a f
 
-checkprops result -l 20674.3
+checkprops result -l 18981.2
 checksection result
index 705c847cabadd0ccc6abd6c9a9bbb5055e11a463..9c456abb584c835d82d8ec344f63da6d0fd4c1c5 100644 (file)
@@ -10,5 +10,5 @@ updatetolerance b 1
 
 bsection result a b
 
-checkprops result -l 135.096
+checkprops result -l 130.625
 checksection result
index 292a1c63097ed3a6a78f8eed02b410ac30da51f0..9b8b8216d16f333c04cbe3c910e7ee56e559f189 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_bat-nord.asm.4.gdml.tcl]
 
index a629840ae8e13fa587f5c35259ba55ae7d9c38b9..ce9a561525aff83a5b8c3946431e1cae5bfcfbe0 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_bat-nord_et2.asm.4.gdml.tcl]
 
index ede38d31324edc87a15cb1d926c698f987b20352..962f45350cdc4cec1ec0f825a8bf2c46e069c3eb 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_bat-nord_et2_13302.prt.3.gdml.tcl]
 
index f1c32cefd15122853c7c330e2e3112def311ac2d..22c6bbe41980732ab5a8723619d2869d17d492a0 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_et1_401-ta6025.prt.3.gdml.tcl]
 
index 551a980067976abf3be4d67b419af97eccadd834..e377ab925efd4110ed56c75a4b9a397d89f22f3c 100644 (file)
@@ -1,4 +1,4 @@
 source [locate_data_file 20000_et1_401-ta6027.prt.2.gdml.tcl]
 
 ## image is differ from application
-checkprops result -s 1.26259e+07
+checkprops result -s 1.50445e+007
index 5d19baa385ad323a1a211844945cec12ca6e3784..a7b3ba602e01d2b9d28a9c54dee2787285554837 100644 (file)
@@ -1,3 +1,3 @@
-puts "TODO OCC26018 Linux: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_et1_401-ta6029.prt.2.gdml.tcl]
 
+checkprops result -s 1.0285e+007
index ac7918183ef24ff9f41939d4e3bc0bc05a9181e8..33ab5272b3ed8a22ededb19fea22dd4637f136a5 100644 (file)
@@ -1,6 +1,4 @@
-puts "TODO OCC26018 ALL: Error : The area of result shape is"
-#puts "TODO OCC26018 Linux: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_et3_401-ta6037.prt.2.gdml.tcl]
 
 ## image is differ from application
-checkprops result -s 0
+checkprops result -s 2.00593e+007
index e56326930e0f0100f3b43ddc7bb0af3204b8340b..359f17beb83ff80c8586ef9737ea1f3bb4b207cb 100644 (file)
@@ -1,4 +1,2 @@
-puts "TODO OCC26018 Linux: Faulty shapes in variables faulty_1 to"
-
 source [locate_data_file 20000_et4_401-ta6049.prt.2.gdml.tcl]
 
index 0920d0b5aa9649216c6e29a6c55b7816ceeaa40b..86f5b92dcbe7d7c57aa89a00edcb900fb8e45551 100644 (file)
@@ -1,6 +1,5 @@
-puts "TODO OCC26018 Windows: Error : The area of result shape is"
-puts "TODO OCC26018 Linux: Error : The command is not valid. The area is"
 source [locate_data_file 20000_et4_401-ta6319.prt.2.gdml.tcl]
 
 ## image is differ from application
-checkprops result -s 0
\ No newline at end of file
+donly result
+checkprops result -s empty
\ No newline at end of file
index ddab5e0865c282113d8ae3a6c2300b6c419c9183..b2008aff6c580be422e89e02dfb1015d2e206bfb 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_et5_401-ta6156.prt.2.gdml.tcl]
 
index 966d77c6a0d1ffbfe9f3769dfdc767ef67883920..c1949985559f87be2d0391db54da2bc5d60a0f52 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_et5_401-ta6160.prt.2.gdml.tcl]
 
index 0d1cae18dfc72025f0f0dc399e06e777b6d16a10..8715f1c4b57eaf996685d33fe3473dd25d8c1224 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_et3.asm.2.gdml.tcl]
 
index 1dda8ec629588ee7884885d9f15b4903e7b59318..95af4a940a7d25f6a43cc782192d5a5e4a1ee3cb 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_et3_401-ta13450.prt.2.gdml.tcl]
 
index 49ebaafb288431740776f8b72fe839158c591ea4..0872a94d7d854445f4c9b9ed21fc2926fd53078a 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_et5.asm.2.gdml.tcl]
 
index 2cac2ebc1f34ca07dacf79971dce983969ef232a..499a27481a8773687d254e251a3318a0efc6c4ca 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_et5_401-ta13428.prt.2.gdml.tcl]
 
index 4b3554e6a0fcabdbbb13c53395fe4c5a7d532e57..e6c506ce2a6e0aae1e4a43c600b7fbabe69eb1f6 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Linux: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_et5_401-ta13429.prt.2.gdml.tcl]
 
index 3999e5247cc009c9ee185792610a13f34683321f..7289aee1de9759f3bd99a00565d4713ba4170e6e 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_et5_401-ta13457.prt.2.gdml.tcl]
 
index 58d6dab61999bda3fa13cb78a4557bf1ab91ad44..11e1059084b608c9f19eed132d09ec4fae2aaadf 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_et6.asm.2.gdml.tcl]
 
index 90ce62d3c9e52931d178465f0ab3b879c0402292..4ca02a8745a910c42ae924e62217d1483b9f228e 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_et6_401-ta13432.prt.2.gdml.tcl]
 
index bac67ea515b8957105d90a788995802407e22fc0..7569d8676afa9860194a3d33576b9123184380a4 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_et6_401-ta13460.prt.2.gdml.tcl]
 
index b5cdf1f0bc6066d3daf9124068761ec311178a6c..90026140ad16a6929ba24f5bc06021d95e850129 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_rdc.asm.3.gdml.tcl]
 
index cc4de0fa69a481296cae3481b30bb0e5b79e48e5..17f92c665c10a4a15f96dbe5bf5c83e7a516dcaf 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_rdc_401-ta13415.prt.2.gdml.tcl]
 
index a07a19ad9e277f1e885a7c6cc05ad7b58048ae0f..8b630ccbd6f8ba3c80a764b2223cdc8a49ed4639 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_rdc_401-ta13416.prt.3.gdml.tcl]
 
index 11407619ce838390199bca60dd1a6e768c65ee0d..459a3432be226797fa6c11a058af5b9b1cca2411 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_ss1.asm.2.gdml.tcl]
 
index 51380e70ed60a8b778a01c26a1635a9418bd5eec..ff55c6648d4179ab1bdd3ebab1431ade4fa1e6fe 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_ss2.asm.2.gdml.tcl]
 
index 3dfd2a9959903b8fea3ebce0811a4f8c96b05437..f9669d0ec74b9547e876b4f3729c9e3b86884b69 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_ss2_401-ta13399.prt.2.gdml.tcl]
 
index 53e7adaa492b2ef8a726440542b31dc88cf88399..1901f5c7a9f9e4682f9a0ea6ccca12564786cd47 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_h1-2_ss2_401-ta13435.prt.2.gdml.tcl]
 
index f8250a3ab98ece798ffc2a38d0c114d0ea921ea1..6b8dba033359e135a6271db37151e88fc2a62f37 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_rdc_401-ta6018.prt.2.gdml.tcl]
 
index 374516f43f298224e95fa0f7543a0760977f12bc..c81ecdd3335c32241aaaaacc6702a3509f2873eb 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_salle-experience.asm.4.gdml.tcl]
 
index febe039223510d451b9ccce6d845c70351ef1124..efec84312781b4e40bd19bea871a31f337e5aaf7 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_ss1_401-ta6004.prt.2.gdml.tcl]
 
index 3fa3a46925dd3dab536d86d254d0a05f73364c62..d0fbd40e2687d15e4fbb4ee8935b935e05d0ea77 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_ss1_401-ta6005.prt.2.gdml.tcl]
 
index f739e0bc810d65deb2ad9b3b1339373e44902797..48b374a546ca2aed37643f2defd5e7bb66a1b282 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 20000_ss1_401-ta6009.prt.2.gdml.tcl]
 
index eb81ab4ad26e0f74b32fca56cff9544672af717c..c21483d7b022f3cac5e931c6d0ffb1fb1ffe8ea2 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 200a0-1_sid-deploye.asm.1.gdml.tcl]
 
index d8f1e720632da3d930157d2dd448838728026cdf..429aa67a96a726f0f93e0026e06ff166fc0be0c8 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 200a0-1_sid-retracte.asm.1.gdml.tcl]
 
index 2034bd03c3c37a7b36ed45201749bbe716c744ba..5056d161e4c78dd0bbea1ff2f7e1076e63afd30a 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 200a0-1_sid_ens-fixe.asm.1.gdml.tcl]
 
index f9f4fbb3b520a06a21e77b4f0dfdd50ff7f93189..5783aea60621cb1063b95434f9d0b9b402c8f8d0 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 200a0-1_sid_ens-fixe_vanne-tete.prt.1.gdml.tcl]
 
index 2f8beda78c1829232713fc39a0d5a93b04ab2d26..3b5f0d0ed18a6713e82a377d8caeaad4abbbde89 100644 (file)
@@ -1,2 +1 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 200a0-1_sopac-dn500.asm.1.gdml.tcl]
index 718103630aa7f3345bc8dce3ef03758377375ab2..bb46cd9d871658caa6cd45d1315dfc3655a9659b 100644 (file)
@@ -1,2 +1 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 200a0-1_sopac-dn500_piquage.prt.1.gdml.tcl]
index c40b0786e773a0bcb55eb64c22b6fc22006b53fe..4b096b74fa88d46b706c0b2abdbc4e0916aa1321 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 200a0-1_sopac-dn500_support.prt.1.gdml.tcl]
 
index 77bd9e25f8f0c0992184d73faf859d4274144516..7ca79cafd77d169172cee3397bef3f4b44571cf7 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file 51678_flame-sbr.prt.1.gdml.tcl]
 
index d87542a46647d5ff25647a805eb086acadbe3100..c00af965b27f84cc924d5d6c074452dc05c168ca 100644 (file)
@@ -1,5 +1,3 @@
-puts "TODO ?OCC26018 ALL: Error: bopcheck failed"
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to"
 source [locate_data_file 52109_shapiro.prt.gdml.tcl]
 
 set bcheck [bopcheck result]
index 754691406978af2b5ae2dda7c6af14357eaed2da..2e5ca2f6eda5d232386433d0899cbe9a61a9cc3e 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file bt_ndc.prt.1.gdml.tcl]
 
index 4c8dfde2905e95fec72392a3d7c963ad7c87fb62..7fc4a44d0f690847f02f82b2ed2efbbde649f350 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file equipement_chambre.asm.1.gdml.tcl]
 
index 243f9e3f07ac7e9777df7699ae3c94c1b0862034..6351da7bc53152d1f750441cb9ebf2699cdd017c 100644 (file)
@@ -1,3 +1,8 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC26018 ALL: bopcheck failed"
 source [locate_data_file mos2014-asm-scf-final.asm.1.gdml.tcl]
 
+set bcheck [bopcheck result]
+puts $bcheck
+if {![regexp {This shape seems to be OK.} $bcheck]} {
+  puts "Error: bopcheck failed"
+}
\ No newline at end of file
index 4ccdaa54a6c123bbb01d0c0a1f7f82386ea50212..21506955a8ef1431934bf2f198b3eb45a9fa7c19 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file mos2014-ndc-final.asm.1.gdml.tcl]
 
index d7be5dc51241b312c4f9ea00bd0a7ac2c1fda2c5..9f13d031f4c114bfc14b8743ccd289acad2e6451 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file mos2014-po-modif.prt.1.gdml.tcl]
 
index c514598ead14bf4fa9220ec658ef852a87535ab0..47a9368a4d2081bafc2853240efefce905f1ff6b 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
 source [locate_data_file mos2014-po-modif.prt.15.gdml.tcl]
 
index 2b0075db81e79b0493ca376da88924eece60b739..a4adc5c8be565fbc827d4a5d24c92acd83b0d9a2 100644 (file)
@@ -1,3 +1,8 @@
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC26018 ALL: bopcheck failed"
 source [locate_data_file mos2014-scf-final.prt.1.gdml.tcl]
 
+set bcheck [bopcheck result]
+puts $bcheck
+if {![regexp {This shape seems to be OK.} $bcheck]} {
+  puts "Error: bopcheck failed"
+}
\ No newline at end of file
index 89564fed03050d6478c6f955d0190515f05a90c5..0ca9e049d5d73fb1ce9d6f208f5e12958b0500ee 100644 (file)
@@ -2,6 +2,8 @@
 # plane unstable
 
 puts "TODO OCC26020 ALL: Error: bopcheck failed"
+puts "TODO ?OCC26020 ALL: Faulty shapes in variables faulty_1"
+puts "TODO OCC26020 ALL: Error : The area of result shape is"
 
 # planar face 
 plane pln_f1 0 -870 -1.3877787807814457e-014 0 1 1.1102230246251565e-016
index a12c46ed16e61916cfa6dba17bf77d20d48e063d..e7dfbe78a3f45ca5eb008c0d171169e77bd9aa87 100644 (file)
@@ -1,10 +1,6 @@
 # test script on make volume operation
 # plane unstable
 
-puts "TODO OCC26020 Windows: Error: bopcheck failed"
-puts "TODO OCC26020 Linux: Error : The area of result shape is"
-puts "TODO OCC26020 Linux: Error : The command is not valid. The area is"
-
 # planar face 
 plane pln_f1 -2740.6595835899998 -150 -1050 1.110223024625157e-016 1 1.1102230246251563e-016
 erase pln_f1
@@ -43,5 +39,5 @@ mkface f7 pln_f7 -1000000 1000000 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7
 
-checkprops result -s 9.99961e+012
+checkprops result -s 25577.7
 
index 5361f85569e522e532b288cef6e658809a60447d..82079fce6f641ee1c7b4e4298bb169857f709f84 100644 (file)
@@ -1,10 +1,6 @@
 # test script on make volume operation
 # plane unstable
 
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Error : The area of result shape is"
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-
 # planar face 
 plane pln_f1 -513.57358775546049 376.87261141864394 391.24411461018769 -0.35888381816183362 -0.86162916044152549 0.35888381816183351
 erase pln_f1
@@ -53,5 +49,5 @@ mkface f9 pln_f9 -1000000 1000000 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7 f8 f9
 
-checkprops result -s 2.99991e+012
+checkprops result -s 16887.7
 
index 264d60dc6141d11906247dfc4415d63c82bbb16a..f8ac37b697feb83b522a11de7d18be5f62b2fe7e 100644 (file)
@@ -1,10 +1,6 @@
 # test script on make volume operation
 # plane unstable
 
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Error : The area of result shape is"
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-
 # planar face 
 plane pln_f1 0 1960 8.8817841970012523e-015 0 -1 -1.1102230246251565e-016
 erase pln_f1
@@ -43,5 +39,5 @@ mkface f7 pln_f7 -1000000 1000000 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7
 
-checkprops result -s 4.00252e+012
+checkprops result -s 70935.2
 
index 3d55712faf493d798e159a89c22f71b21be230c2..8ddc568f6cdc11a91521aad5d798c60eedfd8917 100644 (file)
@@ -2,7 +2,7 @@
 # plane unstable
 
 puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Error : The area of result shape is"
+puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to"
 
 # planar face 
 plane pln_f1 -1863.18155559 1250 -1538.57262704 1.110223024625157e-016 1 1.1102230246251563e-016
@@ -37,5 +37,4 @@ mkface f6 pln_f6 -1000000 1000000 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6
 
-checkprops result -s 7.73553e+007
-
+checkprops result -s 23130.3
index 035d26d64f08caf68a644149000eaa197daa23cd..affce6830ac63fad847b82d473f356f85421eead 100644 (file)
@@ -1,10 +1,6 @@
 # test script on make volume operation
 # plane
 
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 Linux: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 Linux: Error : The area of result shape is"
-
 # planar face 
 plane pln_f1 590.6877421677151 -519.8775759738943 -93.555747452441423 0.64798185367609173 0.7547095802227719 -0.10263024323494339
 erase pln_f1
@@ -42,6 +38,6 @@ mkface f7 pln_f7 -1000000 1000000 -1000000 1000000
 
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7
+donly result
 
-checkprops result -s 9.99931e+012
-
+checkprops result -s empty
index e4ec2a8fbdfe8abc336204986fab9240da36e806..c016f5766fc217aaf73316ae31727aaa9aeb2761 100644 (file)
@@ -1,10 +1,6 @@
 # test script on make volume operation
 # plane
 
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO ?OCC26020 ALL: Error : The area of result shape is"
-
 # planar face 
 plane pln_f1 79.400363856921899 8.7220982904821555e-015 -94.116057183203139 -0.83335943573869897 -2.2204460492503131e-016 -0.55273144551877762
 erase pln_f1
@@ -43,5 +39,5 @@ mkface f7 pln_f7 -1000000 1000000 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7
 
-checkprops result -s 1.19997e+013
+checkprops result -s 236.65
 
index a6ac167c468e526a6b7761907651bbb37de48eb0..b80b800ca168ace06e57e8a9821b451cac72bd03 100644 (file)
@@ -34,4 +34,4 @@ mkface f6 pln_f6 -1000000 1000000 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6
 
-checkprops result -s 12400.
+checkprops result -s empty
index 09befce0c7eb5e063d3e65dc053591a3ff2758f6..e55a34411f02b4b7b39525b33ad9434f8c7813f4 100644 (file)
@@ -1,10 +1,6 @@
 # test script on make volume operation
 # plane
 
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Error : The area of result shape is"
-
 # planar face 
 plane pln_f1 35.877464033656999 5.9462928582193458e-016 -25.973690230789806 -0.64944804833018333 -3.0834627769631957e-016 -0.76040596560003137
 erase pln_f1
@@ -43,5 +39,5 @@ mkface f7 pln_f7 -1000000 1000000 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7
 
-checkprops result -s 4.31002e+007
+checkprops result -s empty
 
index d684fb0b8a3d81f232d6d9134f00d9f8b6944418..9339615fe30a3b607702b065660336467bfb7fae 100644 (file)
@@ -1,10 +1,6 @@
 # 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 result shape is"
-
 # planar face 
 plane pln_f1 18.855982726712998 17.500000000800412 0 -0.96152394764524818 -0.27472112788189063 0
 erase pln_f1
@@ -53,4 +49,4 @@ mkface f9 pln_f9 -1000000 1000000 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7 f8 f9
 
-checkprops result -s 1.3412e+013
+checkprops result -s 45760.9
index 7dc971f81445691100b2de600aa6edc08f5454d8..e413db8d9f85e36382232adc1b507716371ef8aa 100644 (file)
@@ -1,10 +1,6 @@
 # test script on make volume operation
 # plane
 
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Error : The area of result shape is"
-
 # planar face 
 plane pln_f1 32.294537607197917 1.8096910201742288e-014 -39.176406819310692 -0.77162458338772011 -6.6613381477509373e-016 -0.63607822027776384
 erase pln_f1
@@ -53,5 +49,5 @@ mkface f9 pln_f9 -1000000 1000000 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7 f8 f9
 
-checkprops result -s 2.20868e+013
+checkprops result -s 40838.8
 
index efb922c2c842abbb321af80c994e88ceef0a0762..c61ace667fff2e7a56f3e654c2eaec3c91732a38 100644 (file)
@@ -38,5 +38,5 @@ mkface f6 pln_f6 -1000000 1000000 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6
 
-checkprops result -s 26668.8
+checkprops result -s 97028.3
 
index e774e27cc0709f0b91fccf546759c2e50d21715d..c9f76b832d2eb07a77fabedcb143e2a0a36888a9 100644 (file)
@@ -1,10 +1,6 @@
 # test script on make volume operation
 # plane
 
-puts "TODO OCC26020 Windows: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 Linux: Error : The command is not valid. The area is"
-puts "TODO OCC26020 Linux: Error : The area of result shape is"
-
 # planar face 
 plane pln_f1 -513.57358775546049 376.87261141864394 391.24411461018769 -0.35888381816183362 -0.86162916044152549 0.35888381816183351
 erase pln_f1
@@ -43,4 +39,4 @@ mkface f7 pln_f7 -1000000 1000000 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7
 
-checkprops result -s 5.29724e-005 -eps 1.0e-3
+checkprops result -s empty
index cf89e360e634b24c9b4f9f4a9795f5cb86c8f565..03b5e09448b7f496977c3ee8011df4c22d45db59 100644 (file)
@@ -2,6 +2,7 @@
 # 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
index ecb06d1ae5f1882354d03adde681a36b0152f3f3..e1c8068b50846aec03388a6d8fc97966fee9e1fa 100644 (file)
@@ -1,8 +1,6 @@
 # test script on make volume operation
 # cylinder plane unstable
 
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-
 # planar face 
 plane pln_f1 1634.597165131441 820 -503.19389260275346 0.26050450864264807 2.2204460492503131e-016 0.96547263087922519
 erase pln_f1
@@ -51,5 +49,5 @@ mkface f9 cyl_f9 0 6.2831853071795862 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7 f8 f9
 
-checkprops result -s 2.02141e+012
+checkprops result -s 2.12115e+007
 
index ae992da614f5fdeb6c1e48be4096fd5734bd2995..b6f66c461b3c300bea3f633ec834f373ecd90495 100644 (file)
@@ -1,8 +1,6 @@
 # test script on make volume operation
 # cylinder plane unstable
 
-puts "TODO OCC26020 Linux: Error: bopcheck failed"
-
 # planar face 
 plane pln_f1 0 -875 -1.4432899320127035e-014 0 1 1.1102230246251565e-016
 erase pln_f1
index c93b6044675f2036b59234d6ab8ff142d1270059..5828337442ca99217f6fe0f950820128226c8ebd 100644 (file)
@@ -1,9 +1,6 @@
 # test script on make volume operation
 # cylinder plane unstable
 
-puts "TODO OCC26020 Linux: Error: bopcheck failed"
-puts "TODO OCC26020 Linux: Faulty shapes in variables faulty_1 to faulty_"
-
 # planar face 
 plane pln_f1 0 -870 -1.3877787807814457e-014 0 1 1.1102230246251565e-016
 erase pln_f1
index 50aab7029b4a6490552788f4096aab1a8736d00f..5e211c510b4b327a274c78c3d1e18f958c2cfa12 100644 (file)
@@ -1,8 +1,7 @@
 # test script on make volume operation
 # cylinder plane unstable
 
-puts "TODO OCC26020 Windows: Error: bopcheck failed"
-puts "TODO OCC26020 Linux: Error : The area of result shape is"
+puts "TODO OCC26020 ALL: Error: bopcheck failed"
 
 # planar face 
 plane pln_f1 0 -232.5 3.8857805861880479e-015 0 -1 -1.1102230246251565e-016
@@ -42,5 +41,4 @@ mkface f7 cyl_f7 0 6.2831853071795862 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7
 
-checkprops result -s 1.00502e+012
-
+checkprops result -s 1.93904e+007
index 37f0cb8f800de1858b5efed6dfb93cce7babe92b..7918455d6446e64d3b4d474fd2c4e7d96c1bb4c8 100644 (file)
@@ -1,10 +1,6 @@
 # test script on make volume operation
 # cylinder plane unstable
 
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 ALL: Error : The area of result shape is"
-
 # planar face 
 plane pln_f1 -2591.6564295634707 -1492.5 -1185.6605612884966 0.46174861323503397 1.1102230246251565e-016 -0.88701083317822171
 erase pln_f1
index f3c4e147daf3c711914e418d73ea05637e639da9..3bfdb5cdcffbcac1b0874e0d76313b90d4800432 100644 (file)
@@ -1,9 +1,6 @@
 # test script on make volume operation
 # cylinder plane
 
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 Linux: Error : The area of result shape is"
-
 # planar face 
 plane pln_f1 1665.7013364039071 -825 -339.75605834598957 0.15643446504023129 4.4408920985006257e-016 0.98768834059513766
 erase pln_f1
index cd17b62e528d983364ec926c679db718ca540917..23f23cbea4e8e593389b990912fa78257b0a6d85 100644 (file)
@@ -1,9 +1,8 @@
 # test script on make volume operation
 # cylinder plane
 
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 Linux: Error : The area of result shape is"
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to"
+puts "TODO OCC26020 Linux: Error: bopcheck failed"
+puts "TODO OCC26020 Linux: Faulty shapes in variables faulty_1 to"
 
 # planar face 
 plane pln_f1 0 -1450 -4.4408920985006262e-015 0 1 1.1102230246251565e-016
@@ -48,5 +47,4 @@ mkface f8 cyl_f8 0 6.2831853071795862 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7 f8
 
-checkprops result -s 1.8917e+007
-
+checkprops result -s 1.96647e+007
index 134961a39d7e6049ca2122f1935c4f15ac9e41b4..6955ed3dcc181d9fc4cab4b0b0b0bf663626aab2 100644 (file)
@@ -1,9 +1,6 @@
 # test script on make volume operation
 # cylinder plane
 
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-
 # planar face 
 plane pln_f1 1441.7792892394632 -1532.5 900.69424230424909 -0.6072926454886024 -2.2204460492503121e-016 0.79447822042863747
 erase pln_f1
@@ -47,5 +44,5 @@ mkface f8 cyl_f8 0 6.2831853071795862 -1000000 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6 f7 f8
 
-#checkprops result -s 2.00003e+012
+#checkprops result -s 2.13502e+007
 
index db6bafd76639b5ce0a4b69e5fec77d7d6b4ed445..7ee5533b0014f725260626196d6508d2cc55522d 100644 (file)
@@ -3,6 +3,7 @@
 
 puts "TODO OCC26020 ALL: Error: bopcheck failed"
 puts "TODO OCC26020 ALL: Error : The area of result shape is"
+puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to"
 
 # planar face 
 plane pln_f1 -460.8377555733228 -1160 -121.8751945104883 0.17364817766693036 -5.955424826592936e-017 -0.98480775301220813
index 3ba14b95a9284205616de4cada3377aebe5e9f08..268ce61817e2a1fdcb642b438dfd32c5ce988e58 100644 (file)
@@ -2,10 +2,6 @@
 # cone plane
 # Error status: 191
 
-puts "TODO OCC26020 Windows: Error status"
-puts "TODO OCC26020 Windows: TEST INCOMPLETE"
-puts "TODO OCC26020 Linux: Faulty shapes in variables faulty_1 to faulty_"
-
 # planar face 
 plane pln_f1 -2.4595121467478056e-014 -746.52181700999995 1844.22896887 0.86602540378443849 -0.47367733686073094 -0.16009303715192033
 erase pln_f1
@@ -38,3 +34,5 @@ mkface f6 con_f6 0 6.2831853071795862 0 1000000
 
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5 f6
+
+checkprops result -s 1.13448e+007
\ No newline at end of file
index 54d488064487b8e2ff15aff2bc44952f158e4094..a7dd71791a966e3d42ae49ba4839819bb2f98065 100644 (file)
@@ -1,8 +1,6 @@
 # test script on make volume operation
 # cone plane
 
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-
 # planar face 
 plane pln_f1 0 -746.52181700999995 1844.22896887 -0.86602540378443904 -0.4736773368607301 -0.16009303715192008
 erase pln_f1
@@ -31,4 +29,4 @@ mkface f5 con_f5 0 6.2831853071795862 0 1000000
 # make volume operation 
 mkvolume result f1 f2 f3 f4 f5
 
-checkprops result -s 8.06875e+006
+checkprops result -s 8.92077e+006
index fce911df3cf6de47efd9e0ec8a2a609b4f94528f..badc77adc4f8764c070a3a03e7b1d9455eb6929f 100755 (executable)
@@ -1,4 +1,5 @@
-puts "TODO OCC26717 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO ?OCC26717 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC26717 ALL: Error : operation bfuse is WRONG because number of SOLID"
 
 puts "=========="
 puts "BUC60462"
@@ -13,7 +14,7 @@ bfuse result a b
 puts "Fuse end"
 
 checkshape result r
-
+checknbshapes result -solid 1 -m "operation bfuse"
 checkprops result -s 93237.9
 checkshape result
 set 2dviewer 0
index 08000e2536dbd0d80e65527805732549a25d7ee9..4264a43790d423e21628f254280c35a2f273cea1 100755 (executable)
@@ -7,7 +7,7 @@ restore [locate_data_file buc60776b.brep] b
 checkshape b
 bfuse result a b
 
-checkprops result -s 61626.2 
+checkprops result -s 60771.3
 checkshape result
 
 set 2dviewer 1
index 8e2f9fc10a34f9e3681463fbacac9701bfa63ec3..5c2a62e2b5a7eb26f9e85d944fdb693fd72b5682 100755 (executable)
@@ -22,7 +22,7 @@ puts "Start boolean operation ..."
 bopsection result
 puts "Finish boolean operation ..."
 
-checkprops result -l 3331.35 
+checkprops result -l 3384.97
 checkshape result
 checksection result
 checknbshapes result -vertex 1197 -edge 1182 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 2380
index 18a166e152df251a571a60be3b83c0062ccb7190..bf01090a542a7871e170845129a36bd2f1c8ae07 100755 (executable)
@@ -1,9 +1,5 @@
 puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
 puts "TODO OCC25917 ALL: Error : The area of result shape is"
-if { [regexp {Debug mode} [dversion]] } {
-  puts "TODO OCC25917 ALL: TEST INCOMPLETE"
-  puts "TODO OCC25917 ALL: Tcl Exception"
-}
 
 puts "========================"
 puts " OCC472 "
index 090e4c5282998f2fa2f932e480b559922f02bb2f..c7fe651b375b2b417ac2b3d0a534c8bf8fcecb16 100755 (executable)
@@ -1,8 +1,6 @@
-puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
-if { [regexp {Debug mode} [dversion]] } {
-  puts "TODO OCC25917 ALL: TEST INCOMPLETE"
-  puts "TODO OCC25917 ALL: Tcl Exception"
-}
+#puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC25917 ALL: Error : The command is not valid. The area is"
+puts "TODO OCC25917 ALL: Error : The area of result shape is"
 
 puts "========================"
 puts " OCC472 "
index ae0c7ec121490eacd3db956e0306f1e1a7a1575f..fa27fef4ae7b945181f8595ec1876e890e71e337 100755 (executable)
@@ -1,11 +1,6 @@
 puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
 puts "TODO OCC25917 ALL: Error : The area of result shape is"
 puts "TODO OCC25917 ALL: Error :  is WRONG because number of "
-if { [regexp {Debug mode} [dversion]] } {
-  puts "TODO OCC25917 ALL: TEST INCOMPLETE"
-  puts "TODO OCC25917 ALL: Tcl Exception"
-}
-
 puts "========================"
 puts " OCC472 "
 puts "(case 3)"
@@ -25,7 +20,7 @@ bfuse result b1 b2
 
 checknbshapes result -vertex 66 -edge 107
 
-checkprops result -s 31657.5 
+checkprops result -s 229.516 
 checkshape result
 set 2dviewer 0
 
index 0140cd4919c3db12f05d96efebb090c5ee5b4e90..b761d66dc9cb838ee147ca50d7e0864df301cf57 100755 (executable)
@@ -1,3 +1,5 @@
+puts "TODO OCC26999 ALL: Error : .*The area .*is"
+
 puts "========"
 puts "OCC772"
 puts "SAM1643"
index 1c09615967b84966dd5b84081fefe95f0770e9dc..28ef73bf7acbcf51cfe94b6c61ade6d9939e9506 100644 (file)
@@ -11,7 +11,7 @@ restore [locate_data_file bug24628_shellcut2.brep] cut
 
 bsection result shell cut
 
-checknbshapes result -vertex 15 -edge 14
+checknbshapes result -vertex 14 -edge 13
 
 set 2dviewer 1
 
index 856c4921b4f5c6320d45337cbc179fce7e865944..babea0aca227ba9e70575315a4b1a07ec8741dee 100644 (file)
@@ -1,4 +1,4 @@
-puts "REQUIRED All: Info. Faulty shape if found in source shape"
+puts "REQUIRED All: Info. Faulty shape is found in source shape"
 puts "============"
 puts "OCC25043"
 puts "============"
@@ -9,11 +9,13 @@ puts ""
 
 pload QAcommands
 restore [locate_data_file bug25043.brep] a
+subshape a v 3
+settolerance a_3 0.0005
 
 set info [OCC25043 a]
 
-if { [regexp "Faulty shape if found in source shape" ${info}] == 1 } {
+if { [regexp "Faulty shape is found in source shape" ${info}] == 1 } {
     puts "OK : Good result"
-} else {
+} elseif { [regexp "Problems are not detected" $info] != 1 } {
     puts "Error : Wrong result"
 }
index a4252447195fdce7ae84ac7c0bc023c6d2283885..59c9a8825dc48f056beb1ffa73f9fb0657c9a83b 100644 (file)
@@ -1,3 +1,6 @@
+puts "TODO OCC27014 ALL: Faulty shapes in variables faulty_1 to"
+puts "TODO OCC27014 ALL: Error :  is WRONG because number of .* entities in shape .* is"
+
 puts "============"
 puts "OCC25232"
 puts "============"
diff --git a/tests/bugs/modalg_6/bug26619 b/tests/bugs/modalg_6/bug26619
new file mode 100644 (file)
index 0000000..ec314f4
--- /dev/null
@@ -0,0 +1,49 @@
+puts "TODO OCC27014 ALL: Error : result is WRONG because number of .* entities in shape"
+
+puts "============"
+puts "OCC26619"
+puts "============"
+puts ""
+#######################################################################
+# Tolerances of operands are modified using bop
+#######################################################################
+
+restore [locate_data_file bug26619_shell_ft81_h0.brep] h0
+restore [locate_data_file bug26619_the_face.brep] f0
+
+regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance h0] full MaxTolerance1
+
+tolerance f0
+
+#turn on non-destructive mode of BOP
+#setflags h0 locked
+#setflags f0 locked
+bnondestructive 1
+
+bop h0 f0
+bopsection result
+
+set length 145.692
+
+set nbshapes_expected "
+Number of shapes in shape
+ VERTEX    : 46
+ EDGE      : 46
+ WIRE      : 0
+ FACE      : 0
+ SHELL     : 0
+ SOLID     : 0
+ COMPSOLID : 0
+ COMPOUND  : 1
+ SHAPE     : 93
+"
+checknbshapes result -ref ${nbshapes_expected} -t -m "result"
+
+regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance h0] full MaxTolerance2
+
+set expected_MaxTolerance ${MaxTolerance1}
+set tol_abs_MaxTolerance 0.0001
+set tol_rel_MaxTolerance 0.0001
+checkreal "MaxTolerance" ${MaxTolerance2} ${expected_MaxTolerance} ${tol_abs_MaxTolerance} ${tol_rel_MaxTolerance}
+
+set 2dviewer 1
index cb6372f16693e22b4101b988457b63d1683da414..7ca9f1dc3754672633fbfb3d2020bb8bed131dbf 100644 (file)
@@ -17,6 +17,6 @@ baddtools b2
 bfillds
 bbop result 0
 
-checkprops result -s 42.0108
+checkprops result -s 42.131
 
 set 2dviewer 1