0024032: An exception raised during projection of the curve on the surface
authorjgv <jgv@opencascade.com>
Fri, 12 Jul 2013 08:39:06 +0000 (12:39 +0400)
committerjgv <jgv@opencascade.com>
Fri, 12 Jul 2013 08:39:06 +0000 (12:39 +0400)
Added test case bugs/moddata_3/bug24032

src/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx
tests/bugs/moddata_3/bug24032 [new file with mode: 0644]

index 207a523..7f6bc8f 100755 (executable)
@@ -868,6 +868,26 @@ Handle(Adaptor2d_HCurve2d)
     
     Curve->D0(Param.Value(1), pntproj) ;
     Extrema_ExtPS  aExtPS(pntproj, Surf->Surface(), TolU, TolV) ;
+    Standard_Real aMinSqDist = RealLast();
+    if (aExtPS.IsDone())
+    {
+      for (i = 1; i <= aExtPS.NbExt(); i++)
+      {
+        Standard_Real aSqDist = aExtPS.SquareDistance(i);
+        if (aSqDist < aMinSqDist)
+          aMinSqDist = aSqDist;
+      }
+    }
+    if (aMinSqDist > DistTol3d * DistTol3d) //try to project with less tolerance
+    {
+      TolU = Min(TolU, Precision::PConfusion());
+      TolV = Min(TolV, Precision::PConfusion());
+      aExtPS.Initialize(Surf->Surface(),
+                        Surf->Surface().FirstUParameter(), Surf->Surface().LastUParameter(), 
+                        Surf->Surface().FirstVParameter(), Surf->Surface().LastVParameter(),
+                        TolU, TolV);
+      aExtPS.Perform(pntproj);
+    }
 
     if( aExtPS.IsDone() && aExtPS.NbExt() >= 1 ) {
 
diff --git a/tests/bugs/moddata_3/bug24032 b/tests/bugs/moddata_3/bug24032
new file mode 100644 (file)
index 0000000..1360de4
--- /dev/null
@@ -0,0 +1,17 @@
+puts "========"
+puts "OCC24032"
+puts "========"
+puts ""
+#######################################################################
+# An exception raised during projection of the curve on the surface
+#######################################################################
+
+restore [locate_data_file bug24032_f.brep] f
+restore [locate_data_file bug24032_c.draw] c
+
+mksurface s f
+project c2d c s
+
+v2d
+2dfit
+set only_screen_axo 1