0025504: Exception raised during projection curve on surface
authorazv <azv@opencascade.com>
Fri, 21 Nov 2014 12:35:44 +0000 (15:35 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 21 Nov 2014 12:36:40 +0000 (15:36 +0300)
Avoid moving of projected point to a boundary of surface

Test case for CR25504

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

index 24d1a6f..a832202 100644 (file)
@@ -92,13 +92,13 @@ ProjLib_PrjResolve::ProjLib_PrjResolve(const Adaptor3d_Curve& C,const Adaptor3d_
     ExtraU = Tol2d.X();
     ExtraV = Tol2d.Y();
 //  }
-  if (Abs(mySolution.X()-Inf.X()) < Tol2d.X()) mySolution.SetX(Inf.X());
-  if (Abs(mySolution.X()-Sup.X()) < Tol2d.X()) mySolution.SetX(Sup.X()); 
-  if (Abs(mySolution.Y()-Inf.Y()) < Tol2d.Y()) mySolution.SetY(Inf.Y());
-  if (Abs(mySolution.Y()-Sup.Y()) < Tol2d.Y()) mySolution.SetY(Sup.Y()); 
-  if (mySolution.X() < Inf.X() - ExtraU || 
+  if (mySolution.X() > Inf.X() - Tol2d.X() && mySolution.X() < Inf.X()) mySolution.SetX(Inf.X());
+  if (mySolution.X() > Sup.X() && mySolution.X() < Sup.X() + Tol2d.X()) mySolution.SetX(Sup.X()); 
+  if (mySolution.Y() > Inf.Y() - Tol2d.Y() && mySolution.Y() < Inf.Y()) mySolution.SetY(Inf.Y());
+  if (mySolution.Y() > Sup.Y() && mySolution.Y() < Sup.Y() + Tol2d.Y()) mySolution.SetY(Sup.Y()); 
+  if (mySolution.X() < Inf.X() - ExtraU ||
       mySolution.X() > Sup.X() + ExtraU ||
-      mySolution.Y() < Inf.Y() - ExtraV || 
+      mySolution.Y() < Inf.Y() - ExtraV ||
       mySolution.Y() > Sup.Y() + ExtraV) myDone = Standard_False;
   else if (FuncTol > 0) {
     math_Vector X(1,2,0.), FVal(1,2,0.);
diff --git a/tests/bugs/moddata_3/bug25504 b/tests/bugs/moddata_3/bug25504
new file mode 100644 (file)
index 0000000..cbc870c
--- /dev/null
@@ -0,0 +1,12 @@
+puts "================"
+puts "OCC25504"
+puts "================"
+puts ""
+#######################################################################
+# Exception raised during projection curve on surface
+#######################################################################
+
+restore [locate_data_file bug25504_surf.draw] s
+restore [locate_data_file bug25504_curve.draw] c
+
+project c2d c s