From: pkv Date: Mon, 28 Jan 2013 07:33:22 +0000 (+0400) Subject: 0023644: Intersection between coaxial cones produces exception X-Git-Tag: V6_6_0_beta~108 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=4bd102b84cb5f69df12ee753d5624ae0a4d4f0c0 0023644: Intersection between coaxial cones produces exception Small correction: one more tolerance variable has been added. Test case for this fix Small correction of test case --- diff --git a/src/IntAna/IntAna_QuadQuadGeo.cxx b/src/IntAna/IntAna_QuadQuadGeo.cxx index 05ff9798a1..7814185770 100755 --- a/src/IntAna/IntAna_QuadQuadGeo.cxx +++ b/src/IntAna/IntAna_QuadQuadGeo.cxx @@ -1163,6 +1163,9 @@ gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D) // Standard_Real tg1, tg2, aDA1A2, aTol2; gp_Pnt aPApex1, aPApex2; + + Standard_Real TOL_APEX_CONF = 1.e-10; + // tg1=Tan(Con1.SemiAngle()); tg2=Tan(Con2.SemiAngle()); @@ -1187,6 +1190,12 @@ gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D) Standard_Real d=gp_Vec(D).Dot(gp_Vec(P,Con2.Apex())); if(Abs(tg1-tg2)>myEPSILON_ANGLE_CONE) { + if (fabs(d) < TOL_APEX_CONF) { + typeres = IntAna_Point; + nbint = 1; + pt1 = P; + return; + } x=(d*tg2)/(tg1+tg2); pt1.SetCoord( P.X() + x*D.X() ,P.Y() + x*D.Y() @@ -1203,7 +1212,7 @@ gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D) typeres=IntAna_Circle; } else { - if (fabs(d)<1.e-10) { + if (fabs(d) < TOL_APEX_CONF) { typeres=IntAna_Same; } else { @@ -1361,9 +1370,7 @@ gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D) if (aRD2>(aR2+Tol)) { iRet=0; typeres=IntAna_Empty; //nothing - //modified by NIZNHY-PKV Fri Mar 23 08:12:23 2012f return; - //modified by NIZNHY-PKV Fri Mar 23 08:12:29 2012t } // iRet=1; //touch case => 1 line diff --git a/tests/bugs/moddata/bug23644 b/tests/bugs/moddata/bug23644 new file mode 100755 index 0000000000..b4fd0ca772 --- /dev/null +++ b/tests/bugs/moddata/bug23644 @@ -0,0 +1,20 @@ +puts "========" +puts "CR23644" +puts "========" + +########################################## +## Intersection between coaxial cones produces exception +########################################## + +pcone cn1 10 0 20 +pcone cn2 20 0 20 +explode cn1 f +explode cn2 f +copy cn1_1 f1 +copy cn2_1 f2 + +if [catch {bopcurves f1 f2} BOPLog] { + if { [regexp "Tolerance Reached=0\n has no 3d curve" ${BOPLog}] != 1 } { + puts "CR23644: Error" + } +}