]> OCCT Git - occt-copy.git/commitdiff
0026980: Intersection part of Boolean algorithm spends much system time and system... CR26980_2_691
authornbv <nbv@opencascade.com>
Wed, 3 Feb 2016 10:22:16 +0000 (13:22 +0300)
committernbv <nbv@opencascade.com>
Tue, 9 Feb 2016 10:14:57 +0000 (13:14 +0300)
Patch for CR26980_2 fix
Small correction of shape name

-----------------------------------------------------------
0026323: Tolerance computing unification

Computing is unified. ComputeFastTol3d() method was deleted.

If intersection result contains 3D- and corresponded two 2D-curves then tolerance will be computed with using BRepLib_CheckCurveOnSurface algorithm (check same-parameter).

If intersection result contains only 3D-curve (getting 2D-curve can be switched off by users) then tolerance will be computed with using GeomAPI_ProjectPointOnSurf algorithm (projects some point of 3D-curve on the surface and finds maximal distance).

Some workarounds have been deleted.

Some test case have been changed.

0026383: Incorrect tolerance computing in IntTools_FaceFace::ComputeTolerance()

Projection of points 3d curve on faces deleted from ComputeTolerance().
(cherry picked from commit 260f924fe38a8950dafc89351f0b2481d7858758)

0026565: Compsolid after cut becomes compound of solids

Changed the rules for the types of the arguments for different operations:
1. FUSE:   All arguments and tools should have the same dimension;
2. CUT:    The MAXIMAL dimension of the ARGUMENTS should be less
           or equal to the MINIMAL dimension of the TOOLS;
3. CUT21:  The MINIMAL dimension of ARGUMENTS should be grater
           or equal to the MAXIMAL dimension of the TOOLS;
4. COMMON: The arguments and tools could have any dimensions.

For the arguments of collection type (WIRE, SHELL, COMPSOLID)
the type will be passed into the result of the operation.

The documentation should be updated according to new behavior.

Documentation has been updated.

Implemented suggestions by MSV and some grammar changes.

Test cases for issue CR26565

Correction of test cases for issue CR26565

Correction of test cases for issue CR26565
(cherry picked from commit 9526aa6a8a2a5b41713211d2f6c2aa58c1344e24)

0026718: Big tolerance value of the edge in the result of General Fuse operation

class BOPTools_AlgoTools2D
method
  Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
  (const TopoDS_Edge& aE2, // old
   const TopoDS_Edge& aE1, // new
   const TopoDS_Face& aF,
   const Handle(IntTools_Context)& aCtx)

To prevent huge tolerance increasing check the distances between 2d and 3d
curves (through surface) before attaching 2d curve to the edge.

Test case for issue CR26718

Correction of test cases for issue CR26718
(cherry picked from commit 521e1c61912e7b034652be4a6ba85daaf82999af)

0026619: Tolerances of operands are modified using bop

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 class BOPAlgo_PaveFiller.
(cherry picked from commit fb42c34bd2bff56e9411ff4b5a993565c4d60baf)

115 files changed:
.gitignore
dox/user_guides/boolean_operations/boolean_operations.md
dox/user_guides/boolean_operations/images/boolean_image136.png [new file with mode: 0644]
dox/user_guides/boolean_operations/images/boolean_image137.png [new file with mode: 0644]
dox/user_guides/boolean_operations/images/boolean_image138.png [new file with mode: 0644]
samples/tcl/snowflake.tcl
src/BOPAlgo/BOPAlgo_BOP.cdl
src/BOPAlgo/BOPAlgo_BOP.cxx
src/BOPAlgo/BOPAlgo_Builder.cxx
src/BOPAlgo/BOPAlgo_Builder_2.cxx
src/BOPAlgo/BOPAlgo_CheckerSI.cdl
src/BOPAlgo/BOPAlgo_CheckerSI.cxx
src/BOPAlgo/BOPAlgo_PaveFiller.cdl
src/BOPAlgo/BOPAlgo_PaveFiller.cxx
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_WireSplitter_1.cxx
src/BOPAlgo/FILES
src/BOPDS/BOPDS_DS.cdl
src/BOPDS/BOPDS_DS.cxx
src/BOPTest/BOPTest_APICommands.cxx
src/BOPTools/BOPTools_AlgoTools.cdl
src/BOPTools/BOPTools_AlgoTools2D_1.cxx
src/BOPTools/BOPTools_AlgoTools_1.cxx
src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cdl
src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx
src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cdl
src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx
src/IntPatch/IntPatch_Intersection.cxx
src/IntPatch/IntPatch_PrmPrmIntersection.cxx
src/IntTools/IntTools_Context.cdl
src/IntTools/IntTools_Context.cxx
src/IntTools/IntTools_FaceFace.cxx
src/IntTools/IntTools_ShrunkRange.cxx
src/IntWalk/IntWalk.cdl
src/IntWalk/IntWalk_PWalking.cdl
src/IntWalk/IntWalk_PWalking.cxx
src/IntWalk/IntWalk_PWalking.lxx
src/QABugs/QABugs_19.cxx
tests/blend/simple/X4
tests/boolean/bopcut_2d/D5
tests/boolean/gdml_private/F8
tests/boolean/gdml_private/G7
tests/boolean/gdml_private/I6
tests/boolean/gdml_private/ZD3
tests/boolean/gdml_private/ZD6
tests/boolean/volumemaker/B3
tests/boolean/volumemaker/E4
tests/boolean/volumemaker/E5
tests/boolean/volumemaker/E6
tests/bugs/heal/bug26642
tests/bugs/modalg_1/bug11565_1
tests/bugs/modalg_1/bug11565_2
tests/bugs/modalg_1/bug12507
tests/bugs/modalg_2/bug21460
tests/bugs/modalg_2/bug22356
tests/bugs/modalg_2/bug22790
tests/bugs/modalg_2/bug23100
tests/bugs/modalg_2/bug23470
tests/bugs/modalg_2/bug23676
tests/bugs/modalg_2/bug472_1
tests/bugs/modalg_2/bug472_2
tests/bugs/modalg_2/bug472_3
tests/bugs/modalg_4/bug6538
tests/bugs/modalg_4/pro18892
tests/bugs/modalg_5/bug23884
tests/bugs/modalg_5/bug24092
tests/bugs/modalg_5/bug24187
tests/bugs/modalg_5/bug24585_1
tests/bugs/modalg_5/bug24746
tests/bugs/modalg_5/bug24811
tests/bugs/modalg_5/bug24825_cut
tests/bugs/modalg_5/bug24851
tests/bugs/modalg_5/bug25043
tests/bugs/modalg_5/bug25163
tests/bugs/modalg_5/bug25193
tests/bugs/modalg_5/bug25237
tests/bugs/modalg_5/bug25263
tests/bugs/modalg_5/bug25292_11
tests/bugs/modalg_5/bug25292_12
tests/bugs/modalg_5/bug25292_31
tests/bugs/modalg_5/bug25292_32
tests/bugs/modalg_5/bug25319_1
tests/bugs/modalg_5/bug25319_2
tests/bugs/modalg_5/bug25337_1
tests/bugs/modalg_5/bug25337_2
tests/bugs/modalg_5/bug25450_1
tests/bugs/modalg_5/bug25450_2
tests/bugs/modalg_5/bug25614_common
tests/bugs/modalg_5/bug25614_cut
tests/bugs/modalg_5/bug25614_cut21
tests/bugs/modalg_5/bug25625
tests/bugs/modalg_5/bug25721
tests/bugs/modalg_6/bug25937_2
tests/bugs/modalg_6/bug26224
tests/bugs/modalg_6/bug26565_1 [new file with mode: 0644]
tests/bugs/modalg_6/bug26565_2 [new file with mode: 0644]
tests/bugs/modalg_6/bug26565_3 [new file with mode: 0644]
tests/bugs/modalg_6/bug26565_4 [new file with mode: 0644]
tests/bugs/modalg_6/bug26565_5 [new file with mode: 0644]
tests/bugs/modalg_6/bug26565_6 [new file with mode: 0644]
tests/bugs/modalg_6/bug26565_7 [new file with mode: 0644]
tests/bugs/modalg_6/bug26565_8 [new file with mode: 0644]
tests/bugs/modalg_6/bug26582
tests/bugs/modalg_6/bug26718 [new file with mode: 0644]
tests/bugs/modalg_6/bug26980 [new file with mode: 0644]
tests/bugs/moddata_3/bug23738
tests/bugs/moddata_3/bug24108
tests/bugs/moddata_3/bug24108_2

index 022baf36b271d8e26b10c69d0d236f1460d451d9..53cfb10fc1f4d97f2888e2910494ebed8efce1bf 100644 (file)
@@ -28,8 +28,8 @@ Release
 /adm/lin
 /adm/mac
 /adm/make
-/adm/cmake
 *.vcproj*user
+*.vcxproj*user
 *.csproj*user
 *.ncb
 *.suo
@@ -44,12 +44,12 @@ Release
 # Emacs backup files
 *~
 
