From 420399e3318d313623185754b8180f35ddfdc3b1 Mon Sep 17 00:00:00 2001 From: pkv Date: Fri, 24 Aug 2012 14:32:10 +0400 Subject: [PATCH] 0023341: Wrong result done by 2D classifier algorithm for a point and a face. Class classIntCurve_IntConicConic has been changed. The intersection point that is definitely out of both domains is rejected. Improving expression on lines 1101-1104 of IntCurve_IntConicConic_1.cxx to be more clear with adding comments. --- src/IntCurve/IntCurve_IntConicConic_1.cxx | 44 ++++++++++++++--------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/src/IntCurve/IntCurve_IntConicConic_1.cxx b/src/IntCurve/IntCurve_IntConicConic_1.cxx index 6f8beeac9e..600994dab4 100755 --- a/src/IntCurve/IntCurve_IntConicConic_1.cxx +++ b/src/IntCurve/IntCurve_IntConicConic_1.cxx @@ -436,7 +436,6 @@ void LineCircleGeometricIntersection(const gp_Lin2d& Line, Standard_Real dAlpha1; //--------------------------------------------------------------- //-- Line coupe le cercle Circle+ (=C(x1,y1,R1+Tol)) - //modified by NIZNHY-PKV Thu May 12 12:25:17 2011f b2Sol=Standard_False; if (R>dO1O2+TolTang) { Standard_Real aX2, aTol2; @@ -449,7 +448,6 @@ void LineCircleGeometricIntersection(const gp_Lin2d& Line, } if(dO1O2 > RmTol && !b2Sol) { //if(dO1O2 > RmTol) { - //modified by NIZNHY-PKV Thu May 12 12:25:20 2011t Standard_Real dx=dO1O2; Standard_Real dy=0.0; //(RpTol*RpTol-dx*dx); //Patch !!! dy=(dy>=0.0)? Sqrt(dy) : 0.0; @@ -1023,26 +1021,33 @@ static inline void getDomainParametrs(const IntRes2d_Domain& theDomain, } +//======================================================================= +//function : computeIntPoint +//purpose : +//======================================================================= static Standard_Boolean computeIntPoint(const IntRes2d_Domain& theCurDomain, - const IntRes2d_Domain& theDomainOther, - const gp_Lin2d& theCurLin, - const gp_Lin2d& theOtherLin, - Standard_Real theCosT1T2, - Standard_Real theParCur, Standard_Real theParOther, - Standard_Real& theResInf, Standard_Real& theResSup, - Standard_Integer theNum, - IntRes2d_TypeTrans theCurTrans, - IntRes2d_IntersectionPoint& theNewPoint) + const IntRes2d_Domain& theDomainOther, + const gp_Lin2d& theCurLin, + const gp_Lin2d& theOtherLin, + Standard_Real theCosT1T2, + Standard_Real theParCur, Standard_Real theParOther, + Standard_Real& theResInf, Standard_Real& theResSup, + Standard_Integer theNum, + IntRes2d_TypeTrans theCurTrans, + IntRes2d_IntersectionPoint& theNewPoint) { if(fabs(theResSup-theParCur) > fabs(theResInf-theParCur)) theResSup = theResInf; Standard_Real aRes2 = theParOther + (theResSup - theParCur) * theCosT1T2; - Standard_Real aFirst2, aLast2, aTol1, aTol2; - getDomainParametrs(theDomainOther,aFirst2, aLast2, aTol1, aTol2); - if( aRes2 < aFirst2 - aTol1 || aRes2 > aLast2 + aTol2 ) - return Standard_False; + Standard_Real aFirst2, aLast2, aTol21, aTol22, aTol11, aTol12 ; + + getDomainParametrs(theDomainOther,aFirst2, aLast2, aTol21, aTol22); + + if( aRes2 < aFirst2 - aTol21 || aRes2 > aLast2 + aTol22 ) { + return Standard_False; + } //------ compute parameters of intersection point -- IntRes2d_Transition aT1,aT2; @@ -1069,7 +1074,7 @@ static Standard_Boolean computeIntPoint(const IntRes2d_Domain& theCurDomain, Standard_Real aResU2 = theParOther; Standard_Real aFirst1, aLast1; - getDomainParametrs(theCurDomain,aFirst1, aLast1, aTol1, aTol2); + getDomainParametrs(theCurDomain,aFirst1, aLast1, aTol11, aTol12); Standard_Boolean isInside1 = (theParCur >= aFirst1 && theParCur <= aLast1); Standard_Boolean isInside2 = (theParOther >= aFirst2 && theParOther <= aLast2); @@ -1093,6 +1098,13 @@ static Standard_Boolean computeIntPoint(const IntRes2d_Domain& theCurDomain, } else { + //PKVf + // check that parameters are within range on both curves + if ( theParCur < aFirst1-aTol11 || theParCur > aLast1+aTol12 || + theParOther < aFirst2-aTol21 || theParOther > aLast2+aTol22) { + return Standard_False; + } + //PKVt aResU1 = theResSup; aResU2= aRes2; }