From 4414049faefd1b47f7847159b5e5ce5456e65da7 Mon Sep 17 00:00:00 2001 From: aml Date: Fri, 29 Jan 2016 09:11:46 +0300 Subject: [PATCH] 0027114: [Regression to 6.7] DistShapeShape does not find a solution edge-face Extrema Curve / Surface algorithm changed to perform more accurate search. test case bug25232_8 - improvement, one additional intersection point is detected now. test case bug23830 - normal behavior, position of extrema is changed. test case for original issue added. --- src/Extrema/Extrema_ExtCS.cxx | 9 +++++++-- src/Extrema/Extrema_GenExtCS.cxx | 2 +- tests/bugs/fclasses/bug27114 | 26 ++++++++++++++++++++++++++ tests/bugs/modalg_5/bug25232_8 | 6 +++--- tests/bugs/moddata_3/bug23830 | 2 +- 5 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 tests/bugs/fclasses/bug27114 diff --git a/src/Extrema/Extrema_ExtCS.cxx b/src/Extrema/Extrema_ExtCS.cxx index 3bc81ae49d..18f0d95f5b 100644 --- a/src/Extrema/Extrema_ExtCS.cxx +++ b/src/Extrema/Extrema_ExtCS.cxx @@ -187,7 +187,10 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C, } - + if (myS->IsUPeriodic()) + NbU = 13; + if (myS->IsVPeriodic()) + NbV = 13; Extrema_GenExtCS Ext(C, *myS, NbT, NbU, NbV, cfirst, clast, ufirst, ulast, vfirst, vlast, mytolC, mytolS); @@ -243,7 +246,9 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C, Ext.Perform(C, NbT, tmin, tmax, mytolC); // to avoid overflow } else { - if(myCtype == GeomAbs_Circle && NbT < 13) { + if((myCtype == GeomAbs_Circle && NbT < 13) || + (myCtype == GeomAbs_BSplineCurve && NbT < 13)) + { NbT = 13; } Ext.Perform(C, NbT, mytolC); diff --git a/src/Extrema/Extrema_GenExtCS.cxx b/src/Extrema/Extrema_GenExtCS.cxx index 07d309b51b..748677280b 100644 --- a/src/Extrema/Extrema_GenExtCS.cxx +++ b/src/Extrema/Extrema_GenExtCS.cxx @@ -205,7 +205,7 @@ void Extrema_GenExtCS::Perform (const Adaptor3d_Curve& C, TUVsup(3) = trimvsup; // Number of particles used in PSO algorithm (particle swarm optimization). - const Standard_Integer aNbParticles = 32; + const Standard_Integer aNbParticles = 48; math_PSOParticlesPool aParticles(aNbParticles, 3); diff --git a/tests/bugs/fclasses/bug27114 b/tests/bugs/fclasses/bug27114 new file mode 100644 index 0000000000..0e9e166524 --- /dev/null +++ b/tests/bugs/fclasses/bug27114 @@ -0,0 +1,26 @@ +puts "========" +puts "OCC27114" +puts "========" +puts "" +############################################## +# DistShapeShape gives not all solutions +# Correct result is 2 solutions +############################################## + +restore [locate_data_file bug27114.brep] aShape +explode aShape +set anInfo [distmini d aShape_1 aShape_2] + +# Check number of solutions +if { [llength $anInfo] != 9 } { + puts "ERROR: Incorrect number of solutions" +} else { + puts "OK: Two solutions is found" +} + +# Check extrema distance +set absTol 1.0e-10 +set relTol 0.001 +set aDist_Exp 0.0 +set aDist [dval d_val] +checkreal "Distance value check" $aDist $aDist_Exp $absTol $relTol \ No newline at end of file diff --git a/tests/bugs/modalg_5/bug25232_8 b/tests/bugs/modalg_5/bug25232_8 index 1398966532..27bdfece86 100644 --- a/tests/bugs/modalg_5/bug25232_8 +++ b/tests/bugs/modalg_5/bug25232_8 @@ -26,14 +26,14 @@ mkvolume result fcon3 fp set square 1706.51 -set nb_v_good 4 -set nb_e_good 5 +set nb_v_good 5 +set nb_e_good 6 set nb_w_good 2 set nb_f_good 2 set nb_sh_good 1 set nb_sol_good 1 set nb_compsol_good 0 set nb_compound_good 0 -set nb_shape_good 15 +set nb_shape_good 17 set 2dviewer 1 diff --git a/tests/bugs/moddata_3/bug23830 b/tests/bugs/moddata_3/bug23830 index 4f67c887f4..363dece168 100755 --- a/tests/bugs/moddata_3/bug23830 +++ b/tests/bugs/moddata_3/bug23830 @@ -18,7 +18,7 @@ foreach i ${Indices} { if { [isdraw ext_1] } { mkedge e ext_1 regexp {Mass +: +([-0-9.+eE]+)} [lprops e] full l - if {$l > 1e-12} { + if {$l > 2.5e-12} { puts "Error: invalid result" } renamevar ext_1 r_$i -- 2.39.5