-#Generated files
+# Generated files
 /*.am
 /*.m4
 /*.ac
 /*.sh
-/*.bat
+/custom.bat
 /autom4te.cache
 /build_configure
 /configure
@@ -58,3 +58,5 @@ Release
 /Makefile
 /libtool
 /stamp*
+/build*
+/install
index a26fe7595227b912d4e74d58695e87787fef7e60..ccd43d5fcc6c9cff9993af29ccf1445fc718fe0a 100644 (file)
@@ -1050,7 +1050,7 @@ The input data for this step is a *BOPAlgo_Builder* object after building result
 * There are two groups of arguments in BOA:
        * Objects <i>(S1=S11, S12, ...)</i>;
        * Tools <i>(S2=S21, S22, ...)</i>.
-* All arguments in a group should have the same dimension (see the Table).
+* The following table contains the values of dimension for different types of arguments:
 
 | No | Type of Argument        | Index of Type | Dimension |
 | :---- | :---- | :----- | :---- |
@@ -1063,8 +1063,9 @@ The input data for this step is a *BOPAlgo_Builder* object after building result
 | 7 | EDGE | 6 | 1 |
 | 8 | VERTEX | 7 | 0 |
 
-* For Boolean operation Fuse the arguments should have equal dimensions.
-* For Boolean operation Cut the dimension of *S2* should not be less then the dimension of *S1*.
+* For Boolean operation Fuse all arguments should have equal dimensions.
+* For Boolean operation Cut the minimal dimension of *S2* should not be less than the maximal dimension of *S1*.
+* For Boolean operation Common the arguments could have any dimension.
 
 @subsection occt_algorithms_9_3        Results. General Rules
 
@@ -1072,12 +1073,13 @@ The input data for this step is a *BOPAlgo_Builder* object after building result
 * The content of the result depends on the type of the operation (Common, Fuse, Cut12, Cut21) and the dimensions of the arguments. 
 * The result of the operation Fuse is defined for arguments *S1* and *S2* that have the same dimension value : *Dim(S1)=Dim(S2)*. If the arguments have different dimension values the result of the operation Fuse is not defined. The dimension of the result is equal to the dimension of the arguments. For example, it is impossible to fuse an edge and a face.
 * The result of the operation Fuse for arguments *S1* and *S2* contains the parts of arguments that have states **OUT** relative to the opposite arguments.
-* The result of the operations Fuse, Common, Cut12, Cut21  for arguments *S1* and *S2* having dimension value 3 (Solids) is refined by removing all possible internal faces to provide minimal number of solids.
-* The result of the operation Common for arguments *S1* and *S2* is defined for all values of the dimensions of the arguments. The dimension of the result is equal to the lower dimension of the arguments. For example, the result of the operation Common between edges cannot be a vertex. 
+* The result of the operation Fuse for arguments *S1* and *S2* having dimension value 3 (Solids) is refined by removing all possible internal faces to provide minimal number of solids.
+* The result of the operation Common for arguments *S1* and *S2* is defined for all values of the dimensions of the arguments. The result can contain the shapes of different dimension, but the minimal dimension of the result will be equal to the minimal dimension of the arguments. For example, the result of the operation Common between edges cannot be a vertex. 
 * The result of the operation Common for the arguments *S1* and *S2* contains the parts of the argument that have states **IN** and **ON** relative to the opposite argument.
-* The result of the operation Cut is defined for arguments *S1* and *S2* that have values of dimensions *Dim(S2)* that should not be less than *Dim(S1)*. The dimension of the result is equal to *Dim(S1)*. The result of the operation *Cut12* is not defined for other cases. For example, it is impossible to cut an edge from a solid, because a solid without an edge is not defined. 
+* The result of the operation Cut is defined for arguments *S1* and *S2* that have values of dimensions *Dim(S2)* that should not be less than *Dim(S1)*. The result can contain the shapes of different dimension, but the minimal dimension of the result will be equal to the minimal dimension of the objects *Dim(S1)*. The result of the operation *Cut12* is not defined for other cases. For example, it is impossible to cut an edge from a solid, because a solid without an edge is not defined. 
 * The result of the operation *Cut12* for arguments *S1* and *S2* contains the parts of argument *S1* that have state **OUT** relative to the opposite argument *S2*.
 * The result of the operation *Cut21* for arguments *S1* and *S2* contains the parts of argument *S2* that have state **OUT** relative to the opposite argument *S1*.
+* For the argumenst of collection type (WIRE, SHELL, COMPSOLID) the type will be passed in the result. For example, the result of Common operation between Shell and Wire will be compound containing Wire.
 
 @subsection occt_algorithms_9_4 Examples
 
@@ -1522,6 +1524,24 @@ Let us consider two solids *S1* and *S2* that have overlapping vertices:
 
 @figure{/user_guides/boolean_operations/images/boolean_image070.png}
 
+@subsubsection occt_algorithms_9_4_23  Case 23: A Shell and a Wire cut by a Solid.
+
+Let us consider Shell *Sh* and Wire *W* as the objects and Solid *S* as the tool:
+
+@figure{/user_guides/boolean_operations/images/boolean_image136.png}
+
+* The result of *Fuse* operation is not defined as the dimension of the arguments is not the same.
+       
+* The result of *Common* operation is a compound containing the parts of the initial Shell and Wire common for the Solid. The new Shell and Wire are created from the objects.
+
+@figure{/user_guides/boolean_operations/images/boolean_image137.png}   
+
+* The result of *Cut12* operation is a compound containing the parts of the initial Shell and Wire out of the Solid. The new Shell and Wire are created from the objects.
+       
+@figure{/user_guides/boolean_operations/images/boolean_image138.png}   
+       
+* The result of *Cut21* operation is not defined as the objects have lower dimension than the tool. 
+
 
 @subsection occt_algorithms_9_5 Class BOPAlgo_BOP
 
@@ -1554,17 +1574,16 @@ The input data for this step is as follows:
 
 | No | Contents        | Implementation |
 | :---- | :---- | :------ |
-| 1 | For the Type of the Boolean operation Common, Cut and *myDim[0] < 3* | |
-| 1.1 |        Compute minimal dimension *Dmin = min(myDim[0], myDim[1])*      | *BOPAlgo_BOP:: BuildShape()* |
-| 1.2 |        Make connexity blocks from sub-shapes of *myRS*, taking into account the value of *Dmin* |      *BOPTools_Tools::MakeConnexityBlocks()* |
+| 1 | For the Type of the Boolean operation Common, Cut with any dimension and operation Fuse with *myDim[0] < 3* | |
+| 1.1 |        Find containers (WIRE, SHELL, COMPSOLID) in the arguments | *BOPAlgo_BOP:: BuildShape()* |
+| 1.2 |        Make connexity blocks from splits of each container that are in *myRC* |        *BOPTools_Tools::MakeConnexityBlocks()* |
 | 1.3 |        Build the result from shapes made from the connexity blocks | *BOPAlgo_BOP:: BuildShape()* |
-| 2    | For the Type of the Boolean operation Common, Cut and *myDim[0] = 3* | |      
-| 2.1 | *myShape = myRC* | BOPAlgo_BOP::BuildShape () |
-| 3    | For the Type of the Boolean operation Fuse and *myDim[0] = 3* | |     
-| 3.1 |        Find internal faces <i>(FWi)</i> in *myRC* | *BOPAlgo_BOP::BuildSolid()* |
-| 3.2 |        Collect all faces of *myRC* except for internal faces <i>(FWi) -> SFS</i> | *BOPAlgo_BOP::BuildSolid ()* |
-| 3.3 |        Build solids <i>(SDi)</i> from *SFS*. | *BOPAlgo_BuilderSolid* |
-| 3.4 |        Add the solids <i>(SDi)</i> to the result       | |
+| 1.4 |        Add the remaining shapes from *myRC* to the result | *BOPAlgo_BOP:: BuildShape()* |
+| 2    | For the Type of the Boolean operation Fuse with *myDim[0] = 3* | |    
+| 2.1 |        Find internal faces <i>(FWi)</i> in *myRC* | *BOPAlgo_BOP::BuildSolid()* |
+| 2.2 |        Collect all faces of *myRC* except for internal faces <i>(FWi) -> SFS</i> | *BOPAlgo_BOP::BuildSolid ()* |
+| 2.3 |        Build solids <i>(SDi)</i> from *SFS*. | *BOPAlgo_BuilderSolid* |
+| 2.4 |        Add the solids <i>(SDi)</i> to the result       | |
 
 @section occt_algorithms_10a Section Algorithm 
 
diff --git a/dox/user_guides/boolean_operations/images/boolean_image136.png b/dox/user_guides/boolean_operations/images/boolean_image136.png
new file mode 100644 (file)
index 0000000..6c93bc4
Binary files /dev/null and b/dox/user_guides/boolean_operations/images/boolean_image136.png differ
diff --git a/dox/user_guides/boolean_operations/images/boolean_image137.png b/dox/user_guides/boolean_operations/images/boolean_image137.png
new file mode 100644 (file)
index 0000000..a783c0e
Binary files /dev/null and b/dox/user_guides/boolean_operations/images/boolean_image137.png differ
diff --git a/dox/user_guides/boolean_operations/images/boolean_image138.png b/dox/user_guides/boolean_operations/images/boolean_image138.png
new file mode 100644 (file)
index 0000000..d10a5a5
Binary files /dev/null and b/dox/user_guides/boolean_operations/images/boolean_image138.png differ
index 3b50252e5861a28f8f6cc795f3ac01a00a2fc2c3..4f0f054fd1559f12d9df58ffa4a72cf42d277970 100644 (file)
@@ -64,7 +64,7 @@ bcut r r f5
 explode r Sh
 renamevar r_1 r
 explode r e
-wire w r_4 r_1 r_7 r_8 r_9 r_10 r_11 r_12 r_13 r_14 r_22 r_23 r_24 r_25 r_19 r_20 r_21 r_26 r_35 r_31 r_32 r_33 r_34 r_36 r_37
+wire w r_4 r_1 r_20 r_21 r_22 r_23 r_24 r_25 r_26 r_7 r_30 r_31 r_32 r_33 r_27 r_28 r_29 r_11 r_38 r_34 r_35 r_36 r_37 r_16 r_17
 tcopy w w1
 tmirror w1 -6 0 0 0 1 0
 wire w w w1
index 71404a83ff13fa8d7564377a17f91d3eeb27f408..97646d045d2efccb87f8caaabb4b654b6fe516f7 100644 (file)
@@ -51,10 +51,6 @@ is
     ---Purpose:  Adds Tool argument of the operation                
         is virtual;  
         
-    SetTools (me:out;
-            theShapes: ListOfShape from TopTools)
-        is virtual;  
-         
     SetTools (me:out;
             theShapes: ListOfShape from BOPCol)
         is virtual; 
index e9638c4d6da00192f3c970491d286a0700c38199..7fe150009c1bbfeeca6717fbe055e0b59c63fbef 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <BOPAlgo_BOP.ixx>
-
-#include <TopAbs_ShapeEnum.hxx>
-
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TopoDS_Edge.hxx>
-#include <BRep_Builder.hxx>
-#include <TopExp_Explorer.hxx>
 
+#include <BOPAlgo_BOP.hxx>
+#include <BOPAlgo_BuilderSolid.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+#include <BOPCol_DataMapOfShapeShape.hxx>
+#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
+#include <BOPCol_IndexedMapOfShape.hxx>
 #include <BOPCol_ListOfShape.hxx>
 #include <BOPCol_MapOfShape.hxx>
-#include <BOPCol_IndexedMapOfShape.hxx>
-#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
-#include <BOPCol_DataMapOfShapeShape.hxx>
-
 #include <BOPDS_DS.hxx>
-
 #include <BOPTools.hxx>
 #include <BOPTools_AlgoTools.hxx>
 #include <BOPTools_AlgoTools3D.hxx>
-#include <BOPTools_AlgoTools.hxx>
-
-#include <BOPAlgo_BuilderSolid.hxx>
-
-#include <BRep_Tool.hxx>
-//
 #include <BOPTools_Set.hxx>
 #include <BOPTools_SetMapHasher.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
 #include <NCollection_DataMap.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 
 typedef NCollection_IndexedDataMap
@@ -51,6 +45,10 @@ typedef NCollection_IndexedDataMap
 //
 static
   TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim);
+//
+static
+  void CollectContainers(const TopoDS_Shape& theS,
+                         BOPCol_ListOfShape& theLSC);
 
 
 //=======================================================================
@@ -129,21 +127,6 @@ void BOPAlgo_BOP::AddTool(const TopoDS_Shape& theShape)
 //function : SetTools
 //purpose  : 
 //=======================================================================
-void BOPAlgo_BOP::SetTools(const TopTools_ListOfShape& theShapes)
-{
-  TopTools_ListIteratorOfListOfShape aIt;
-  //
-  myTools.Clear();
-  aIt.Initialize(theShapes);
-  for (; aIt.More(); aIt.Next()) {
-    const TopoDS_Shape& aS = aIt.Value();
-    AddTool(aS);
-  }
-}
-//=======================================================================
-//function : SetTools
-//purpose  : 
-//=======================================================================
 void BOPAlgo_BOP::SetTools(const BOPCol_ListOfShape& theShapes)
 {
   BOPCol_ListIteratorOfListOfShape aIt;
@@ -162,7 +145,7 @@ void BOPAlgo_BOP::SetTools(const BOPCol_ListOfShape& theShapes)
 void BOPAlgo_BOP::CheckData()
 {
   Standard_Integer i, j, iDim, aNbArgs, aNbTools;
-  Standard_Boolean bFlag;
+  Standard_Boolean bFlag, bFuse;
   BOPCol_ListIteratorOfListOfShape aItLS;
   //
   myErrorStatus=0;
@@ -200,9 +183,18 @@ void BOPAlgo_BOP::CheckData()
     return;
   }
   //
-  // myDims
-  myDims[0]=-1;
-  myDims[1]=-1;
+  bFuse = (myOperation == BOPAlgo_FUSE);
+  //
+  // The rules for different types of operations are the following:
+  // 1. FUSE:   All arguments and tools should have the same dimension;
+  // 2. CUT:    The MAXIMAL dimension of the ARGUMENTS should be less
+  //            or equal to the MINIMAL dimension of the TOOLS;
+  // 3. CUT21:  The MINIMAL dimension of ARGUMENTS should be grater
+  //            or equal to the MAXIMAL dimension of the TOOLS;
+  // 4. COMMON: The arguments and tools could have any dimensions.
+  //
+  Standard_Integer iDimMin[2], iDimMax[2];
+  //
   for (i=0; i<2; ++i) {
     const BOPCol_ListOfShape& aLS=(!i)? myArguments : myTools;
     aItLS.Initialize(aLS);
@@ -221,11 +213,19 @@ void BOPAlgo_BOP::CheckData()
       }
       //
       if (!j) {
-        myDims[i]=iDim;
+        iDimMin[i] = iDim;
+        iDimMax[i] = iDim;
         continue;
       }
       //
-      if (iDim!=myDims[i]) { 
+      if (iDim < iDimMin[i]) {
+        iDimMin[i] = iDim;
+      }
+      else if (iDim > iDimMax[i]) {
+        iDimMax[i] = iDim;
+      }
+      //
+      if (bFuse && (iDimMin[i] != iDimMax[i])) {
         // non-homogenious argument
         myErrorStatus=13;
         return;
@@ -233,22 +233,16 @@ void BOPAlgo_BOP::CheckData()
     }
   }
   //
-  if (myDims[0]<myDims[1]) {
-    if (myOperation==BOPAlgo_FUSE ||
-        myOperation==BOPAlgo_CUT21) { 
-      // non-licit operation for the arguments
-      myErrorStatus=14;
-      return;
-    }
-  }
-  else if (myDims[0]>myDims[1]) {
-    if (myOperation==BOPAlgo_FUSE ||
-        myOperation==BOPAlgo_CUT) {
-      // non-licit operation for the arguments
-      myErrorStatus=14; 
-      return;
-    }
+  if (((myOperation == BOPAlgo_FUSE)  && (iDimMax[0] != iDimMax[1])) ||
+      ((myOperation == BOPAlgo_CUT)   && (iDimMax[0] >  iDimMin[1])) ||
+      ((myOperation == BOPAlgo_CUT21) && (iDimMin[0] <  iDimMax[1])) ) {
+    // non-licit operation for the arguments
+    myErrorStatus=14;
+    return;
   }
+  //
+  myDims[0] = iDimMin[0];
+  myDims[1] = iDimMin[1];
 }
 //=======================================================================
 //function : Prepare
@@ -521,199 +515,187 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
 //=======================================================================
 void BOPAlgo_BOP::BuildRC()
 {
-  Standard_Boolean bFlag1, bFlag2, bIsBound;
-  Standard_Integer aDmin;
-  TopAbs_ShapeEnum aTmin;
+  TopAbs_ShapeEnum aType;
   TopoDS_Compound aC;
-  TopoDS_Shape aSAIm, aSTIm;
   BRep_Builder aBB;
-  TopExp_Explorer aExp;
-  BOPCol_DataMapOfShapeShape aDMSSA;
-  BOPCol_ListIteratorOfListOfShape aItLS, aItIm; 
-  Standard_Boolean bHasInterf;
-  Standard_Integer iX;
-  BOPTools_IndexedDataMapOfSetShape aDMSTS;
   //
-  myErrorStatus=0;
+  myErrorStatus = 0;
   //
   aBB.MakeCompound(aC);
   //
   // A. Fuse
-  if (myOperation==BOPAlgo_FUSE) {
-    aTmin=TypeToExplore(myDims[0]);
-    aExp.Init(myShape, aTmin);
+  if (myOperation == BOPAlgo_FUSE) {
+    BOPCol_MapOfShape aMFence;
+    aType = TypeToExplore(myDims[0]);
+    TopExp_Explorer aExp(myShape, aType);
     for (; aExp.More(); aExp.Next()) {
-      const TopoDS_Shape& aS=aExp.Current();
-      aBB.Add(aC, aS);
+      const TopoDS_Shape& aS = aExp.Current();
+      if (aMFence.Add(aS)) {
+        aBB.Add(aC, aS);
+      }
     }
-    myRC=aC;
+    myRC = aC;
     return;
-  } 
-  //
-  aDmin=myDims[1];
-  if (myDims[0] < myDims[1]) {
-    aDmin=myDims[0];
   }
-  aTmin=TypeToExplore(aDmin);
   //
   // B. Common, Cut, Cut21
   //
-  bFlag1=(myOperation==BOPAlgo_COMMON || myOperation==BOPAlgo_CUT21);
-  bFlag2=(myOperation==BOPAlgo_CUT || myOperation==BOPAlgo_CUT21);
+  Standard_Integer i, j, aNb, iDim;
+  Standard_Boolean bCheckEdges, bContains, bCut21, bCommon;
+  BOPCol_IndexedMapOfShape aMArgs, aMTools;
+  BOPCol_IndexedMapOfShape aMArgsIm, aMToolsIm;
+  BOPCol_ListIteratorOfListOfShape aItLS;
   //
-  const BOPCol_ListOfShape& aLA=( bFlag1) ? myArguments : myTools;
-  aItLS.Initialize(aLA);
-  for (; aItLS.More(); aItLS.Next()) {
-    const TopoDS_Shape& aSA=aItLS.Value();
+  for (i = 0; i < 2; ++i) {
+    const BOPCol_ListOfShape& aLS = !i ? myArguments : myTools;
+    BOPCol_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
+    aItLS.Initialize(aLS);
+    for (; aItLS.More(); aItLS.Next()) {
+      const TopoDS_Shape& aS = aItLS.Value();
+      iDim = BOPTools_AlgoTools::Dimension(aS);
+      aType = TypeToExplore(iDim);
+      BOPTools::MapShapes(aS, aType, aMS);
+    }
+  }
+  //
+  bCheckEdges = Standard_False;
+  //
+  for (i = 0; i < 2; ++i) {
+    const BOPCol_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
+    BOPCol_IndexedMapOfShape& aMSIm = !i ? aMArgsIm : aMToolsIm;
     //
-    if (myImages.IsBound(aSA)){
-      const BOPCol_ListOfShape& aLSAIm=myImages.Find(aSA);
-      aItIm.Initialize(aLSAIm);
-      for (; aItIm.More(); aItIm.Next()) {
-        const TopoDS_Shape& aSAIm=aItIm.Value();
-        aExp.Init(aSAIm, aTmin);
-        for (; aExp.More(); aExp.Next()) {
-          const TopoDS_Shape aSIm=aExp.Current();
-          aDMSSA.Bind(aSIm, aSIm);
+    aNb = aMS.Extent();
+    for (j = 1; j <= aNb; ++j) {
+      const TopoDS_Shape& aS = aMS(j);
+      aType = aS.ShapeType();
+      if (aType == TopAbs_EDGE) {
+        const TopoDS_Edge& aE = *(TopoDS_Edge*)&aS;
+        bCheckEdges = Standard_True;
+        if (BRep_Tool::Degenerated(aE)) {
+          continue;
         }
       }
-    }
-    //
-    else {
-      aExp.Init(aSA, aTmin);
-      for (; aExp.More(); aExp.Next()) {
-        const TopoDS_Shape aSIm=aExp.Current();
-        aDMSSA.Bind(aSIm, aSIm);
-        if (aTmin==TopAbs_SOLID) {
-          iX=myDS->Index(aSIm);
-          bHasInterf=myDS->HasInterf(iX);
-          if (!bHasInterf) {
-            BOPTools_Set aST;
-            //
-            aST.Add(aSIm, TopAbs_FACE);
-            //
-            aDMSTS.Add(aST, aSIm);
-          }
+      //
+      if (myImages.IsBound(aS)) {
+        const BOPCol_ListOfShape& aLSIm = myImages.Find(aS);
+        aItLS.Initialize(aLSIm);
+        for (; aItLS.More(); aItLS.Next()) {
+          const TopoDS_Shape& aSIm = aItLS.Value();
+          aMSIm.Add(aSIm);
         }
       }
+      else {
+        aMSIm.Add(aS);
+      }
     }
-  } //for (; aItLS.More(); aItLS.Next())
+  }
   //
-  const BOPCol_ListOfShape& aLT=(!bFlag1) ? myArguments : myTools;
-  aItLS.Initialize(aLT);
-  for (; aItLS.More(); aItLS.Next()) {
-    const TopoDS_Shape& aST=aItLS.Value();
-    if (myImages.IsBound(aST)){
-      const BOPCol_ListOfShape& aLSTIm=myImages.Find(aST);
-      aItIm.Initialize(aLSTIm);
-      for (; aItIm.More(); aItIm.Next()) {
-        const TopoDS_Shape& aSTIm=aItIm.Value();
-        aExp.Init(aSTIm, aTmin);
-        for (; aExp.More(); aExp.Next()) {
-          const TopoDS_Shape aSIm=aExp.Current();
-          // skip degenerated edges
-          if (aTmin==TopAbs_EDGE) {
-            const TopoDS_Edge& aEIm=*((TopoDS_Edge*)&aSIm);
-            if (BRep_Tool::Degenerated(aEIm)) {
-              continue;
-            }
-          }
-          //
-          bIsBound=aDMSSA.IsBound(aSIm);
-          if (!bFlag2) { // ie common
-            if (bIsBound) {
-              const TopoDS_Shape& aSImA=aDMSSA.Find(aSIm);
-              aBB.Add(aC, aSImA);
-            }
-          }
-          else {// ie cut or cut21
-            if (!bIsBound) {
-              aBB.Add(aC, aSIm);
-            }
-          }
-        }
+  // compare the maps and make the result
+  //
+  Standard_Integer iDimMin, iDimMax;
+  //
+  iDimMin = Min(myDims[0], myDims[1]);
+  bCommon = (myOperation == BOPAlgo_COMMON);
+  bCut21  = (myOperation == BOPAlgo_CUT21);
+  //
+  const BOPCol_IndexedMapOfShape& aMIt = bCut21 ? aMToolsIm : aMArgsIm;
+  const BOPCol_IndexedMapOfShape& aMCheck = bCut21 ? aMArgsIm : aMToolsIm;
+  //
+  BOPCol_IndexedMapOfShape aMCheckExp, aMItExp;
+  //
+  if (bCommon) {
+    aNb = aMIt.Extent();
+    for (i = 1; i <= aNb; ++i) {
+      const TopoDS_Shape& aS = aMIt(i);
+      iDimMax = BOPTools_AlgoTools::Dimension(aS);
+      for (iDim = iDimMin; iDim < iDimMax; ++iDim) {
+        aType = TypeToExplore(iDim);
+        BOPTools::MapShapes(aS, aType, aMItExp);
       }
-    }// if (myImages.IsBound(aST)){
+      aMItExp.Add(aS);
+    }
+  }
+  else {
+    aMItExp = aMIt;
+  }
+  //
+  aNb = aMCheck.Extent();
+  for (i = 1; i <= aNb; ++i) {
+    const TopoDS_Shape& aS = aMCheck(i);
+    iDimMax = BOPTools_AlgoTools::Dimension(aS);
+    for (iDim = iDimMin; iDim < iDimMax; ++iDim) {
+      aType = TypeToExplore(iDim);
+      BOPTools::MapShapes(aS, aType, aMCheckExp);
+    }
+    aMCheckExp.Add(aS);
+  }
+  //
+  aNb = aMItExp.Extent();
+  for (i = 1; i <= aNb; ++i) {
+    const TopoDS_Shape& aS = aMItExp(i);
+    //
+    bContains = aMCheckExp.Contains(aS);
+    if (bCommon) {
+      if (bContains) {
+        aBB.Add(aC, aS);
+      }
+    }
     else {
-      aExp.Init(aST, aTmin);
+      if (!bContains) {
+        aBB.Add(aC, aS);
+      }
+    }
+  }
+  //
+  // filter result for COMMON operation
+  if (bCommon) {
+    BOPCol_MapOfShape aMFence;
+    TopExp_Explorer aExp;
+    TopoDS_Compound aCx;
+    aBB.MakeCompound(aCx);
+    //
+    for (iDim = 3; iDim >= iDimMin; --iDim) {
+      aType = TypeToExplore(iDim);
+      aExp.Init(aC, aType);
       for (; aExp.More(); aExp.Next()) {
-        const TopoDS_Shape aSIm=aExp.Current();
-        // skip degenerated edges
-        if (aTmin==TopAbs_EDGE) {
-          const TopoDS_Edge& aEIm=*((TopoDS_Edge*)&aSIm);
-          if (BRep_Tool::Degenerated(aEIm)) {
-            continue;
-          }
-        }
-        bIsBound=aDMSSA.IsBound(aSIm);
-        if (!bFlag2) { // ie common
-          if (bIsBound) {
-            const TopoDS_Shape& aSImA=aDMSSA.Find(aSIm);
-            aBB.Add(aC, aSImA);
-          }
-          else {
-             if (aTmin==TopAbs_SOLID) {
-               BOPTools_Set aST;
-               //
-               aST.Add(aSIm, TopAbs_FACE);
-               //
-               if (aDMSTS.Contains(aST)) {
-                 const TopoDS_Shape& aSImA=aDMSTS.FindFromKey(aST);
-                 aBB.Add(aC, aSImA);
-               }
-             }
-          }
-        }
-        else {// ie cut or cut21
-          if (!bIsBound) {
-            if (aTmin==TopAbs_SOLID) {
-              BOPTools_Set aST;
-              //
-              aST.Add(aSIm, TopAbs_FACE);
-              //
-              bIsBound=aDMSTS.Contains(aST); 
-            }
-            //
-            if (!bIsBound) {
-              aBB.Add(aC, aSIm);
-            }
-          }
+        const TopoDS_Shape& aS = aExp.Current();
+        if (aMFence.Add(aS)) {
+          aBB.Add(aCx, aS);
+          BOPTools::MapShapes(aS, aMFence);
         }
       }
     }
-  } //for (; aItLS.More(); aItLS.Next())
+    aC = aCx;
+  }
   //
-  // the squats around degeneracy
-  if (aTmin!=TopAbs_EDGE) {
-    myRC=aC;
+  if (!bCheckEdges) {
+    myRC = aC;
     return;
   }
-  //---------------------------------------------------------
   //
   // The squats around degenerated edges
-  Standard_Integer i, aNbS, nVD;
-  TopAbs_ShapeEnum aType;
+  Standard_Integer nVD;
   BOPCol_IndexedMapOfShape aMVC;
   //
   // 1. Vertices of aC
   BOPTools::MapShapes(aC, TopAbs_VERTEX, aMVC);
   //
   // 2. DE candidates
-  aNbS=myDS->NbSourceShapes();
-  for (i=0; i<aNbS; ++i) {
-    const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
-    aType=aSI.ShapeType();
-    if (aType!=aTmin) {
+  aNb = myDS->NbSourceShapes();
+  for (i = 0; i < aNb; ++i) {
+    const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
+    aType = aSI.ShapeType();
+    if (aType != TopAbs_EDGE) {
       continue;
     }
     //
-    const TopoDS_Edge& aE=*((TopoDS_Edge*)&aSI.Shape());
+    const TopoDS_Edge& aE = *((TopoDS_Edge*)&aSI.Shape());
     if (!BRep_Tool::Degenerated(aE)) {
       continue;
     }
     //
-    nVD=aSI.SubShapes().First();
-    const TopoDS_Shape& aVD=myDS->Shape(nVD);
+    nVD = aSI.SubShapes().First();
+    const TopoDS_Shape& aVD = myDS->Shape(nVD);
     //
     if (!aMVC.Contains(aVD)) {
       continue;
@@ -738,86 +720,120 @@ void BOPAlgo_BOP::BuildRC()
 //=======================================================================
 void BOPAlgo_BOP::BuildShape()
 {
-  Standard_Integer aDmin, aNbLCB;
-  TopAbs_ShapeEnum aT1, aT2, aTR;
-  TopoDS_Shape aR, aRC;
+  BuildRC();
+  //
+  if ((myOperation == BOPAlgo_FUSE) && (myDims[0] == 3)) {
+    BuildSolid();
+    return;
+  }
+  //
+  Standard_Integer i;
+  TopAbs_ShapeEnum aType, aT1, aT2;
+  BOPCol_ListOfShape aLSC, aLCB;
+  BOPCol_ListIteratorOfListOfShape aItLS, aItLSIm, aItLCB;
   TopoDS_Iterator aIt;
   BRep_Builder aBB;
-  BOPCol_ListOfShape aLCB;
-  BOPCol_ListIteratorOfListOfShape aItLCB;
-  //
-  myErrorStatus=0;
+  TopoDS_Shape aRC, aRCB;
   //
-  BuildRC();
+  TopoDS_Compound aResult;
+  aBB.MakeCompound(aResult);
   //
-  aDmin=myDims[1];
-  if (myDims[0]<myDims[1]) {
-    aDmin=myDims[0];
-  }
+  BOPCol_MapOfShape aMSRC, aMFence;
+  BOPTools::MapShapes(myRC, aMSRC);
   //
-  if (!aDmin) {
-    myShape=myRC;
-    return;
+  // collect images of containers
+  for (i = 0; i < 2; ++i) {
+    const BOPCol_ListOfShape& aLS = !i ? myArguments : myTools;
+    //
+    aItLS.Initialize(aLS);
+    for (; aItLS.More(); aItLS.Next()) {
+      const TopoDS_Shape& aS = aItLS.Value();
+      //
+      CollectContainers(aS, aLSC);
+    }
   }
-  //
-  else if (aDmin==1 || aDmin==2) { //edges, faces 
-    aT1=TopAbs_VERTEX;
-    aT2=TopAbs_EDGE;
-    aTR=TopAbs_WIRE;
-    if (aDmin==2) {
-      aT1=TopAbs_EDGE;
-      aT2=TopAbs_FACE;
-      aTR=TopAbs_SHELL;
+  // make containers
+  aItLS.Initialize(aLSC);
+  for (; aItLS.More(); aItLS.Next()) {
+    const TopoDS_Shape& aSC = aItLS.Value();
+    //
+    BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
+    //
+    aIt.Initialize(aSC);
+    for (; aIt.More(); aIt.Next()) {
+      const TopoDS_Shape& aS = aIt.Value();
+      if (myImages.IsBound(aS)) {
+        const BOPCol_ListOfShape& aLSIm = myImages.Find(aS);
+        //
+        aItLSIm.Initialize(aLSIm);
+        for (; aItLSIm.More(); aItLSIm.Next()) {
+          const TopoDS_Shape& aSIm = aItLSIm.Value();
+          if (aMSRC.Contains(aSIm) && aMFence.Add(aSIm)) {
+            aBB.Add(aRC, aSIm);
+          }
+        }
+      }
+      else if (aMSRC.Contains(aS) && aMFence.Add(aS)) {
+        aBB.Add(aRC, aS);
+      }
     }
     //
-    BOPTools_AlgoTools::MakeConnexityBlocks
-      (myRC, aT1, aT2, aLCB);
-    aNbLCB=aLCB.Extent();
-    if (!aNbLCB) {
-      myShape=myRC;
-      return;
+    aType = aSC.ShapeType();
+    switch (aType) {
+      case TopAbs_WIRE: {
+        aT1 = TopAbs_VERTEX;
+        aT2 = TopAbs_EDGE;
+        break;
+      }
+      case TopAbs_SHELL: {
+        aT1 = TopAbs_EDGE;
+        aT2 = TopAbs_FACE;
+        break;
+      }
+      default: {
+        aT1 = TopAbs_FACE;
+        aT2 = TopAbs_SOLID;
+      }
     }
     //
-    BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);  
+    aLCB.Clear();
+    BOPTools_AlgoTools::MakeConnexityBlocks(aRC, aT1, aT2, aLCB);
+    if (aLCB.IsEmpty()) {
+      continue;
+    }
     //
     aItLCB.Initialize(aLCB);
     for (; aItLCB.More(); aItLCB.Next()) {
-      BOPTools_AlgoTools::MakeContainer(aTR, aR);  
+      BOPTools_AlgoTools::MakeContainer(aType, aRCB);
       //
-      const TopoDS_Shape& aCB=aItLCB.Value();
+      const TopoDS_Shape& aCB = aItLCB.Value();
       aIt.Initialize(aCB);
       for (; aIt.More(); aIt.Next()) {
-        const TopoDS_Shape& aS=aIt.Value();
-        aBB.Add(aR, aS);
+        const TopoDS_Shape& aCBS = aIt.Value();
+        aBB.Add(aRCB, aCBS);
       }
       //
-      if (aTR==TopAbs_SHELL) {
-        BOPTools_AlgoTools::OrientFacesOnShell(aR);
+      if (aType == TopAbs_SHELL) {
+        BOPTools_AlgoTools::OrientFacesOnShell(aRCB);
       }
       //
-      aBB.Add(aRC, aR);
+      aBB.Add(aResult, aRCB);
     }
-    myShape=aRC;
-  }// elase if (aDmin==1 || aDmin==2) {
-  
-  else {//aDmin=3
-    Standard_Integer aNbObjs, aNbTools;
-    //
-    aNbObjs=myArguments.Extent();
-    aNbTools=myTools.Extent();
-    //
-    if (aNbObjs==1 && aNbTools==1) {
-      if (myOperation==BOPAlgo_FUSE) {
-        BuildSolid();
-      }
-      else {
-        myShape=myRC;
-      }
-    }
-    else {
-      BuildSolid();
+  }
+  //
+  // add the rest of the shapes into result
+  BOPCol_MapOfShape aMSResult;
+  BOPTools::MapShapes(aResult, aMSResult);
+  //
+  aIt.Initialize(myRC);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aS = aIt.Value();
+    if (!aMSResult.Contains(aS)) {
+      aBB.Add(aResult, aS);
     }
   }
+  //
+  myShape = aResult;
 }
 //=======================================================================
 //function : BuildSolid
@@ -1075,3 +1091,29 @@ TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim)
   }
   return aRet;
 }
+//=======================================================================
+//function : CollectContainers
+//purpose  : 
+//=======================================================================
+void CollectContainers(const TopoDS_Shape& theS,
+                       BOPCol_ListOfShape& theLSC)
+{
+  TopAbs_ShapeEnum aType = theS.ShapeType();
+  if (aType == TopAbs_WIRE ||
+      aType == TopAbs_SHELL ||
+      aType == TopAbs_COMPSOLID) {
+    theLSC.Append(theS);
+    return;
+  }
+  //
+  if (aType != TopAbs_COMPOUND) {
+    return;
+  }
+  //
+  TopoDS_Iterator aIt(theS);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aS = aIt.Value();
+    CollectContainers(aS, theLSC);
+  }
+}
+
index 089f47ccd4200ebff727132f2aaf1768244ccaee..52cab4580baf4ff3332754054e2c157b050cbe41 100644 (file)
 #include <TopoDS_Compound.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  : 
@@ -421,17 +427,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 c32a4a3019baf3b3078cf26249b978033b3f2788..ad7e36e70dcc4dfc670548a4ef16654b877078b9 100644 (file)
@@ -403,8 +403,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 9578c091f197aa4319ce31e337f49985d22e8d9b..d7b684495205fbadeb934a51429cbe362025df13 100644 (file)
@@ -48,20 +48,6 @@ is
     --           4 - V/V, V/E, E/E, V/F and E/F; 
     --           5 - all interferences, default value. 
  
-    SetNonDestructive(me:out; 
-      theFlag: Boolean from Standard);  
-    ---Purpose: 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 
-     
-    NonDestructive(me) 
-        returns Boolean from Standard; 
-    ---Purpose: 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
     PostTreat  (me:out)  
      is protected;       
     ---Purpose: Provides post-treatment actions   
@@ -76,7 +62,6 @@ is
  
 fields
     myLevelOfCheck: Integer from Standard is protected;
-    myNonDestructive: Boolean from Standard is protected; 
     myNewOldMap   : DataMapOfShapeShape from BOPCol is protected;   
     
 end CheckerSI;
index b22be8b282b0d06b75ba6094af33e28b2c9b2023..c2ab02bc8befe8cfc4d30099180f398f04f84727 100644 (file)
@@ -76,22 +76,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 7dd03af03e4415c71d09f1b86a40c789cc9f132f..9922eaafe59de9eba04c53ae9d879a8d1217ab04 100644 (file)
@@ -49,6 +49,7 @@ uses
     Iterator  from BOPDS, 
     PIterator from BOPDS, 
     PaveBlock from BOPDS, 
+    CommonBlock from BOPDS, 
     Curve from BOPDS,  
     IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS,
     MapOfPaveBlock from BOPDS,  
@@ -483,6 +484,69 @@ is
     returns Real from Standard;
     ---Purpose: Returns the additional tolerance 
 
+    UpdateVertex(me:out;   
+            nV  : Integer from Standard; 
+            aTolNew: Real from Standard) 
+        returns Integer from Standard 
+        is protected;
+    ---Purpose:      
+    --  Updates tolerance vertex nV due to V/E interference; 
+    --  It always creates new vertex if nV is from arguments  
+    --  Returns: DS index of updated vertex.  
+     
+    ComputeTolerance(me:out; 
+            theCB:CommonBlock from BOPDS) 
+        returns Real from Standard   
+        is protected;   
+         
+    UpdatePaveBlocksWithSDVertices(me:out)  
+        is protected;   
+    UpdateCommonBlocksWithSDVertices (me:out)  
+        is protected;  
+     
+    UpdateBlocksWithSharedVertices  (me:out) 
+        is protected;   
+     
+    EstimatePaveOnCurve  (me:out; 
+        nV        : Integer from Standard;  
+        theNC     : out Curve from BOPDS; 
+        theTolR3D : Real from Standard) 
+        returns Boolean from Standard
+        is protected;       
+        
+    UpdateEdgeTolerance(me:out;   
+            nE  : Integer from Standard; 
+            aTolNew: Real from Standard) 
+        is protected;   
+       
+    SetNonDestructive(me:out;  
+            theFlag:Boolean from Standard);
+    ---Purpose: Sets the flag <theFlag> that defines 
+    --  the mode of treatment: in non-destructive mode
+    --  the argument shapes are not modified: the copy of sub-shape
+    --  is created in the result if it is needed to be updated.
+        
+    SetNonDestructive(me:out) 
+        is protected;  
+    ---Purpose: Sets non-destructive mode automatically if the argument 
+    --  contains a locked shape (see TopoDS_Shape::Locked()).
+    
+    NonDestructive(me) 
+        returns Boolean from Standard; 
+    ---Purpose: Returns the flag that defines 
+    --  the mode of treatment: in non-destructive mode
+    --  the argument shapes are not modified: the copy of sub-shape
+    --  is created in the result if it is needed to be updated.
+     
+    SetIsPrimary(me:out;  
+            theFlag:Boolean from Standard) 
+        is protected;  
+     
+    IsPrimary(me) 
+        returns Boolean from Standard 
+        is protected; 
+    
 fields  
     myArguments   : ListOfShape from BOPCol is protected;  
     myDS          : PDS from BOPDS is protected; 
@@ -490,4 +554,6 @@ fields
     myContext     : Context from IntTools is protected;   
     mySectionAttribute : SectionAttribute from BOPAlgo is protected;
     myFuzzyValue  : Real from Standard is protected;
+    myNonDestructive : Boolean from Standard is protected;   
+    myIsPrimary      : Boolean from Standard is protected;   
 end PaveFiller;
index b5fe4c6110e4e1c5325d68190c994dcf4670a1f4..9052f46fdc8275b8e6eb0866a4efd2eeb54ff563 100644 (file)
@@ -39,6 +39,8 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
 {
   myDS=NULL;
   myIterator=NULL;
+  myNonDestructive=Standard_False;
+  myIsPrimary=Standard_True;
 }
 //=======================================================================
 //function : 
@@ -52,6 +54,8 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
 {
   myDS=NULL;
   myIterator=NULL;
+  myNonDestructive=Standard_False;
+  myIsPrimary=Standard_True;
 }
 //=======================================================================
 //function : ~
@@ -62,6 +66,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  : 
 //=======================================================================
@@ -171,6 +207,7 @@ void BOPAlgo_PaveFiller::Init()
   //
   // 0 Clear
   Clear();
+  
   //
   // 1.myDS 
   myDS=new BOPDS_DS(myAllocator);
@@ -187,6 +224,9 @@ void BOPAlgo_PaveFiller::Init()
   // 3 myContext
   myContext=new IntTools_Context;
   //
+  // 4 NonDestructive flag
+  SetNonDestructive();
+  //
   myErrorStatus=0;
 }
 //=======================================================================
@@ -236,34 +276,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; 
@@ -280,7 +328,6 @@ void BOPAlgo_PaveFiller::PerformInternal()
   if (myErrorStatus) {
     return; 
   }
-  //
   // 03
   PerformVZ();
   if (myErrorStatus) {
index a5e5e179a8958eac9083cbe326e5a91c6a810068..984d71ab3d171fd5e6d0bc8fc60596bba0ff3bc1 100644 (file)
 #include <TopoDS_Vertex.hxx>
 #include <BRepBndLib.hxx>
 
+#include <BOPCol_DataMapOfIntegerInteger.hxx>
 #include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
 #include <BOPCol_MapOfInteger.hxx>
 #include <BOPCol_ListOfShape.hxx>
 
 #include <BOPDS_DS.hxx>
 #include <BOPDS_Iterator.hxx>
-#include <BOPTools_AlgoTools.hxx>
+
 #include <BOPDS_VectorOfInterfVV.hxx>
 #include <BOPDS_ShapeInfo.hxx>
-#include <BOPAlgo_Tools.hxx>
+#include <BOPTools_AlgoTools.hxx>
 
+#include <BOPAlgo_Tools.hxx>
 
 //=======================================================================
 // function: PerformVV
     //
     BOPTools_AlgoTools::MakeVertex(aLV, aVn);
     //
-    // Appennd new vertex to the DS
+    // Append new vertex to the DS
     aSIn.SetShape(aVn);
     n=myDS->Append(aSIn);
     //
     }
   }
   //
+  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();
diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx
new file mode 100644 (file)
index 0000000..8d581d0
--- /dev/null
@@ -0,0 +1,230 @@
+// 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.ixx>
+
+#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) {
+    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);
+  //
+  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);
+    }
+  }
+}
+//=======================================================================
+//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);
+    }
+    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);
+  //
+  // add vertex to SD map
+  myDS->AddShapeSD(nV, nVNew);
+  //
+  myDS->InitPaveBlocksForVertex(nV);
+  //
+  return nVNew;
+}
+//=======================================================================
+//function : UpdatePaveBlocksWithSDVertices
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices()
+{
+  if (!myNonDestructive) {
+    return;
+  }
+  myDS->UpdatePaveBlocksWithSDVertices();
+}
+//=======================================================================
+//function : UpdateCommonBlocksWithSDVertices
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
+{
+  if (!myNonDestructive) {
+    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 69cfa25e3813f113df91387ffeb0ba773b372eec..6dc2711881fd716a6cceb7ac27e9047001263def 100644 (file)
@@ -45,7 +45,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(){
@@ -71,18 +71,10 @@ 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 {
-    return myE;
-  }
-  //
   Standard_Integer Flag()const {
     return myFlag;
   }
@@ -91,6 +83,10 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
     return myT;
   }
   //
+  Standard_Real VertexNewTolerance()const {
+    return myTolVNew;
+  }
+  //
   void SetContext(const Handle(IntTools_Context)& aContext) {
     myContext=aContext;
   }
@@ -101,7 +97,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:
@@ -110,6 +106,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;
@@ -137,11 +134,10 @@ 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;
   BOPDS_Pave aPave;
   BOPDS_PassKey aPK;
   BOPDS_MapOfPassKey aMPK;
-  BRep_Builder aBB;
   BOPAlgo_VectorOfVertexEdge aVVE;
   //
   myErrorStatus=0;
@@ -208,29 +204,28 @@ 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();
       // 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 24d5ec8f19551f994a3e8588e5a2c50616d86a61..cd3f3be38cfdecba2a172d87e25731ce7af41307 100644 (file)
@@ -569,7 +569,7 @@ void BOPAlgo_PaveFiller::PerformEE()
   aMPBToUpdate.Clear();
 }
 //=======================================================================
-//function : PerformVertices
+//function : PerformVerticesEE
 //purpose  : 
 //=======================================================================
 Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
@@ -890,8 +890,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();
   //
@@ -908,60 +908,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 65d6f55f294650f4997933f1140bf2f9319a75bc..43b0997b46231b87032e2740660635bf5d9bae12 100644 (file)
@@ -20,8 +20,6 @@
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Face.hxx>
 #include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepBndLib.hxx>
 //
 #include <BOPCol_MapOfInteger.hxx>
 #include <BOPCol_NCVector.hxx>
@@ -47,7 +45,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(){
@@ -95,6 +93,10 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
     aT2=myT2;
   }
   //
+  Standard_Real VertexNewTolerance()const {
+    return myTolVNew;
+  }
+  //
   void SetContext(const Handle(IntTools_Context)& aContext) {
     myContext=aContext;
   }
@@ -105,7 +107,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:
@@ -115,6 +117,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;
@@ -142,8 +145,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;
@@ -207,27 +209,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 {
index 18bf7ba3b4f3685af72e1d43329b20944c0a723e..41019ebc575f8d9c3962c0df157445caaae9cfbe 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <GeomAPI_ProjectPointOnSurf.hxx>
 //
+#include <Precision.hxx>
+
 #include <Bnd_Box.hxx>
 //
 #include <TopoDS_Vertex.hxx>
@@ -311,12 +313,25 @@ void BOPAlgo_PaveFiller::PerformEF()
             if (bIsOnPave[j]) {
               bV[j]=CheckFacePaves(nV[j], aMIFOn, aMIFIn);
               if (bV[j]) {
-                const TopoDS_Vertex& aV=
+                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);
@@ -370,11 +385,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);
@@ -451,6 +461,8 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
   }
   //
   // 2 Fuse vertices
+  aPF.SetIsPrimary(Standard_False);
+  aPF.SetNonDestructive(myNonDestructive);
   aPF.SetArguments(aLS);
   aPF.Perform();
   iErr=aPF.ErrorStatus();
@@ -530,7 +542,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();
@@ -615,46 +627,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);
-  //
-  gp_Pnt2d aP2d(U, V);
-  bRet = myContext->IsPointInFace (aF, aP2d);
-  if (bRet) {
-    //Standard_Integer i;
-    BRep_Builder aBB;
+  iFlag = myContext->ComputeVF(aV, aF, U, V, aTolVNew);
+  if (iFlag == 0 || iFlag == -2) {
+    bRet=!bRet;
     //
     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 eceef1604bad0b4a51270ef336decf4f798eaa5d..317793d2ad2146514ad790284f01c12492445aea 100644 (file)
@@ -217,22 +217,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);
@@ -526,10 +525,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) ||
@@ -644,6 +644,8 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
   //
   BOPCol_ListOfShape aLS(theAllocator);
   BOPAlgo_PaveFiller aPF(theAllocator);
+  aPF.SetIsPrimary(Standard_False);
+  aPF.SetNonDestructive(myNonDestructive);
   //
   BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
   //
@@ -1036,10 +1038,10 @@ 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;
@@ -1077,11 +1079,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;
   //
@@ -1104,6 +1106,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)) {
@@ -1160,6 +1164,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();
@@ -1419,9 +1425,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;
@@ -1626,11 +1633,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;
   //
@@ -1808,7 +1815,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,
@@ -1882,11 +1889,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;
@@ -2044,7 +2051,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;
@@ -2099,7 +2106,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,
@@ -2265,3 +2272,120 @@ 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,
+   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;
+}
index 29364f468042cd9c69c76bf190b19f52d25a888b..1d5c773139037f67e639e265f4a0cc09392676b5 100644 (file)
@@ -57,6 +57,8 @@
 #include <BOPDS_MapOfPaveBlock.hxx>
 #include <BOPDS_Curve.hxx>
 #include <BOPDS_Iterator.hxx>
+#include <Precision.hxx>
+#include <BOPDS_MapOfCommonBlock.hxx>
 
 #include <BOPTools_AlgoTools.hxx>
 #include <BOPTools_AlgoTools2D.hxx>
@@ -359,13 +361,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);
@@ -376,17 +382,26 @@ 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);
+          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) {
@@ -444,6 +459,8 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
     nSp=myDS->Append(aSI);
     //
     if (!aCBk.IsNull()) {
+      Standard_Real aTolCB = ComputeTolerance(aCBk);
+      myDS->UpdateEdgeTolerance(nSp, aTolCB);
       aCBk->SetEdge(nSp);
     }
     else {
@@ -452,6 +469,52 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
   }
 }
 //=======================================================================
+//function : ComputeTolerance
+//purpose  : 
+//=======================================================================
+Standard_Real BOPAlgo_PaveFiller::ComputeTolerance
+  (const Handle(BOPDS_CommonBlock)& theCB)
+{
+  Standard_Integer nE, nF;
+  Standard_Real aTol, aTolMax;
+  BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+  BOPCol_ListIteratorOfListOfInteger aItLI;
+  //
+  const Handle(BOPDS_PaveBlock)& aPBR = theCB->PaveBlock1();
+  nE = aPBR->OriginalEdge();
+  const TopoDS_Edge& aEOr = *(TopoDS_Edge*)&myDS->Shape(nE);
+  aTolMax = BRep_Tool::Tolerance(aEOr);
+  //
+  const BOPDS_ListOfPaveBlock& aLPB = theCB->PaveBlocks();
+  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*)&myDS->Shape(nE);
+    aTol = BRep_Tool::Tolerance(aE);
+    if (aTol > aTolMax) {
+      aTolMax=aTol;
+    }
+  }
+  //
+  const BOPCol_ListOfInteger& aLFI = theCB->Faces();
+  aItLI.Initialize(aLFI);
+  for (; aItLI.More(); aItLI.Next()) {
+    nF = aItLI.Value();
+    const TopoDS_Face& aF = *(TopoDS_Face*)&myDS->Shape(nF);
+    //
+    aTol=BRep_Tool::Tolerance(aF);
+    if (aTol > aTolMax) {
+      aTolMax=aTol;
+    }
+  } 
+  return aTolMax;
+}
+//=======================================================================
 // function: SplitEdge
 // purpose: 
 //=======================================================================
@@ -732,6 +795,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 eca9276911457205fc5e98341f35b97d8b8f00ae..e7ecdc8cdece006351d580755835429d78bc314d 100644 (file)
@@ -170,8 +170,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 e6c81f7ad7033b32ba8470bcb51260e6682b79d3..369b62468a2854b5cc4cd421840f5015ac15b805 100644 (file)
@@ -14,5 +14,4 @@ BOPAlgo_Builder_3.cxx
 BOPAlgo_Builder_4.cxx
 BOPAlgo_WireSplitter_1.cxx
 BOPAlgo_ListOfCheckResult.hxx
-
-
+BOPAlgo_PaveFiller_11.cxx
index 4fc375f386de7f2d4029e62d673f0950cf470e8a..9a3da4e3137540567e587dc03a2a52c708f72d4b 100644 (file)
@@ -44,6 +44,7 @@ uses
     ListOfInteger           from BOPCol, 
     MapOfInteger            from BOPCol, 
     BaseAllocator           from BOPCol, 
+    DataMapOfIntegerListOfInteger from BOPCol, 
     --
     ShapeInfo  from BOPDS, 
     IndexRange from BOPDS, 
@@ -627,7 +628,17 @@ is
              ---Purpose: 
              --- Updates tolerance of the sub-shapes of the shape with index <theIndex>.
              ---
+    UpdatePaveBlocksWithSDVertices(me:out);   
+      
+    UpdatePaveBlockWithSDVertices(me:out; 
+            thePB:PaveBlock from BOPDS);   
+            
+    UpdateCommonBlockWithSDVertices(me:out;      
+            theCB:CommonBlock from BOPDS); 
+             
+    InitPaveBlocksForVertex(me:out; 
+            theNV:Integer from Standard);        
+     
     BuildBndBoxSolid (me:out; 
                 theIndex:Integer from Standard;  
                 theBox:out Box from Bnd) 
@@ -666,6 +677,8 @@ fields
     --same domain shapes 
     myShapesSD         : DataMapOfIntegerInteger from BOPCol is protected;  
     -- 
+    myMapVE:   DataMapOfIntegerListOfInteger from BOPCol is protected;            
+    -- 
     --interferences 
     myInterfTB         : MapOfPassKey     from BOPDS is protected; 
     myInterfVV         : VectorOfInterfVV from BOPDS is protected;
index 371565cb7150178ad1bd0a56d9830491fca91aa0..5190db51624af5436494d7022bdb469fbd706088 100644 (file)
 #include <IntTools_Tools.hxx>
 #include <BOPTools_AlgoTools.hxx>
 #include <GeomAPI_ProjectPointOnCurve.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 +95,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 +128,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 +171,7 @@ void BOPDS_DS::Clear()
   myPaveBlocksPool.Clear();
   myFaceInfoPool.Clear();
   myShapesSD.Clear();
+  myMapVE.Clear();
   myMapPBCB.Clear();
   myInterfTB.Clear();
   myInterfVV.Clear();
@@ -338,7 +339,6 @@ Standard_Integer BOPDS_DS::Index(const TopoDS_Shape& theS)const
   }
   return iRet;
 }
-
 //=======================================================================
 //function : Init
 //purpose  : 
@@ -354,6 +354,7 @@ void BOPDS_DS::Init()
   BOPCol_ListIteratorOfListOfShape aIt;
   BOPDS_IndexRange aR;
   Handle(NCollection_BaseAllocator) aAllocator;
+  BOPCol_MapOfShape aMS;
   //
   // 1 Append Source Shapes
   aNb=myArguments.Extent();
@@ -363,21 +364,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
@@ -415,7 +412,6 @@ void BOPDS_DS::Init()
     BOPDS_ShapeInfo& aSI=ChangeShapeInfo(j);
     //
     const TopoDS_Shape& aS=aSI.Shape();
-    ResetShape(aS);
     //
     aTS=aSI.ShapeType();
     //
@@ -427,7 +423,7 @@ 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);
@@ -449,7 +445,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);
@@ -533,7 +529,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);
@@ -647,6 +643,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 +866,7 @@ const BOPDS_ListOfPaveBlock& BOPDS_DS::PaveBlocks
   }
   return sLPB;
 }
+
 //=======================================================================
 //function : ChangePaveBlocks
 //purpose  : 
@@ -1375,6 +1420,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);
     }
   }
@@ -1533,9 +1581,9 @@ void BOPDS_DS::VerticesOnIn
 //purpose  : 
 //=======================================================================
 void BOPDS_DS::SharedEdges(const Standard_Integer nF1,
-      const Standard_Integer nF2,
-      BOPCol_ListOfInteger& theLI,
-      const Handle(NCollection_BaseAllocator)& aAllocator)
+                           const Standard_Integer nF2,
+                           BOPCol_ListOfInteger& theLI,
+                           const Handle(NCollection_BaseAllocator)& aAllocator)
 {
   Standard_Integer nE, nSp;
   BOPCol_ListIteratorOfListOfInteger aItLI;
@@ -1808,7 +1856,6 @@ Standard_Boolean BOPDS_DS::IsSubShape
 
   return bRet;
 }
-
 //=======================================================================
 // function: Paves
 // purpose:
@@ -1854,7 +1901,6 @@ void BOPDS_DS::Paves(const Standard_Integer theEdge,
     theLP.Append(pPaves(i));
   }
 }
-
 //=======================================================================
 // function: UpdateTolerance
 // purpose:
@@ -1887,55 +1933,25 @@ void BOPDS_DS::UpdateEdgeTolerance(const Standard_Integer nE,
     }
   }
 }
-
 //=======================================================================
 //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 +2299,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 01a0dc42a2c2027ef7ffb79850a0af1114f1bf34..b1cd167ebf7f3044723e0c0a44eb093510afea65 100644 (file)
 #include <BRepAlgoAPI_Cut.hxx>
 #include <BRepAlgoAPI_Section.hxx>
 
+#include <stdio.h>
+#include <string.h>
 static 
   void ConvertList(const BOPCol_ListOfShape& aLSB,
-                   TopTools_ListOfShape& aLS);
+                   BOPCol_ListOfShape& aLS);
 
 static Standard_Integer bapibuild(Draw_Interpretor&, Standard_Integer, const char**); 
 static Standard_Integer bapibop  (Draw_Interpretor&, Standard_Integer, const char**); 
@@ -114,7 +116,7 @@ Standard_Integer bapibop(Draw_Interpretor& di,
   BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
   BOPCol_ListOfShape& aLTB=BOPTest_Objects::Tools();
   //
-  TopTools_ListOfShape aLS, aLT;
+  BOPCol_ListOfShape aLS, aLT;
   ConvertList(aLSB, aLS);
   ConvertList(aLTB, aLT);
   //
@@ -172,7 +174,7 @@ Standard_Integer bapibuild(Draw_Interpretor& di,
   BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
   BOPCol_ListOfShape& aLTB=BOPTest_Objects::Tools();
   //
-  TopTools_ListOfShape aLS;
+  BOPCol_ListOfShape aLS;
   ConvertList(aLSB, aLS);
   ConvertList(aLTB, aLS);
   //
@@ -205,7 +207,7 @@ Standard_Integer bapibuild(Draw_Interpretor& di,
 //purpose  : 
 //=======================================================================
 void ConvertList(const BOPCol_ListOfShape& aLSB,
-                 TopTools_ListOfShape& aLS)
+                 BOPCol_ListOfShape& aLS)
 {
   BOPCol_ListIteratorOfListOfShape aItB;
   //
index 77eebf826fb2f12c9bfa0e025943b84646afdfc4..9c777684fae0808f84e30e87159d931eb0157d43 100644 (file)
@@ -288,10 +288,10 @@ is
             theS   :out Shape from TopoDS); 
      
     CorrectTolerances (myclass;  
-            theS: Shape  from  TopoDS; 
-            theTolMax: Real from Standard =0.0001;  
-            theRunParallel: Boolean from Standard=Standard_False);   
+        theS: Shape  from  TopoDS;  
+        theMapToAvoid:IndexedMapOfShape from BOPCol;
+        theTolMax: Real from Standard =0.0001;
+        theRunParallel: Boolean from Standard=Standard_False);  
     ---Purpose:         
     -- Provides valid values of tolerances for the shape <theS>         
     -- <theTolMax> is max value of the tolerance that can be 
@@ -300,21 +300,23 @@ is
     -- perform. 
  
     CorrectCurveOnSurface  (myclass;  
-            theS: Shape  from  TopoDS; 
-            theTolMax: Real from Standard =0.0001; 
-            theRunParallel: Boolean from Standard=Standard_False);   
+        theS: Shape  from  TopoDS;  
+        theMapToAvoid:IndexedMapOfShape from BOPCol;
+        theTolMax: Real from Standard =0.0001;
+        theRunParallel: Boolean from Standard=Standard_False); 
     ---Purpose:         
     -- Provides valid values of tolerances for the shape <theS> 
     -- in  terms of BRepCheck_InvalidCurveOnSurface.   
  
     CorrectPointOnCurve    (myclass;  
-            theS: Shape  from  TopoDS; 
-            theTolMax: Real from Standard =0.0001; 
-            theRunParallel: Boolean from Standard=Standard_False);   
+        theS: Shape  from  TopoDS;  
+        theMapToAvoid:IndexedMapOfShape from BOPCol;
+        theTolMax: Real from Standard =0.0001; 
+        theRunParallel: Boolean from Standard=Standard_False);
     ---Purpose:         
     -- Provides valid values of tolerances for the shape <theS> 
     -- in  terms of BRepCheck_InvalidPointOnCurve.   
+
     MakeNewVertex  (myclass;  
             aP1 : Pnt  from  gp;  
             aTol: Real from Standard;
@@ -440,6 +442,7 @@ is
  
     CorrectShapeTolerances (myclass;
             theS: Shape from TopoDS; 
+            theMapToAvoid:IndexedMapOfShape from BOPCol; 
             theRunParallel: Boolean from Standard=Standard_False);   
     ---Purpose: 
     -- Corrects tolerance values of the sub-shapes of the shape <theS> if needed. 
index 86390a2355470474fa8ad77ec683dccc14659cf7..55cbc3efa4df42ac122579a0fc0d451c076adbf7 100644 (file)
@@ -37,6 +37,7 @@
 #include <TopExp_Explorer.hxx>
 
 #include <IntTools_Context.hxx>
+#include <IntTools_Tools.hxx>
 
 #include <BOPTools_AlgoTools2D.hxx>
 
@@ -55,7 +56,6 @@ static
   Standard_Boolean IsClosed(const TopoDS_Edge& ,
                             const TopoDS_Face& );
 
-
 //=======================================================================
 //function : AttachExistingPCurve
 //purpose  : 
@@ -66,9 +66,10 @@ Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
    const TopoDS_Face& aF, 
    const Handle(IntTools_Context)& aCtx)
 {
-  Standard_Boolean bIsToReverse, bIsClosed;
+  Standard_Boolean bIsToReverse, bIsClosed, bComp;
   Standard_Integer iRet;
   Standard_Real aTol, aT11, aT12, aT21, aT22, aTolPPC;
+  Standard_Real aTolSP, aTMax;
   Handle(Geom2d_Curve) aC2Dold, aC2DoldC;
   Handle(Geom2d_TrimmedCurve) aC2DT;
   BRep_Builder aBB;
@@ -97,13 +98,10 @@ Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
   //
   aC2DT=new Geom2d_TrimmedCurve(aC2DoldC, aT21, aT22);
   //
-  aTol=BRep_Tool::Tolerance(aE1);
-  BRep_Tool::Range (aE1, aT11, aT12);
-  aBB.SameRange(aE1, Standard_False);
-  aBB.SameParameter(aE1, Standard_False);
-  
   aTolPPC=Precision::PConfusion();
   //
+  Handle(Geom_Curve) aCE1 = BRep_Tool::Curve(aE1, aT11, aT12);
+  //
   GeomLib::SameRange(aTolPPC, aC2DT, aT21, aT22, aT11, aT12, aC2DT);
   //
   if (aC2DT.IsNull()){
@@ -111,15 +109,36 @@ Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
     return iRet;
   }
   //
+  // check the curves on same parameter to prevent 
+  // big tolerance increasing
+  Handle(Geom_Surface) aSF = BRep_Tool::Surface(aF);
+  //
+  bComp = IntTools_Tools::ComputeTolerance
+    (aCE1, aC2DT, aSF, aT11, aT12, aTolSP, aTMax);
+  if (!bComp) {
+    iRet = 3;
+    return iRet;
+  }
+  //
+  aTol = BRep_Tool::Tolerance(aE1);
+  //
+  if ((aTolSP > 10.*aTol) && aTolSP > 0.1) {
+    iRet = 4;
+    return iRet;
+  }
+  //
+  aBB.SameRange(aE1, Standard_False);
+  aBB.SameParameter(aE1, Standard_False);
+  //
   aBB.UpdateEdge(aE1, aC2DT, aF, aTol);
   BRepLib::SameParameter(aE1);
   BRepLib::SameRange(aE1);
   //
-  bIsClosed=IsClosed(aE2, aF);
+  bIsClosed = IsClosed(aE2, aF);
   if (bIsClosed) {
-    iRet=UpdateClosedPCurve(aE2, aE1, aF, aCtx);
+    iRet = UpdateClosedPCurve(aE2, aE1, aF, aCtx);
     if(iRet) {
-      iRet=3;
+      iRet = 5;
     }
   }
   //
@@ -309,4 +328,3 @@ Standard_Boolean IsClosed(const TopoDS_Edge& aE,
   }
   return bRet;
 }
-
index 10efe77184fdd6e46fa05fb712ec0ea0b2441624..6f2d037f83c36c40d40a9d646e5e6608ad71ef80 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,
@@ -98,15 +100,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,
@@ -124,7 +134,7 @@ static
 class BOPTools_CPC {
  public:
   BOPTools_CPC()
-    : myMaxTol(1.e-7) {
+    : myMaxTol(1.e-7), mypMapToAvoid(0L) {
   }
   //
   ~BOPTools_CPC() {
@@ -146,13 +156,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;
 };
 //
 //=======================================================================
@@ -172,7 +188,7 @@ typedef BOPCol_Cnt
 //=======================================================================
 class BOPTools_CWT {
  public:
-  BOPTools_CWT() {
+  BOPTools_CWT() : mypMapToAvoid(0L) {
   }
   //
   ~BOPTools_CWT() {
@@ -182,12 +198,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; 
@@ -207,7 +229,7 @@ typedef BOPCol_Cnt
 class BOPTools_CDT {
  public:
   BOPTools_CDT() 
-    : myMaxTol(1.e-7) {
+    : myMaxTol(1.e-7), mypMapToAvoid(0L) {
   }
   //
   ~BOPTools_CDT() {
@@ -225,14 +247,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; 
@@ -251,7 +279,7 @@ typedef BOPCol_Cnt
 //=======================================================================
 class BOPTools_CVT {
  public:
-  BOPTools_CVT() {
+  BOPTools_CVT() : mypMapToAvoid(0L) {
   }
   //
   ~BOPTools_CVT() {
@@ -261,12 +289,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;
 };
 //
 //=======================================================================
@@ -286,7 +320,7 @@ typedef BOPCol_Cnt
 //=======================================================================
 class BOPTools_CET {
  public:
-  BOPTools_CET() {
+  BOPTools_CET() : mypMapToAvoid(0L) {
   }
   //
   ~BOPTools_CET() {
@@ -296,12 +330,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; 
@@ -323,11 +363,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);
 }
 //
 //=======================================================================
@@ -336,6 +377,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)
 {
@@ -348,6 +390,7 @@ void BOPTools_AlgoTools::CorrectPointOnCurve
     BOPTools_CPC& aCPC=aVCPC.Append1();
     aCPC.SetEdge(aE);
     aCPC.SetMaxTol(aMaxTol);
+    aCPC.SetMapToAvoid(aMapToAvoid);
   }
   //
   //======================================================
@@ -360,6 +403,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)
 {
@@ -373,6 +417,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()) {
@@ -382,6 +427,7 @@ void BOPTools_AlgoTools::CorrectCurveOnSurface
       aCDT.SetEdge(aE);
       aCDT.SetFace(aF);
       aCDT.SetMaxTol(aMaxTol);
+      aCDT.SetMapToAvoid(aMapToAvoid);
     }
   }
   //
@@ -397,6 +443,7 @@ void BOPTools_AlgoTools::CorrectCurveOnSurface
 //=======================================================================
 void BOPTools_AlgoTools::CorrectShapeTolerances
   (const TopoDS_Shape& aShape,
+   const BOPCol_IndexedMapOfShape& aMapToAvoid,
    const Standard_Boolean bRunParallel)
 { 
   TopExp_Explorer aExp;
@@ -408,6 +455,7 @@ void BOPTools_AlgoTools::CorrectShapeTolerances
     const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExp.Current();
     BOPTools_CVT& aCVT=aVCVT.Append1();
     aCVT.SetEdge(aE);
+    aCVT.SetMapToAvoid(aMapToAvoid);
   }
   //
   //======================================================
@@ -419,6 +467,7 @@ void BOPTools_AlgoTools::CorrectShapeTolerances
     const TopoDS_Face& aF = *(TopoDS_Face*)&aExp.Current();
     BOPTools_CET& aCET=aVCET.Append1();
     aCET.SetFace(aF);
+    aCET.SetMapToAvoid(aMapToAvoid);
   }
   //
   //======================================================
@@ -431,7 +480,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;
@@ -483,7 +533,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();
@@ -505,7 +555,7 @@ void CheckEdge (const TopoDS_Edge& Ed,
             if (aD2 > aTol) {
               aNewTolerance=sqrt(aD2)+dd;
               if (aNewTolerance<aMaxTol) 
-                TV->UpdateTolerance(aNewTolerance);
+                UpdateShape(aV, aNewTolerance, aMapToAvoid);
             }
           }
         }
@@ -518,7 +568,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;
@@ -593,10 +644,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) {
 }
@@ -666,7 +715,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
@@ -806,9 +856,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);
           }
         }
         
@@ -820,8 +869,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);
             } 
           }
         }
@@ -876,8 +925,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);
           }
         }
       }
@@ -888,7 +937,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;
@@ -899,8 +949,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);
     }
   }
 }
@@ -1022,11 +1071,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);
@@ -1038,22 +1087,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 aa4cf220cd388406e7b7f99b044dcb12ecbb6427..221fb82c91dc68cdd0926ecd47639fa59cb57948 100644 (file)
@@ -30,6 +30,7 @@ uses
     Shape from TopoDS, 
     DataMapOfShapeShape from TopTools, 
     ListOfShape from TopTools, 
+    ListOfShape from BOPCol,    
     --
     Operation   from BOPAlgo,
     PaveFiller from BOPAlgo 
@@ -79,11 +80,11 @@ is
     ---C++: return const &
       
     SetTools(me:out; 
-           theLS: ListOfShape from TopTools); 
+           theLS: ListOfShape from BOPCol); 
     ---Purpose: Sets the tools    
      
     Tools(me) 
-      returns ListOfShape from TopTools
+      returns ListOfShape from BOPCol
     ---C++: return const &   
     ---Purpose: Gets the tools    
      
@@ -181,7 +182,7 @@ is
     
     
 fields 
-    myTools    : ListOfShape from TopTools is protected; 
+    myTools    : ListOfShape from BOPCol is protected; 
     myOperation: Operation from BOPAlgo   is protected;   
     -- 
     myBuilderCanWork : Boolean from Standard is protected;   
index f98f2acea32ae09d6ac24adbf8a2a7ebfbda6327..90717638b8569d1c0a9a804ebcca6ba3ba6b77a8 100644 (file)
@@ -191,7 +191,7 @@ void BRepAlgoAPI_BooleanOperation::Clear()
 //purpose  : 
 //=======================================================================
 void BRepAlgoAPI_BooleanOperation::SetTools
-  (const TopTools_ListOfShape& theLS)
+  (const BOPCol_ListOfShape& theLS)
 {
   myTools=theLS;
 }
@@ -199,7 +199,7 @@ void BRepAlgoAPI_BooleanOperation::SetTools
 //function : Tools
 //purpose  : 
 //=======================================================================
-const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Tools()const
+const BOPCol_ListOfShape& BRepAlgoAPI_BooleanOperation::Tools()const
 {
   return myTools;
 }
@@ -285,7 +285,7 @@ void BRepAlgoAPI_BooleanOperation::Build()
   //
   //-----------------------------------------------
   TopTools_ListOfShape aLS;
-  TopTools_ListIteratorOfListOfShape aIt;
+  BOPCol_ListIteratorOfListOfShape aIt;
   //
   aIt.Initialize(myArguments);
   for (; aIt.More(); aIt.Next()) {
@@ -382,8 +382,8 @@ void BRepAlgoAPI_BooleanOperation::RefineEdges ()
   }
   //
   TopTools_IndexedMapOfShape mapOldEdges;
-  TopTools_ListOfShape aLS;
-  TopTools_ListIteratorOfListOfShape aIt;
+  BOPCol_ListOfShape aLS;
+  BOPCol_ListIteratorOfListOfShape aIt;
   //
   aIt.Initialize(myArguments);
   for (; aIt.More(); aIt.Next()) {
index 7c9a9784eeceae145a58b608557914ce5f9183da..bb29c6cc5d7bdc0720e49dfab4d76716490b36f3 100644 (file)
@@ -20,6 +20,7 @@ class BuilderAlgo from BRepAlgoAPI
 uses
     Shape from TopoDS, 
     ListOfShape from TopTools,
+    ListOfShape from BOPCol,
     --
     PPaveFiller from BOPAlgo, 
     PaveFiller from BOPAlgo,
@@ -47,11 +48,11 @@ is
     ---Purpose: Returns the additional tolerance   
     
     SetArguments(me:out; 
-        theLS: ListOfShape from TopTools);  
+        theLS: ListOfShape from BOPCol);  
     ---Purpose: Sets the arguments    
             
     Arguments(me) 
-        returns ListOfShape from TopTools
+        returns ListOfShape from BOPCol
     ---C++: return const & 
     ---Purpose: Gets the arguments   
     
@@ -111,5 +112,5 @@ fields
     myDSFiller   : PPaveFiller from BOPAlgo  is protected;
     myBuilder    : PBuilder    from BOPAlgo  is protected;
     myFuzzyValue : Real        from Standard is protected; 
-    myArguments  : ListOfShape from TopTools is protected;   
+    myArguments  : ListOfShape from BOPCol is protected;   
 end BuilderAlgo;
index 64ad14a820eb991c8fbf97b5a39ce2092fa6f937..a9e98112bf4dcb7a0d60afa43521369ffd7955ab 100644 (file)
@@ -88,7 +88,7 @@ void BRepAlgoAPI_BuilderAlgo::Clear()
 //purpose  : 
 //=======================================================================
 void BRepAlgoAPI_BuilderAlgo::SetArguments
-  (const TopTools_ListOfShape& theLS)
+  (const BOPCol_ListOfShape& theLS)
 {
   myArguments=theLS;
 }
@@ -96,7 +96,7 @@ void BRepAlgoAPI_BuilderAlgo::SetArguments
 //function : Arguments
 //purpose  : 
 //=======================================================================
-const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
+const BOPCol_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
 {
   return myArguments;
 }
index fb0107e33301c42496a03b82153ca806bb72fc4a..7cdb4daf11a8479019fef94dabe42cfefb568ddb 100644 (file)
@@ -524,7 +524,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  S1,
     default:
     {
       IntPatch_PrmPrmIntersection interpp;
-      interpp.Perform(S1,D1,TolArc,TolTang,myFleche,myUVMaxStep);
+      interpp.Perform(S1,D1,TolTang,TolArc,myFleche,myUVMaxStep);
       if (interpp.IsDone())
       {
         done = Standard_True;
@@ -1329,7 +1329,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  theS1,
     ParamParamPerfom(theS1, theD1, theS2, theD2, TolArc,
                         TolTang, ListOfPnts, RestrictLine, typs1, typs2);
   }
-}
+  }
 
 //=======================================================================
 //function : Perform
@@ -1548,7 +1548,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  theS1,
               TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2);
     }
   }
-}
+  }
 
 //=======================================================================
 //function : ParamParamPerfom
@@ -1571,10 +1571,10 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
     Standard_Boolean ClearFlag = Standard_True;
     if(!ListOfPnts.IsEmpty())
     {
-      interpp.Perform(theS1,theD1,theS2,theD2,TolArc,TolTang,myFleche,myUVMaxStep, ListOfPnts, RestrictLine);
+      interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep, ListOfPnts, RestrictLine);
       ClearFlag = Standard_False;
     }
-    interpp.Perform(theS1,theD1,theS2,theD2,TolArc,TolTang,myFleche,myUVMaxStep,ClearFlag);   //double call!!!!!!!
+    interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep,ClearFlag);   //double call!!!!!!!
   }
   else if((theD1->DomainIsInfinite()) ^ (theD2->DomainIsInfinite()))
   {
@@ -1587,7 +1587,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
       const Standard_Real AP = Max(MU, MV);
       Handle(Adaptor3d_HSurface) SS;
       FUN_TrimInfSurf(pMinXYZ, pMaxXYZ, theS1, AP, SS);
-      interpp.Perform(SS,theD1,theS2,theD2,TolArc,TolTang,myFleche,myUVMaxStep);
+      interpp.Perform(SS,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep);
     }
     else
     {
@@ -1597,7 +1597,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
       const Standard_Real AP = Max(MU, MV);
       Handle(Adaptor3d_HSurface) SS;
       FUN_TrimInfSurf(pMinXYZ, pMaxXYZ, theS2, AP, SS);
-      interpp.Perform(theS1, theD1, SS, theD2,TolArc,TolTang,myFleche,myUVMaxStep);
+      interpp.Perform(theS1, theD1, SS, theD2,TolTang, TolArc,myFleche,myUVMaxStep);
     }
   }//(theD1->DomainIsInfinite()) ^ (theD2->DomainIsInfinite())
   else
@@ -1636,7 +1636,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
       Handle(Adaptor3d_HSurface) nS1 = theS1;
       Handle(Adaptor3d_HSurface) nS2 = theS2;
       FUN_TrimBothSurf(theS1,typs1,theS2,typs2,1.e+8,nS1,nS2);
-      interpp.Perform(nS1,theD1,nS2,theD2,TolArc,TolTang,myFleche,myUVMaxStep);
+      interpp.Perform(nS1,theD1,nS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep);
     }// 'NON - COLLINEAR LINES'
   }// both domains are infinite
 
@@ -1906,10 +1906,10 @@ void IntPatch_Intersection::
         }
 
         JoinWLines( slin, spnt, theTolTang,
-                    theS1->IsUPeriodic()? theS1->UPeriod() : 0.0,
-                    theS2->IsUPeriodic()? theS2->UPeriod() : 0.0,
-                    theS1->IsVPeriodic()? theS1->VPeriod() : 0.0,
-                    theS2->IsVPeriodic()? theS2->VPeriod() : 0.0,
+                                        theS1->IsUPeriodic()? theS1->UPeriod() : 0.0,
+                                        theS2->IsUPeriodic()? theS2->UPeriod() : 0.0,
+                                        theS1->IsVPeriodic()? theS1->VPeriod() : 0.0,
+                                        theS2->IsVPeriodic()? theS2->VPeriod() : 0.0,
                     theS1->FirstUParameter(), theS1->LastUParameter(),
                     theS1->FirstVParameter(), theS1->LastVParameter(),
                     theS2->FirstUParameter(), theS2->LastUParameter(),
@@ -1982,7 +1982,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  S1,
   else
   {
     IntPatch_PrmPrmIntersection interpp;
-    interpp.Perform(S1,D1,S2,D2,U1,V1,U2,V2,TolArc,TolTang,myFleche,myUVMaxStep);
+    interpp.Perform(S1,D1,S2,D2,U1,V1,U2,V2,TolTang,TolArc,myFleche,myUVMaxStep);
     if (interpp.IsDone())
     {
       done = Standard_True;
@@ -1993,7 +1993,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  S1,
       for (; i<=nblm; i++) slin.Append(interpp.Line(i));
     }
   }
-}
+  }
 //======================================================================
 #include <IntPatch_IType.hxx>
 #include <IntPatch_LineConstructor.hxx>
@@ -2053,7 +2053,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer ,
     NR1[nbR1]=0;
     nbR1++;
   }
-  for(D2->Init();D2->More() && nbR2<MAXR; D2->Next()) { 
+  for(D2->Init();D2->More() && nbR2<MAXR; D2->Next()) {
     R2[nbR2]=D2->Value();
     NR2[nbR2]=0;
     nbR2++;
index 8d07c7b2df76033b1ce0af1203f794c52b66e153..a0bc4144a8c876270989336ff9d9c1c977f8affb 100644 (file)
@@ -68,6 +68,192 @@ static void AddWLine(IntPatch_SequenceOfLine      &theLines,
                      const Handle(IntPatch_WLine) &theWLine,
                      const Standard_Real           Deflection);
 
+static void SeveralWlinesProcessing(const Handle(Adaptor3d_HSurface)& theSurf1,
+                                    const Handle(Adaptor3d_HSurface)& theSurf2,
+                                    const IntPatch_SequenceOfLine& theSLin,
+                                    const Standard_Real* const thePeriodsArr,
+                                    const IntSurf_TypeTrans theTrans1,
+                                    const IntSurf_TypeTrans theTrans2,
+                                    const Standard_Real theTol,
+                                    const Standard_Real theMaxStepS1,
+                                    const Standard_Real theMaxStepS2,
+                                    Handle(IntPatch_WLine)& theWLline)
+{
+  if(theSLin.Length() == 0)
+    return;
+
+  Standard_Real aU1 = 0.0, aV1 = 0.0, aU2 = 0.0, aV2 = 0.0;
+
+  Standard_Integer cnbV = theWLline->NbVertex();
+  Standard_Integer ciV;
+  for( ciV = 1; ciV <= cnbV; ciV++ )
+  {
+    Standard_Real pntDMin = 1.e+100;
+    Standard_Integer VDMin = 0;
+    Standard_Integer WLDMin = 0;
+    gp_Pnt cPV = theWLline->Vertex(ciV).Value();
+    theWLline->Vertex(ciV).Parameters(aU1, aV1, aU2, aV2);
+    const gp_Pnt2d aPCS1(aU1, aV1), aPCS2(aU2, aV2);
+    Standard_Integer iL;
+    for( iL = 1; iL <= theSLin.Length(); iL++)
+    {
+      const Handle(IntPatch_Line)& aSLine = theSLin.Value(iL);
+      IntPatch_IType aType = aSLine->ArcType();
+      if( aType != IntPatch_Walking)
+        continue;
+      const Handle(IntPatch_WLine) aWLine = Handle(IntPatch_WLine)::DownCast(aSLine);
+      Standard_Integer tnbV = aWLine->NbVertex();
+      Standard_Integer tiV;
+      for( tiV = 1; tiV <= tnbV; tiV++ )
+      {
+        gp_Pnt tPV = aWLine->Vertex(tiV).Value();
+
+        aWLine->Vertex(tiV).Parameters(aU1, aV1, aU2, aV2);
+        const gp_Pnt2d aPTS1(aU1, aV1), aPTS2(aU2, aV2);
+
+        Standard_Real tDistance = cPV.Distance(tPV);
+        Standard_Real uRs1 = theSurf1->Surface().UResolution(tDistance);
+        Standard_Real vRs1 = theSurf1->Surface().VResolution(tDistance);
+        Standard_Real uRs2 = theSurf2->Surface().UResolution(tDistance);
+        Standard_Real vRs2 = theSurf2->Surface().VResolution(tDistance);
+        Standard_Real RmaxS1 = Max(uRs1,vRs1);
+        Standard_Real RmaxS2 = Max(uRs2,vRs2);
+        
+        if(RmaxS1 < theMaxStepS1 && RmaxS2 < theMaxStepS2)
+        {
+          if( pntDMin > tDistance && tDistance > Precision::PConfusion())
+          {
+            const Standard_Real aSqDist1 = aPCS1.SquareDistance(aPTS1),
+                                aSqDist2 = aPCS2.SquareDistance(aPTS2);
+            if((aSqDist1 < RmaxS1*RmaxS1) && (aSqDist2 < RmaxS2*RmaxS2))
+            {
+              pntDMin = tDistance;
+              VDMin = tiV;
+              WLDMin = iL;
+            }
+          }
+        }
+      }
+    }
+
+    if( VDMin != 0 )
+    {
+      const Handle(IntPatch_Line)& aSLine = theSLin.Value(WLDMin);
+      const Handle(IntPatch_WLine) aWLine = Handle(IntPatch_WLine)::DownCast(aSLine);
+      Standard_Integer tiVpar = (Standard_Integer)aWLine->Vertex(VDMin).ParameterOnLine();
+      Standard_Integer ciVpar = (Standard_Integer)theWLline->Vertex(ciV).ParameterOnLine();
+      Standard_Real u11 = 0., u12 = 0., v11 = 0., v12 = 0.;
+      Standard_Real u21 = 0., u22 = 0., v21 = 0., v22 = 0.;
+      theWLline->Point(ciVpar).Parameters(u11,v11,u12,v12);
+      aWLine->Point(tiVpar).Parameters(u21,v21,u22,v22);
+
+      Handle(IntSurf_LineOn2S) newL2s = new IntSurf_LineOn2S();
+      IntSurf_PntOn2S replacePnt = aWLine->Point(tiVpar);
+      Standard_Integer cNbP = theWLline->NbPnts();
+
+      TColStd_SequenceOfInteger VPold;
+      Standard_Integer iPo;
+      for( iPo = 1; iPo <= cnbV; iPo++ )
+      {
+        Standard_Real Po = theWLline->Vertex(iPo).ParameterOnLine();
+        Standard_Integer IPo = (Standard_Integer) Po;
+        VPold.Append(IPo);
+      }
+
+      Standard_Boolean removeNext = Standard_False;
+      Standard_Boolean removePrev = Standard_False;
+      if( ciV == 1)
+      {
+        Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
+        if(dPar > 10)
+        {
+          removeNext = Standard_True;
+          for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
+            VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
+        }
+      }
+      else if( ciV == cnbV)
+      {
+        Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
+        if(dPar > 10)
+        {
+          removePrev = Standard_True;
+          VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
+        }
+      }
+      else
+      {
+        Standard_Integer dParMi = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
+        Standard_Integer dParMa = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
+        if(dParMi > 10)
+        {
+          removePrev = Standard_True;
+          VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
+        }
+
+        if(dParMa > 10)
+        {
+          removeNext = Standard_True;
+          for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
+          {
+            if(dParMi > 10)
+              VPold.SetValue(iPo, VPold.Value(iPo) - 2 );
+            else
+              VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
+          }
+        }
+        else
+        {
+          if(dParMi > 10)
+            for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
+              VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
+        } 
+      }
+
+      Standard_Integer pI = ciVpar;
+
+      Standard_Integer iP;
+      for( iP = 1; iP <= cNbP; iP++)
+      {
+        if( pI == iP )
+        {
+          IntSurf_PntOn2S newPnt = MakeNewPoint(replacePnt, theWLline->Point(iP), thePeriodsArr);
+          newL2s->Add(newPnt);
+        }
+        else if(removeNext && iP == (pI + 1))
+          continue;
+        else if(removePrev && iP == (pI - 1))
+          continue;
+        else
+          newL2s->Add(theWLline->Point(iP));
+      }
+
+      IntPatch_Point newVtx;
+      gp_Pnt Pnt3dV = aWLine->Vertex(VDMin).Value();
+      newVtx.SetValue(Pnt3dV,theTol,Standard_False);
+      newVtx.SetParameters(u21,v21,u22,v22);
+      newVtx.SetParameter(VPold.Value(ciV));
+
+      Handle(IntPatch_WLine) NWLine = new IntPatch_WLine(newL2s,Standard_False,theTrans1,theTrans2);
+
+      Standard_Integer iV;
+      for( iV = 1; iV <= cnbV; iV++ )
+      {
+        if( iV == ciV )
+          NWLine->AddVertex(newVtx);
+        else
+        {
+          IntPatch_Point theVtx = theWLline->Vertex(iV);
+          theVtx.SetParameter(VPold.Value(iV));
+          NWLine->AddVertex(theVtx);
+        }
+      }
+
+      theWLline = NWLine;
+    }//if( VDMin != 0 )
+  }//for( ciV = 1; ciV <= cnbV; ciV++ )
+}
+
 //=======================================================================
 //function : DublicateOfLinesProcessing
 //purpose  : Decides, if rejecting current line is necessary
@@ -1606,144 +1792,9 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
                 wline->AddVertex(vtx);
               }              
 
-              Standard_Integer slinlen = SLin.Length();
-              if( slinlen > 0 ) {
-                Standard_Integer cnbV = wline->NbVertex();
-                Standard_Integer ciV;
-                for( ciV = 1; ciV <= cnbV; ciV++ ) {
-                  Standard_Real pntDMin = 1.e+100;
-                  Standard_Integer VDMin = 0;
-                  Standard_Integer WLDMin = 0;
-                  gp_Pnt cPV = wline->Vertex(ciV).Value();
-                  Standard_Integer iL;
-                  for( iL = 1; iL <= slinlen; iL++) {
-                    const Handle(IntPatch_Line)& aSLine = SLin.Value(iL);
-                    IntPatch_IType aType = aSLine->ArcType();
-                    if( aType != IntPatch_Walking)
-                      continue;
-                    const Handle(IntPatch_WLine)&  aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
-                    Standard_Integer tnbV = aWLine->NbVertex();
-                    Standard_Integer tiV;
-                    for( tiV = 1; tiV <= tnbV; tiV++ ) {
-                      gp_Pnt tPV = aWLine->Vertex(tiV).Value();
-                      Standard_Real tDistance = cPV.Distance(tPV);
-                      Standard_Real uRs1 = Surf1->Surface().UResolution(tDistance);
-                      Standard_Real vRs1 = Surf1->Surface().VResolution(tDistance);
-                      Standard_Real uRs2 = Surf2->Surface().UResolution(tDistance);
-                      Standard_Real vRs2 = Surf2->Surface().VResolution(tDistance);
-                      Standard_Real RmaxS1 = Max(uRs1,vRs1);
-                      Standard_Real RmaxS2 = Max(uRs2,vRs2);
-                      if(RmaxS1 < 1.e-4 && RmaxS2 < 1.e-4) {
-                        if( pntDMin > tDistance && tDistance > 1.e-9) {
-                          pntDMin = tDistance;
-                          VDMin = tiV;
-                          WLDMin = iL;
-                        }
-                      }
-                    }
-                  }
-
-                  if( VDMin != 0 ) {
-                    const Handle(IntPatch_Line)& aSLine = SLin.Value(WLDMin);
-                    const Handle(IntPatch_WLine)&  aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
-                    Standard_Integer tiVpar = (Standard_Integer)aWLine->Vertex(VDMin).ParameterOnLine();
-                    Standard_Integer ciVpar = (Standard_Integer)wline->Vertex(ciV).ParameterOnLine();
-                    Standard_Real u11 = 0., u12 = 0., v11 = 0., v12 = 0.;
-                    Standard_Real u21 = 0., u22 = 0., v21 = 0., v22 = 0.;
-                    wline->Point(ciVpar).Parameters(u11,v11,u12,v12);
-                    aWLine->Point(tiVpar).Parameters(u21,v21,u22,v22);
-
-                    Handle(IntSurf_LineOn2S) newL2s = new IntSurf_LineOn2S();
-                    IntSurf_PntOn2S replacePnt = aWLine->Point(tiVpar);
-                    Standard_Integer cNbP = wline->NbPnts();
-
-                    TColStd_SequenceOfInteger VPold;
-                    Standard_Integer iPo;
-                    for( iPo = 1; iPo <= cnbV; iPo++ ) {
-                      Standard_Real Po = wline->Vertex(iPo).ParameterOnLine();
-                      Standard_Integer IPo = (Standard_Integer) Po;
-                      VPold.Append(IPo);
-                    }
-
-                    Standard_Boolean removeNext = Standard_False;
-                    Standard_Boolean removePrev = Standard_False;
-                    if( ciV == 1) {
-                      Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
-                      if(dPar > 10) {
-                        removeNext = Standard_True;
-                        for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
-                          VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
-                      }
-                    }
-                    else if( ciV == cnbV) {
-                      Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
-                      if(dPar > 10) {
-                        removePrev = Standard_True;
-                        VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
-                      }
-                    }
-                    else {
-                      Standard_Integer dParMi = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
-                      Standard_Integer dParMa = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
-                      if(dParMi > 10) {
-                        removePrev = Standard_True;
-                        VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
-                      }
-                      if(dParMa > 10) {
-                        removeNext = Standard_True;
-                        for( iPo = (ciV+1); iPo <= cnbV; iPo++ ) {
-                          if(dParMi > 10)
-                            VPold.SetValue(iPo, VPold.Value(iPo) - 2 );
-                          else
-                            VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
-                        }
-                      }
-                      else {
-                        if(dParMi > 10)
-                          for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
-                            VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
-                      } 
-                    }
-                    Standard_Integer pI = (Standard_Integer) ciVpar;
-
-                    Standard_Integer iP;
-                    for( iP = 1; iP <= cNbP; iP++) {
-                      if( pI == iP )
-                      {
-                        IntSurf_PntOn2S newPnt = MakeNewPoint(replacePnt, wline->Point(iP), Periods);
-                        newL2s->Add(newPnt);
-                      }
-                      else if(removeNext && iP == (pI + 1))
-                        continue;
-                      else if(removePrev && iP == (pI - 1))
-                        continue;
-                      else
-                        newL2s->Add(wline->Point(iP));
-                    }
-
-                    IntPatch_Point newVtx;
-                    gp_Pnt Pnt3dV = aWLine->Vertex(VDMin).Value();
-                    newVtx.SetValue(Pnt3dV,TolTang,Standard_False);
-                    newVtx.SetParameters(u21,v21,u22,v22);
-                    newVtx.SetParameter(VPold.Value(ciV));
-
-                    Handle(IntPatch_WLine) NWLine = new IntPatch_WLine(newL2s,Standard_False,trans1,trans2);
-
-                    Standard_Integer iV;
-                    for( iV = 1; iV <= cnbV; iV++ ) {
-                      if( iV == ciV )
-                        NWLine->AddVertex(newVtx);
-                      else {
-                        IntPatch_Point theVtx = wline->Vertex(iV);
-                        theVtx.SetParameter(VPold.Value(iV));
-                        NWLine->AddVertex(theVtx);
-                      }
-                    }
-
-                    wline = NWLine;
-                  }
-                }
-              }// SLin.Length > 0
+              SeveralWlinesProcessing(Surf1, Surf2, SLin, Periods, trans1, trans2,
+                                      TolTang, Max(PW.MaxStep(0), PW.MaxStep(1)),
+                                      Max(PW.MaxStep(2), PW.MaxStep(3)), wline);
 
               AddWLine(SLin, wline, Deflection);
               empt = Standard_False;
@@ -2423,166 +2474,9 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
 
                       lignetrouvee = Standard_True;
 
-                      Standard_Integer slinlen = SLin.Length();
-                      if( slinlen > 0 )
-                      {
-                        Standard_Integer cnbV = wline->NbVertex();
-                        Standard_Integer ciV;
-                        for( ciV = 1; ciV <= cnbV; ciV++ )
-                        {
-                          Standard_Real pntDMin = 1.e+100;
-                          Standard_Integer VDMin = 0;
-                          Standard_Integer WLDMin = 0;
-                          gp_Pnt cPV = wline->Vertex(ciV).Value();
-                          Standard_Integer iL;
-                          for( iL = 1; iL <= slinlen; iL++)
-                          {
-                            const Handle(IntPatch_Line)& aSLine = SLin.Value(iL);
-                            IntPatch_IType aType = aSLine->ArcType();
-                            if( aType != IntPatch_Walking)
-                              continue;
-                            const Handle(IntPatch_WLine)&  aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
-                            Standard_Integer tnbV = aWLine->NbVertex();
-                            Standard_Integer tiV;
-                            for( tiV = 1; tiV <= tnbV; tiV++ )
-                            {
-                              gp_Pnt tPV = aWLine->Vertex(tiV).Value();
-                              Standard_Real tDistance = cPV.Distance(tPV);
-                              Standard_Real uRs1 = Surf1->Surface().UResolution(tDistance);
-                              Standard_Real vRs1 = Surf1->Surface().VResolution(tDistance);
-                              Standard_Real uRs2 = Surf2->Surface().UResolution(tDistance);
-                              Standard_Real vRs2 = Surf2->Surface().VResolution(tDistance);
-                              Standard_Real RmaxS1 = Max(uRs1,vRs1);
-                              Standard_Real RmaxS2 = Max(uRs2,vRs2);
-                              if(RmaxS1 < 1.e-4 && RmaxS2 < 1.e-4)
-                              {
-                                if( pntDMin > tDistance && tDistance > 1.e-9)
-                                {
-                                  pntDMin = tDistance;
-                                  VDMin = tiV;
-                                  WLDMin = iL;
-                                }
-                              }
-                            }
-                          }
-
-                          if( VDMin != 0 )
-                          {
-                            const Handle(IntPatch_Line)& aSLine = SLin.Value(WLDMin);
-                            const Handle(IntPatch_WLine)&  aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
-                            Standard_Integer tiVpar = (Standard_Integer)aWLine->Vertex(VDMin).ParameterOnLine();
-                            Standard_Integer ciVpar = (Standard_Integer)wline->Vertex(ciV).ParameterOnLine();
-                            Standard_Real u11 = 0., u12 = 0., v11 = 0., v12 = 0.;
-                            Standard_Real u21 = 0., u22 = 0., v21 = 0., v22 = 0.;
-                            wline->Point(ciVpar).Parameters(u11,v11,u12,v12);
-                            aWLine->Point(tiVpar).Parameters(u21,v21,u22,v22);
-
-                            Handle(IntSurf_LineOn2S) newL2s = new IntSurf_LineOn2S();
-                            IntSurf_PntOn2S replacePnt = aWLine->Point(tiVpar);
-                            Standard_Integer cNbP = wline->NbPnts();
-
-                            TColStd_SequenceOfInteger VPold;
-                            Standard_Integer iPo;
-                            for( iPo = 1; iPo <= cnbV; iPo++ )
-                            {
-                              Standard_Real Po = wline->Vertex(iPo).ParameterOnLine();
-                              Standard_Integer IPo = (Standard_Integer) Po;
-                              VPold.Append(IPo);
-                            }
-
-                            Standard_Boolean removeNext = Standard_False;
-                            Standard_Boolean removePrev = Standard_False;
-                            if( ciV == 1)
-                            {
-                              Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
-                              if(dPar > 10)
-                              {
-                                removeNext = Standard_True;
-                                for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
-                                  VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
-                              }
-                            }
-                            else if( ciV == cnbV)
-                            {
-                              Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
-                              if(dPar > 10)
-                              {
-                                removePrev = Standard_True;
-                                VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
-                              }
-                            }
-                            else
-                            {
-                              Standard_Integer dParMi = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
-                              Standard_Integer dParMa = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
-                              if(dParMi > 10)
-                              {
-                                removePrev = Standard_True;
-                                VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
-                              }
-
-                              if(dParMa > 10)
-                              {
-                                removeNext = Standard_True;
-                                for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
-                                {
-                                  if(dParMi > 10)
-                                    VPold.SetValue(iPo, VPold.Value(iPo) - 2 );
-                                  else
-                                    VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
-                                }
-                              }
-                              else
-                              {
-                                if(dParMi > 10)
-                                  for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
-                                    VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
-                              } 
-                            }
-
-                            Standard_Integer pI = ciVpar;
-
-                            Standard_Integer iP;
-                            for( iP = 1; iP <= cNbP; iP++)
-                            {
-                              if( pI == iP )
-                              {
-                                IntSurf_PntOn2S newPnt = MakeNewPoint(replacePnt, wline->Point(iP), Periods);
-                                newL2s->Add(newPnt);
-                              }
-                              else if(removeNext && iP == (pI + 1))
-                                continue;
-                              else if(removePrev && iP == (pI - 1))
-                                continue;
-                              else
-                                newL2s->Add(wline->Point(iP));
-                            }
-
-                            IntPatch_Point newVtx;
-                            gp_Pnt Pnt3dV = aWLine->Vertex(VDMin).Value();
-                            newVtx.SetValue(Pnt3dV,TolTang,Standard_False);
-                            newVtx.SetParameters(u21,v21,u22,v22);
-                            newVtx.SetParameter(VPold.Value(ciV));
-
-                            Handle(IntPatch_WLine) NWLine = new IntPatch_WLine(newL2s,Standard_False,trans1,trans2);
-
-                            Standard_Integer iV;
-                            for( iV = 1; iV <= cnbV; iV++ )
-                            {
-                              if( iV == ciV )
-                                NWLine->AddVertex(newVtx);
-                              else
-                              {
-                                IntPatch_Point theVtx = wline->Vertex(iV);
-                                theVtx.SetParameter(VPold.Value(iV));
-                                NWLine->AddVertex(theVtx);
-                              }
-                            }
-
-                            wline = NWLine;
-                          }//if( VDMin != 0 )
-                        }//for( ciV = 1; ciV <= cnbV; ciV++ )
-                      }// SLin.Length > 0
+                      SeveralWlinesProcessing(Surf1, Surf2, SLin, Periods, trans1, trans2,
+                                              TolTang, Max(PW.MaxStep(0), PW.MaxStep(1)),
+                                              Max(PW.MaxStep(2), PW.MaxStep(3)), wline);
 
                       AddWLine(SLin, wline, Deflection);
                       empt = Standard_False;
index 5225edcc3f5a39d598f64cbcb31554c0a5ec2767..484d83956aba0ad7e7ff717560110a591de15c6c 100644 (file)
@@ -154,7 +154,24 @@ is
     --- 2. the edge does not contain 3d curve and pcurves (-2)
     --- 3. projection algorithm failed (-3)
     ---
-         
+
+    ComputeVE  (me:mutable;  
+       aV   : Vertex from  TopoDS; 
+       aE   : Edge   from  TopoDS; 
+       aT   :out Real from Standard; 
+       aTolVnew:out Real from Standard) 
+    returns Integer from Standard;
+    ---Purpose: 
+    --- Computes parameter of the vertex aV on
+    --- the edge aE.
+    --- 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)
+    --- 3. projection algorithm failed (-3)
+
     ComputeVF  (me:mutable;  
        aV  :     Vertex from  TopoDS; 
        aF  :     Face   from  TopoDS; 
@@ -171,6 +188,23 @@ is
     --- 2. distance is more than sum of tolerances (-2)
     --- 3. projection point out or on the boundaries of face (-3)
     --- 
+    ComputeVF  (me:mutable;  
+       aV  :     Vertex from  TopoDS; 
+       aF  :     Face   from  TopoDS; 
+       U   : out Real from Standard; 
+       V   : out Real from Standard;  
+       aTolVnew:out Real from Standard)
+    returns Integer from Standard;
+    ---Purpose:
+    --- Computes UV parameters of the vertex aV on face aF
+    --- 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)
+    --- 3. projection point out or on the boundaries of face (-3)
     
     StatePointFace(me:mutable;    
        aF   :  Face   from  TopoDS;
index 9501d58a9e94a803fa7745a00fc231d81ad1064c..d4b72c7bd9582118e4a5ff70fbf5dd67ab8bce9f 100644 (file)
@@ -509,6 +509,20 @@ Standard_Integer IntTools_Context::ComputeVE
   (const TopoDS_Vertex& aV1, 
    const TopoDS_Edge&   aE2,
    Standard_Real& aT)
+{
+  Standard_Real aTolVnew;
+  //
+  return ComputeVE(aV1, aE2, aT, aTolVnew);
+}
+//=======================================================================
+//function : ComputeVE
+//purpose  : 
+//=======================================================================
+Standard_Integer IntTools_Context::ComputeVE
+  (const TopoDS_Vertex& aV1, 
+  const TopoDS_Edge&   aE2,
+  Standard_Real& aT,
+  Standard_Real& aTolVnew)
 {
   if (BRep_Tool::Degenerated(aE2)) {
     return -1;
@@ -539,6 +553,8 @@ Standard_Integer IntTools_Context::ComputeVE
   aTolE2=BRep_Tool::Tolerance(aE2);
   aTolSum = aTolV1 + aTolE2 + Precision::Confusion();
   //
+  aTolVnew=aDist+aTolE2;
+  //
   aT=aProjector.LowerDistanceParameter();
   if (aDist > aTolSum) {
     return -4;
@@ -546,7 +562,7 @@ Standard_Integer IntTools_Context::ComputeVE
   return 0;
 }
 //=======================================================================
-//function : ComputeVS
+//function : ComputeVF
 //purpose  : 
 //=======================================================================
 Standard_Integer IntTools_Context::ComputeVF
@@ -554,6 +570,21 @@ Standard_Integer IntTools_Context::ComputeVF
    const TopoDS_Face&   aF2,
    Standard_Real& U,
    Standard_Real& V)
+{
+  Standard_Real aTolVnew;
+  //
+  return ComputeVF(aV1, aF2, U, V, aTolVnew);
+}
+//=======================================================================
+//function : ComputeVF
+//purpose  : 
+//=======================================================================
+Standard_Integer IntTools_Context::ComputeVF
+  (const TopoDS_Vertex& aV1, 
+  const TopoDS_Face&   aF2,
+  Standard_Real& U,
+  Standard_Real& V,
+  Standard_Real& aTolVnew)
 {
   Standard_Real aTolV1, aTolF2, aTolSum, aDist;
   gp_Pnt aP;
@@ -574,7 +605,10 @@ Standard_Integer IntTools_Context::ComputeVF
 
   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;
index ff86dfce3df3042f70328530fb09307e56246101..16c3b06b8f63a35c13f1dfa05ffecab155da0285 100644 (file)
@@ -285,17 +285,18 @@ static
   Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC, 
                                const TopoDS_Face& aFace);
 
-//
 static
   Standard_Real MaxDistance(const Handle(Geom_Curve)& theC,
                             const Standard_Real aT,
                             GeomAPI_ProjectPointOnSurf& theProjPS);
+
 static
   Standard_Real FindMaxDistance(const Handle(Geom_Curve)& theC,
                                 const Standard_Real theFirst,
                                 const Standard_Real theLast,
                                 GeomAPI_ProjectPointOnSurf& theProjPS,
                                 const Standard_Real theEps);
+
 static
   Standard_Real FindMaxDistance(const Handle(Geom_Curve)& theCurve,
                                 const Standard_Real theFirst,
@@ -825,10 +826,12 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
   aS1 = myHS1->ChangeSurface().Surface();
   aS2 = myHS2->ChangeSurface().Surface();
   //
-  for (i = 1; i <= aNbLin; ++i) {
+  for (i = 1; i <= aNbLin; ++i)
+  {
     const IntTools_Curve& aIC = mySeqOfCurve(i);
     const Handle(Geom_Curve)& aC3D = aIC.Curve();
-    if (aC3D.IsNull()) {
+    if (aC3D.IsNull())
+    {
       continue;
     }
     //
@@ -838,24 +841,31 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
     const Handle(Geom2d_Curve)& aC2D1 = aIC.FirstCurve2d();
     const Handle(Geom2d_Curve)& aC2D2 = aIC.SecondCurve2d();
     //
-    for (j = 0; j < 2; ++j) {
+    for (j = 0; j < 2; ++j)
+    {
       const Handle(Geom2d_Curve)& aC2D = !j ? aC2D1 : aC2D2;
       const Handle(Geom_Surface)& aS = !j ? aS1 : aS2;
       //
-      if (!aC2D.IsNull()) {
+      if (!aC2D.IsNull())
+      {
         if (IntTools_Tools::ComputeTolerance
-            (aC3D, aC2D, aS, aFirst, aLast, aD, aT)) {
-          if (aD > aDMax) {
+            (aC3D, aC2D, aS, aFirst, aLast, aD, aT))
+        {
+          if (aD > aDMax)
+          {
             aDMax = aD;
           }
         }
       }
-      //
-      const TopoDS_Face& aF = !i ? myFace1 : myFace2;
-      aD = FindMaxDistance(aC3D, aFirst, aLast, aF, myContext);
-      if (aD > aDMax) {
-        aDMax = aD;
-      }
+      else
+      {
+        const TopoDS_Face& aF = !j ? myFace1 : myFace2;
+        aD = FindMaxDistance(aC3D, aFirst, aLast, aF, myContext);
+        if (aD > aDMax)
+        {
+          aDMax = aD;
+    }
+  }
     }
   }
   //
@@ -868,7 +878,7 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
 //=======================================================================
   void IntTools_FaceFace::ComputeTolReached3d()
 {
-  Standard_Integer aNbLin, i;
+  Standard_Integer aNbLin;
   GeomAbs_SurfaceType aType1, aType2;
   //
   aNbLin=myIntersector.NbLines();
@@ -879,8 +889,10 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
   aType1=myHS1->Surface().GetType();
   aType2=myHS2->Surface().GetType();
   //
-  if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder) {
-    if (aNbLin==2){ 
+  if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder)
+  {
+    if (aNbLin==2)
+    { 
       Handle(IntPatch_Line) aIL1, aIL2;
       IntPatch_IType aTL1, aTL2;
       //
@@ -899,150 +911,21 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
         aL2=Handle(IntPatch_GLine)::DownCast(aIL2)->Line();
         aD=aL1.Distance(aL2);
         aD=0.5*aD;
-        if (aD<aDTresh) {
+        if (aD<aDTresh)
+        {//In order to avoid creation too thin face
           myTolReached3d=aD+dTol;
         }
-        return;
       }
     }
-    //ZZ
-    if (aNbLin) {// Check the distances
-      Standard_Real aDMax;
-      //
-      aDMax = ComputeTolerance();
-      if (aDMax > 0.) {
-        myTolReached3d = aDMax;
-      }
-    }// if (aNbLin) 
   }// if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder) {
   //
-  //904/G3 f
-  else if (aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
-    Standard_Real aTolF1, aTolF2, aTolFMax, aTolTresh;
-    //
-    aTolTresh=1.e-7;
-    //
-    aTolF1 = BRep_Tool::Tolerance(myFace1);
-    aTolF2 = BRep_Tool::Tolerance(myFace2);
-    aTolFMax=Max(aTolF1, aTolF2);
-    //
-    if (aTolFMax>aTolTresh) {
-      myTolReached3d=aTolFMax;
-    }
-  }//if (aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
-  //t
-  //IFV Bug OCC20297 
-  else if((aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) ||
-          (aType2 == GeomAbs_Cylinder && aType1 == GeomAbs_Plane)) {
-    if(aNbLin == 1) {
-      const Handle(IntPatch_Line)& aIL1 = myIntersector.Line(1);
-      if(aIL1->ArcType() == IntPatch_Circle) {
-        gp_Circ aCir = Handle(IntPatch_GLine)::DownCast(aIL1)->Circle();
-        gp_XYZ aCirDir = aCir.Axis().Direction().XYZ();
-        gp_XYZ aPlDir;
-        gp_Pln aPln;
-        if(aType1 == GeomAbs_Plane) {
-          aPln = myHS1->Surface().Plane();
-        }
-        else {
-          aPln = myHS2->Surface().Plane();
-        }
-        aPlDir = aPln.Axis().Direction().XYZ();
-        Standard_Real cs = aCirDir*aPlDir;
-        if(cs < 0.) aPlDir.Reverse();
-        Standard_Real eps = 1.e-14;
-        if(!aPlDir.IsEqual(aCirDir, eps)) {
-          Standard_Integer aNbP = 11;
-          Standard_Real dt = 2.*M_PI / (aNbP - 1), t;
-          for(t = 0.; t < 2.*M_PI; t += dt) {
-            Standard_Real d = aPln.Distance(ElCLib::Value(t, aCir)); 
-            if(myTolReached3d < d) myTolReached3d = d;
-          }
-          myTolReached3d *= 1.1;
-        }
-      } //aIL1->ArcType() == IntPatch_Circle
-    } //aNbLin == 1
-  } // aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) 
-  //End IFV Bug OCC20297
-  //
-  else if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
-           (aType2==GeomAbs_Plane && aType1==GeomAbs_Torus)) {
-    aNbLin=mySeqOfCurve.Length();
-    if (aNbLin!=1) {
-      return;
-    }
-    //
-    Standard_Integer aNbP;
-    Standard_Real aT, aT1, aT2, dT, aUT, aVT, aUP, aVP;
-    Standard_Real aDP, aDT, aDmax;
-    gp_Pln aPln;
-    gp_Torus aTorus;
-    gp_Pnt aP, aPP, aPT;
-    //
-    const IntTools_Curve& aIC=mySeqOfCurve(1);
-    const Handle(Geom_Curve)& aC3D=aIC.Curve();
-    const Handle(Geom_BSplineCurve)& aBS=
-      Handle(Geom_BSplineCurve)::DownCast(aC3D);
-    if (aBS.IsNull()) {
-      return;
-    }
-    //
-    aT1=aBS->FirstParameter();
-    aT2=aBS->LastParameter();
-    //
-    aPln  =(aType1==GeomAbs_Plane) ? myHS1->Plane() : myHS2->Plane();
-    aTorus=(aType1==GeomAbs_Plane) ? myHS2->Torus() : myHS1->Torus();
-    //
-    aDmax=-1.;
-    aNbP=11;
-    dT=(aT2-aT1)/(aNbP-1);
-    for (i=0; i<aNbP; ++i) {
-      aT=aT1+i*dT;
-      if (i==aNbP-1) {
-        aT=aT2;
-      }
-      //
-      aC3D->D0(aT, aP);
-      //
-      ElSLib::Parameters(aPln, aP, aUP, aVP);
-      aPP=ElSLib::Value(aUP, aVP, aPln);
-      aDP=aP.SquareDistance(aPP);
-      if (aDP>aDmax) {
-        aDmax=aDP;
-      }
-      //
-      ElSLib::Parameters(aTorus, aP, aUT, aVT);
-      aPT=ElSLib::Value(aUT, aVT, aTorus);
-      aDT=aP.SquareDistance(aPT);
-      if (aDT>aDmax) {
-        aDmax=aDT;
-      }
-    }
-    //
-    if (aDmax > myTolReached3d*myTolReached3d) {
-      myTolReached3d=sqrt(aDmax);
-      myTolReached3d=1.1*myTolReached3d;
-    }
-  }// if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
-  //
-  else if ((aType1==GeomAbs_SurfaceOfRevolution && aType2==GeomAbs_Cylinder) ||
-           (aType2==GeomAbs_SurfaceOfRevolution && aType1==GeomAbs_Cylinder) ||
-           (aType1==GeomAbs_Plane && aType2==GeomAbs_Sphere) ||
-           (aType2==GeomAbs_Plane && aType1==GeomAbs_Sphere) ||
-           (aType1==GeomAbs_Plane && aType2==GeomAbs_SurfaceOfExtrusion) ||
-           (aType2==GeomAbs_Plane && aType1==GeomAbs_SurfaceOfExtrusion) ||
-           (aType1==GeomAbs_Plane && aType2==GeomAbs_BSplineSurface) ||
-           (aType2==GeomAbs_Plane && aType1==GeomAbs_BSplineSurface) ||
-           !myApprox) {
-    //
-    Standard_Real aDMax;
-    //
-    aDMax = ComputeTolerance();
-    if (aDMax > myTolReached3d) {
+
+  Standard_Real aDMax = ComputeTolerance();
+  if (aDMax > myTolReached3d)
+  {
       myTolReached3d = aDMax;
     }
   }
-}
 
 //=======================================================================
 //function : MakeCurve
@@ -4841,6 +4724,7 @@ void RefineVector(gp_Vec2d& aV2D)
   }
   aV2D.SetCoord(aC[0], aC[1]);
 }
+
 //=======================================================================
 // Function : FindMaxDistance
 // purpose : 
@@ -4877,6 +4761,7 @@ Standard_Real FindMaxDistance(const Handle(Geom_Curve)& theCurve,
   //
   return aDMax;
 }
+
 //=======================================================================
 // Function : FindMaxDistance
 // purpose : 
@@ -4932,6 +4817,7 @@ Standard_Real FindMaxDistance(const Handle(Geom_Curve)& theC,
   //
   return aF;
 }
+
 //=======================================================================
 // Function : MaxDistance
 // purpose : 
index 98b4b2ab39099e88ebf76ea9f6706828bc4387b3..796f355fc9ca3ae4d1679bb281ed072a706a4566 100644 (file)
@@ -187,8 +187,10 @@ void IntTools_ShrunkRange::Perform()
     return;
   }
   //
-  aTol1 = aTolV1+aTolE;
-  aTol2 = aTolV2+aTolE;
+  //aTol1 = aTolV1+aTolE;
+  //aTol2 = aTolV2+aTolE;
+  aTol1 = Max(aTolV1, aTolE);
+  aTol2 = Max(aTolV2, aTolE);
   //
   aCoeff1 = (aTolE>0.05) ? 1. : 2.;
   aCoeff2 = aCoeff1;
index 5aa4e72566caef857e1c5da8b7081c4ce25d30c5..eb9c3217014f5bf04e6ef90ac2b15cb934aeb66f 100644 (file)
@@ -34,10 +34,10 @@ uses
 is
 
     enumeration StatusDeflection is 
-                PasTropGrand, PointConfondu, ArretSurPointPrecedent,
+                PasTropGrand, StepTooSmall, PointConfondu, ArretSurPointPrecedent,
                 ArretSurPoint, OK;
 
--- StepTooGreat, ConfusedPoint, StopOnPreviousPoint, StopOnPoint, OK
+-- StepTooGreat, StepTooSmall, ConfusedPoint, StopOnPreviousPoint, StopOnPoint, OK
     
 --class of result objects marching on a biparametric surface
 
index 99b7bcd6442797f4bc38d98d5d3112ff14dab9c4..0760347223164b9433d17ae13b0827bb7cdf04f9 100644 (file)
@@ -210,7 +210,21 @@ is
        
        raises NotDone from StdFail
        is static;
+      
+      
+    MaxStep(me ; Index : Integer from Standard)
+    
+       ---Purpose: Returns the point of range Index on the polyline. 
+       --          An exception is raised if IsDone returns False.
+       --          An exception is raised if Index<=0 or Index>NbPoints.
 
+       returns  Real from Standard
+       ---C++: inline
+
+       raises OutOfRange from Standard
+       
+       is static;
+       
 
     TangentAtLine(me; Index: out Integer from Standard)
     
@@ -250,6 +264,12 @@ is
     POn2S :          PntOn2S   from  IntSurf  ) ;
     ---C++: inline
     
+  ComputePasInit(me          : in out;
+                 theDeltaU1, theDeltaV1, theDeltaU2, theDeltaV2: Real from Standard)
+
+  is protected;
+
+    
     ExtendLineInCommonZone(me: in out; theChoixIso: ConstIsoparametric  from IntImp;
 theDirectionFlag: Boolean from Standard)
     returns Boolean from Standard
@@ -317,9 +337,11 @@ fields
     fleche             : Real     from Standard;   -- max possible vector
     pasMax             : Real     from Standard;   -- max possible uv ratio
     tolconf            : Real     from Standard;   -- tol of confusion of 2 points
+    myTolTang          : Real     from Standard;
     pasuv              : Real     from Standard[4];-- uv step on squares 
     pasSav             : Real     from Standard[4];-- first saved step
     pasInit            : Real     from Standard[4];-- saving of steps  
+    myStepMin          : Real     from Standard[4];
 
     Um1                : Real from Standard;
     UM1                : Real from Standard;
index ae9e675e82b2a9fbde0a63bc634cd6c97541186c..b5b60c70ba840d9ebb34b986dfec463a539b29ae 100644 (file)
 #include <Extrema_GenLocateExtPS.hxx>
 
 //==================================================================================
-// function : IntWalk_PWalking::IntWalk_PWalking
-// purpose  :
-// estimate of max step : To avoid abrupt changes 
-// during change of isos 
+// function : ComputePasInit
+// purpose  : estimate of max step : To avoid abrupt changes during change of isos 
 //==================================================================================
-void ComputePasInit(Standard_Real *pasuv,
-                    Standard_Real Um1,Standard_Real UM1,
-                    Standard_Real Vm1,Standard_Real VM1,
-                    Standard_Real Um2,Standard_Real UM2,
-                    Standard_Real Vm2,Standard_Real VM2,
-                    Standard_Real _Um1,Standard_Real _UM1,
-                    Standard_Real _Vm1,Standard_Real _VM1,
-                    Standard_Real _Um2,Standard_Real _UM2,
-                    Standard_Real _Vm2,Standard_Real _VM2,
-                    const Handle(Adaptor3d_HSurface)& Caro1,
-                    const Handle(Adaptor3d_HSurface)& Caro2,
-                    const Standard_Real Increment,
-                    const Standard_Real tolconf)
-{ 
-  Standard_Real du1=Abs(UM1-Um1);
-  Standard_Real dv1=Abs(VM1-Vm1);
-  Standard_Real du2=Abs(UM2-Um2);
-  Standard_Real dv2=Abs(VM2-Vm2);
-
-  Standard_Real _du1=Abs(_UM1-_Um1);
-  Standard_Real _dv1=Abs(_VM1-_Vm1);
-  Standard_Real _du2=Abs(_UM2-_Um2);
-  Standard_Real _dv2=Abs(_VM2-_Vm2);
+void IntWalk_PWalking::ComputePasInit(const Standard_Real theDeltaU1,
+                                      const Standard_Real theDeltaV1,
+                                      const Standard_Real theDeltaU2,
+                                      const Standard_Real theDeltaV2)
+{
+  const Standard_Real aRangePart = 0.01;
+  const Standard_Real Increment = 2.0*pasMax;
+  const Handle(Adaptor3d_HSurface)& 
+          Caro1 = myIntersectionOn2S.Function().AuxillarSurface1();
+  const Handle(Adaptor3d_HSurface)& 
+          Caro2 = myIntersectionOn2S.Function().AuxillarSurface2();
+
+  const Standard_Real aDeltaU1=Abs(UM1-Um1);
+  const Standard_Real aDeltaV1=Abs(VM1-Vm1);
+  const Standard_Real aDeltaU2=Abs(UM2-Um2);
+  const Standard_Real aDeltaV2=Abs(VM2-Vm2);
 
   //-- limit the reduction of uv box estimate to 0.01 natural box
-  //--  du1 : On box of Inter
-  //-- _du1 : On parametric space
-  if(_du1<1e50 && du1<0.01*_du1) du1=0.01*_du1;
-  if(_dv1<1e50 && dv1<0.01*_dv1) dv1=0.01*_dv1;
-  if(_du2<1e50 && du2<0.01*_du2) du2=0.01*_du2;
-  if(_dv2<1e50 && dv2<0.01*_dv2) dv2=0.01*_dv2;
-
-  pasuv[0]=Increment*du1;
-  pasuv[1]=Increment*dv1;
-  pasuv[2]=Increment*du2;
-  pasuv[3]=Increment*dv2;
-
-  Standard_Real ResoU1tol = Adaptor3d_HSurfaceTool::UResolution(Caro1, tolconf);
-  Standard_Real ResoV1tol = Adaptor3d_HSurfaceTool::VResolution(Caro1, tolconf);
-  Standard_Real ResoU2tol = Adaptor3d_HSurfaceTool::UResolution(Caro2, tolconf);
-  Standard_Real ResoV2tol = Adaptor3d_HSurfaceTool::VResolution(Caro2, tolconf);
-
-  if (pasuv[0] < 2*ResoU1tol)
-    pasuv[0] = 2*ResoU1tol;
-  if (pasuv[1] < 2*ResoV1tol)
-    pasuv[1] = 2*ResoV1tol;
-  if (pasuv[2] < 2*ResoU2tol)
-    pasuv[2] = 2*ResoU2tol;
-  if (pasuv[3] < 2*ResoV2tol)
-    pasuv[3] = 2*ResoV2tol;
+  //--  theDeltaU1 : On box of Inter
+  //-- aDeltaU1 : On parametric space
+  if(!Precision::IsInfinite(aDeltaU1))
+    pasuv[0]=Max(Increment*Max(theDeltaU1, aRangePart*aDeltaU1), pasuv[0]);
+  else
+    pasuv[0]=Max(Increment*theDeltaU1, pasuv[0]);
+
+  if(!Precision::IsInfinite(aDeltaV1))
+    pasuv[1]=Max(Increment*Max(theDeltaV1, aRangePart*aDeltaV1), pasuv[1]);
+  else
+    pasuv[1]=Max(Increment*theDeltaV1, pasuv[1]);
+
+  if(!Precision::IsInfinite(aDeltaU2))
+    pasuv[2]=Max(Increment*Max(theDeltaU2, aRangePart*aDeltaU2), pasuv[2]);
+  else
+    pasuv[2]=Max(Increment*theDeltaU2, pasuv[2]);
+
+  if(!Precision::IsInfinite(aDeltaV2))
+    pasuv[3]=Max(Increment*Max(theDeltaV2, aRangePart*aDeltaV2), pasuv[3]);
+  else
+    pasuv[3]=Max(Increment*theDeltaV2, pasuv[3]);
+
+  const Standard_Real ResoU1tol = Adaptor3d_HSurfaceTool::UResolution(Caro1, tolconf);
+  const Standard_Real ResoV1tol = Adaptor3d_HSurfaceTool::VResolution(Caro1, tolconf);
+  const Standard_Real ResoU2tol = Adaptor3d_HSurfaceTool::UResolution(Caro2, tolconf);
+  const Standard_Real ResoV2tol = Adaptor3d_HSurfaceTool::VResolution(Caro2, tolconf);
+
+  myStepMin[0] = Max(myStepMin[0], 2.0*ResoU1tol);
+  myStepMin[1] = Max(myStepMin[1], 2.0*ResoV1tol);
+  myStepMin[2] = Max(myStepMin[2], 2.0*ResoU2tol);
+  myStepMin[3] = Max(myStepMin[3], 2.0*ResoV2tol);
+
+  for(Standard_Integer i  = 0; i < 4; i++)
+  {
+    pasuv[i]=Max(myStepMin[i], pasuv[i]);
+  }
 }
 
 //=======================================================================
@@ -268,6 +270,7 @@ done(Standard_True),
 close(Standard_False),
 fleche(Deflection),
 tolconf(Epsilon),
+myTolTang(TolTangency),
 sensCheminement(1),
 myIntersectionOn2S(Caro1,Caro2,TolTangency),
 STATIC_BLOCAGE_SUR_PAS_TROP_GRAND(0),
@@ -378,6 +381,11 @@ STATIC_PRECEDENT_INFLEXION(0)
     }
   }
 
+  myStepMin[0] = 100.0*ResoU1;
+  myStepMin[1] = 100.0*ResoV1;
+  myStepMin[2] = 100.0*ResoU2;
+  myStepMin[3] = 100.0*ResoV2;
+
   //-- ComputePasInit(pasuv,Um1,UM1,Vm1,VM1,Um2,UM2,Vm2,VM2,Caro1,Caro2);
 
   for (Standard_Integer i = 0; i<=3;i++) {
@@ -408,6 +416,7 @@ done(Standard_True),
 close(Standard_False),
 fleche(Deflection),
 tolconf(Epsilon),
+myTolTang(TolTangency),
 sensCheminement(1),
 myIntersectionOn2S(Caro1,Caro2,TolTangency),
 STATIC_BLOCAGE_SUR_PAS_TROP_GRAND(0),
@@ -544,6 +553,12 @@ STATIC_PRECEDENT_INFLEXION(0)
   if(ResoV1>0.0001*pasuv[1]) ResoV1=0.00001*pasuv[1];
   if(ResoU2>0.0001*pasuv[2]) ResoU2=0.00001*pasuv[2];
   if(ResoV2>0.0001*pasuv[3]) ResoV2=0.00001*pasuv[3];
+  
+  myStepMin[0] = 100.0*ResoU1;
+  myStepMin[1] = 100.0*ResoV1;
+  myStepMin[2] = 100.0*ResoU2;
+  myStepMin[3] = 100.0*ResoV2;
+
   //
   TColStd_Array1OfReal Par(1,4);
   Par(1) = U1;
@@ -623,6 +638,7 @@ static Standard_Boolean IsTangentExtCheck(const Handle(Adaptor3d_HSurface)& theS
                                           const Standard_Real theV10,
                                           const Standard_Real theU20,
                                           const Standard_Real theV20,
+                                          const Standard_Real theToler,
                                           const Standard_Real theArrStep[])
 {
   {
@@ -646,7 +662,8 @@ static Standard_Boolean IsTangentExtCheck(const Handle(Adaptor3d_HSurface)& theS
     }
   }
 
-  const Standard_Real aSQToler = 4.0e-14;
+  //For two faces (2^2 = 4)
+  const Standard_Real aSQToler = 4.0*theToler*theToler;
   const Standard_Integer aNbItems = 4;
   const Standard_Real aParUS1[aNbItems] = { theU10 + theArrStep[0],
                                             theU10 - theArrStep[0],
@@ -718,22 +735,8 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
   const Standard_Real ULast2  = Adaptor3d_HSurfaceTool::LastUParameter (Caro2);
   const Standard_Real VLast2  = Adaptor3d_HSurfaceTool::LastVParameter (Caro2);
   //
-  ComputePasInit(pasuv,u1min,u1max,v1min,v1max,u2min,u2max,v2min,v2max,
-                 Um1,UM1,Vm1,VM1,Um2,UM2,Vm2,VM2,Caro1,Caro2,pasMax+pasMax,tolconf);
-  //
-  if(pasuv[0]<100.0*ResoU1) {
-    pasuv[0]=100.0*ResoU1; 
-  }
-  if(pasuv[1]<100.0*ResoV1) {
-    pasuv[1]=100.0*ResoV1; 
-  }
-  if(pasuv[2]<100.0*ResoU2) {
-    pasuv[2]=100.0*ResoU2;
-  }
-  if(pasuv[3]<100.0*ResoV2) {
-    pasuv[3]=100.0*ResoV2;
-  }
-  //
+  ComputePasInit(u1max - u1min,v1max - v1min,u2max - u2min,v2max - v2min);
+
   for (Standard_Integer i=0; i<4; ++i)
   {
     if(pasuv[i]>10)
@@ -807,7 +810,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
 
   previousPoint.Parameters(Param(1),Param(2),Param(3),Param(4));
 
-  if(IsTangentExtCheck(Caro1, Caro2, Param(1), Param(2), Param(3), Param(4), pasuv))
+  if(IsTangentExtCheck(Caro1, Caro2, Param(1), Param(2), Param(3), Param(4), myTolTang, pasuv))
     return;
 
   AddAPoint(line,previousPoint);
@@ -1166,28 +1169,13 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
               {
                 pastroppetit=Standard_True;
 
-                if(pasuv[0]<pasInit[0])
-                {
-                  pasuv[0]+=(pasInit[0]-pasuv[0])*0.25;
-                  pastroppetit=Standard_False;
-                }
-
-                if(pasuv[1]<pasInit[1])
-                {
-                  pasuv[1]+=(pasInit[1]-pasuv[1])*0.25;
-                  pastroppetit=Standard_False;
-                }
-
-                if(pasuv[2]<pasInit[2])
-                {
-                  pasuv[2]+=(pasInit[2]-pasuv[2])*0.25;
-                  pastroppetit=Standard_False; 
-                }
-
-                if(pasuv[3]<pasInit[3])
+                for(Standard_Integer i = 0; i < 4; i++)
                 {
-                  pasuv[3]+=(pasInit[3]-pasuv[3])*0.25;
-                  pastroppetit=Standard_False;
+                  if(pasuv[i]<pasInit[i])
+                  {
+                    pasuv[i]+=(pasInit[i]-pasuv[i])*0.25;
+                    pastroppetit=Standard_False;
+                  }
                 }
 
                 if(pastroppetit)
@@ -1211,6 +1199,32 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
 
             break;
           }
+        case IntWalk_StepTooSmall:
+          {
+            Standard_Boolean hasStepBeenIncreased = Standard_False;
+
+            for(Standard_Integer i = 0; i < 4; i++)
+            {
+              const Standard_Real aNewStep = Min(1.5*pasuv[i], pasInit[i]);
+              if(aNewStep > pasuv[i])
+              {
+                pasuv[i] = aNewStep;
+                hasStepBeenIncreased = Standard_True;
+              }
+            }
+
+            if(hasStepBeenIncreased)
+            {
+              Param(1)=SvParam[0];
+              Param(2)=SvParam[1];
+              Param(3)=SvParam[2];
+              Param(4)=SvParam[3];
+
+              LevelOfIterWithoutAppend = 0;
+
+              break;
+            }
+          }
         case IntWalk_OK:
         case IntWalk_ArretSurPoint://006
           {
@@ -1299,6 +1313,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
 
                     if(RejectIndex >= RejectIndexMAX)
                     {
+                      Arrive = Standard_True;
                       break;
                     }
 
@@ -1386,6 +1401,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
 
                       if(RejectIndex >= RejectIndexMAX)
                       {
+                        Arrive = Standard_True;
                         break;
                       }
 
@@ -1619,6 +1635,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
 
                         if(RejectIndex >= RejectIndexMAX)
                         {
+                          Arrive = Standard_True;
                           break;
                         }
 
@@ -2104,7 +2121,7 @@ DistanceMinimizeByGradient( const Handle(Adaptor3d_HSurface)& theASurf1,
     aS1 = theASurf1->Surface().BSpline();
     break;
   default:
-    return Standard_True;
+      return Standard_True;
   }
 
   switch(theASurf2->GetType())
@@ -2116,7 +2133,7 @@ DistanceMinimizeByGradient( const Handle(Adaptor3d_HSurface)& theASurf1,
     aS2 = theASurf2->Surface().BSpline();
     break;
   default:
-    return Standard_True;
+      return Standard_True;
   }
 
   Standard_Boolean aStatus = Standard_False;
@@ -2821,7 +2838,7 @@ IntWalk_StatusDeflection  IntWalk_PWalking::TestDeflection()
   }
 
   IntWalk_StatusDeflection Status = IntWalk_OK;
-  Standard_Real FlecheCourante ,Ratio;
+  Standard_Real FlecheCourante , Ratio = 1.0;
 
 
   const IntSurf_PntOn2S& CurrentPoint = myIntersectionOn2S.Point(); 
@@ -2834,10 +2851,12 @@ IntWalk_StatusDeflection  IntWalk_PWalking::TestDeflection()
 
   const gp_Dir& TgCourante = myIntersectionOn2S.Direction();
 
+  const Standard_Real aCosBetweenTangent = TgCourante.Dot(previousd);
+
   //==================================================================================
   //=========   R i s k   o f    i n f l e x i o n   p o i n t  ============
   //==================================================================================  
-  if (TgCourante.Dot(previousd)<0) {
+  if (aCosBetweenTangent < 0) {
     //------------------------------------------------------------
     //-- Risk of inflexion point : Divide the step by 2
     //-- Initialize STATIC_PRECEDENT_INFLEXION so that 
@@ -2855,7 +2874,6 @@ IntWalk_StatusDeflection  IntWalk_PWalking::TestDeflection()
     else 
       return IntWalk_PasTropGrand;
   }
-
   else {
     if(STATIC_PRECEDENT_INFLEXION  > 0) { 
       STATIC_PRECEDENT_INFLEXION -- ;
@@ -2867,11 +2885,11 @@ IntWalk_StatusDeflection  IntWalk_PWalking::TestDeflection()
   //=========  D e t e c t    c o n f u s e d    P o in t s       ===========
   //==================================================================================
 
-  Standard_Real Dist = previousPoint.Value().
+  const Standard_Real aSqDist = previousPoint.Value().
     SquareDistance(CurrentPoint.Value());
 
 
-  if (Dist < tolconf*tolconf ) { 
+  if (aSqDist < tolconf*tolconf) { 
     pasuv[0] = Max(5.*ResoU1,Min(1.5*pasuv[0],pasInit[0]));
     pasuv[1] = Max(5.*ResoV1,Min(1.5*pasuv[1],pasInit[1]));
     pasuv[2] = Max(5.*ResoU2,Min(1.5*pasuv[2],pasInit[2]));
@@ -2994,7 +3012,7 @@ IntWalk_StatusDeflection  IntWalk_PWalking::TestDeflection()
   //-- Estimate of the vector           --
   //---------------------------------------
   FlecheCourante =
-    Sqrt(Abs((previousd.XYZ()-TgCourante.XYZ()).SquareModulus()*Dist))/8.;
+    Sqrt(Abs((previousd.XYZ()-TgCourante.XYZ()).SquareModulus()*aSqDist))/8.;
 
   if ( FlecheCourante<= fleche*0.5) {     //-- Current step too small
     if(FlecheCourante>1e-16) { 
@@ -3061,10 +3079,114 @@ IntWalk_StatusDeflection  IntWalk_PWalking::TestDeflection()
       Ratio = 0.75 * (fleche / FlecheCourante);
     }
   }
-  pasuv[0] = Max(5.*ResoU1,Min(Min(Ratio*AbsDu1,pasuv[0]),pasInit[0]));
-  pasuv[1] = Max(5.*ResoV1,Min(Min(Ratio*AbsDv1,pasuv[1]),pasInit[1]));
-  pasuv[2] = Max(5.*ResoU2,Min(Min(Ratio*AbsDu2,pasuv[2]),pasInit[2]));
-  pasuv[3] = Max(5.*ResoV2,Min(Min(Ratio*AbsDv2,pasuv[3]),pasInit[3]));
+
+  if(Status != IntWalk_PointConfondu)
+  {
+    //Here, aCosBetweenTangent >= 0.0 definitely.
+
+    /*
+    Brief algorithm description.
+    We have two (not-coincindent) intersection point (P1 and P2). In every point,
+    vector of tangent (to the intersection curve) is known (vectors T1 and T2).
+    Basing on these data, we create osculating circle.
+
+                                    * - arc of osculating circle
+                                *      * 
+                           P1 x----------x P2
+                             /            \
+                            /              \
+                          Vec(T1)         Vec(T2)
+
+    Let me draw your attention to the following facts:
+      1. Vectors T1 and T2 direct FROM (not TO) points P1 and P2. Therefore,
+        one of previously computed vector should be reversed.
+
+    In this case, the absolute (!) value of the deflection between the arc of
+    the osculating circle and the P1P2 segment can be computed as follows:
+          e = d*(1-sin(B/2))/(2*cos(B/2)),      (1)
+    where d is the length of P1P2 segment, B is the angle between vectors T1 and T2.
+    At that,
+              pi/2 <= B <= pi,
+              cos(B/2) >= 0,
+              sin(B/2) > 0,
+              sin(B) > 0,
+              cos(B) < 0.
+
+    Later, the normal state of algorithm work is (as we apply) 
+              tolconf/2 <= e <= tolconf.
+    In this case, we keep previous step.
+
+    If e < tolconf/2 then the local curvature of the intersection curve is small.
+    As result, the step should be increased.
+
+    If e > tolconf then the step is too big. Therefore, we should decrease one.
+
+    Condition (1) is equivalent to
+              sin(B/2) = 1 - 2/(1+(d/(2*e))^2) = Fs(e),
+              cos(B) = 1 - 2*Fs(e)^2 = Fd(e),
+    where Fs(e)and Fd(e) are some function with parameter "deflection".
+
+    Let mean that Fs(e) is decreasing function. Fd(e) is increasing function,
+    in the range, where Fs(e) > 0.0 (i.e. when e < d/2).
+
+    Now, let substitute required deflection (tolconf or tolconf/2) to z. Then
+    it is necessary to check if e < z or if e > z.
+
+    In this case, it is enough to comapare Fs(e) and Fs(z).
+    At that Fs(e) > 0 because sin(B/2) > 0 always.
+
+    Therefore, if Fs(z) < 0.0 then Fs(e) > Fs(z) ==> e < z definitely.
+    If Fs(z) > 0.0 then we can compare Fs(z)^2 and Fs(e)^2 or, in substance,
+    values Fd(e) and Fd(z). If Fd(e) > Fd(z) then e > z and vice versa.
+    */
+
+    //Fd(e) is already known (Fd(e) == -aCosBetweenTangent)
+
+    const Standard_Real anInvSqAbsArcDeflMax = 0.25*aSqDist/(tolconf*tolconf);
+    const Standard_Real aSinB2Max = 1.0 - 2.0/(1.0 + anInvSqAbsArcDeflMax);
+
+    if(aSinB2Max >= 0.0 && (aCosBetweenTangent <= 2.0 * aSinB2Max * aSinB2Max - 1.0))
+    {//Real deflection is greater or equal than tolconf
+      Status = IntWalk_PasTropGrand;
+    }
+    else
+    {//Real deflection is less than tolconf
+      const Standard_Real anInvSqAbsArcDeflMin = 4.0*anInvSqAbsArcDeflMax;
+      const Standard_Real aSinB2Min = 1.0 - 2.0/(1.0 + anInvSqAbsArcDeflMin);
+
+      if((aSinB2Min < 0.0) || (aCosBetweenTangent >= 2.0 * aSinB2Min * aSinB2Min - 1.0))
+      {//Real deflection is less than tolconf/2.0
+        Status = IntWalk_StepTooSmall;
+      }
+    }
+
+    if(Status == IntWalk_PasTropGrand)
+    {
+      pasuv[0]*=0.5; pasuv[1]*=0.5; pasuv[2]*=0.5; pasuv[3]*=0.5;
+      return Status;
+    }
+
+    if(Status == IntWalk_StepTooSmall)
+    {
+      pasuv[0] = Max(pasuv[0], AbsDu1);
+      pasuv[1] = Max(pasuv[1], AbsDv1);
+      pasuv[2] = Max(pasuv[2], AbsDu2);
+      pasuv[3] = Max(pasuv[3], AbsDv2);
+
+      pasInit[0] = Max(pasInit[0], AbsDu1);
+      pasInit[1] = Max(pasInit[1], AbsDv1);
+      pasInit[2] = Max(pasInit[2], AbsDu2);
+      pasInit[3] = Max(pasInit[3], AbsDv2);
+
+      return Status;
+    }
+  }
+
+  pasuv[0] = Max(myStepMin[0],Min(Min(Ratio*AbsDu1,pasuv[0]),pasInit[0]));
+  pasuv[1] = Max(myStepMin[1],Min(Min(Ratio*AbsDv1,pasuv[1]),pasInit[1]));
+  pasuv[2] = Max(myStepMin[2],Min(Min(Ratio*AbsDu2,pasuv[2]),pasInit[2]));
+  pasuv[3] = Max(myStepMin[3],Min(Min(Ratio*AbsDv2,pasuv[3]),pasInit[3]));
+
   if(Status == IntWalk_OK) STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0;
   return Status;
 }
