]> OCCT Git - occt-copy.git/commitdiff
0025876: Geom2dAPI_InterCurveCurve returns only one intersection point instead of...
authormsv <msv@opencascade.com>
Fri, 27 Feb 2015 21:12:38 +0000 (00:12 +0300)
committeraml <aml@opencascade.com>
Wed, 11 Mar 2015 06:11:48 +0000 (09:11 +0300)
Extend domain of circle to include all possible solutions.
Test case for issue CR25876
Period 'jump" handling algorithm changed.

src/IntCurve/IntCurve_IntConicConic_1.cxx
tests/bugs/moddata_3/bug25876 [new file with mode: 0644]

index 65b557619b7c05e6ad6e4015d4327af692a780fe..53e56a310385cfe7ce1f71c523af621a93983dad 100644 (file)
@@ -718,7 +718,11 @@ void IntCurve_IntConicConic::Perform(const gp_Circ2d& Circle1
   PeriodicInterval C1Domain(DomainCirc1); 
   //-- On se ramene entre 0 et 2PI
   Standard_Real deltat = C1Domain.Bsup-C1Domain.Binf;
-  if(deltat>=PIpPI) { deltat=PIpPI-1e-14; } 
+  if(deltat>=PIpPI)
+  {
+    // make deltat not including the upper limit
+    deltat=NextAfter(PIpPI, 0.);
+  }
   
   while(C1Domain.Binf >= PIpPI) C1Domain.Binf-=PIpPI;
   while(C1Domain.Binf <  0.0)   C1Domain.Binf+=PIpPI;
@@ -726,7 +730,10 @@ void IntCurve_IntConicConic::Perform(const gp_Circ2d& Circle1
 
   PeriodicInterval C2Domain(DomainCirc2); 
   deltat = C2Domain.Bsup-C2Domain.Binf;
-  if(deltat>=PIpPI) { deltat=PIpPI-1e-14; } 
+  if(deltat>=PIpPI)
+  {
+    deltat=NextAfter(PIpPI, 0.);
+  }
 
   while(C2Domain.Binf >= PIpPI) C2Domain.Binf-=PIpPI;
   while(C2Domain.Binf <  0.0)   C2Domain.Binf+=PIpPI;
@@ -935,14 +942,10 @@ void IntCurve_IntConicConic::Perform(const gp_Circ2d& Circle1
        //--------------------------------------------------
        
        if(Opposite) {
-         if(nbsol!=3) { 
            if(C2inf<C2sup) C2inf+=PIpPI;
-         }
        }
        else {
-         if(nbsol!=3) { 
            if(C2sup<C2inf) C2sup+=PIpPI;
-         }
        }
        
        IntRes2d_IntersectionPoint NewPoint2(P1b,C1sup,C2sup,T1b,T2b,Standard_False);
diff --git a/tests/bugs/moddata_3/bug25876 b/tests/bugs/moddata_3/bug25876
new file mode 100644 (file)
index 0000000..b4e1062
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "CR25876"
+puts "==========="
+puts ""
+###############################################################################
+# Geom2dAPI_InterCurveCurve returns only one intersection point instead of two intersection points
+###############################################################################
+
+restore [locate_data_file bug25876_oc_test_firstcircle.brep] e1
+restore [locate_data_file bug25876_oc_test_secondcircle.brep] e2
+
+explode e1
+explode e2
+
+mk2dcurve c1 e1_1
+mk2dcurve c2 e2_1
+
+set inter1 [2dintersect c1 c2 1e-3]
+set int1 [regexp {Intersection point 2} ${inter1}]
+if { ${int1} == 0 } {
+    puts "Error : Second intersection is not found"
+} 
+
+#smallview -2D-
+view 1 -2D- 728 450 400 400
+2dfit
+xwd ${imagedir}/${test_image}_1.png
+donly c1 c2
+
+set inter2 [2dintersect c1 c2 1e-7]
+set int2 [regexp {Intersection point 2} ${inter2}]
+if { ${int2} == 0 } {
+    puts "Error : Second intersection is not found"
+} 
+
+xwd ${imagedir}/${test_image}_2.png