0025193: Bad Intersection curveobtained by Surface/Surface Intersection Algorithm.
authorjgv <jgv@opencascade.com>
Thu, 11 Dec 2014 13:34:23 +0000 (16:34 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 11 Dec 2014 13:36:42 +0000 (16:36 +0300)
Test case for issue CR25193

Correction of test case for issue CR25193

src/IntPatch/IntPatch_WLine.cxx
src/IntWalk/IntWalk_PWalking.cxx
tests/boolean/bsection/R9
tests/bugs/modalg_5/bug25193 [new file with mode: 0755]
tests/bugs/moddata_1/bug13

index 181639e..28a313f 100644 (file)
@@ -119,8 +119,8 @@ static void RecadreMemePeriode(IntSurf_PntOn2S& POn2S,const IntSurf_PntOn2S& Ref
   POn2S.SetValue(u1,v1,u2,v2);
 }
 
-static Standard_Boolean CompareVertexAndPoint(const gp_Pnt& V,const gp_Pnt& P,const Standard_Real& Tol) { 
-  return(V.Distance(P)<=Tol);
+static Standard_Boolean CompareVertexAndPoint(const gp_Pnt& V, const gp_Pnt& P, const Standard_Real& Tol) { 
+  return (V.Distance(P) <= Tol);
 }
 
 void IntPatch_WLine::SetPeriod(const Standard_Real pu1,
@@ -770,8 +770,9 @@ void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol,
     for(i=1;
        (vtxfound==Standard_False) && (i<=nbvtx);i++) { 
       const IntPatch_Point&  V = svtx.Value(i);
-      Standard_Real vTol = V.Tolerance();
-      if(CompareVertexAndPoint(V.Value(),curv->Value(1).Value(),vTol)) { 
+      //jgv: to avoid loops
+      //Standard_Real vTol = V.Tolerance();
+      if(CompareVertexAndPoint(V.Value(), curv->Value(1).Value(), Precision::Confusion()/*vTol*/)) { 
        vtx = V;
        vtx.SetParameters(pu1,pv1,pu2,pv2);
        vtxfound = Standard_True;
@@ -794,8 +795,9 @@ void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol,
     for(i=1;
        (vtxfound==Standard_False) && (i<=nbvtx);i++) { 
       const IntPatch_Point&  V = svtx.Value(i);
-      Standard_Real vTol = V.Tolerance();
-      if(CompareVertexAndPoint(V.Value(),curv->Value(nbponline).Value(),vTol)) { 
+      //jgv: to avoid loops
+      //Standard_Real vTol = V.Tolerance();
+      if(CompareVertexAndPoint(V.Value(), curv->Value(nbponline).Value(), Precision::Confusion()/*vTol*/)) { 
        vtx = V;
        vtx.SetParameters(pu1,pv1,pu2,pv2);
        vtxfound = Standard_True;
index a5b21df..ffdcc00 100644 (file)
@@ -1328,6 +1328,24 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
                       bFlag2=u2 >= Um2-aTol2D && v2 >= Vm2-aTol2D && u2 <= UM2+aTol2D && v2 <= VM2+aTol2D;
                       if (bFlag1 && bFlag2)
                       {
+                        if (line->NbPoints() > 1)
+                        {
+                          IntSurf_PntOn2S prevprevPoint = line->Value(line->NbPoints()-1);
+                          Standard_Real ppU1, ppV1, ppU2, ppV2;
+                          prevprevPoint.Parameters(ppU1, ppV1, ppU2, ppV2);
+                          Standard_Real pU1, pV1, pU2, pV2;
+                          previousPointSave.Parameters(pU1, pV1, pU2, pV2);
+                          gp_Vec2d V1onS1(gp_Pnt2d(ppU1, ppV1), gp_Pnt2d(pU1, pV1));
+                          gp_Vec2d V2onS1(gp_Pnt2d(pU1, pV1), gp_Pnt2d(u1, v1));
+                          gp_Vec2d V1onS2(gp_Pnt2d(ppU2, ppV2), gp_Pnt2d(pU2, pV2));
+                          gp_Vec2d V2onS2(gp_Pnt2d(pU2, pV2), gp_Pnt2d(u2, v2));
+                          if (V1onS1 * V2onS1 < 0. ||
+                              V1onS2 * V2onS2 < 0.)
+                          {
+                            Arrive = Standard_True;
+                            break;
+                          }
+                        }
                         /*
                         if(u1 <= UM1  && u2 <= UM2 && v1 <= VM1 &&
                         v2 <= VM2  && u1 >= Um1 && u2 >= Um2 &&
index 4e1312c..3d3a76a 100644 (file)
@@ -7,4 +7,4 @@ restore [locate_data_file buc60462b.brep] b
 
 bsection result a b
 
-set length 265.954
+set length 261.262
diff --git a/tests/bugs/modalg_5/bug25193 b/tests/bugs/modalg_5/bug25193
new file mode 100755 (executable)
index 0000000..d3e07d1
--- /dev/null
@@ -0,0 +1,23 @@
+puts "================"
+puts "OCC25193"
+puts "================"
+puts ""
+#######################################################################
+# Bad Intersection curveobtained by Surface/Surface Intersection Algorithm.
+#######################################################################
+
+restore [locate_data_file bug25193_s1t.draw] s1
+restore [locate_data_file bug25193_s4t.draw] s4
+
+set CurveNumb [intersect i s1 s4 3.6570868343352305e-005]
+
+if { [llength ${CurveNumb}] != 6 } {
+    puts "Error : Bad Intersection curveobtained by Surface/Surface Intersection Algorithm"
+} else {
+    puts "OK : Good Intersection curveobtained by Surface/Surface Intersection Algorithm"
+}
+
+smallview
+fit
+
+set only_screen_axo 1
index b81a51f..2fc3254 100755 (executable)
@@ -29,7 +29,7 @@ set nom 0
           if { $j == 1 } {
             set info [length res_$j]
             regexp {The length res_1 is+ +([-0-9.+eE]+)} $info full ll
-            set lcheck_1 5.6627572343058755e-05
+            set lcheck_1 2.310700219185881e-005
             if { [expr 1.*abs($lcheck_1 - $ll)/$lcheck_1] > 0.01 } {
               puts "Error : The lenght of result shape is $ll"
             } else {
@@ -39,7 +39,7 @@ set nom 0
           if { $j == 2 } {
             set info [length res_$j]
             regexp {The length res_2 is+ +([-0-9.+eE]+)} $info full ll
-            set lcheck_2 5.5763870549528719e-05
+            set lcheck_2 2.2948490793846324e-005
             if { [expr 1.*abs($lcheck_2 - $ll)/$lcheck_2] > 0.01 } {
               puts "Error : The lenght of result shape is $ll"
             } else {
@@ -51,7 +51,3 @@ set nom 0
 if { $nom == 0} {
   puts "Error : Intersection was made WRONGLY"
 }
-
-
-
-