]> OCCT Git - occt-copy.git/commitdiff
0024103: Infinite loop in HLR algorithm on the customer's shape CR24103_2
authorjgv <jgv@opencascade.com>
Tue, 6 Aug 2013 14:49:17 +0000 (17:49 +0300)
committerabv <abv@opencascade.com>
Tue, 16 Feb 2016 04:49:53 +0000 (07:49 +0300)
Points that are not "same parameter" are excluded from processing

src/Contap/Contap_Contour.cxx
tests/bugs/modalg_5/bug24103_1 [new file with mode: 0755]
tests/bugs/modalg_5/bug24103_2 [new file with mode: 0755]

index 22cdbe038790b043d1e410b82ebae694ff00c7f3..3dc2f0734b8ea7d5b07be49e4c38adb2eb9ccb7a 100644 (file)
 #include <TColStd_Array1OfInteger.hxx>
 #include <TopTrans_CurveTransition.hxx>
 
+#include <BRepAdaptor_HCurve2d.hxx>
+#include <Geom_Curve.hxx>
+#include <BRep_Tool.hxx>
+
 #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 (executable)
index 0000000..d599364
--- /dev/null
@@ -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 (executable)
index 0000000..a889d8b
--- /dev/null
@@ -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