From 6ccc9c06eb6c26b4ed4d81663bf35fd00fe6db86 Mon Sep 17 00:00:00 2001 From: jgv Date: Tue, 6 Aug 2013 17:06:10 +0400 Subject: [PATCH] 0024103: Infinite loop in HLR algorithm on the customer's shape --- src/Contap/Contap_ContourGen_2.gxx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Contap/Contap_ContourGen_2.gxx b/src/Contap/Contap_ContourGen_2.gxx index 52fbbd3e9f..a557d4c271 100755 --- a/src/Contap/Contap_ContourGen_2.gxx +++ b/src/Contap/Contap_ContourGen_2.gxx @@ -36,9 +36,12 @@ #include #include - #include +#include +#include +#include + #define tole 5.e-6 @@ -385,6 +388,22 @@ static void ComputeTangency (const Contap_TheSearch& solrst, const TheArc& thearc = PStart.Arc(); theparam = PStart.Parameter(); gp_Pnt2d Ptoproj=TheArcTool::Value(thearc,theparam); + + //jgv: purge of bad points (points that are out of domain) + gp_Pnt PointFromSurf = TheSurfaceTool::Value(Surf, Ptoproj.X(), Ptoproj.Y()); + Handle(BRepAdaptor_HCurve2d) brhc = Handle(BRepAdaptor_HCurve2d)::DownCast(thearc); + TopoDS_Edge theedge = ((BRepAdaptor_Curve2d *)&(brhc->Curve2d()))->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; -- 2.39.5