index e1614170c9be5a0b4f397a5bd4e933bb9cd0edcf..430d1bf1246053431efa3aedbbd1a18463745c3d 100644 (file)
@@ -62,6 +62,12 @@ inline const gp_Dir& IntWalk_PWalking::TangentAtLine
   return tgdir;
 }
 
+inline Standard_Real IntWalk_PWalking::MaxStep(Standard_Integer theIndex) const
+{
+  Standard_OutOfRange_Raise_if((theIndex < 0) || (theIndex > 3), "");
+  return pasInit[theIndex];
+}
+
 #define REGLAGE 0
 
 inline void IntWalk_PWalking::AddAPoint(Handle(IntSurf_LineOn2S)& theLine,
index 02f24518edf42dca880e4e4c220c315adfa4d1be..321a5c59d4b32dd5503706044b654eef67fa0b34 100755 (executable)
@@ -2727,14 +2727,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 cfb6e23eee1b9dac9d79f116d12cfd4bc7c01e1f..4bd5ec485b805e2e466cc397a5ee4dd4a6934689 100644 (file)
@@ -4,6 +4,8 @@
 ## Comment : From CV tests serie page 25/26
 ## ===========================================
 
+puts "TODO #OCC26740 ALL: Faulty shapes in variables faulty_1 to faulty_"
+
 restore [locate_data_file CCV_1_h1_gsk.rle] s
 explode s E
 blend result s 30 s_14
index b069a320fbf7a194b847160eb7e53114913d4221..ccecdc76a258fd1a053730f9350ef981ad145979 100644 (file)
@@ -1,5 +1,3 @@
-puts "TODO #23876 ALL: Error : The bopcut 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 97f1249ddeaa63a68f7d1489aa34eac6084ce26b..2a2e37e94638d248434a8ab9058ca736feaff55f 100644 (file)
@@ -1,4 +1,4 @@
 source [locate_data_file 20000_et1_401-ta6027.prt.2.gdml.tcl]
 
 ## image is differ from application
-set square 3.52888e+07
+set square 1.26259e+07
index 1af9cde9a7c03a0518a9539b2769b00c34e4026d..fa749685a1acf492a28c4eb45829d06c23aa8a34 100644 (file)
@@ -1,5 +1,5 @@
 puts "TODO OCC26018 ALL: Error : The area of the resulting shape is"
-puts "TODO OCC26018 Linux: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC26018 ALL: 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
index 83c1c0d33424d6372e43a61c85b7f29df298d981..0636c290b73cc3b65937b9da67d8268a984fc681 100644 (file)
@@ -1,5 +1,5 @@
-puts "TODO ?OCC26017 Windows: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO ?OCC26017 Windows: Error : The area of the resulting shape is"
+puts "TODO ?OCC26017 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO ?OCC26017 ALL: Error : The area of the resulting shape is"
 puts "TODO ?OCC26017 ALL: Error : The gdml is not valid. The area is"
 source [locate_data_file 20000_et4_401-ta6319.prt.2.gdml.tcl]
 
index 56e572c89d60d68dbee7006fe13739da812b297e..2f8beda78c1829232713fc39a0d5a93b04ab2d26 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO ?OCC26017 ALL: Faulty shapes in variables faulty_1 to faulty_"
+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 f4d1578a184dcc6f268cdaf1ca954b18500547ba..718103630aa7f3345bc8dce3ef03758377375ab2 100644 (file)
@@ -1,3 +1,2 @@
-puts "TODO ?OCC26017 ALL: Faulty shapes in variables faulty_1 to faulty_"
+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 ab548307df4b1cc146b45922bdd28c22e8f28b46..0eea89bdfe4cca79e8a22ef123f6efd7a6ba746b 100644 (file)
@@ -3,7 +3,7 @@
 
 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 the resulting shape is"
+puts "TODO OCC26020 ALL: Error : The area of the resulting shape is"
 
 # planar face 
 plane pln_f1 590.6877421677151 -519.8775759738943 -93.555747452441423 0.64798185367609173 0.7547095802227719 -0.10263024323494339
index 3fdf57e3ad993f2130f8d33afdafbe3934ca883c..95405ad626039660334c1eb29397e9057fa227ab 100644 (file)
@@ -2,8 +2,8 @@
 # cone plane killed by cpulimit 300 
 # ? - because sometimes test is killed by elapsed time
 
-puts "TODO OCC26020 ALL: TEST INCOMPLETE"
-puts "TODO ?OCC26020 ALL: Process killed by CPU limit"
+puts "TODO OCC26020 ALL: Error: bopcheck failed"
+puts "TODO OCC26020 ALL: Error : The area of the resulting shape is"
 puts "TODO ?OCC26020 Linux: \\*\\* Exception"
 puts "TODO ?OCC26020 Linux: An exception"
 
index 98d2f1778affb15ddc3b18b794738c0e9a073cd9..7aa21132670525e2812489397cb1e48af5f91840 100644 (file)
@@ -2,8 +2,8 @@
 # cone plane killed by cpulimit 300
 # ? - because sometimes test is killed by elapsed time
 
-puts "TODO OCC26020 ALL: TEST INCOMPLETE"
-puts "TODO ?OCC26020 ALL: Process killed by CPU limit"
+puts "TODO OCC26020 ALL: Error: bopcheck failed"
+puts "TODO OCC26020 ALL: Error : The area of the resulting shape is"
 
 # planar face 
 plane pln_f1 460.8377555733228 -1160 121.87519451048833 -0.17364817766693036 1.1223734950417248e-017 0.98480775301220813
index c965d7435b5022af839241fe8b0c2b599d477911..0fbeab70fb49863b1bde895a3d6b83b438725805 100644 (file)
@@ -1,8 +1,8 @@
 # test script on make volume operation
 # cone plane killed by cpulimit 300
 
-puts "TODO OCC26020 ALL: TEST INCOMPLETE"
-puts "TODO ?OCC26019 ALL: Process killed by CPU limit"
+puts "TODO OCC26020 ALL: Error: bopcheck failed"
+puts "TODO OCC26020 ALL: Error : The area of the resulting shape is"
 
 # planar face 
 plane pln_f1 -460.8377555733228 -1160 -121.8751945104883 0.17364817766693036 -5.955424826592936e-017 -0.98480775301220813
index 5f5e174c472ef7a6a9f941080a1618011302b3bb..87de0b59f81ff5bfb363033084be9846b293116a 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 # ShapeUpgrade_UnifySameDomain introduces extremely high vertex tolerances
 ############################################################################
 
-restore [locate_data_file OCC26656_unify.input.brep] i
+restore [locate_data_file bug26656_unify.input.brep] i
 
 set bug_info [tolerance i]
 set value_1 [lindex $bug_info 1]
index 29a46b572bf60cb7f067cd54e655de6c302de512..6ca06f77c67f6d3b7b42eabf0e0e3d75b8e1a43f 100755 (executable)
@@ -17,11 +17,11 @@ set nb_v_good 12
 set nb_e_good 12
 set nb_w_good 2
 set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 29
+set nb_shape_good 28
 
 set 2dviewer 0
 
index 3a2358bcc2e27fb0ae5d3d9eeac7d9d4e5145725..01bb884cb4c29863efe421d4871c1d83aae44b9d 100755 (executable)
@@ -17,11 +17,11 @@ set nb_v_good 12
 set nb_e_good 12
 set nb_w_good 2
 set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 29
+set nb_shape_good 28
 
 set 2dviewer 0
 
index dbef9be48fb261a16f8dc23a9e255aedd902f735..bd1213fa471df207d43e062c37f2672af509af28 100755 (executable)
@@ -19,12 +19,12 @@ bopfuse result
 
 set nb_v_good 3
 set nb_e_good 4
-set nb_w_good 1
+set nb_w_good 0
 set nb_f_good 0
 set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 9
+set nb_shape_good 8
 
 set 2dviewer 0
index aeb40c38c2b4c8b0472c987ce5085620cf342404..31956991173bce95365a59d49116e60a51975670 100755 (executable)
@@ -27,12 +27,12 @@ set length 448.285
 
 set nb_v_good 5
 set nb_e_good 4
-set nb_w_good 1
+set nb_w_good 0
 set nb_f_good 0
 set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 11
+set nb_shape_good 10
 
 set 2dviewer 0
index 748acac8a5720ba68634a58e31bf4bf06b582e0c..f8dfc8ff586aa8e5101288e2e564dac2bf27ad69 100755 (executable)
@@ -25,13 +25,13 @@ set length 300
 
 set nb_v_good 3
 set nb_e_good 2
-set nb_w_good 1
+set nb_w_good 0
 set nb_f_good 0
 set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 7
+set nb_shape_good 6
 
 
 set 2dviewer 0
index 15712fa3782133b82e979076c7144f69796d1e1d..bf6ed2951d385b9f9fd723d982d5e1b4a35cf3cb 100755 (executable)
@@ -25,11 +25,11 @@ set nb_v_good 11
 set nb_e_good 12
 set nb_w_good 4
 set nb_f_good 2
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 31
+set nb_shape_good 30
 
 set 3dviewer 1
 
index c2a149fb1cebc5b6632c7a742403100535cd5724..a9210fef8c50e716cb1024c42a488942eea709b1 100755 (executable)
@@ -23,10 +23,10 @@ set nb_v_good 34
 set nb_e_good 62
 set nb_w_good 30
 set nb_f_good 29
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 157
+set nb_shape_good 156
 
 set 3dviewer 1
index 1b5405bf91dfa71f8c58c2ca56aff4099cb89e1d..8111768a1f0025ab6ef3653631f309d5efc79caf 100755 (executable)
@@ -13,8 +13,9 @@ bopfuse result
 
 set nb_v_good 2
 set nb_e_good 1
-set nb_w_good 1
-set nb_shape_good 5
+set nb_w_good 0
+set nb_shape_good 4
+
 set length 48.4459
 set command bopfuse
 
index 0edbcb8f422bca9ef4ba8db26f27b64f71629917..d581a5b7c9f684a0e7921ff927bbe12724fab162 100755 (executable)
@@ -17,10 +17,10 @@ bopcut result
 
 set nb_v_good 2
 set nb_e_good 1
-set nb_w_good 1
+set nb_w_good 0
 set nb_f_good 0
 set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good  1
-set nb_shape_good 5
+set nb_shape_good 4
index a663055096a669209979f1108a6461dfe46b1213..a84fa36e4ba0ee56162b4e9f753794d7de99b1a1 100755 (executable)
@@ -1,9 +1,5 @@
 puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
 puts "TODO OCC25917 ALL: Error : The square of result shape is"
-if { [regexp {Debug mode} [dversion]] } {
-  puts "TODO OCC25917 ALL: TEST INCOMPLETE"
-  puts "TODO OCC25917 ALL: Tcl Exception"
-}
 
 puts "========================"
 puts " OCC472 "
index bb40ce531ae351463a138b128cb65bcebdc4c94b..eb00f2c0dd0e508838bacf2e727e2d83343dfc76 100755 (executable)
@@ -1,8 +1,5 @@
-puts "TODO OCC25917 ALL: Error : The command is not valid. The square is"
-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 square of result shape is"
 
 puts "========================"
 puts " OCC472 "
index db34c1aebe021b55f2226667b4a99a2ca8ed32aa..6c16aa9224d28886dd7a35ad841108365f22a25b 100755 (executable)
@@ -1,8 +1,4 @@
-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 "========================"
 puts " OCC472 "
 puts "(case 3)"
@@ -20,8 +16,6 @@ checkshape b2
 
 bfuse result b1 b2
 
-set nb_v_good 66
-set nb_e_edge 107
-set square 31657.5
+set square 229.516
 set 2dviewer 0
 
index dec5dfa13e44d6c24382050f6fa25871fcabf675..72f74ceedc341853827b500d7feeb62115b42ed5 100755 (executable)
@@ -33,10 +33,10 @@ set nb_v_good 16
 set nb_e_good 16
 set nb_w_good 1
 set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 36
+set nb_shape_good 35
 
 set 2dviewer 0
index 64ad937977db269a502323268a320f9f998deaaf..20c002dac9641778db01c276642abad5a74e2a96 100755 (executable)
@@ -1,6 +1,3 @@
-puts "TODO OCC12345 ALL: Faulty : Result is BAD. Distance is more than MaxTolerance"
-puts "TODO OCC12345 ALL: Error : The length of result shape is"
-
 puts "=========="
 puts "PRO18892"
 puts "=========="
@@ -32,4 +29,6 @@ if { [expr $d > $MaxEdgeTolerance] || [expr $d > $MaxVertexTolerance] } {
     puts "Faulty : Result is BAD. Distance is more than MaxTolerance"
 }
 
-set length 0
+set length 6.46299 
+checkshape result 
+checksection result
index 1d9e7d54ec6673f23d802e0aeb1d62ca9b5e97ce..9ce8a447cf583b45a7a9bca7fd4e86b89ea4acb3 100755 (executable)
@@ -12,7 +12,7 @@ restore [locate_data_file bug23884_fz124] b2
 bop b1 b2
 bopfuse result
 
-set square 2415.65
+set square 2377.71
 set 2dviewer 0
 
 
index 9e7bbd1b76400c9aefc3ead5957f1304730fbef6..9b737794134498c34b1f0e207281c3761694782f 100644 (file)
@@ -18,10 +18,10 @@ set nb_v_good 9
 set nb_e_good 15
 set nb_w_good 4
 set nb_f_good 4
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 34
+set nb_shape_good 33
 
 set 2dviewer 0
index 54c90778344a269cc9d6a125372a96f162a13b48..5d7781b9a6eabd55229c577c7de609e809c2583e 100644 (file)
@@ -22,12 +22,12 @@ set length 18.5459
 # Analysis of "nbshapes result"
 set nb_v_good 6
 set nb_e_good 4
-set nb_w_good 2
+set nb_w_good 0
 set nb_f_good 0
 set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 13
+set nb_shape_good 11
 
 set 2dviewer 1
index 462b19679c56ca2d24e309e66a5174d44c02414e..f9d65c634aa792410146e90ab9c5f86d27af7154 100644 (file)
@@ -5,7 +5,8 @@ puts ""
 ###########################################################
 # Wrong pcurve of the section curve
 ###########################################################
-set MaxTol 1.0e-7
+
+set ExpectedTol 0.00013092495734395759
 set NbCurv_OK 1
 
 restore [locate_data_file bug24585_b1.brep] b1
@@ -22,39 +23,15 @@ if {${NbCurv} != ${NbCurv_OK}} {
   puts "Error: ${NbCurv_OK} curve(s) expected, but ${NbCurv} found."
 }
 
-if {${Toler} > ${MaxTol}} {
-  puts "Error: Tolerance is too big!"
-}
-
-#Theoretically, c2d1_1 must cover U-diapason of surface s1 fully.
-
-set log [dump c2d1_1]
-
-regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-puts "Degree=${Degree}"
-puts "Poles=${Poles}"
-puts "KnotsPoles=${KnotsPoles}"
-puts ""
-
-set Pole 1
-set exp_string " +${Pole} : +(\[-0-9.+eE\]+), +(\[-0-9.+eE\]+)"
-regexp ${exp_string} ${log} full U_begin V_begin
-
-puts "Pole=${Pole}"
-puts "U_begin=${U_begin}"
-puts "V_begin=${V_begin}"
-dset U_begin ${U_begin}
-puts ""
+set tol_abs 0.0
+set tol_rel 0.01
+checkreal "Tolerance Reached" ${Toler} ${ExpectedTol} ${tol_abs} ${tol_rel}
 
-set Pole ${Poles}
-set exp_string " +${Pole} : +(\[-0-9.+eE\]+), +(\[-0-9.+eE\]+)"
-regexp ${exp_string} ${log} full U_end V_end
+bounds c2d1_1 U1 U2
+2dcvalue c2d1_1 U1 U_begin V_begin
+2dcvalue c2d1_1 U2 U_end V_end
 
-puts "Pole=${Pole}"
-puts "U_end=${U_end}"
-puts "V_end=${V_end}"
-dset U_end ${U_end}
-puts ""
+#Theoretically, c2d1_1 must cover U-diapason of surface s1 fully.
 
 set delta_f [dval U1f_exp-U_begin]
 
@@ -74,4 +51,18 @@ if {${delta_l} != 0} {
   puts "Error: Bad value. U_end = [dval U_end], Ulast = [dval U1l_exp]."
 } else {
   puts "OK: Good value. U_end matches with Ulast of surface."
-}
\ No newline at end of file
+}
+
+puts ""
+puts "Check if tangents in first and last point of line have the same directions"
+
+#See bug#26752
+cvalue c_1 U1 xx yy zz dx1 dy1 dz1
+cvalue c_1 U2 xx yy zz dx2 dy2 dz2
+
+set DP [dval dx1*dx2+dy1*dy2+dz1*dz2]
+if {${DP} < 0} {
+  puts "Error: Tangents are reversed. Bug 26752 is reproduced."
+} else {
+  puts "OK: Tangents are not reversed."
+}
index 57ffe130a310c896b42d218160725e5deb737aad..2db9f01292ffe56adf8323d0f4b7baca0360c056 100644 (file)
@@ -20,12 +20,12 @@ bopcommon result
 
 set nb_v_good 2
 set nb_e_good 1
