0025380: Intersection curve cannot reach boundary of surface
authoraml <aml@opencascade.com>
Thu, 30 Oct 2014 09:04:27 +0000 (12:04 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 30 Oct 2014 09:05:56 +0000 (12:05 +0300)
Changed next point computation in IntWalk_PWalker.cxx.
Now trying to walk over another isoline if new point is too close to previous.

Test case for issue CR25380

src/IntWalk/IntWalk_PWalking.cxx
tests/bugs/modalg_5/bug25380 [new file with mode: 0755]

index 17d1c13..9834a6a 100644 (file)
@@ -783,7 +783,43 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
     SvParam[2]=Param(3);
     SvParam[3]=Param(4);
     //
-    ChoixIso= myIntersectionOn2S.Perform(Param, Rsnld, ChoixIso);                  
+    Standard_Integer aTryNumber = 0;
+    Standard_Real    isBadPoint = Standard_False;
+    IntImp_ConstIsoparametric aBestIso = ChoixIso;
+    do
+    {
+      isBadPoint = Standard_False;
+
+      ChoixIso= myIntersectionOn2S.Perform(Param, Rsnld, aBestIso);
+
+      if (myIntersectionOn2S.IsDone() && !myIntersectionOn2S.IsEmpty())
+      {
+        Standard_Real aNewPnt[4], anAbsParamDist[4];
+        myIntersectionOn2S.Point().Parameters(aNewPnt[0], aNewPnt[1], aNewPnt[2], aNewPnt[3]);
+
+        if (aNewPnt[0] < u1min || aNewPnt[0] > u1max ||
+            aNewPnt[1] < v1min || aNewPnt[1] > v1max ||
+            aNewPnt[2] < u2min || aNewPnt[2] > u2max ||
+            aNewPnt[3] < v2min || aNewPnt[3] > v2max)
+        {
+          break; // Out of borders, handle this later.
+        }
+
+        anAbsParamDist[0] = Abs(Param(1) - dP1 - aNewPnt[0]);
+        anAbsParamDist[1] = Abs(Param(2) - dP2 - aNewPnt[1]);
+        anAbsParamDist[2] = Abs(Param(3) - dP3 - aNewPnt[2]);
+        anAbsParamDist[3] = Abs(Param(4) - dP4 - aNewPnt[3]);
+        if (anAbsParamDist[0] < ResoU1 &&
+            anAbsParamDist[1] < ResoV1 &&
+            anAbsParamDist[2] < ResoU2 &&
+            anAbsParamDist[3] < ResoV2 &&
+            Status != IntWalk_PasTropGrand)
+        {
+          isBadPoint = Standard_True;
+          aBestIso = IntImp_ConstIsoparametric((aBestIso + 1) % 4);
+        }
+      }
+    } while (isBadPoint && ++aTryNumber <= 4);
     //
     if (!myIntersectionOn2S.IsDone())
     {
diff --git a/tests/bugs/modalg_5/bug25380 b/tests/bugs/modalg_5/bug25380
new file mode 100755 (executable)
index 0000000..f472350
--- /dev/null
@@ -0,0 +1,32 @@
+puts "================"
+puts "OCC25380"
+puts "================"
+puts ""
+#######################################################################
+# Intersection curve cannot reach boundary of surface
+#######################################################################
+
+restore [locate_data_file bug25380_b1.brep] b1
+restore [locate_data_file bug25380_b2.brep] b2
+
+set log [bopcurves b1 b2]
+
+regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
+set MaxTol 1.e-11
+if {${Toler} > ${MaxTol}} {
+  puts "Error: Tolerance is too big!"
+}
+
+regexp {The length c_1 is ([-0-9.+eE]+)} [length c_1] full Curve_Length
+
+set expected_length 1.614
+set tol_abs_length 1.e-3
+set tol_rel_length 0.01
+checkreal "Curve length" ${Curve_Length} ${expected_length} ${tol_abs_length} ${tol_rel_length}
+
+smallview
+donly c_1 b1
+fit
+display b2
+
+set only_screen_axo 1