0025980: Wrong result obtained by projection algorithm.
authoraml <aml@opencascade.com>
Fri, 27 Mar 2015 12:32:10 +0000 (15:32 +0300)
committerapv <apv@opencascade.com>
Tue, 7 Apr 2015 15:41:53 +0000 (18:41 +0300)
Possibility of "projection failed" state to non-analytical and non-spline surfaces added.
Test-case for issue #25980

src/ProjLib/ProjLib_CompProjectedCurve.cxx
src/ProjLib/ProjLib_ProjectedCurve.cxx
tests/bugs/modalg_5/bug25980 [new file with mode: 0644]

index 37083ed..76520c7 100644 (file)
@@ -560,7 +560,6 @@ void ProjLib_CompProjectedCurve::Init()
   Standard_Boolean FromLastU=Standard_False;
 
   //new part (to discard far solutions)
-  //Method Extrema_ExtCS gives wrong result(ex. sphere and segment orthogonal to it)
   Standard_Real TolC = Precision::Confusion(), TolS = Precision::Confusion();
   Extrema_ExtCS CExt(myCurve->Curve(),
     mySurface->Surface(),
@@ -570,13 +569,16 @@ void ProjLib_CompProjectedCurve::Init()
   {
     // Search for the minimum solution
     Nend = CExt.NbExt();
-    if(myMaxDist > 0) 
+    if(myMaxDist > 0 &&
+       // Avoid usage of extrema result that can be wrong for extrusion
+       mySurface->GetType() != GeomAbs_SurfaceOfExtrusion)
     {
       Standard_Real min_val2;
       min_val2 = CExt.SquareDistance(1);
       for(i = 2; i <= Nend; i++)
-        if (CExt.SquareDistance(i) < min_val2) min_val2 = CExt.SquareDistance(i);  
-      if(min_val2 > myMaxDist * myMaxDist) return;
+        if (CExt.SquareDistance(i) < min_val2) min_val2 = CExt.SquareDistance(i);
+      if (min_val2 > myMaxDist * myMaxDist)
+        return;
     }
   }
   // end of new part
index 934ca7a..a446bad 100644 (file)
@@ -522,7 +522,7 @@ void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
           }
         }
 
-        ProjLib_CompProjectedCurve Projector(mySurface,myCurve, myTolerance, myTolerance);
+        ProjLib_CompProjectedCurve Projector(mySurface,myCurve, myTolerance, myTolerance, 100 * myTolerance);
         Handle(ProjLib_HCompProjectedCurve) HProjector = new ProjLib_HCompProjectedCurve();
         HProjector->Set(Projector);
 
@@ -537,7 +537,7 @@ void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
         }
         else 
         {
-          StdFail_NotDone::Raise("ProjLib CompProjectedCurve Not Done");
+          return;
         }
         // Approximons cette courbe algorithmique.
         Standard_Boolean Only3d = Standard_False;
diff --git a/tests/bugs/modalg_5/bug25980 b/tests/bugs/modalg_5/bug25980
new file mode 100644 (file)
index 0000000..5de305c
--- /dev/null
@@ -0,0 +1,16 @@
+puts "========"
+puts "OCC25980"
+puts "========"
+puts ""
+#################################################
+# Wrong result obtained by projection algorithm
+#################################################
+
+restore [locate_data_file c2t.draw] c
+restore [locate_data_file s1t.draw] s
+
+set bug_info [catch {project x c s}]
+
+if {$bug_info == 0} {
+  puts "ERROR: OCC25980 is reproduced."
+}