-set nb_w_good 1
+set nb_w_good 0
 set nb_f_good 0
 set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 5
+set nb_shape_good 4
 
 set 2dviewer 1
index 1ebb8d2fc79ae9a4a9c3ec192282907a54653ce1..59db6c9b4e34c869fc3c633a0d086b6dea12f80b 100644 (file)
@@ -19,16 +19,15 @@ restore [locate_data_file bug24811_e2.brep] circle
 
 bop curve circle
 bopcut result
-explode result
 
-if { [llength [explode result_1]] != 4 } {
-  puts "Error: wrong number of intersections. Should be result_1_1 result_1_2 result_1_3 result_1_4"
+if { [llength [explode result]] != 4 } {
+  puts "Error: wrong number of intersections. Should be result_1 result_2 result_3 result_4"
 } else {
   puts "OK: right number of intersections"
 }
 
-explode result_1_2
-set info1 [dump result_1_2_1]
+explode result_2
+set info1 [dump result_2_1]
 regexp {Point 3D +: +([-0-9.+eE]+), +([-0-9.+eE]+), +([-0-9.+eE]+)} $info1 full x1 y1 z1
 regexp {Tolerance +: +([-0-9.+eE]+)} $info1 full tol1
 
@@ -49,7 +48,7 @@ if { $p1_3 >= [expr $z1 - $tol1] && $p1_3 <= [expr $z1 + $tol1] } {
 }
 
 
-set info2 [dump result_1_2_2]
+set info2 [dump result_2_2]
 regexp {Point 3D +: +([-0-9.+eE]+), +([-0-9.+eE]+), +([-0-9.+eE]+)} $info2 full x2 y2 z2
 regexp {Tolerance +: +([-0-9.+eE]+)} $info2 full tol2
 
index 4b404481fe20d412701a22ac9f62aa21e94974bd..014b7c0be04670a046312bfd5b47f4ee42b6d4db 100644 (file)
@@ -43,16 +43,16 @@ baddctools b7
 bfillds
 bbop result 2
 
-set square 103838
-
-set nb_v_good 106
-set nb_e_good 164
-set nb_w_good 142
-set nb_f_good 80
-set nb_sh_good 3
-set nb_sol_good 3
+set square 142845
+
+set nb_v_good 108
+set nb_e_good 168
+set nb_w_good 152
+set nb_f_good 86
+set nb_sh_good 7
+set nb_sol_good 7
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 499
+set nb_shape_good 529
 
 set 2dviewer 1
index 51ea4efefc11833e55c653665ab3488c486e7b2b..546e95ae15754d76001f843dcc8e08c844aff8e3 100644 (file)
@@ -18,10 +18,10 @@ set nb_v_good 6
 set nb_e_good 8
 set nb_w_good 2
 set nb_f_good 2
-set nb_sh_good 2
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 21
+set nb_shape_good 19
 
 set 2dviewer 1
index b605450e5b69018978601ef08a423969b1aad2e4..36cc709d9307b1b69f2f1e47457749487e31c3aa 100644 (file)
@@ -8,13 +8,15 @@ puts ""
 
 pload QAcommands
 restore [locate_data_file bug25043.brep] a
+subshape a v 3
+settolerance a_3 0.0005
 
 decho off
 set info [OCC25043 a]
 decho on
 
-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 d45aef0bec12384c52e0b28c606b49075a8e5a61..d3a27b8353f6df87173d671e94373886b6d88e09 100644 (file)
@@ -22,10 +22,10 @@ set nb_v_good 4
 set nb_e_good 4
 set nb_w_good 1
 set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 12
+set nb_shape_good 11
 
 set 2dviewer 1
index d3e07d122b6890c69fb18d1b61a308770283131b..60016e8f4462be31de87b0218d8dee99839f8844 100755 (executable)
@@ -1,3 +1,6 @@
+puts "TODO OCC27116 ALL: Error: Summary length  ="
+puts "TODO OCC27116 ALL: Error: 1 intersection curve\\(s\\) expected but"
+
 puts "================"
 puts "OCC25193"
 puts "================"
@@ -6,18 +9,97 @@ puts ""
 # Bad Intersection curveobtained by Surface/Surface Intersection Algorithm.
 #######################################################################
 
+puts ""
+
+pload QAcommands
+
+set GoodNbCurv 1
+set GoodTol 3.6570868343352305e-005
+set NbControlPts 10
+
 restore [locate_data_file bug25193_s1t.draw] s1
 restore [locate_data_file bug25193_s4t.draw] s4
 
-set CurveNumb [intersect i s1 s4 3.6570868343352305e-005]
+#Ethalon of intersection curve
+bounds s1 us1 us2 vs1 vs2
+uiso cc s1 us1
 
-if { [llength ${CurveNumb}] != 6 } {
-    puts "Error : Bad Intersection curveobtained by Surface/Surface Intersection Algorithm"
+regexp {is ([-0-9.+eE]+)} [length cc 1.0e-4] full ExpLength
+puts "Expected length = $ExpLength"
+
+intersect res s1 s4 $GoodTol
+set che [whatis res]
+set ind [string first "3d curve" $che]
+
+set AllowRepeate 1
+set ic 1
+
+if {${ind} >= 0} {
+  #Only variable "res" exists
+  renamevar res res_1
+}
+
+set SumLength 0
+
+while { $AllowRepeate != 0 } {
+  set che [whatis res_$ic]
+  set ind [string first "3d curve" $che]
+  if {${ind} < 0} {
+    set AllowRepeate 0
+    break
+  }
+  
+  for {set jc 1} {$jc < $ic} {incr jc} {
+    mkedge e1 res_$ic
+    mkedge e2 res_$jc
+    set coe [checkoverlapedges e1 e2]
+
+    puts "res_$ic <-> res_$jc: $coe"
+    if { [regexp "Edges is not overlaped" $coe] != 1 } {
+      puts "Error: Overlapped intersection curves"
+    }
+  }
+
+  regexp {is ([-0-9.+eE]+)} [length res_$ic 1.0e-4] full ll
+
+  set SumLength [ expr $SumLength+$ll ]
+  
+  bounds res_$ic U1 U2
+  
+  set step [ dval (U2-U1)/$NbControlPts ]
+  
+  if { $step < 1.0e-9*$NbControlPts } {
+    puts "Error: Wrong curve's range!"
+  }
+
+  set DPPrev 0
+  for {set par [dval U1]} {$par <= [dval U2]} {set par [expr $par+$step]} {
+    cvalue res_$ic $par xx yy zz dx1 dy1 dz1
+    regexp " parameter 1 = +(\[-0-9*\.+eE\]+)" [proj cc xx yy zz] full cpar
+    cvalue cc $cpar xx yy zz dx2 dy2 dz2
+    
+    set DP [dval dx1*dx2+dy1*dy2+dz1*dz2]
+    
+    if {$DPPrev*$DP < 0.0} {
+      puts "Error: Curve res_$ic changes its direction"
+    }
+    
+    set DPPrev $DP
+  }
+  
+  incr ic
+}
+  
+if {[expr {$ic - 1}] == $GoodNbCurv} {
+  puts "OK: Good number of intersection curve(s) obtained by Surface/Surface Intersection Algorithm"
 } else {
-    puts "OK : Good Intersection curveobtained by Surface/Surface Intersection Algorithm"
+  puts "Error: $GoodNbCurv intersection curve(s) expected but [expr {$ic - 1}] found"
 }
 
+checkreal "Summary length " ${SumLength} $ExpLength 0.0 1.0e-6
+
 smallview
+donly res_* s1 s4
 fit
 
 set only_screen_axo 1
index a3e324da2b82cf1b95f49673e4aa8f8265985d13..818f581b19480d78e618128628fc6caf445639ec 100644 (file)
@@ -14,10 +14,10 @@ bopcommon result
 
 set nb_v_good 2
 set nb_e_good 1
-set nb_w_good 1
+set nb_w_good 0
 set nb_f_good 0
 set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 5
+set nb_shape_good 4
index dada6b1869118902c03a802e82b85f08d605668c..de01c71d1bc415b34185b97ec04d55b42fbfaab8 100644 (file)
@@ -19,10 +19,10 @@ set nb_v_good 3
 set nb_e_good 4
 set nb_w_good 1
 set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 11
+set nb_shape_good 10
 
 set 2dviewer 1
index 1c667efb506a85c805af1f5ab0d73201d9410266..16038d33880580742bd01dbc351b36b8a936ea76 100644 (file)
@@ -29,7 +29,7 @@ set log [bopcurves f1 f2 -2d]
 regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
 
 #This value must be equal to the analogical value in bug25292_11 and bug25292_12 of "bugs modalg_5" testgrid. 
-set MaxTol 1.5e-7
+set MaxTol 2.0e-7
 
 #This value must be equal to the analogical value in bug25292_11, bug25292_12, bug25292_15 and bug25292_16 of "bugs modalg_5" testgrid. 
 set GoodNbCurv 4
index dfc8dad4ef9c26a64c6defe2935ac39c6b9f16c5..d603d7e51218c5fe14e41a776e4a23b72224044e 100644 (file)
@@ -29,7 +29,7 @@ set log [bopcurves f2 f1 -2d]
 regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
 
 #This value must be equal to the analogical value in bug25292_11 and bug25292_12 of "bugs modalg_5" testgrid. 
-set MaxTol 1.5e-7
+set MaxTol 2.0e-7
 
 #This value must be equal to the analogical value in bug25292_11, bug25292_12, bug25292_15 and bug25292_16 of "bugs modalg_5" testgrid. 
 set GoodNbCurv 4
index ed1b9dac5e9e0c39b5459367ef7da90cc05d9d12..482a52fb927b5dedd95d519d045593da617c58ef 100644 (file)
@@ -24,7 +24,7 @@ set log [bopcurves f1 f2 -2d]
 regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
 
 #This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid. 
-set MaxTol 1.0e-8
+set MaxTol 1.3e-7
 
 #This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid. 
 set GoodNbCurv 1
index 5dad932ed7204a1015312339f3b9bae2878031d3..fa4492fe033e1747e7954fb879bfd90b21012939 100644 (file)
@@ -24,7 +24,7 @@ set log [bopcurves f2 f1 -2d]
 regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
 
 #This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid. 
-set MaxTol 1.0e-8
+set MaxTol 1.3e-7
 
 #This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid. 
 set GoodNbCurv 1
index 893fda7ca9874855656b612452d07dce6c181772..ea14adf85061f7980179ad8d0a40e425d67ceeb1 100644 (file)
@@ -1,3 +1,7 @@
+puts "TODO OCC26417 ALL: Faulty shapes in variables faulty_1"
+puts "TODO OCC26417 ALL: Error : Result shape is WRONG because it must contains 13 wires"
+puts "TODO OCC26417 ALL: Error : Result shape is WRONG because it must contains 80 shapes"
+
 puts "================"
 puts "OCC25319"
 puts "================"
index 601d0f5435d967194e0eb17cc6e8d8e82310d573..4f39750d0c63e0332bf484b48272d035eb8e1669 100644 (file)
@@ -1,3 +1,7 @@
+puts "TODO OCC26417 ALL: Faulty shapes in variables faulty_1"
+puts "TODO OCC26417 ALL: Error : Result shape is WRONG because it must contains 13 wires"
+puts "TODO OCC26417 ALL: Error : Result shape is WRONG because it must contains 80 shapes"
+
 puts "================"
 puts "OCC25319"
 puts "================"
index 4d15b34ad8d7937fa47f555f639c5de20d52418c..6ff3f9c5e03cd3ca3da32a7e5f434db6227821e3 100644 (file)
@@ -24,10 +24,10 @@ set nb_v_good 4
 set nb_e_good 6
 set nb_w_good 3
 set nb_f_good 3
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 18
+set nb_shape_good 17
 
 set 2dviewer 1
index 6351e020c07494f3c7ebebe9a3cf8dc6fc1b2863..36be0fd87237c63ee761a205a895238c9963002f 100644 (file)
@@ -24,11 +24,11 @@ set nb_v_good 3
 set nb_e_good 3
 set nb_w_good 1
 set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 10
+set nb_shape_good 9
 
 set 2dviewer 1
 
index 16a9f4826fc425ac8542cc9dcbde0333b811dc96..6fada1be7f7688cee249718cd155320cf8226043 100644 (file)
@@ -17,10 +17,10 @@ set nb_v_good 8
 set nb_e_good 12
 set nb_w_good 4
 set nb_f_good 4
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 30
+set nb_shape_good 29
 
 set 3dviewer 1
index fbac40d55cef369a80ff3f8e5218dc00d64c6c57..61b22fd50b0404fb1b77880cef6f6e17589c059c 100644 (file)
@@ -18,10 +18,10 @@ set nb_v_good 4
 set nb_e_good 4
 set nb_w_good 1
 set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 12
+set nb_shape_good 11
 
 set 3dviewer 1
index c1a2c273f832d6ee218f91629fbea6fa063cc319..42c5b195cc4f01be58c1592d52b3ab28aa3d7532 100755 (executable)
@@ -45,13 +45,13 @@ baddctools b2
 bapibop result 0
 
 set nb_v_good 1720
-set nb_e_good 3800
-set nb_w_good 1920
-set nb_f_good 1920
-set nb_sh_good 1
-set nb_sol_good 1
+set nb_e_good 4260
+set nb_w_good 3220
+set nb_f_good 3220
+set nb_sh_good 760
+set nb_sol_good 760
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 9363
+set nb_shape_good 13941
 
 set 3dviewer 1
index b8907e1b5525136d25cdde8c45cc77c723dcef9a..c321a580b28b7852aea0c1798fbfb8d6a8e4e69d 100755 (executable)
@@ -46,12 +46,12 @@ bapibop result 2
 
 set nb_v_good 888
 set nb_e_good 1412
-set nb_w_good 686
-set nb_f_good 686
-set nb_sh_good 82
-set nb_sol_good 82
+set nb_w_good 726
+set nb_f_good 726
+set nb_sh_good 121
+set nb_sol_good 121
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 3837
+set nb_shape_good 3995
 
 set 3dviewer 1
index a825b460d68991e3e25f90b55fafd85c1425ad0b..f44c178228edc601f514bf1d91c8539264b0c485 100755 (executable)
@@ -45,13 +45,13 @@ baddctools b2
 bapibop result 3
 
 set nb_v_good 2640
-set nb_e_good 5780
-set nb_w_good 2820
-set nb_f_good 2820
-set nb_sh_good 2
-set nb_sol_good 2
+set nb_e_good 5960
+set nb_w_good 3720
+set nb_f_good 3720
+set nb_sh_good 560
+set nb_sol_good 560
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 14065
+set nb_shape_good 17161
 
 set 3dviewer 1
index dcc82e231881fc67196ffb848cf7e3931c378e52..c78ba3699b6a758cec65da76f222a5e60ba1d1ca 100644 (file)
@@ -18,10 +18,10 @@ set nb_v_good 10
 set nb_e_good 11
 set nb_w_good 2
 set nb_f_good 2
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 27
+set nb_shape_good 26
 
 set 2dviewer 1
index 3c525a6258ffda9786c50ea19f5e59662561e4ab..8d52a802c7b1affdf13c59458b310da951dc3d41 100644 (file)
@@ -24,10 +24,10 @@ set nb_v_good 2
 set nb_e_good 3
 set nb_w_good 3
 set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 11
+set nb_shape_good 10
 
 set 2dviewer 1
index 039abf19eaa70667cd6be741f10f35b103608136..dae7aafd960d04dee222e0b6738d60836a2f6163 100755 (executable)
@@ -25,11 +25,11 @@ Number of shapes in shape
  EDGE      : 4
  WIRE      : 1
  FACE      : 1
- SHELL     : 1
+ SHELL     : 0
  SOLID     : 0
  COMPSOLID : 0
  COMPOUND  : 1
- SHAPE     : 12
+ SHAPE     : 11
 "
 checknbshapes result -ref ${nbshapes_expected} -t -m "Result obtained by Cut a wire by halfspace"
 
index 564f6ba17778a56d01b5e24f68e93bd953d9969f..a6d6078f8fd364792c2b36cf0ef4278b4510c499 100755 (executable)
@@ -25,11 +25,11 @@ Number of shapes in shape
  EDGE : 9
  WIRE : 1
  FACE : 1
- SHELL : 1
+ SHELL : 0
  SOLID : 0
  COMPSOLID : 0
  COMPOUND : 1
- SHAPE : 22
+ SHAPE : 21
 
 "
 checknbshapes result -ref ${nbshapes_expected} -t -m "result obtained by Common operator"
diff --git a/tests/bugs/modalg_6/bug26565_1 b/tests/bugs/modalg_6/bug26565_1
new file mode 100644 (file)
index 0000000..8b0b3c0
--- /dev/null
@@ -0,0 +1,46 @@
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+explode b1 f
+copy b1_1 f
+explode b1 e
+copy b1_8 e
+
+box b2 10 5 5
+
+bclearobjects
+bcleartools
+baddobjects f e
+baddtools b2
+
+bfillds
+bbop r 0
+
+nbshapes r
+
+bbop r 2
+
+nbshapes r
+explode r
+
+# should edge and face
+
+set ShapeType "FACE"
+if { [regexp $ShapeType [whatis r_1]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "EDGE"
+if { [regexp $ShapeType [whatis r_2]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
diff --git a/tests/bugs/modalg_6/bug26565_2 b/tests/bugs/modalg_6/bug26565_2
new file mode 100644 (file)
index 0000000..b8a6223
--- /dev/null
@@ -0,0 +1,51 @@
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 5 0 0 10 10 10
+explode b2 sh
+copy b2_1 b2
+box b3 5 0 5 10 10 10
+
+bclearobjects
+bcleartools
+baddobjects b1 b2
+baddtools b3
+
+bfillds
+bbop r 0
+
+nbshapes r
+
+bbop r 2
+
+nbshapes r
+explode r
+
+# should shell and two solids
+
+set ShapeType "SHELL"
+if { [regexp $ShapeType [whatis r_1]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "SOLID"
+if { [regexp $ShapeType [whatis r_2]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "SOLID"
+if { [regexp $ShapeType [whatis r_3]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
diff --git a/tests/bugs/modalg_6/bug26565_3 b/tests/bugs/modalg_6/bug26565_3
new file mode 100644 (file)
index 0000000..64ae202
--- /dev/null
@@ -0,0 +1,52 @@
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+explode b1 f
+copy b1_1 f
+explode b1 e
+copy b1_8 e
+
+box b2 10 5 5
+shape sh sh
+add f sh
+copy sh f
+shape w w
+add e w
+copy w e
+
+bclearobjects
+bcleartools
+baddobjects f e
+baddtools b2
+
+bfillds
+bbop r 0
+
+nbshapes r
+
+bbop r 2
+
+nbshapes r
+explode r
+
+# should be shell and wire
+set ShapeType "SHELL"
+if { [regexp $ShapeType [whatis r_1]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "WIRE"
+if { [regexp $ShapeType [whatis r_2]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
diff --git a/tests/bugs/modalg_6/bug26565_4 b/tests/bugs/modalg_6/bug26565_4
new file mode 100644 (file)
index 0000000..c18ab2a
--- /dev/null
@@ -0,0 +1,47 @@
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 10 0 0 10 5 5
+box b3 10 5 0 10 5 5
+box b4 10 0 5 10 10 5
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3 b4
+
+bfillds
+bbuild r
+
+explode r so
+
+shape b1 CS
+add r_1 b1
+add r_2 b1
+add r_3 b1
+add r_4 b1
+
+box b2 5 0 2 10 10 10
+bclearobjects
+bcleartools
+baddobjects b1
+baddtools b2
+
+bfillds
+bbop r 2
+
+explode r
+
+# should be compsolid
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_1]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
diff --git a/tests/bugs/modalg_6/bug26565_5 b/tests/bugs/modalg_6/bug26565_5
new file mode 100644 (file)
index 0000000..0607643
--- /dev/null
@@ -0,0 +1,68 @@
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 10 0 0 10 5 5
+box b3 10 5 0 10 5 5
+box b4 10 0 5 10 10 5
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3 b4
+bfillds
+
+bbuild r
+
+explode r so
+shape b1 CS
+add r_1 b1
+add r_2 b1
+add r_3 b1
+add r_4 b1
+
+box b2 5 0 2 10 10 5
+box b3 5 0 7 10 10 5
+bclearobjects
+bcleartools
+baddobjects b2 b3
+
+bfillds
+bbuild r
+
+explode r so
+shape b2 CS
+add r_1 b2
+add r_2 b2
+
+box b3 -5 2 3 30 6 4
+
+bclearobjects
+bcleartools
+baddobjects b1 b2
+baddtools b3
+
+bfillds
+bbop r 2
+
+explode r
+
+# should be two compsolids
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_1]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_2]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
diff --git a/tests/bugs/modalg_6/bug26565_6 b/tests/bugs/modalg_6/bug26565_6
new file mode 100644 (file)
index 0000000..7624b51
--- /dev/null
@@ -0,0 +1,67 @@
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 10 0 0 10 5 5
+box b3 10 5 0 10 5 5
+box b4 10 0 5 10 10 5
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3 b4
+
+bfillds
+bbuild r
+
+explode r so
+shape b1 CS
+add r_1 b1
+add r_2 b1
+add r_3 b1
+add r_4 b1
+
+box b2 5 0 2 10 10 5
+box b3 5 0 7 10 10 5
+bclearobjects
+bcleartools
+baddobjects b2 b3
+
+bfillds
+bbuild r
+
+explode r so
+shape b2 CS
+add r_1 b2
+add r_2 b2
+
+box b3 5 -2 -2 10 14 20
+bclearobjects
+bcleartools
+baddobjects b1 b2
+baddtools b3
+
+bfillds
+bbop r 2
+
+explode r
+
+# should be two compsolids
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_1]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_2]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
diff --git a/tests/bugs/modalg_6/bug26565_7 b/tests/bugs/modalg_6/bug26565_7
new file mode 100644 (file)
index 0000000..0a619f2
--- /dev/null
@@ -0,0 +1,54 @@
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 10 0 0 10 5 5
+box b3 10 5 0 10 5 5
+box b4 10 0 5 10 10 5
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3 b4
+
+bfillds
+bbuild r
+
+explode r so
+shape b1 CS
+add r_1 b1
+add r_2 b1
+add r_3 b1
+add r_4 b1
+
+box b2 5 0 2 10 10 10
+box b3 -5 2 3 30 6 4
+bclearobjects
+bcleartools
+baddobjects b1 b2
+baddtools b3
+
+bfillds
+bbop r 2
+
+explode r
+
+# should be compsolid and solid
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_1]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "SOLID"
+if { [regexp $ShapeType [whatis r_2]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
diff --git a/tests/bugs/modalg_6/bug26565_8 b/tests/bugs/modalg_6/bug26565_8
new file mode 100644 (file)
index 0000000..efe49fd
--- /dev/null
@@ -0,0 +1,33 @@
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b 10 10 10
+explode b f
+mkshe profile b_1 b_3
+
+polyline spine 0 0 0 10 10 0
+
+pipe sh spine profile
+
+whatis sh
+plane pl 10 10 0 -1 -1 0 1 0 0
+mkface f pl
+mksol sl f
+
+bcut res sh sl
+
+explode res
+
+# should be compsolid
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis res_1]] == 1  } {
+   puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+   puts "Error : There is not $ShapeType; Compsolid is bad"
+}
index 5c29422e5b0fe4632c05a12cf56824ad1bc55161..d06d3c7f17d22834d0741b80e86b3302879393c7 100755 (executable)
@@ -28,11 +28,11 @@ Number of shapes in shape
  EDGE      : 7
  WIRE      : 3
  FACE      : 3
- SHELL     : 1
+ SHELL     : 0
  SOLID     : 0
  COMPSOLID : 0
  COMPOUND  : 1
- SHAPE     : 20
+ SHAPE     : 19
 "
 checknbshapes result -ref ${nbshapes_expected} -t -m "result obtained by Common operator"
 
diff --git a/tests/bugs/modalg_6/bug26718 b/tests/bugs/modalg_6/bug26718
new file mode 100644 (file)
index 0000000..eb8e62d
--- /dev/null
@@ -0,0 +1,45 @@
+puts "============"
+puts "OCC26718"
+puts "============"
+puts ""
+#############################################################################################
+## Big tolerance value of the edge in the result of Genral Fuse operation
+#############################################################################################
+
+restore [locate_data_file bug26718_w6_b1.brep] b1
+restore [locate_data_file bug26718_w6_b2.brep] b2
+
+bclearobjects
+bcleartools
+baddobjects b1
+baddtools b2
+
+bfillds
+bbuild result
+
+set square 2.3834e+06
+
+set nbshapes_expected "
+Number of shapes in shape
+ VERTEX    : 7
+ EDGE      : 11
+ WIRE      : 8
+ FACE      : 5
+ SHELL     : 2
+ SOLID     : 2
+ COMPSOLID : 0
+ COMPOUND  : 1
+ SHAPE     : 36
+"
+
+checknbshapes result -ref ${nbshapes_expected} -t -m "Result obtained by General Fuse operation"
+
+regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance result] full MaxTolerance
+puts "MaxTolerance=$MaxTolerance"
+
+set expected_MaxTolerance 0.317915740714732
+set tol_abs_MaxTolerance 0.01
+set tol_rel_MaxTolerance 0.01
+checkreal "MaxTolerance" ${MaxTolerance} ${expected_MaxTolerance} ${tol_abs_MaxTolerance} ${tol_rel_MaxTolerance}
+
+set 3dviewer 1
diff --git a/tests/bugs/modalg_6/bug26980 b/tests/bugs/modalg_6/bug26980
new file mode 100644 (file)
index 0000000..ebafab7
--- /dev/null
@@ -0,0 +1,64 @@
+puts "========"
+puts "OCC26980"
+puts "========"
+puts ""
+#################################
+# Intersection part of Boolean algorithm spends much system time and system memory
+#################################
+
+cpulimit 5000 
+
+set max_time 240
+set mem_max_wsetpeak 700000000
+
+
+bclearobjects;
+bcleartools;
+
+restore [locate_data_file bug26980-cmp.brep] cmp
+
+puts [nbshapes cmp -t]
+
+eval baddobjects [explode cmp]
+
+dchrono cr reset
+dchrono cr start
+
+bfillds
+bbuild result
+
+dchrono cr stop
+
+set mem_wsetpeak [meminfo wsetpeak]
+
+if { ${mem_wsetpeak} > ${mem_max_wsetpeak}} {
+    puts "Error : there is memory problem (${mem_wsetpeak} MBytes has been allocated)"
+}
+
+set chrono_info [dchrono cr show]
+regexp {CPU user time: ([-0-9.+eE]+) seconds} $chrono_info full CPU_time
+if { $CPU_time > ${max_time} } {
+  puts "CPU user time of Boolean operation is more than ${max_time} seconds - Error"
+} else {
+  puts "CPU user time of Boolean operation is less than ${max_time} seconds - OK"
+}
+
+set nbshapes_expected "
+ VERTEX    : 365
+ EDGE      : 793
+ WIRE      : 531
+ FACE      : 531
+ SHELL     : 102
+ SOLID     : 101
+ COMPSOLID : 0
+ COMPOUND  : 1
+ SHAPE     : 2424
+"
+
+checknbshapes result -ref ${nbshapes_expected} -t
+
+smallview
+donly result
+fit
+
+set 2dviewer 1
index 2e8fead91a4458c63ef44999314acdb0e1906b63..b6b8164f5601cd2b66fc4dc707713a6e43d263ba 100644 (file)
@@ -25,10 +25,10 @@ set nb_v_good 6
 set nb_e_good 10
 set nb_w_good 8
 set nb_f_good 6
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 32
+set nb_shape_good 31
 
 set 3dviewer 1
index 08ac9921070c9464a1838b3ff2e345b4c6d0f04e..b082f005ccbdedb894284f8056a052e7c07c8686 100644 (file)
@@ -31,10 +31,10 @@ set nb_v_good 37
 set nb_e_good 39
 set nb_w_good 4
 set nb_f_good 3
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 85
+set nb_shape_good 84
 
 set 3dviewer 1
index edb13d6d38f30b69c4171a7cb66ebbee295b04b9..6692bba19eb6ee7378eb7d982b91584f208d2320 100644 (file)
@@ -36,10 +36,10 @@ set nb_v_good 37
 set nb_e_good 39
 set nb_w_good 4
 set nb_f_good 3
-set nb_sh_good 1
+set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 85
+set nb_shape_good 84
 
 set 3dviewer 1