From 068904e027b29e87fb60284cdcf24d54df8d898c Mon Sep 17 00:00:00 2001 From: nbv Date: Wed, 3 Feb 2016 13:22:16 +0300 Subject: [PATCH] 0026980: Intersection part of Boolean algorithm spends much system time and system memory 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) --- .gitignore | 8 +- .../boolean_operations/boolean_operations.md | 51 +- .../images/boolean_image136.png | Bin 0 -> 4973 bytes .../images/boolean_image137.png | Bin 0 -> 1198 bytes .../images/boolean_image138.png | Bin 0 -> 1682 bytes samples/tcl/snowflake.tcl | 2 +- src/BOPAlgo/BOPAlgo_BOP.cdl | 4 - src/BOPAlgo/BOPAlgo_BOP.cxx | 562 ++++++++++-------- src/BOPAlgo/BOPAlgo_Builder.cxx | 33 +- src/BOPAlgo/BOPAlgo_Builder_2.cxx | 6 +- src/BOPAlgo/BOPAlgo_CheckerSI.cdl | 15 - src/BOPAlgo/BOPAlgo_CheckerSI.cxx | 16 - src/BOPAlgo/BOPAlgo_PaveFiller.cdl | 66 ++ src/BOPAlgo/BOPAlgo_PaveFiller.cxx | 55 +- src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx | 17 +- src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx | 230 +++++++ src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx | 41 +- src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx | 62 +- src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx | 36 +- src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx | 73 +-- src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx | 198 ++++-- src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx | 77 ++- src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx | 2 - src/BOPAlgo/FILES | 3 +- src/BOPDS/BOPDS_DS.cdl | 15 +- src/BOPDS/BOPDS_DS.cxx | 213 +++++-- src/BOPTest/BOPTest_APICommands.cxx | 10 +- src/BOPTools/BOPTools_AlgoTools.cdl | 25 +- src/BOPTools/BOPTools_AlgoTools2D_1.cxx | 40 +- src/BOPTools/BOPTools_AlgoTools_1.cxx | 153 +++-- .../BRepAlgoAPI_BooleanOperation.cdl | 7 +- .../BRepAlgoAPI_BooleanOperation.cxx | 10 +- src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cdl | 7 +- src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx | 4 +- src/IntPatch/IntPatch_Intersection.cxx | 30 +- src/IntPatch/IntPatch_PrmPrmIntersection.cxx | 490 ++++++--------- src/IntTools/IntTools_Context.cdl | 36 +- src/IntTools/IntTools_Context.cxx | 38 +- src/IntTools/IntTools_FaceFace.cxx | 188 ++---- src/IntTools/IntTools_ShrunkRange.cxx | 6 +- src/IntWalk/IntWalk.cdl | 4 +- src/IntWalk/IntWalk_PWalking.cdl | 22 + src/IntWalk/IntWalk_PWalking.cxx | 328 ++++++---- src/IntWalk/IntWalk_PWalking.lxx | 6 + src/QABugs/QABugs_19.cxx | 4 +- tests/blend/simple/X4 | 2 + tests/boolean/bopcut_2d/D5 | 2 - tests/boolean/gdml_private/F8 | 2 +- tests/boolean/gdml_private/G7 | 2 +- tests/boolean/gdml_private/I6 | 4 +- tests/boolean/gdml_private/ZD3 | 3 +- tests/boolean/gdml_private/ZD6 | 3 +- tests/boolean/volumemaker/B3 | 2 +- tests/boolean/volumemaker/E4 | 4 +- tests/boolean/volumemaker/E5 | 4 +- tests/boolean/volumemaker/E6 | 4 +- tests/bugs/heal/bug26642 | 2 +- tests/bugs/modalg_1/bug11565_1 | 4 +- tests/bugs/modalg_1/bug11565_2 | 4 +- tests/bugs/modalg_1/bug12507 | 4 +- tests/bugs/modalg_2/bug21460 | 4 +- tests/bugs/modalg_2/bug22356 | 4 +- tests/bugs/modalg_2/bug22790 | 4 +- tests/bugs/modalg_2/bug23100 | 4 +- tests/bugs/modalg_2/bug23470 | 5 +- tests/bugs/modalg_2/bug23676 | 4 +- tests/bugs/modalg_2/bug472_1 | 4 - tests/bugs/modalg_2/bug472_2 | 7 +- tests/bugs/modalg_2/bug472_3 | 10 +- tests/bugs/modalg_4/bug6538 | 4 +- tests/bugs/modalg_4/pro18892 | 7 +- tests/bugs/modalg_5/bug23884 | 2 +- tests/bugs/modalg_5/bug24092 | 4 +- tests/bugs/modalg_5/bug24187 | 4 +- tests/bugs/modalg_5/bug24585_1 | 57 +- tests/bugs/modalg_5/bug24746 | 4 +- tests/bugs/modalg_5/bug24811 | 11 +- tests/bugs/modalg_5/bug24825_cut | 18 +- tests/bugs/modalg_5/bug24851 | 4 +- tests/bugs/modalg_5/bug25043 | 6 +- tests/bugs/modalg_5/bug25163 | 4 +- tests/bugs/modalg_5/bug25193 | 90 ++- tests/bugs/modalg_5/bug25237 | 4 +- tests/bugs/modalg_5/bug25263 | 4 +- tests/bugs/modalg_5/bug25292_11 | 2 +- tests/bugs/modalg_5/bug25292_12 | 2 +- tests/bugs/modalg_5/bug25292_31 | 2 +- tests/bugs/modalg_5/bug25292_32 | 2 +- tests/bugs/modalg_5/bug25319_1 | 4 + tests/bugs/modalg_5/bug25319_2 | 4 + tests/bugs/modalg_5/bug25337_1 | 4 +- tests/bugs/modalg_5/bug25337_2 | 4 +- tests/bugs/modalg_5/bug25450_1 | 4 +- tests/bugs/modalg_5/bug25450_2 | 4 +- tests/bugs/modalg_5/bug25614_common | 12 +- tests/bugs/modalg_5/bug25614_cut | 10 +- tests/bugs/modalg_5/bug25614_cut21 | 12 +- tests/bugs/modalg_5/bug25625 | 4 +- tests/bugs/modalg_5/bug25721 | 4 +- tests/bugs/modalg_6/bug25937_2 | 4 +- tests/bugs/modalg_6/bug26224 | 4 +- tests/bugs/modalg_6/bug26565_1 | 46 ++ tests/bugs/modalg_6/bug26565_2 | 51 ++ tests/bugs/modalg_6/bug26565_3 | 52 ++ tests/bugs/modalg_6/bug26565_4 | 47 ++ tests/bugs/modalg_6/bug26565_5 | 68 +++ tests/bugs/modalg_6/bug26565_6 | 67 +++ tests/bugs/modalg_6/bug26565_7 | 54 ++ tests/bugs/modalg_6/bug26565_8 | 33 + tests/bugs/modalg_6/bug26582 | 4 +- tests/bugs/modalg_6/bug26718 | 45 ++ tests/bugs/modalg_6/bug26980 | 64 ++ tests/bugs/moddata_3/bug23738 | 4 +- tests/bugs/moddata_3/bug24108 | 4 +- tests/bugs/moddata_3/bug24108_2 | 4 +- 115 files changed, 2754 insertions(+), 1379 deletions(-) create mode 100644 dox/user_guides/boolean_operations/images/boolean_image136.png create mode 100644 dox/user_guides/boolean_operations/images/boolean_image137.png create mode 100644 dox/user_guides/boolean_operations/images/boolean_image138.png create mode 100644 src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx create mode 100644 tests/bugs/modalg_6/bug26565_1 create mode 100644 tests/bugs/modalg_6/bug26565_2 create mode 100644 tests/bugs/modalg_6/bug26565_3 create mode 100644 tests/bugs/modalg_6/bug26565_4 create mode 100644 tests/bugs/modalg_6/bug26565_5 create mode 100644 tests/bugs/modalg_6/bug26565_6 create mode 100644 tests/bugs/modalg_6/bug26565_7 create mode 100644 tests/bugs/modalg_6/bug26565_8 create mode 100644 tests/bugs/modalg_6/bug26718 create mode 100644 tests/bugs/modalg_6/bug26980 diff --git a/.gitignore b/.gitignore index 022baf36b2..53cfb10fc1 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/dox/user_guides/boolean_operations/boolean_operations.md b/dox/user_guides/boolean_operations/boolean_operations.md index a26fe75952..ccd43d5fcc 100644 --- a/dox/user_guides/boolean_operations/boolean_operations.md +++ b/dox/user_guides/boolean_operations/boolean_operations.md @@ -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 (S1=S11, S12, ...); * Tools (S2=S21, S22, ...). -* 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 (FWi) in *myRC* | *BOPAlgo_BOP::BuildSolid()* | -| 3.2 | Collect all faces of *myRC* except for internal faces (FWi) -> SFS | *BOPAlgo_BOP::BuildSolid ()* | -| 3.3 | Build solids (SDi) from *SFS*. | *BOPAlgo_BuilderSolid* | -| 3.4 | Add the solids (SDi) 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 (FWi) in *myRC* | *BOPAlgo_BOP::BuildSolid()* | +| 2.2 | Collect all faces of *myRC* except for internal faces (FWi) -> SFS | *BOPAlgo_BOP::BuildSolid ()* | +| 2.3 | Build solids (SDi) from *SFS*. | *BOPAlgo_BuilderSolid* | +| 2.4 | Add the solids (SDi) 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 index 0000000000000000000000000000000000000000..6c93bc48e718e20f01b04f6c5be0a343bd202a9a GIT binary patch literal 4973 zcmXw7c{mi__a0@*nr)&%vSv>)$zI49gb~J)tl1`OL^P7+BPC>)oxzNmvBX%jQ`xi3 zkfli!#=eYQe$(%HzV~^~bMHOxd+&43x%ZEAPMnzugq;P%0ssKmp$2;9007->n($vZ zN7F#6k*u_d+0Ve{DFDFH{ZHu9WH|%?03Kne-d&53oVDEPWNZVs-ZIb5SsQMr>NxUl z2F{#0+FDj}uc6wavo2W<$nQ%#@V|lUnwV7w+(qRxy+8p{l1(lG92LyxZpd}N4Bh|) zZknbqGy!&!!KQ*iFu!r8$oJ<4OlFn*Eh3IRDV&80ESL@5tFsK5LbKQW$M1E(78%88 zn^?_XXh6oV6hR$(UUTx{KSHjFQ8$c_0g}rY&+GWCD2Efmz<;lxiIY;4bo7H|S)qM3 z-cMT)cr|_(i}r958NVk&ZOPHAV0HT&ywCB8&4NY2Zya0TLoal7+^F54@M5$Ye>|_~ z9kf`7fyjk7(5^croJ$I$LBd6fKA?uj(P1Q*zUQBPL9hOKh(g>uvt~$Osq&sPW zn#eytU?#xRn(o^a+Rf)w9u7pj?_|0_=<{Ay;AY@#6n&?WIHDqh*`T4SXaTx`p_0;6 zlZ%nRI&6QU^UYKurSGD(XG;0RS-d$Zb>1oW)DXB-hKnUTAfq;BW2wgrI;QQZP>)R^6`xsMxbL+itj9{foNJbe>xO*2WXd@j0#3R8mN6F-% zb_0j*P@U7H-hR2)&X`14zsLqO&V6?3E7$wi!YM%N>?mFU?0V zrTKJ_KDl)wk8QfCrkj0+pv8aNOs!J*Al!yAEl2YuFvoU3UwUG&th9b_*x&+8@O$3Yn<^60e_(u* zFwW>Br476Si7<1L+fu>_Z9z<+s`}RO!k9hGk-N%;Aedz3QNk~a^3xV+J!>k};ckcu zeHqk=P9bnSWdhoWuBneXprjx$ug9^l@9|{Up7!H)(bvZx#vaSBBmfE(`i?NZUnIgEV&cfg ziEoEFPX4eHWEvuGB*-{~C(SmrIcxRCVV7}o6TiA@_^(wvg${5@H- zJ8Xb=lSX6SprmfA1Zn&0Fba`+uaS|7*qOZ^t)NnWETG3$nTCToA-YV(h;Ds>^9 zPxDP=^Q_rF{AI_*v-+`90s|du}zDfkpYr(i?V~e4lOS++n9x3JJIw5?f%;)4zn7kmE^bm`Oz+8!}%afNre;RGO&2Y-XklR zZ&sar0)5hI)amM?JwAIw#SnL$Cv^1a|qxGL%Lz|;3|sd+dXQS~_Xs7l*o>?MY#*DGp&Mo% zKz%2>VwppyUd5X4Zt5l*_FqA!QcS%45vUGDdR-#Cl3OU$rUl_puziZUcZ^E>#*2t~ zemloumt0>sKHBs_Gc@<~nmj5+YkSBMuXw((H?{fxdsFlvTTSibvZ47Q>(BMzqE7lT z^Gs+NnUBCi#jUNT@6>#8`%gB7?MsRqY3(9%HIASIAOsj~qjKM=+V4+4L|Pg5csnOi ztUo^@zV-k%dGr=g$7UB33~fSu^WKF9P^XokLP}%s87SgQfL<+2cy0G+K)rY@3QM)g zKO{hcRm9l;TY(vY2U#x~W4}jbSY_Akczl@&=BpOsGSM87$%MfRJ!L_i9ZspZ0P={$ z_=DbFv>?I-2VDOhc8bAbpSS86TdJFrr^+qGzeQJDH2@|K<0(X)zO2NjqgY@H{rU8# zzD(A#GcmKUvnGPf=f-zIVt7(D8_(2HfUzUqPct3tRcadE8+uS94(?4#!KCL1*K5Af z4DqwBWwBf+-xzMYERqJt+lYB{?0=ukhm&HLqLuk87EtQslYaZI@c|owD|z9cSF<}x zV*(8}D-Jw>0R}6^y%Jh44|Qy8>QeKyrgl9odz*?QC+b|3^eKE%9=+f z^X;{3L9X~YwRT%4skIs*^JXNUjY$m1xAhJXffv)`^uUvCm`N=`7Lz>CsUT| z!Y}D;0Lqbr2nWAFhV4n8=0^X9_GkyJr5?hqpQk&kQAa)T355Fdv$jSX6i*&oq;%si zuNM2$b_e59(}0^G&u1Akq|gvm6I zSdtdz#@cM|Bwu{Kn1||k>%v)X?WYDt1hsV8_8h!=>Yy?(B~p2V(boPFVYg^_HE^aN zP{0{4yw%d7n*bt7_y;7uB`CbH4Zbn_g+9?wi#Bf&xJG{@L^wye4~giXd7%` zA_q=(1$2~Z!3(}Q9pq2T--peKeE3#D%Zr_5_5(8KS44GXjZ1H*xe`)p)l0kSud#<~ zVGbZAvs;bB{z)uwNXdUrr?43q`-RaMit#dr2PfzNJv?jKZ`V7B}P%2 zn^H?c2oinq$M9$~;de%8A`mO+hbB-u5=oRL%gNE+LJFdWbfQ9?t43|VjCGrSh7(9T z_d$RE+i1BMPMZCh)ogr@F2;6nU0VmKETP_aAK9yf8xyJP9CtxDgEU;Z6uwBev~R4X z6|>O@-@EF<<>2QMC_x`mPkY^4I#FLPLZb#-?K4DaXrE5M@|rW-;5T{i{4jpe3Eh)< zeMrvIdP!jY!8RAA7-Jzfig^VtaBSR{JTBA0Vo^*p*F!`rzms^%jx__?37 zKe~HjdFI^{QbDvKjX;Z$Va95W*xon68A~VgMLhsC z>SPr2;=zA}_#N>@?H|A~`H&0LIeIn9r4In6>rs_WJx;zkZ6V2UEM%ZJMosFnUE&a! zqH2O-lv6ib+f$(yUm_OE7^h#KfeN@^qI5Uk64UgBTjgu1F1K`!IjVG!yc)|eO+WG; zp!qS0dHZ;ajO__e#@e&>phFekUCo+s_N%}v?xMq=Uxe){>foqVu(->QzI(ALXA{C7 z`MLtVuuIBWa+1@zWxt+fCRh3pBRYbFTDJHRv!{hN2=eSS3YiC?CE#-hR+(w7r;Ywd zkHufl7U~y1Zmkq=L@Dpb3ULJG1i=mwH!j-I>WUu*iDvFt#moB4 z7)9bn&gfB*=jo(MuG#ygwVad+H!GVg=!6|&jM%TKjj^h zhR;Q1QjF!Y=zryyB(S6`hl=?!7*UBMI`@id-e+BI95*@pDTz_^)cmbH8N8S}R=+tF z<{B?}QD5!aq3*%@t(t_3>&}QE$#!zC9ckkEVygITm5M+W>2VUxf*eSzK&_8JSh56($c_WbQ3!?N_P4<$^qu&B_t*Y zY1w?(#Kn=OU=R$_KzF)wCvz%fc(QCME&Dva;BeXIkw*R9qPI#8G0-3p@I#mm@XP{B zz`sguh1zMukB`H;o@U}YQ4L8V4HDq{l464izmMG#k53^*l`bDxQYIw~&r9sAhNwS7 zn3gn7!(husS;d{G`V0>GDQId<#xp0pQnqj0YeR>jDwY&zIO#6d)JSJGAYiQ|El3^P zYQWptNVJWrdF(a(^!h=K7Z7Y^paRE?<1v2tDEW%JE={>OYu8yU6fwCgO zvn{>0Sw)*WMq~!bo^oq6m?BG9^GPp%Nop!I=l}YGoU9(BL_e187CicZ--tP`Q-YQf z+$>WLjZEaC6t?VG@W{kq<7!A~md(T6cu$pGg(2G;%L+5PW--f8syK=f4;{ZvF^%2% zv!lr`J!2XSTJ05)m5*h%#0dPZc-C&<#Jzr;{?LSfONVGg%3t)OrTFg>lpEHuz{`9) z#{J(;y|)oh;(7n{lo0#c>BvLO@(~CYZ z$|iVO8&Ac&d4F!T>g3#qwoX^xa)%N?e{v1Ud{%0#`4cj@v~6koLjrNriu{kq49c-EV6%s|=T>uxuVO?7=ikBXPR*3= z-w z$&bP&eTi8Hvt?*hSUK$nw*RNjzLyK>F`zrSUF&t|Y_E30uCzm@HJ9$SwzkIXQ-PPM zS4X~10(|xBt#pmZ6@WVouvdmkChY(=J&Ynj;AaVd&n&}v{`;goT?7jdA@2hz0n{fE zUBl;>{%PD1nt$UA=_H-54<&w?*kA!z91s`DQO(a7KDP%+zujCcacDaOw5K|v{@2_3 c->k@d#xy&XA}Q$B=J-zsy=S6Vq2n0&e-FfytN;K2 literal 0 HcmV?d00001 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 index 0000000000000000000000000000000000000000..a783c0eeefeca8d054057fd580a0634694882adf GIT binary patch literal 1198 zcmeAS@N?(olHy`uVBq!ia0y~yV6+5cSq>(k$d7&PZ9s~%z$3Dlfr0M`2s2LA=96Y% zU`gS0#$b2u?5y&0|ZC1R6p+ z&=6kn`Y&rs#{ak<%+0%Qy!+!}B4XHJXL$SrP}wfal)x^)uE1s;5S zViLZvB|rFz*54bA(^EHocWQZj`BF@4-mU5KeX%^UK6{vNS9cm^ul8NqGIM?C<0(Fq zw^r57@si2={37MWjcSECx);yO6o0)GP?GJ@F2wEwwH>2>Cdd2JJ*|-_`aZbDTYU$qar3L-V=k;#+I#XQF;nqRW zDUnaM0i8MhLfCux<^Qr4Yz8v;Lzk9JyP7rq`#J8ZLQPS%`Omf`z1=G!bTMmsT2FA+ zN{HdN)=Dk^urOzJ>?}d8(yKM^_60nwzxpg|{oe2Y;zi~K=dRng)3Md}>a$mKdx9tV z++J1aHG>lv7M&*1tJ9CKJn%AiRhWLus-UXbORjP!2d=nc;0$z{n?c#?W15d8b^wET zVb3j~FWijdfZ{(g-RGbE^kCQK{_@Oy{6;e6Td#62bgE2#bKqOtF>{C2=c;Eql>l`L zpUk~#(Hb|;BD$!DMOK!}bH#wm0L#Ker5E(<`m1Rd+X(%NpxC< zWS8dKyjJ@~o?nYk;GI{`2FNNo*1vuIdh>fdmb!@F zUly&cdv<%0e2vVbQ0wTZZDIGf?a_S~u&{5Nsf4@@Z$<6Wgp4C^Xzc(`4{yreSVD@*r)>A(&{m=hiz3AnB z!5?kELr)0Yef7NE_-5lmjdX8;1N+w-&3z#&ftD>-oIh->(BP%m5U|jyTAw9AGbDYE z6T?&|hJ{Y0-{LqH1g$t{(aNCJ`l=@w$l*{3S#jA{Jvxk7)wUWD(E`Nq>*c7`ST;CfnEju?t!$^>r0U%+uA+Wt~$(698r?2mk;8 literal 0 HcmV?d00001 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 index 0000000000000000000000000000000000000000..d10a5a59f9cc98e9eaea7b063e002f6b7450a7fe GIT binary patch literal 1682 zcmZ{kX;4#F6vu-V#UO}H;!;Hf5lPS>h$vJ*V%U;^F^d7pswg0P%BCn3Vdpw2UrFkF9ZE2?qA!!R-+2CZ7ad8M`tip)xuq^L(+_T!N{N#Hal+jii&hZaUDjS}W_$J&l!bpzaJl-4@Qiq-pvscrLL zisDVA(1Rz&DMRbfqpvo-mqBo{H^Vs9vcA?asW}x7NX(wZ#}r2}S1%HN9)8*2>q^Os z?YGEq;SS2tv-ZH89rjAF95mt8-NOt|OoZ)hXQCn;+M;uE3^Y_yYZ%_fHd~|wS_nmN zz78gGw`}=1sfF!SgriK*@gdw?jwHfKuXbBjVS|vfkK^QfglSP0ABO&gH~?CgXE2r^ z29WDo0ajBr!d4t5U3%NDTs4%HlU-W_PTN32uQ`)a8iusNfnE)xo_c4;QcQLgHzf2X zOtnQ1f;S0Pr}$tI8(U2xg`rQeR$!fKav5Cl4VQkQJYyGICDrBH$6s$i^eh8N@>ifV_cRQW2r9*)@aBYu(0ra4{179S2 z5J8KcXk`qg)o}O#ta5n?4&^fQz}QM^I=|jpAaWrN*xm2CP$6>Z%m|8VqephhmRz zoMpTQW8K?bwNG^9T0pKN;pt+XnR687RLH_|ob{+8G*7HkEFdehGkiWTvoQUoL~Q9P zQ`>0(Q7?#=f^W*D8oLuoOk;)m$ton!f(@hbk9?fGU5G8+%n9~QP>Wbg3BHMCQ7@V@ zNX3*^%dAC8C0M{?hoSE{Rf0Z2gK*Q|O3dLV(1HtS-P(KkZZN?~nGs}}<$TkgR2+)7 z+Am|;K(07hz++4rFSQ}NYj9z-X=2{-nZvXxlO-aWiO*t zW<4eYc>_@;vvIHM>^m|?LCpmN2u81p+;*nY8GE2Rws>cnU(sTcnx;ZGlbgXlF34;) zq~pB;r4_0ayiGb1*wD1K9C^;z+Zsdy+~<}8B+%!RP9<99WG)<}`_XoK z#u*P2aiF4QDK85>*ciGagq3uhShau9uyx{A+BxxW2=V?+TP;_7J;9d*)vht)6bzq+ zj&k7+M%D- zH}@`Rj$_8%I)A@$$zU - -#include - -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include - #include - #include #include #include -#include - -#include - -#include -// #include #include +#include +#include #include +#include +#include +#include +#include +#include +#include #include 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_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; iShapeInfo(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] #include +#include + +#include +#include + #include #include + //======================================================================= //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; iShapeInfo(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); } diff --git a/src/BOPAlgo/BOPAlgo_Builder_2.cxx b/src/BOPAlgo/BOPAlgo_Builder_2.cxx index c32a4a3019..ad7e36e70d 100644 --- a/src/BOPAlgo/BOPAlgo_Builder_2.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder_2.cxx @@ -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); diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI.cdl b/src/BOPAlgo/BOPAlgo_CheckerSI.cdl index 9578c091f1..d7b6844952 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.cdl +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.cdl @@ -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 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; diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx index b22be8b282..c2ab02bc8b 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx @@ -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 : //======================================================================= diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.cdl b/src/BOPAlgo/BOPAlgo_PaveFiller.cdl index 7dd03af03e..9922eaafe5 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.cdl +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.cdl @@ -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 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; diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller.cxx index b5fe4c6110..9052f46fdc 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.cxx @@ -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) { diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx index a5e5e179a8..984d71ab3d 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx @@ -24,17 +24,19 @@ #include #include +#include #include #include #include #include #include -#include + #include #include -#include +#include +#include //======================================================================= // function: PerformVV @@ -100,7 +102,7 @@ // BOPTools_AlgoTools::MakeVertex(aLV, aVn); // - // Appennd new vertex to the DS + // Append new vertex to the DS aSIn.SetShape(aVn); n=myDS->Append(aSIn); // @@ -129,6 +131,15 @@ } } // + 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 index 0000000000..8d581d08af --- /dev/null +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx @@ -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 + +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +//======================================================================= +//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; iCommonBlock(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(); +} diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx index 69cfa25e38..6dc2711881 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx @@ -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) { } diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx index 24d5ec8f19..cd3f3be38c 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx @@ -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 - */ diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx index 65d6f55f29..43b0997b46 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx @@ -20,8 +20,6 @@ #include #include #include -#include -#include // #include #include @@ -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 { diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx index 18bf7ba3b4..41019ebc57 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx @@ -19,6 +19,8 @@ #include // +#include + #include // #include @@ -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; } - diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index eceef1604b..317793d2ad 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -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; iUpdateFaceInfoOn(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; jHasShapeSD(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; jShape(nV)); + const IntTools_Curve& aIC=aNC.Curve(); + // + bIsVertexOnLine=myContext->IsVertexOnLine(aV, aIC, aTolR3D, aT); + return bIsVertexOnLine; +} diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx index 29364f4680..1d5c773139 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx @@ -57,6 +57,8 @@ #include #include #include +#include +#include #include #include @@ -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; iIndices(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, diff --git a/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx b/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx index eca9276911..e7ecdc8cde 100644 --- a/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx +++ b/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx @@ -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()); diff --git a/src/BOPAlgo/FILES b/src/BOPAlgo/FILES index e6c81f7ad7..369b62468a 100644 --- a/src/BOPAlgo/FILES +++ b/src/BOPAlgo/FILES @@ -14,5 +14,4 @@ BOPAlgo_Builder_3.cxx BOPAlgo_Builder_4.cxx BOPAlgo_WireSplitter_1.cxx BOPAlgo_ListOfCheckResult.hxx - - +BOPAlgo_PaveFiller_11.cxx diff --git a/src/BOPDS/BOPDS_DS.cdl b/src/BOPDS/BOPDS_DS.cdl index 4fc375f386..9a3da4e313 100644 --- a/src/BOPDS/BOPDS_DS.cdl +++ b/src/BOPDS/BOPDS_DS.cdl @@ -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 . --- - + 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; diff --git a/src/BOPDS/BOPDS_DS.cxx b/src/BOPDS/BOPDS_DS.cxx index 371565cb71..5190db5162 100644 --- a/src/BOPDS/BOPDS_DS.cxx +++ b/src/BOPDS/BOPDS_DS.cxx @@ -54,19 +54,17 @@ #include #include #include +#include +#include #include // -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; jChecked()) { + 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); + } + } +} diff --git a/src/BOPTest/BOPTest_APICommands.cxx b/src/BOPTest/BOPTest_APICommands.cxx index 01a0dc42a2..b1cd167ebf 100644 --- a/src/BOPTest/BOPTest_APICommands.cxx +++ b/src/BOPTest/BOPTest_APICommands.cxx @@ -35,9 +35,11 @@ #include #include +#include +#include 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; // diff --git a/src/BOPTools/BOPTools_AlgoTools.cdl b/src/BOPTools/BOPTools_AlgoTools.cdl index 77eebf826f..9c777684fa 100644 --- a/src/BOPTools/BOPTools_AlgoTools.cdl +++ b/src/BOPTools/BOPTools_AlgoTools.cdl @@ -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 -- 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 -- 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 -- 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 if needed. diff --git a/src/BOPTools/BOPTools_AlgoTools2D_1.cxx b/src/BOPTools/BOPTools_AlgoTools2D_1.cxx index 86390a2355..55cbc3efa4 100644 --- a/src/BOPTools/BOPTools_AlgoTools2D_1.cxx +++ b/src/BOPTools/BOPTools_AlgoTools2D_1.cxx @@ -37,6 +37,7 @@ #include #include +#include #include @@ -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; } - diff --git a/src/BOPTools/BOPTools_AlgoTools_1.cxx b/src/BOPTools/BOPTools_AlgoTools_1.cxx index 10efe77184..6f2d037f83 100644 --- a/src/BOPTools/BOPTools_AlgoTools_1.cxx +++ b/src/BOPTools/BOPTools_AlgoTools_1.cxx @@ -85,11 +85,13 @@ 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_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_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_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 (aNewToleranceUpdateTolerance(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 (aNewToleranceUpdateTolerance(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 (aNewTolUpdateTolerance(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 (aNewTolUpdateTolerance(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 (aNewTolUpdateTolerance(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 (aTolVUpdateTolerance(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 : //======================================================================= diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cdl b/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cdl index aa4cf220cd..221fb82c91 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cdl +++ b/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cdl @@ -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; diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx index f98f2acea3..90717638b8 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx @@ -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()) { diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cdl b/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cdl index 7c9a9784ee..bb29c6cc5d 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cdl +++ b/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cdl @@ -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; diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx index 64ad14a820..a9e98112bf 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx @@ -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; } diff --git a/src/IntPatch/IntPatch_Intersection.cxx b/src/IntPatch/IntPatch_Intersection.cxx index fb0107e333..7cdb4daf11 100644 --- a/src/IntPatch/IntPatch_Intersection.cxx +++ b/src/IntPatch/IntPatch_Intersection.cxx @@ -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 #include @@ -2053,7 +2053,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer , NR1[nbR1]=0; nbR1++; } - for(D2->Init();D2->More() && nbR2Next()) { + for(D2->Init();D2->More() && nbR2Next()) { R2[nbR2]=D2->Value(); NR2[nbR2]=0; nbR2++; diff --git a/src/IntPatch/IntPatch_PrmPrmIntersection.cxx b/src/IntPatch/IntPatch_PrmPrmIntersection.cxx index 8d07c7b2df..a0bc4144a8 100644 --- a/src/IntPatch/IntPatch_PrmPrmIntersection.cxx +++ b/src/IntPatch/IntPatch_PrmPrmIntersection.cxx @@ -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; diff --git a/src/IntTools/IntTools_Context.cdl b/src/IntTools/IntTools_Context.cdl index 5225edcc3f..484d83956a 100644 --- a/src/IntTools/IntTools_Context.cdl +++ b/src/IntTools/IntTools_Context.cdl @@ -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; diff --git a/src/IntTools/IntTools_Context.cxx b/src/IntTools/IntTools_Context.cxx index 9501d58a9e..d4b72c7bd9 100644 --- a/src/IntTools/IntTools_Context.cxx +++ b/src/IntTools/IntTools_Context.cxx @@ -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; diff --git a/src/IntTools/IntTools_FaceFace.cxx b/src/IntTools/IntTools_FaceFace.cxx index ff86dfce3d..16c3b06b8f 100644 --- a/src/IntTools/IntTools_FaceFace.cxx +++ b/src/IntTools/IntTools_FaceFace.cxx @@ -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 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; iD0(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 : diff --git a/src/IntTools/IntTools_ShrunkRange.cxx b/src/IntTools/IntTools_ShrunkRange.cxx index 98b4b2ab39..796f355fc9 100644 --- a/src/IntTools/IntTools_ShrunkRange.cxx +++ b/src/IntTools/IntTools_ShrunkRange.cxx @@ -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; diff --git a/src/IntWalk/IntWalk.cdl b/src/IntWalk/IntWalk.cdl index 5aa4e72566..eb9c321701 100644 --- a/src/IntWalk/IntWalk.cdl +++ b/src/IntWalk/IntWalk.cdl @@ -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 diff --git a/src/IntWalk/IntWalk_PWalking.cdl b/src/IntWalk/IntWalk_PWalking.cdl index 99b7bcd644..0760347223 100644 --- a/src/IntWalk/IntWalk_PWalking.cdl +++ b/src/IntWalk/IntWalk_PWalking.cdl @@ -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; diff --git a/src/IntWalk/IntWalk_PWalking.cxx b/src/IntWalk/IntWalk_PWalking.cxx index ae9e675e82..b5b60c70ba 100644 --- a/src/IntWalk/IntWalk_PWalking.cxx +++ b/src/IntWalk/IntWalk_PWalking.cxx @@ -35,61 +35,63 @@ #include //================================================================================== -// 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] 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; } diff --git a/src/IntWalk/IntWalk_PWalking.lxx b/src/IntWalk/IntWalk_PWalking.lxx index e1614170c9..430d1bf124 100644 --- a/src/IntWalk/IntWalk_PWalking.lxx +++ b/src/IntWalk/IntWalk_PWalking.lxx @@ -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, diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index 02f24518ed..321a5c59d4 100755 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -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; diff --git a/tests/blend/simple/X4 b/tests/blend/simple/X4 index cfb6e23eee..4bd5ec485b 100644 --- a/tests/blend/simple/X4 +++ b/tests/blend/simple/X4 @@ -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 diff --git a/tests/boolean/bopcut_2d/D5 b/tests/boolean/bopcut_2d/D5 index b069a320fb..ccecdc76a2 100644 --- a/tests/boolean/bopcut_2d/D5 +++ b/tests/boolean/bopcut_2d/D5 @@ -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 diff --git a/tests/boolean/gdml_private/F8 b/tests/boolean/gdml_private/F8 index 97f1249dde..2a2e37e946 100644 --- a/tests/boolean/gdml_private/F8 +++ b/tests/boolean/gdml_private/F8 @@ -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 diff --git a/tests/boolean/gdml_private/G7 b/tests/boolean/gdml_private/G7 index 1af9cde9a7..fa749685a1 100644 --- a/tests/boolean/gdml_private/G7 +++ b/tests/boolean/gdml_private/G7 @@ -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 diff --git a/tests/boolean/gdml_private/I6 b/tests/boolean/gdml_private/I6 index 83c1c0d334..0636c290b7 100644 --- a/tests/boolean/gdml_private/I6 +++ b/tests/boolean/gdml_private/I6 @@ -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] diff --git a/tests/boolean/gdml_private/ZD3 b/tests/boolean/gdml_private/ZD3 index 56e572c89d..2f8beda78c 100644 --- a/tests/boolean/gdml_private/ZD3 +++ b/tests/boolean/gdml_private/ZD3 @@ -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] - diff --git a/tests/boolean/gdml_private/ZD6 b/tests/boolean/gdml_private/ZD6 index f4d1578a18..718103630a 100644 --- a/tests/boolean/gdml_private/ZD6 +++ b/tests/boolean/gdml_private/ZD6 @@ -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] - diff --git a/tests/boolean/volumemaker/B3 b/tests/boolean/volumemaker/B3 index ab548307df..0eea89bdfe 100644 --- a/tests/boolean/volumemaker/B3 +++ b/tests/boolean/volumemaker/B3 @@ -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 diff --git a/tests/boolean/volumemaker/E4 b/tests/boolean/volumemaker/E4 index 3fdf57e3ad..95405ad626 100644 --- a/tests/boolean/volumemaker/E4 +++ b/tests/boolean/volumemaker/E4 @@ -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" diff --git a/tests/boolean/volumemaker/E5 b/tests/boolean/volumemaker/E5 index 98d2f1778a..7aa2113267 100644 --- a/tests/boolean/volumemaker/E5 +++ b/tests/boolean/volumemaker/E5 @@ -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 diff --git a/tests/boolean/volumemaker/E6 b/tests/boolean/volumemaker/E6 index c965d7435b..0fbeab70fb 100644 --- a/tests/boolean/volumemaker/E6 +++ b/tests/boolean/volumemaker/E6 @@ -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 diff --git a/tests/bugs/heal/bug26642 b/tests/bugs/heal/bug26642 index 5f5e174c47..87de0b59f8 100644 --- a/tests/bugs/heal/bug26642 +++ b/tests/bugs/heal/bug26642 @@ -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] diff --git a/tests/bugs/modalg_1/bug11565_1 b/tests/bugs/modalg_1/bug11565_1 index 29a46b572b..6ca06f77c6 100755 --- a/tests/bugs/modalg_1/bug11565_1 +++ b/tests/bugs/modalg_1/bug11565_1 @@ -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 diff --git a/tests/bugs/modalg_1/bug11565_2 b/tests/bugs/modalg_1/bug11565_2 index 3a2358bcc2..01bb884cb4 100755 --- a/tests/bugs/modalg_1/bug11565_2 +++ b/tests/bugs/modalg_1/bug11565_2 @@ -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 diff --git a/tests/bugs/modalg_1/bug12507 b/tests/bugs/modalg_1/bug12507 index dbef9be48f..bd1213fa47 100755 --- a/tests/bugs/modalg_1/bug12507 +++ b/tests/bugs/modalg_1/bug12507 @@ -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 diff --git a/tests/bugs/modalg_2/bug21460 b/tests/bugs/modalg_2/bug21460 index aeb40c38c2..3195699117 100755 --- a/tests/bugs/modalg_2/bug21460 +++ b/tests/bugs/modalg_2/bug21460 @@ -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 diff --git a/tests/bugs/modalg_2/bug22356 b/tests/bugs/modalg_2/bug22356 index 748acac8a5..f8dfc8ff58 100755 --- a/tests/bugs/modalg_2/bug22356 +++ b/tests/bugs/modalg_2/bug22356 @@ -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 diff --git a/tests/bugs/modalg_2/bug22790 b/tests/bugs/modalg_2/bug22790 index 15712fa378..bf6ed2951d 100755 --- a/tests/bugs/modalg_2/bug22790 +++ b/tests/bugs/modalg_2/bug22790 @@ -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 diff --git a/tests/bugs/modalg_2/bug23100 b/tests/bugs/modalg_2/bug23100 index c2a149fb1c..a9210fef8c 100755 --- a/tests/bugs/modalg_2/bug23100 +++ b/tests/bugs/modalg_2/bug23100 @@ -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 diff --git a/tests/bugs/modalg_2/bug23470 b/tests/bugs/modalg_2/bug23470 index 1b5405bf91..8111768a1f 100755 --- a/tests/bugs/modalg_2/bug23470 +++ b/tests/bugs/modalg_2/bug23470 @@ -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 diff --git a/tests/bugs/modalg_2/bug23676 b/tests/bugs/modalg_2/bug23676 index 0edbcb8f42..d581a5b7c9 100755 --- a/tests/bugs/modalg_2/bug23676 +++ b/tests/bugs/modalg_2/bug23676 @@ -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 diff --git a/tests/bugs/modalg_2/bug472_1 b/tests/bugs/modalg_2/bug472_1 index a663055096..a84fa36e4b 100755 --- a/tests/bugs/modalg_2/bug472_1 +++ b/tests/bugs/modalg_2/bug472_1 @@ -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 " diff --git a/tests/bugs/modalg_2/bug472_2 b/tests/bugs/modalg_2/bug472_2 index bb40ce531a..eb00f2c0dd 100755 --- a/tests/bugs/modalg_2/bug472_2 +++ b/tests/bugs/modalg_2/bug472_2 @@ -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 " diff --git a/tests/bugs/modalg_2/bug472_3 b/tests/bugs/modalg_2/bug472_3 index db34c1aebe..6c16aa9224 100755 --- a/tests/bugs/modalg_2/bug472_3 +++ b/tests/bugs/modalg_2/bug472_3 @@ -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 diff --git a/tests/bugs/modalg_4/bug6538 b/tests/bugs/modalg_4/bug6538 index dec5dfa13e..72f74ceedc 100755 --- a/tests/bugs/modalg_4/bug6538 +++ b/tests/bugs/modalg_4/bug6538 @@ -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 diff --git a/tests/bugs/modalg_4/pro18892 b/tests/bugs/modalg_4/pro18892 index 64ad937977..20c002dac9 100755 --- a/tests/bugs/modalg_4/pro18892 +++ b/tests/bugs/modalg_4/pro18892 @@ -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 diff --git a/tests/bugs/modalg_5/bug23884 b/tests/bugs/modalg_5/bug23884 index 1d9e7d54ec..9ce8a447cf 100755 --- a/tests/bugs/modalg_5/bug23884 +++ b/tests/bugs/modalg_5/bug23884 @@ -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 diff --git a/tests/bugs/modalg_5/bug24092 b/tests/bugs/modalg_5/bug24092 index 9e7bbd1b76..9b73779413 100644 --- a/tests/bugs/modalg_5/bug24092 +++ b/tests/bugs/modalg_5/bug24092 @@ -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 diff --git a/tests/bugs/modalg_5/bug24187 b/tests/bugs/modalg_5/bug24187 index 54c9077834..5d7781b9a6 100644 --- a/tests/bugs/modalg_5/bug24187 +++ b/tests/bugs/modalg_5/bug24187 @@ -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 diff --git a/tests/bugs/modalg_5/bug24585_1 b/tests/bugs/modalg_5/bug24585_1 index 462b19679c..f9d65c634a 100644 --- a/tests/bugs/modalg_5/bug24585_1 +++ b/tests/bugs/modalg_5/bug24585_1 @@ -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." +} diff --git a/tests/bugs/modalg_5/bug24746 b/tests/bugs/modalg_5/bug24746 index 57ffe130a3..2db9f01292 100644 --- a/tests/bugs/modalg_5/bug24746 +++ b/tests/bugs/modalg_5/bug24746 @@ -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 diff --git a/tests/bugs/modalg_5/bug24811 b/tests/bugs/modalg_5/bug24811 index 1ebb8d2fc7..59db6c9b4e 100644 --- a/tests/bugs/modalg_5/bug24811 +++ b/tests/bugs/modalg_5/bug24811 @@ -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 diff --git a/tests/bugs/modalg_5/bug24825_cut b/tests/bugs/modalg_5/bug24825_cut index 4b404481fe..014b7c0be0 100644 --- a/tests/bugs/modalg_5/bug24825_cut +++ b/tests/bugs/modalg_5/bug24825_cut @@ -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 diff --git a/tests/bugs/modalg_5/bug24851 b/tests/bugs/modalg_5/bug24851 index 51ea4efefc..546e95ae15 100644 --- a/tests/bugs/modalg_5/bug24851 +++ b/tests/bugs/modalg_5/bug24851 @@ -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 diff --git a/tests/bugs/modalg_5/bug25043 b/tests/bugs/modalg_5/bug25043 index b605450e5b..36cc709d93 100644 --- a/tests/bugs/modalg_5/bug25043 +++ b/tests/bugs/modalg_5/bug25043 @@ -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" } diff --git a/tests/bugs/modalg_5/bug25163 b/tests/bugs/modalg_5/bug25163 index d45aef0bec..d3a27b8353 100644 --- a/tests/bugs/modalg_5/bug25163 +++ b/tests/bugs/modalg_5/bug25163 @@ -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 diff --git a/tests/bugs/modalg_5/bug25193 b/tests/bugs/modalg_5/bug25193 index d3e07d122b..60016e8f44 100755 --- a/tests/bugs/modalg_5/bug25193 +++ b/tests/bugs/modalg_5/bug25193 @@ -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 diff --git a/tests/bugs/modalg_5/bug25237 b/tests/bugs/modalg_5/bug25237 index a3e324da2b..818f581b19 100644 --- a/tests/bugs/modalg_5/bug25237 +++ b/tests/bugs/modalg_5/bug25237 @@ -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 diff --git a/tests/bugs/modalg_5/bug25263 b/tests/bugs/modalg_5/bug25263 index dada6b1869..de01c71d1b 100644 --- a/tests/bugs/modalg_5/bug25263 +++ b/tests/bugs/modalg_5/bug25263 @@ -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 diff --git a/tests/bugs/modalg_5/bug25292_11 b/tests/bugs/modalg_5/bug25292_11 index 1c667efb50..16038d3388 100644 --- a/tests/bugs/modalg_5/bug25292_11 +++ b/tests/bugs/modalg_5/bug25292_11 @@ -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 diff --git a/tests/bugs/modalg_5/bug25292_12 b/tests/bugs/modalg_5/bug25292_12 index dfc8dad4ef..d603d7e512 100644 --- a/tests/bugs/modalg_5/bug25292_12 +++ b/tests/bugs/modalg_5/bug25292_12 @@ -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 diff --git a/tests/bugs/modalg_5/bug25292_31 b/tests/bugs/modalg_5/bug25292_31 index ed1b9dac5e..482a52fb92 100644 --- a/tests/bugs/modalg_5/bug25292_31 +++ b/tests/bugs/modalg_5/bug25292_31 @@ -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 diff --git a/tests/bugs/modalg_5/bug25292_32 b/tests/bugs/modalg_5/bug25292_32 index 5dad932ed7..fa4492fe03 100644 --- a/tests/bugs/modalg_5/bug25292_32 +++ b/tests/bugs/modalg_5/bug25292_32 @@ -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 diff --git a/tests/bugs/modalg_5/bug25319_1 b/tests/bugs/modalg_5/bug25319_1 index 893fda7ca9..ea14adf850 100644 --- a/tests/bugs/modalg_5/bug25319_1 +++ b/tests/bugs/modalg_5/bug25319_1 @@ -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 "================" diff --git a/tests/bugs/modalg_5/bug25319_2 b/tests/bugs/modalg_5/bug25319_2 index 601d0f5435..4f39750d0c 100644 --- a/tests/bugs/modalg_5/bug25319_2 +++ b/tests/bugs/modalg_5/bug25319_2 @@ -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 "================" diff --git a/tests/bugs/modalg_5/bug25337_1 b/tests/bugs/modalg_5/bug25337_1 index 4d15b34ad8..6ff3f9c5e0 100644 --- a/tests/bugs/modalg_5/bug25337_1 +++ b/tests/bugs/modalg_5/bug25337_1 @@ -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 diff --git a/tests/bugs/modalg_5/bug25337_2 b/tests/bugs/modalg_5/bug25337_2 index 6351e020c0..36be0fd872 100644 --- a/tests/bugs/modalg_5/bug25337_2 +++ b/tests/bugs/modalg_5/bug25337_2 @@ -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 diff --git a/tests/bugs/modalg_5/bug25450_1 b/tests/bugs/modalg_5/bug25450_1 index 16a9f4826f..6fada1be7f 100644 --- a/tests/bugs/modalg_5/bug25450_1 +++ b/tests/bugs/modalg_5/bug25450_1 @@ -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 diff --git a/tests/bugs/modalg_5/bug25450_2 b/tests/bugs/modalg_5/bug25450_2 index fbac40d55c..61b22fd50b 100644 --- a/tests/bugs/modalg_5/bug25450_2 +++ b/tests/bugs/modalg_5/bug25450_2 @@ -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 diff --git a/tests/bugs/modalg_5/bug25614_common b/tests/bugs/modalg_5/bug25614_common index c1a2c273f8..42c5b195cc 100755 --- a/tests/bugs/modalg_5/bug25614_common +++ b/tests/bugs/modalg_5/bug25614_common @@ -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 diff --git a/tests/bugs/modalg_5/bug25614_cut b/tests/bugs/modalg_5/bug25614_cut index b8907e1b55..c321a580b2 100755 --- a/tests/bugs/modalg_5/bug25614_cut +++ b/tests/bugs/modalg_5/bug25614_cut @@ -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 diff --git a/tests/bugs/modalg_5/bug25614_cut21 b/tests/bugs/modalg_5/bug25614_cut21 index a825b460d6..f44c178228 100755 --- a/tests/bugs/modalg_5/bug25614_cut21 +++ b/tests/bugs/modalg_5/bug25614_cut21 @@ -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 diff --git a/tests/bugs/modalg_5/bug25625 b/tests/bugs/modalg_5/bug25625 index dcc82e2318..c78ba3699b 100644 --- a/tests/bugs/modalg_5/bug25625 +++ b/tests/bugs/modalg_5/bug25625 @@ -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 diff --git a/tests/bugs/modalg_5/bug25721 b/tests/bugs/modalg_5/bug25721 index 3c525a6258..8d52a802c7 100644 --- a/tests/bugs/modalg_5/bug25721 +++ b/tests/bugs/modalg_5/bug25721 @@ -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 diff --git a/tests/bugs/modalg_6/bug25937_2 b/tests/bugs/modalg_6/bug25937_2 index 039abf19ea..dae7aafd96 100755 --- a/tests/bugs/modalg_6/bug25937_2 +++ b/tests/bugs/modalg_6/bug25937_2 @@ -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" diff --git a/tests/bugs/modalg_6/bug26224 b/tests/bugs/modalg_6/bug26224 index 564f6ba177..a6d6078f8f 100755 --- a/tests/bugs/modalg_6/bug26224 +++ b/tests/bugs/modalg_6/bug26224 @@ -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 index 0000000000..8b0b3c0be0 --- /dev/null +++ b/tests/bugs/modalg_6/bug26565_1 @@ -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 index 0000000000..b8a6223ef0 --- /dev/null +++ b/tests/bugs/modalg_6/bug26565_2 @@ -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 index 0000000000..64ae202c0e --- /dev/null +++ b/tests/bugs/modalg_6/bug26565_3 @@ -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 index 0000000000..c18ab2ad09 --- /dev/null +++ b/tests/bugs/modalg_6/bug26565_4 @@ -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 index 0000000000..0607643e19 --- /dev/null +++ b/tests/bugs/modalg_6/bug26565_5 @@ -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 index 0000000000..7624b5189a --- /dev/null +++ b/tests/bugs/modalg_6/bug26565_6 @@ -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 index 0000000000..0a619f2880 --- /dev/null +++ b/tests/bugs/modalg_6/bug26565_7 @@ -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 index 0000000000..efe49fd9e8 --- /dev/null +++ b/tests/bugs/modalg_6/bug26565_8 @@ -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" +} diff --git a/tests/bugs/modalg_6/bug26582 b/tests/bugs/modalg_6/bug26582 index 5c29422e5b..d06d3c7f17 100755 --- a/tests/bugs/modalg_6/bug26582 +++ b/tests/bugs/modalg_6/bug26582 @@ -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 index 0000000000..eb8e62dde5 --- /dev/null +++ b/tests/bugs/modalg_6/bug26718 @@ -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 index 0000000000..ebafab7233 --- /dev/null +++ b/tests/bugs/modalg_6/bug26980 @@ -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 diff --git a/tests/bugs/moddata_3/bug23738 b/tests/bugs/moddata_3/bug23738 index 2e8fead91a..b6b8164f56 100644 --- a/tests/bugs/moddata_3/bug23738 +++ b/tests/bugs/moddata_3/bug23738 @@ -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 diff --git a/tests/bugs/moddata_3/bug24108 b/tests/bugs/moddata_3/bug24108 index 08ac992107..b082f005cc 100644 --- a/tests/bugs/moddata_3/bug24108 +++ b/tests/bugs/moddata_3/bug24108 @@ -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 diff --git a/tests/bugs/moddata_3/bug24108_2 b/tests/bugs/moddata_3/bug24108_2 index edb13d6d38..6692bba19e 100644 --- a/tests/bugs/moddata_3/bug24108_2 +++ b/tests/bugs/moddata_3/bug24108_2 @@ -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 -- 2.39.5