]> OCCT Git - occt-copy.git/commitdiff
0024103: Infinite loop in HLR algorithm on the customer's shape
authorjgv <jgv@opencascade.com>
Tue, 6 Aug 2013 13:06:10 +0000 (17:06 +0400)
committerjgv <jgv@opencascade.com>
Tue, 6 Aug 2013 13:06:10 +0000 (17:06 +0400)
src/Contap/Contap_ContourGen_2.gxx

index 52fbbd3e9f396a82ee94b303ec79e6cdc6bc3aba..a557d4c2719936c66bf23dc55fa3a098ef73c982 100755 (executable)
 #include <BndLib_AddSurface.hxx>
 #include <Bnd_Box.hxx>
 
-
 #include <ElSLib.hxx>
 
+#include <BRepAdaptor_HCurve2d.hxx>
+#include <Geom_Curve.hxx>
+#include <BRep_Tool.hxx>
+
 #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;