From b20eeb13fe4b6995467ba98705eddde931091ba5 Mon Sep 17 00:00:00 2001 From: emv Date: Thu, 4 Jul 2013 14:21:44 +0400 Subject: [PATCH] 0024037: Wrong result done by General Fuse algorithm Do not calculate the angle between same edges in WireSplitter algorithm and set it to 2*PI. Adding test cases for this fix Correction of test case --- src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx | 42 ++++++++++++++------------ tests/bugs/modalg_5/bug24037_1 | 33 ++++++++++++++++++++ tests/bugs/modalg_5/bug24037_2 | 38 +++++++++++++++++++++++ 3 files changed, 94 insertions(+), 19 deletions(-) create mode 100755 tests/bugs/modalg_5/bug24037_1 create mode 100755 tests/bugs/modalg_5/bug24037_2 diff --git a/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx b/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx index ea300d0dd9..71b7af0636 100644 --- a/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx +++ b/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx @@ -342,12 +342,13 @@ void Path (const GeomAdaptor_Surface& aGAS, Standard_Integer i, j, aNb, aNbj; Standard_Real aTol, anAngleIn, anAngleOut, anAngle, aMinAngle; Standard_Real aTol2D, aTol2D2; - Standard_Real aTol2, aD2; + Standard_Real aTol2, aD2, aTwoPI; Standard_Boolean anIsSameV2d, anIsSameV, anIsFound, anIsOut, anIsNotPassed; TopoDS_Vertex aVb; TopoDS_Edge aEOutb; BOPAlgo_ListIteratorOfListOfEdgeInfo anIt; // + aTwoPI = M_PI + M_PI; aTol=1.e-7; // // append block @@ -527,26 +528,29 @@ void Path (const GeomAdaptor_Surface& aGAS, break; } // - // Look for minimal angle and make the choice. - gp_Pnt2d aP2Dx; - // - aP2Dx=Coord2dVf(aE, myFace); - // - aD2=aP2Dx.SquareDistance(aPb); - if (aD2 > aTol2D2){ - continue; - } - // - // - anAngleOut=anEI.Angle(); - // - if(bRecomputeAngle) { - if(aCurIndexE <= aRecomputedAngles.Length()) { - anAngleOut = aRecomputedAngles.Value(aCurIndexE); + if (aE.IsSame(aEOuta)) { + anAngle = aTwoPI; + } else { + // Look for minimal angle and make the choice. + gp_Pnt2d aP2Dx; + // + aP2Dx=Coord2dVf(aE, myFace); + // + aD2=aP2Dx.SquareDistance(aPb); + if (aD2 > aTol2D2){ + continue; + } + // + // + anAngleOut=anEI.Angle(); + // + if(bRecomputeAngle) { + if(aCurIndexE <= aRecomputedAngles.Length()) { + anAngleOut = aRecomputedAngles.Value(aCurIndexE); + } } + anAngle=ClockWiseAngle(anAngleIn, anAngleOut); } - - anAngle=ClockWiseAngle(anAngleIn, anAngleOut); if (anAngle < aMinAngle) { aMinAngle=anAngle; pEdgeInfo=&anEI; diff --git a/tests/bugs/modalg_5/bug24037_1 b/tests/bugs/modalg_5/bug24037_1 new file mode 100755 index 0000000000..5fb33a0439 --- /dev/null +++ b/tests/bugs/modalg_5/bug24037_1 @@ -0,0 +1,33 @@ +puts "================" +puts "OCC24037" +puts "================" +puts "" +####################################################################### +# Wrong result done by General Fuse algorithm +####################################################################### + +restore [locate_data_file bug24037_coude_sain.brep] b1 +restore [locate_data_file bug24037_plans_bloc.brep] b2 + +bclearobjects +bcleartools +baddcompound b1 +baddcompound b2 +bfillds +bbuild result + +nbshapes result -t +#the number of solids should be 12 instead of 2 + +set nbsh_t 1 +set nb_v_good 52 +set nb_e_good 105 +set nb_w_good 76 +set nb_f_good 70 +set nb_sh_good 12 +set nb_sol_good 12 +set nb_compsol_good 0 +set nb_compound_good 1 +set nb_shape_good 328 + +set 3dviewer 1 diff --git a/tests/bugs/modalg_5/bug24037_2 b/tests/bugs/modalg_5/bug24037_2 new file mode 100755 index 0000000000..48c95fdc79 --- /dev/null +++ b/tests/bugs/modalg_5/bug24037_2 @@ -0,0 +1,38 @@ +puts "================" +puts "OCC24037" +puts "================" +puts "" +####################################################################### +# Wrong result done by General Fuse algorithm +####################################################################### + +restore [locate_data_file bug24037_coude_sain.brep] b1 +restore [locate_data_file bug24037_plans_bloc.brep] b2 + +explode b1 so +copy b1_1 b1 +explode b2 f +copy b2_3 b2 +don b1 b2 +bclearobjects +bcleartools +baddobjects b1 +baddtools b2 +bfillds +bbuild result + +nbshapes result -t +#the number of solids should be 2 instead of 1 + +set nbsh_t 1 +set nb_v_good 16 +set nb_e_good 24 +set nb_w_good 13 +set nb_f_good 12 +set nb_sh_good 2 +set nb_sol_good 2 +set nb_compsol_good 0 +set nb_compound_good 1 +set nb_shape_good 70 + +set 3dviewer 1 -- 2.39.5