From 6f47090071a0b341e07956d421ae98050fbb4040 Mon Sep 17 00:00:00 2001 From: jgv Date: Tue, 6 Aug 2013 17:49:17 +0300 Subject: [PATCH] 0024103: Infinite loop in HLR algorithm on the customer's shape Points that are not "same parameter" are excluded from processing --- src/Contap/Contap_Contour.cxx | 21 +++++++++++++++++++++ tests/bugs/modalg_5/bug24103_1 | 24 ++++++++++++++++++++++++ tests/bugs/modalg_5/bug24103_2 | 24 ++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100755 tests/bugs/modalg_5/bug24103_1 create mode 100755 tests/bugs/modalg_5/bug24103_2 diff --git a/src/Contap/Contap_Contour.cxx b/src/Contap/Contap_Contour.cxx index 22cdbe0387..3dc2f0734b 100644 --- a/src/Contap/Contap_Contour.cxx +++ b/src/Contap/Contap_Contour.cxx @@ -44,6 +44,10 @@ #include #include +#include +#include +#include + #define Tolpetit 1.e-10 // pour dist au carre #define tole 5.e-6 @@ -535,6 +539,23 @@ static void ComputeTangency (const Contap_TheSearch& solrst, const Handle(Adaptor2d_HCurve2d)& thearc = PStart.Arc(); theparam = PStart.Parameter(); gp_Pnt2d Ptoproj=Contap_HCurve2dTool::Value(thearc,theparam); + + //jgv: for the issue 24103 to exclude points that are not same parameter: + //these points can be out of the surface's domain and lead to failure of Walking algorithm. + gp_Pnt PointFromSurf = Surf->Value(Ptoproj.X(), Ptoproj.Y()); + Handle(BRepAdaptor_HCurve2d) brhc = Handle(BRepAdaptor_HCurve2d)::DownCast(thearc); + TopoDS_Edge theedge = brhc->ChangeCurve2d().Edge(); + Standard_Real fpar, lpar; + Handle(Geom_Curve) thecurve = BRep_Tool::Curve(theedge, fpar, lpar); + if (!thecurve.IsNull()) + { + gp_Pnt PointFromEdge = thecurve->Value(theparam); + Standard_Real TolEdge = BRep_Tool::Tolerance(theedge); + if (PointFromSurf.Distance(PointFromEdge) > 2.*TolEdge) + continue; + } + ////////////////////////////////////////////////////////// + //-- lbr le 15 mai 97 //-- On elimine les points qui sont egalement present sur une restriction solution Standard_Boolean SurUneRestrictionSolution = Standard_False; diff --git a/tests/bugs/modalg_5/bug24103_1 b/tests/bugs/modalg_5/bug24103_1 new file mode 100755 index 0000000000..d599364f3d --- /dev/null +++ b/tests/bugs/modalg_5/bug24103_1 @@ -0,0 +1,24 @@ +puts "============" +puts "OCC24103" +puts "============" +puts "" +###################################################### +# Infinite loop in HLR algorithm on the customer's shape +###################################################### + +pload XDE + +smallview +right + +stepread [locate_data_file bug24100_REFLECT_CURVE_PART_5_SOL_ohne_Metadaten.stp] a * + +explode a_1 +donly a_1_1 +fit + +reflectlines result a_1_1 1 0 0 + +set length 4217.78 + +set only_screen_axo 1 diff --git a/tests/bugs/modalg_5/bug24103_2 b/tests/bugs/modalg_5/bug24103_2 new file mode 100755 index 0000000000..a889d8bef7 --- /dev/null +++ b/tests/bugs/modalg_5/bug24103_2 @@ -0,0 +1,24 @@ +puts "============" +puts "OCC24103" +puts "============" +puts "" +###################################################### +# Infinite loop in HLR algorithm on the customer's shape +###################################################### + +pload XDE + +smallview +top + +stepread [locate_data_file bug24100_REFLECT_CURVE_PART_5_SOL_ohne_Metadaten.stp] a * + +explode a_1 +donly a_1_1 +fit + +reflectlines result a_1_1 0 0 1 + +set length 6385.96 + +set only_screen_axo 1 -- 2.39.5