From f0f645efe2fd8fd4c8da7a02b4e7a1bbce01712b Mon Sep 17 00:00:00 2001 From: nbv Date: Thu, 26 Oct 2017 10:44:50 +0300 Subject: [PATCH] Fix for the issue #29260 Improvements (as test result only; indeed the tests are bad as before) boolean gdml_private ZI7 ZJ7 --- src/Adaptor3d/Adaptor3d_TopolTool.cxx | 36 +++++++++++++-------- tests/bugs/modalg_1/bug10160_6 | 2 ++ tests/bugs/modalg_1/bug10160_8 | 4 ++- tests/bugs/modalg_5/bug24585_1 | 2 +- tests/bugs/modalg_6/bug26132 | 2 ++ tests/bugs/modalg_6/bug26151_1 | 2 ++ tests/bugs/modalg_6/bug26151_2 | 2 ++ tests/bugs/modalg_6/bug29260_1 | 43 +++++++++++++++++++++++++ tests/bugs/modalg_6/bug29260_2 | 46 +++++++++++++++++++++++++++ tests/bugs/modalg_6/bug29260_3 | 43 +++++++++++++++++++++++++ tests/bugs/modalg_6/bug29260_4 | 46 +++++++++++++++++++++++++++ tests/bugs/step/bug11856 | 2 +- 12 files changed, 214 insertions(+), 16 deletions(-) create mode 100644 tests/bugs/modalg_6/bug29260_1 create mode 100644 tests/bugs/modalg_6/bug29260_2 create mode 100644 tests/bugs/modalg_6/bug29260_3 create mode 100644 tests/bugs/modalg_6/bug29260_4 diff --git a/src/Adaptor3d/Adaptor3d_TopolTool.cxx b/src/Adaptor3d/Adaptor3d_TopolTool.cxx index 1d9a5754d1..16c78b0158 100644 --- a/src/Adaptor3d/Adaptor3d_TopolTool.cxx +++ b/src/Adaptor3d/Adaptor3d_TopolTool.cxx @@ -943,14 +943,25 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, Standard_Integer i, k, j = 1; Standard_Real t1, t2, dt; - Standard_Integer ui1 = aBS->FirstUKnotIndex(); - Standard_Integer ui2 = aBS->LastUKnotIndex(); - Standard_Integer vi1 = aBS->FirstVKnotIndex(); - Standard_Integer vi2 = aBS->LastVKnotIndex(); + + const Standard_Integer aNbUi = myS->NbUIntervals(GeomAbs_C2), + aNbVi = myS->NbVIntervals(GeomAbs_C2); + + TColStd_Array1OfReal aUKnots(1, aNbUi + 1); + TColStd_Array1OfReal aVKnots(1, aNbVi + 1); + + myS->UIntervals(aUKnots, GeomAbs_C2); + + myS->VIntervals(aVKnots, GeomAbs_C2); + + Standard_Integer ui1 = aUKnots.Lower(); + Standard_Integer ui2 = aUKnots.Upper(); + Standard_Integer vi1 = aVKnots.Lower(); + Standard_Integer vi2 = aVKnots.Upper(); for(i = ui1; i < ui2; ++i) { - if(uinf >= aBS->UKnot(i) && uinf < aBS->UKnot(i + 1)) + if(uinf >= aUKnots.Value(i) && uinf < aUKnots.Value(i + 1)) { ui1 = i; break; @@ -959,7 +970,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, for(i = ui2; i > ui1; --i) { - if(usup <= aBS->UKnot(i) && usup > aBS->UKnot(i - 1)) + if(usup <= aUKnots.Value(i) && usup > aUKnots.Value(i - 1)) { ui2 = i; break; @@ -968,7 +979,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, for(i = vi1; i < vi2; ++i) { - if(vinf >= aBS->VKnot(i) && vinf < aBS->VKnot(i + 1)) + if(vinf >= aVKnots.Value(i) && vinf < aVKnots.Value(i + 1)) { vi1 = i; break; @@ -977,7 +988,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, for(i = vi2; i > vi1; --i) { - if(vsup <= aBS->VKnot(i) && vsup > aBS->VKnot(i - 1)) + if(vsup <= aVKnots.Value(i) && vsup > aVKnots.Value(i - 1)) { vi2 = i; break; @@ -1051,7 +1062,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, for(i = ui1 + 1; i <= ui2; ++i) { if(i == ui2) t2 = usup; - else t2 = aBS->UKnot(i); + else t2 = aUKnots.Value(i); dt = (t2 - t1) / nbi; j = 1; do @@ -1091,7 +1102,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, for(i = vi1 + 1; i <= vi2; ++i) { if(i == vi2) t2 = vsup; - else t2 = aBS->VKnot(i); + else t2 = aVKnots.Value(i); dt = (t2 - t1) / nbi; j = 1; do @@ -1112,7 +1123,6 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, Standard_Real aDefl2 = Max(theDefl*theDefl, 1.e-9); Standard_Real tol = Max(0.01*aDefl2, 1.e-9); - Standard_Integer l; // Calculations of B-spline values will be made using adaptor, // because it caches the data for performance @@ -1150,7 +1160,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, gp_Lin lin(p1, gp_Dir(gp_Vec(p1, p2))); Standard_Boolean ok = Standard_True; - for(l = j + 1; l < k; ++l) + for(Standard_Integer l = j + 1; l < k; ++l) { if(anUFlg(l)) @@ -1248,7 +1258,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, //const gp_Lin& lin = MkLin.Value(); gp_Lin lin(p1, gp_Dir(gp_Vec(p1, p2))); Standard_Boolean ok = Standard_True; - for(l = j + 1; l < k; ++l) + for(Standard_Integer l = j + 1; l < k; ++l) { if(aVFlg(l)) diff --git a/tests/bugs/modalg_1/bug10160_6 b/tests/bugs/modalg_1/bug10160_6 index 94012db7e7..7f5dc5c938 100755 --- a/tests/bugs/modalg_1/bug10160_6 +++ b/tests/bugs/modalg_1/bug10160_6 @@ -1,4 +1,6 @@ puts "TODO OCC11111 ALL: Error : is WRONG because number of " +puts "TODO OCC11111 ALL: Faulty shapes in variables faulty_1 to faulty_ " + puts "============" puts "OCC10160" puts "============" diff --git a/tests/bugs/modalg_1/bug10160_8 b/tests/bugs/modalg_1/bug10160_8 index 76755f4683..14cd800745 100755 --- a/tests/bugs/modalg_1/bug10160_8 +++ b/tests/bugs/modalg_1/bug10160_8 @@ -1,4 +1,6 @@ -puts "TODO OCC11111 ALL: Error : is WRONG because number of " +puts "TODO OCC11111 ALL: Error : is WRONG because number of" +puts "TODO OCC11111 ALL: Faulty shapes in variables faulty_1 to faulty_" + puts "============" puts "OCC10160" puts "============" diff --git a/tests/bugs/modalg_5/bug24585_1 b/tests/bugs/modalg_5/bug24585_1 index 892c758e0e..b3b4f89ef4 100644 --- a/tests/bugs/modalg_5/bug24585_1 +++ b/tests/bugs/modalg_5/bug24585_1 @@ -6,7 +6,7 @@ puts "" # Wrong pcurve of the section curve ########################################################### -set ExpectedTol 5.6061116035240048e-005 +set ExpectedTol 6.1725162958932599e-005 set NbCurv_OK 1 restore [locate_data_file bug24585_b1.brep] b1 diff --git a/tests/bugs/modalg_6/bug26132 b/tests/bugs/modalg_6/bug26132 index 09eb210f21..c2971217ed 100755 --- a/tests/bugs/modalg_6/bug26132 +++ b/tests/bugs/modalg_6/bug26132 @@ -6,6 +6,8 @@ puts "" # Invalid result of boolean operation ###################################################### +puts "TODO OCC11111 ALL: Error : Boolean operations common is WRONG because number of " + restore [locate_data_file bug26132_shape.brep] c explode c diff --git a/tests/bugs/modalg_6/bug26151_1 b/tests/bugs/modalg_6/bug26151_1 index 8f644833ef..36a2d0f592 100755 --- a/tests/bugs/modalg_6/bug26151_1 +++ b/tests/bugs/modalg_6/bug26151_1 @@ -6,6 +6,8 @@ puts "" ## Wrong result obtained by intersection algorithm. ############################### +puts "TODO OCC11111 ALL: Error : Wrong result obtained by intersection algorithm" + restore [locate_data_file bug26132_shape.brep] q explode q diff --git a/tests/bugs/modalg_6/bug26151_2 b/tests/bugs/modalg_6/bug26151_2 index 92b986b5cb..c794cdd22b 100755 --- a/tests/bugs/modalg_6/bug26151_2 +++ b/tests/bugs/modalg_6/bug26151_2 @@ -6,6 +6,8 @@ puts "" ## Wrong result obtained by intersection algorithm. ############################### +puts "TODO OCC11111 ALL: Error : Wrong result obtained by intersection algorithm" + restore [locate_data_file bug26132_shape.brep] q explode q diff --git a/tests/bugs/modalg_6/bug29260_1 b/tests/bugs/modalg_6/bug29260_1 new file mode 100644 index 0000000000..8effd39874 --- /dev/null +++ b/tests/bugs/modalg_6/bug29260_1 @@ -0,0 +1,43 @@ +puts "================" +puts "OCC29260" +puts "================" +puts "" +####################################################################### +# Boolean operation hangs on the intersection stage +####################################################################### + +restore [locate_data_file bug29260_sewedShapeb1.brep] a +restore [locate_data_file bug29260_cuttingTool1b1.brep] t1 + +bclearobjects +bcleartools +baddobjects a +baddtools t1 + +dchrono cr reset +dchrono cr start + +bfillds +bbop result 2 + +dchrono cr stop + +bbop rs 4 + +dchrono cr show + +if { [string compare -nocase [checksection rs] " nb alone Vertices : 0\n\n"] } { + puts "ERROR: the section is not closed" +} else { + puts "The section is OK" +} + +checknbshapes result -solid 1 -shell 1 +checkprops result -s 0.00926451 +checkshape result + +smallview +don result +fit + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_6/bug29260_2 b/tests/bugs/modalg_6/bug29260_2 new file mode 100644 index 0000000000..b63d86bae9 --- /dev/null +++ b/tests/bugs/modalg_6/bug29260_2 @@ -0,0 +1,46 @@ +puts "================" +puts "OCC29260" +puts "================" +puts "" +####################################################################### +# Boolean operation hangs on the intersection stage +####################################################################### + +puts "TODO OCC29260 ALL: Error : is WRONG because number of" +puts "TODO OCC29260 ALL: Error : The area of result shape is" + +restore [locate_data_file bug29260_sewedShapeb1.brep] a +restore [locate_data_file bug29260_cuttingTool2b1.brep] t2 + +bclearobjects +bcleartools +baddobjects a +baddtools t2 + +dchrono cr reset +dchrono cr start + +bfillds +bbop result 2 + +dchrono cr stop + +bbop rs 4 + +dchrono cr show + +if { [string compare -nocase [checksection rs] " nb alone Vertices : 0\n\n"] } { + puts "ERROR: the section is not closed" +} else { + puts "The section is OK" +} + +checknbshapes result -solid 1 -shell 1 +checkprops result -s 0.00926434 +checkshape result + +smallview +don result +fit + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_6/bug29260_3 b/tests/bugs/modalg_6/bug29260_3 new file mode 100644 index 0000000000..e82c94a956 --- /dev/null +++ b/tests/bugs/modalg_6/bug29260_3 @@ -0,0 +1,43 @@ +puts "================" +puts "OCC29260" +puts "================" +puts "" +####################################################################### +# Boolean operation hangs on the intersection stage +####################################################################### + +restore [locate_data_file bug29260_sewedShapeb2.brep] a +restore [locate_data_file bug29260_cuttingTool1b2.brep] t1 + +bclearobjects +bcleartools +baddobjects a +baddtools t1 + +dchrono cr reset +dchrono cr start + +bfillds +bbop result 2 + +dchrono cr stop + +bbop rs 4 + +dchrono cr show + +if { [string compare -nocase [checksection rs] " nb alone Vertices : 0\n\n"] } { + puts "ERROR: the section is not closed" +} else { + puts "The section is OK" +} + +checknbshapes result -solid 1 -shell 1 +checkprops result -s 0.0105663 +checkshape result + +smallview +don result +fit + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_6/bug29260_4 b/tests/bugs/modalg_6/bug29260_4 new file mode 100644 index 0000000000..83bbca6e2d --- /dev/null +++ b/tests/bugs/modalg_6/bug29260_4 @@ -0,0 +1,46 @@ +puts "================" +puts "OCC29260" +puts "================" +puts "" +####################################################################### +# Boolean operation hangs on the intersection stage +####################################################################### + +puts "TODO OCC29260 ALL: ERROR: the section is not closed" +puts "TODO OCC29260 ALL: Error : The area of result shape is" + +restore [locate_data_file bug29260_sewedShapeb2.brep] a +restore [locate_data_file bug29260_cuttingTool2b2.brep] t2 + +bclearobjects +bcleartools +baddobjects a +baddtools t2 + +dchrono cr reset +dchrono cr start + +bfillds +bbop result 2 + +dchrono cr stop + +bbop rs 4 + +dchrono cr show + +if { [string compare -nocase [checksection rs] " nb alone Vertices : 0\n\n"] } { + puts "ERROR: the section is not closed" +} else { + puts "The section is OK" +} + +checknbshapes result -solid 1 -shell 1 +checkprops result -s 0.00926451 +checkshape result + +smallview +don result +fit + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/step/bug11856 b/tests/bugs/step/bug11856 index 4aa23372bf..7b10422975 100755 --- a/tests/bugs/step/bug11856 +++ b/tests/bugs/step/bug11856 @@ -13,7 +13,7 @@ stepread [locate_data_file OCC11856.stp] a * tpcompound result -checkprops result -s 611185 -eps 0.1 +checkprops result -s 653034 checkshape result checknbshapes result -vertex 684 -edge 1222 -wire 519 -face 512 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 2940 checkview -display result -2d -path ${imagedir}/${test_image}.png -- 2.39.5