1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

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.
This commit is contained in:
pkv 2012-08-24 14:32:10 +04:00
parent d93f7683c9
commit 420399e331

View File

@ -436,7 +436,6 @@ void LineCircleGeometricIntersection(const gp_Lin2d& Line,
Standard_Real dAlpha1; Standard_Real dAlpha1;
//--------------------------------------------------------------- //---------------------------------------------------------------
//-- Line coupe le cercle Circle+ (=C(x1,y1,R1+Tol)) //-- Line coupe le cercle Circle+ (=C(x1,y1,R1+Tol))
//modified by NIZNHY-PKV Thu May 12 12:25:17 2011f
b2Sol=Standard_False; b2Sol=Standard_False;
if (R>dO1O2+TolTang) { if (R>dO1O2+TolTang) {
Standard_Real aX2, aTol2; Standard_Real aX2, aTol2;
@ -449,7 +448,6 @@ void LineCircleGeometricIntersection(const gp_Lin2d& Line,
} }
if(dO1O2 > RmTol && !b2Sol) { if(dO1O2 > RmTol && !b2Sol) {
//if(dO1O2 > RmTol) { //if(dO1O2 > RmTol) {
//modified by NIZNHY-PKV Thu May 12 12:25:20 2011t
Standard_Real dx=dO1O2; Standard_Real dx=dO1O2;
Standard_Real dy=0.0; //(RpTol*RpTol-dx*dx); //Patch !!! Standard_Real dy=0.0; //(RpTol*RpTol-dx*dx); //Patch !!!
dy=(dy>=0.0)? Sqrt(dy) : 0.0; 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, static Standard_Boolean computeIntPoint(const IntRes2d_Domain& theCurDomain,
const IntRes2d_Domain& theDomainOther, const IntRes2d_Domain& theDomainOther,
const gp_Lin2d& theCurLin, const gp_Lin2d& theCurLin,
const gp_Lin2d& theOtherLin, const gp_Lin2d& theOtherLin,
Standard_Real theCosT1T2, Standard_Real theCosT1T2,
Standard_Real theParCur, Standard_Real theParOther, Standard_Real theParCur, Standard_Real theParOther,
Standard_Real& theResInf, Standard_Real& theResSup, Standard_Real& theResInf, Standard_Real& theResSup,
Standard_Integer theNum, Standard_Integer theNum,
IntRes2d_TypeTrans theCurTrans, IntRes2d_TypeTrans theCurTrans,
IntRes2d_IntersectionPoint& theNewPoint) IntRes2d_IntersectionPoint& theNewPoint)
{ {
if(fabs(theResSup-theParCur) > fabs(theResInf-theParCur)) if(fabs(theResSup-theParCur) > fabs(theResInf-theParCur))
theResSup = theResInf; theResSup = theResInf;
Standard_Real aRes2 = theParOther + (theResSup - theParCur) * theCosT1T2; Standard_Real aRes2 = theParOther + (theResSup - theParCur) * theCosT1T2;
Standard_Real aFirst2, aLast2, aTol1, aTol2; Standard_Real aFirst2, aLast2, aTol21, aTol22, aTol11, aTol12 ;
getDomainParametrs(theDomainOther,aFirst2, aLast2, aTol1, aTol2);
if( aRes2 < aFirst2 - aTol1 || aRes2 > aLast2 + aTol2 ) getDomainParametrs(theDomainOther,aFirst2, aLast2, aTol21, aTol22);
return Standard_False;
if( aRes2 < aFirst2 - aTol21 || aRes2 > aLast2 + aTol22 ) {
return Standard_False;
}
//------ compute parameters of intersection point -- //------ compute parameters of intersection point --
IntRes2d_Transition aT1,aT2; IntRes2d_Transition aT1,aT2;
@ -1069,7 +1074,7 @@ static Standard_Boolean computeIntPoint(const IntRes2d_Domain& theCurDomain,
Standard_Real aResU2 = theParOther; Standard_Real aResU2 = theParOther;
Standard_Real aFirst1, aLast1; 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 isInside1 = (theParCur >= aFirst1 && theParCur <= aLast1);
Standard_Boolean isInside2 = (theParOther >= aFirst2 && theParOther <= aLast2); Standard_Boolean isInside2 = (theParOther >= aFirst2 && theParOther <= aLast2);
@ -1093,6 +1098,13 @@ static Standard_Boolean computeIntPoint(const IntRes2d_Domain& theCurDomain,
} }
else 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; aResU1 = theResSup;
aResU2= aRes2; aResU2= aRes2;
} }