From: nbv Date: Thu, 30 Oct 2014 10:24:23 +0000 (+0300) Subject: 0025292: Face/Face intersection algorithm gives different results for different order... X-Git-Tag: V6_8_0~36 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=02effd356b25dd2aa1c41ff47f815b60628d1418 0025292: Face/Face intersection algorithm gives different results for different order of the arguments Method of adjusting was corrected. Test cases for issue CR25292 --- diff --git a/src/IntPatch/IntPatch_ImpImpIntersection_2.gxx b/src/IntPatch/IntPatch_ImpImpIntersection_2.gxx index fdd3b2a0bb..f2f3814224 100644 --- a/src/IntPatch/IntPatch_ImpImpIntersection_2.gxx +++ b/src/IntPatch/IntPatch_ImpImpIntersection_2.gxx @@ -158,9 +158,17 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1, Bnd_Box2d aBox1, aBox2; const Standard_Real aU1f = S1->FirstUParameter(); - const Standard_Real aU1l = S1->LastUParameter(); + Standard_Real aU1l = S1->LastUParameter(); const Standard_Real aU2f = S2->FirstUParameter(); - const Standard_Real aU2l = S2->LastUParameter(); + Standard_Real aU2l = S2->LastUParameter(); + + const Standard_Real anUperiod = 2.0*M_PI; + + if(aU1l - aU1f > anUperiod) + aU1l = aU1f + anUperiod; + + if(aU2l - aU2f > anUperiod) + aU2l = aU2f + anUperiod; aBox1.Add(gp_Pnt2d(aU1f, S1->FirstVParameter())); aBox1.Add(gp_Pnt2d(aU1l, S1->LastVParameter())); diff --git a/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx b/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx index 606c1b6d40..11f3040c10 100644 --- a/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx +++ b/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx @@ -1005,15 +1005,17 @@ static Standard_Boolean SearchOnVBounds(const SearchBoundType theSBType, //======================================================================= //function : InscribePoint -//purpose : +//purpose : If theFlForce==TRUE theUGiven will be adjasted forceful. //======================================================================= static Standard_Boolean InscribePoint(const Standard_Real theUfTarget, const Standard_Real theUlTarget, Standard_Real& theUGiven, const Standard_Real theTol2D, - const Standard_Real thePeriod) + const Standard_Real thePeriod, + const Standard_Boolean theFlForce) { - if((theUfTarget - theUGiven <= theTol2D) && (theUGiven - theUlTarget <= theTol2D)) + if((theUfTarget - theUGiven <= theTol2D) && + (theUGiven - theUlTarget <= theTol2D)) {//it has already inscribed /* @@ -1021,6 +1023,24 @@ static Standard_Boolean InscribePoint(const Standard_Real theUfTarget, + * + */ + if(theFlForce) + { + Standard_Real anUtemp = theUGiven + thePeriod; + if((theUfTarget - anUtemp <= theTol2D) && + (anUtemp - theUlTarget <= theTol2D)) + { + theUGiven = anUtemp; + return Standard_True; + } + + anUtemp = theUGiven - thePeriod; + if((theUfTarget - anUtemp <= theTol2D) && + (anUtemp - theUlTarget <= theTol2D)) + { + theUGiven = anUtemp; + } + } + return Standard_True; } @@ -1057,7 +1077,8 @@ static Standard_Boolean InscribeInterval(const Standard_Real theUfTarget, { Standard_Real anUpar = theUfGiven; const Standard_Real aDelta = theUlGiven - theUfGiven; - if(InscribePoint(theUfTarget, theUlTarget, anUpar, theTol2D, thePeriod)) + if(InscribePoint(theUfTarget, theUlTarget, anUpar, + theTol2D, thePeriod, Standard_False)) { theUfGiven = anUpar; theUlGiven = theUfGiven + aDelta; @@ -1065,7 +1086,8 @@ static Standard_Boolean InscribeInterval(const Standard_Real theUfTarget, else { anUpar = theUlGiven; - if(InscribePoint(theUfTarget, theUlTarget, anUpar, theTol2D, thePeriod)) + if(InscribePoint(theUfTarget, theUlTarget, anUpar, + theTol2D, thePeriod, Standard_False)) { theUlGiven = anUpar; theUfGiven = theUlGiven - aDelta; @@ -1100,7 +1122,7 @@ static void InscribeAndSortArray( Standard_Real theArr[], continue; } - InscribePoint(theUf, theUl, theArr[i], theTol2D, thePeriod); + InscribePoint(theUf, theUl, theArr[i], theTol2D, thePeriod, Standard_False); for(Standard_Integer j = i - 1; j >= 0; j--) { @@ -1129,13 +1151,15 @@ static Standard_Boolean AddPointIntoWL( const IntSurf_Quadric& theQuad1, const Standard_Real theUlSurf1, const Standard_Real thePeriodOfSurf1, const Handle(IntSurf_LineOn2S)& theLine, - const Standard_Real theTol2D) + const Standard_Real theTol2D, + const Standard_Boolean theFlForce) { gp_Pnt aPt1(theQuad1.Value(thePntOnSurf1.X(), thePntOnSurf1.Y())), aPt2(theQuad2.Value(thePntOnSurf2.X(), thePntOnSurf2.Y())); Standard_Real anUpar = thePntOnSurf1.X(); - if(!InscribePoint(theUfSurf1, theUlSurf1, anUpar, theTol2D, thePeriodOfSurf1)) + if(!InscribePoint(theUfSurf1, theUlSurf1, anUpar, theTol2D, + thePeriodOfSurf1, theFlForce)) return Standard_False; IntSurf_PntOn2S aPnt; @@ -1144,12 +1168,12 @@ static Standard_Boolean AddPointIntoWL( const IntSurf_Quadric& theQuad1, { aPnt.SetValue((aPt1.XYZ()+aPt2.XYZ())/2.0, thePntOnSurf2.X(), thePntOnSurf2.Y(), - thePntOnSurf1.X(), thePntOnSurf1.Y()); + anUpar, thePntOnSurf1.Y()); } else { aPnt.SetValue((aPt1.XYZ()+aPt2.XYZ())/2.0, - thePntOnSurf1.X(), thePntOnSurf1.Y(), + anUpar, thePntOnSurf1.Y(), thePntOnSurf2.X(), thePntOnSurf2.Y()); } @@ -1178,6 +1202,7 @@ static Standard_Boolean AddBoundaryPoint( const IntSurf_Quadric& theQuad1, const Standard_Real theV2Prev, const Standard_Boolean isTheReverse, const Standard_Real theArccosFactor, + const Standard_Boolean theFlForce, Standard_Boolean& isTheFound1, Standard_Boolean& isTheFound2) { @@ -1242,16 +1267,21 @@ static Standard_Boolean AddBoundaryPoint( const IntSurf_Quadric& theQuad1, Standard_Real aU2 = theCoeffs.mFI2 + theArccosFactor * acos(anArg); - if(InscribePoint(aUSurf2f, aUSurf2l, aU2, theTol2D, thePeriod)) + if(InscribePoint(aUSurf2f, aUSurf2l, aU2, theTol2D, thePeriod, Standard_False)) { - const Standard_Real aV1 = (aTS1 == SearchV1) ? aV1zad : + const Standard_Real aV1 = + (aTS1 == SearchV1) ? aV1zad : theCoeffs.mK21 * sin(aU2) + theCoeffs.mK11 * sin(anUpar1) + theCoeffs.mL21 * cos(aU2) + theCoeffs.mL11 * cos(anUpar1) + theCoeffs.mM1; - const Standard_Real aV2 = (aTS1 == SearchV2) ? aV2zad : + const Standard_Real aV2 = + (aTS1 == SearchV2) ? aV2zad : theCoeffs.mK22 * sin(aU2) + theCoeffs.mK12 * sin(anUpar1) + theCoeffs.mL22 * cos(aU2) + theCoeffs.mL12 * cos(anUpar1) + theCoeffs.mM2; - AddPointIntoWL(theQuad1, theQuad2, isTheReverse, gp_Pnt2d(anUpar1, aV1), gp_Pnt2d(aU2, aV2), aUSurf1f, aUSurf1l, thePeriod, theWL->Curve(), theTol2D); + AddPointIntoWL(theQuad1, theQuad2, isTheReverse, + gp_Pnt2d(anUpar1, aV1), gp_Pnt2d(aU2, aV2), + aUSurf1f, aUSurf1l, thePeriod, + theWL->Curve(), theTol2D, theFlForce); } else { @@ -1269,16 +1299,21 @@ static Standard_Boolean AddBoundaryPoint( const IntSurf_Quadric& theQuad1, anArg = -1.0; Standard_Real aU2 = theCoeffs.mFI2 + theArccosFactor * acos(anArg); - if(InscribePoint(aUSurf2f, aUSurf2l, aU2, theTol2D, thePeriod)) + if(InscribePoint(aUSurf2f, aUSurf2l, aU2, theTol2D, thePeriod, Standard_False)) { - const Standard_Real aV1 = (aTS2 == SearchV1) ? aV1zad : + const Standard_Real aV1 = + (aTS2 == SearchV1) ? aV1zad : theCoeffs.mK21 * sin(aU2) + theCoeffs.mK11 * sin(anUpar2) + theCoeffs.mL21 * cos(aU2) + theCoeffs.mL11 * cos(anUpar2) + theCoeffs.mM1; - const Standard_Real aV2 = (aTS2 == SearchV2) ? aV2zad : + const Standard_Real aV2 = + (aTS2 == SearchV2) ? aV2zad : theCoeffs.mK22 * sin(aU2) + theCoeffs.mK12 * sin(anUpar2) + theCoeffs.mL22 * cos(aU2) + theCoeffs.mL12 * cos(anUpar2) + theCoeffs.mM2; - AddPointIntoWL(theQuad1, theQuad2, isTheReverse, gp_Pnt2d(anUpar2, aV1), gp_Pnt2d(aU2, aV2), aUSurf1f, aUSurf1l, thePeriod, theWL->Curve(), theTol2D); + AddPointIntoWL(theQuad1, theQuad2, isTheReverse, + gp_Pnt2d(anUpar2, aV1), gp_Pnt2d(aU2, aV2), + aUSurf1f, aUSurf1l, thePeriod, + theWL->Curve(), theTol2D, theFlForce); } else { @@ -1299,7 +1334,7 @@ static Standard_Boolean AddBoundaryPoint( const IntSurf_Quadric& theQuad1, Standard_Real aU2 = theCoeffs.mFI2 + theArccosFactor * acos(anArg); - if(InscribePoint(aUSurf2f, aUSurf2l, aU2, theTol2D, thePeriod)) + if(InscribePoint(aUSurf2f, aUSurf2l, aU2, theTol2D, thePeriod, Standard_False)) { const Standard_Real aV1 = (aTS2 == SearchV1) ? aV1zad : theCoeffs.mK21 * sin(aU2) + theCoeffs.mK11 * sin(anUpar2) + @@ -1308,7 +1343,10 @@ static Standard_Boolean AddBoundaryPoint( const IntSurf_Quadric& theQuad1, theCoeffs.mK22 * sin(aU2) + theCoeffs.mK12 * sin(anUpar2) + theCoeffs.mL22 * cos(aU2) + theCoeffs.mL12 * cos(anUpar2) + theCoeffs.mM2; - AddPointIntoWL(theQuad1, theQuad2, isTheReverse, gp_Pnt2d(anUpar2, aV1), gp_Pnt2d(aU2, aV2), aUSurf1f, aUSurf1l, thePeriod, theWL->Curve(), theTol2D); + AddPointIntoWL(theQuad1, theQuad2, isTheReverse, + gp_Pnt2d(anUpar2, aV1), gp_Pnt2d(aU2, aV2), + aUSurf1f, aUSurf1l, thePeriod, + theWL->Curve(), theTol2D, theFlForce); } else { @@ -1326,7 +1364,7 @@ static Standard_Boolean AddBoundaryPoint( const IntSurf_Quadric& theQuad1, anArg = -1.0; Standard_Real aU2 = theCoeffs.mFI2+theArccosFactor*acos(anArg); - if(InscribePoint(aUSurf2f, aUSurf2l, aU2, theTol2D, thePeriod)) + if(InscribePoint(aUSurf2f, aUSurf2l, aU2, theTol2D, thePeriod, Standard_False)) { const Standard_Real aV1 = (aTS1 == SearchV1) ? aV1zad : theCoeffs.mK21 * sin(aU2) + theCoeffs.mK11 * sin(anUpar1) + @@ -1335,7 +1373,10 @@ static Standard_Boolean AddBoundaryPoint( const IntSurf_Quadric& theQuad1, theCoeffs.mK22 * sin(aU2) + theCoeffs.mK12 * sin(anUpar1) + theCoeffs.mL22 * cos(aU2) + theCoeffs.mL12 * cos(anUpar1) + theCoeffs.mM2; - AddPointIntoWL(theQuad1, theQuad2, isTheReverse, gp_Pnt2d(anUpar1, aV1), gp_Pnt2d(aU2, aV2), aUSurf1f, aUSurf1l, thePeriod, theWL->Curve(), theTol2D); + AddPointIntoWL(theQuad1, theQuad2, isTheReverse, + gp_Pnt2d(anUpar1, aV1), gp_Pnt2d(aU2, aV2), + aUSurf1f, aUSurf1l, thePeriod, + theWL->Curve(), theTol2D, theFlForce); } else { @@ -1377,8 +1418,11 @@ static void SeekAdditionalPoints( const IntSurf_Quadric& theQuad1, aNbPointsPrev = aNbPoints; for(Standard_Integer fp = 1, lp = 2; fp < aNbPoints; fp = lp + 1) { - Standard_Real U1f, V1f; //first point in 1st suraface - Standard_Real U1l, V1l; //last point in 1st suraface + Standard_Real U1f = 0.0, V1f = 0.0; //first point in 1st suraface + Standard_Real U1l = 0.0, V1l = 0.0; //last point in 1st suraface + + Standard_Real U2f = 0.0, V2f = 0.0; //first point in 2nd suraface + Standard_Real U2l = 0.0, V2l = 0.0; //last point in 2nd suraface lp = fp+1; @@ -1386,11 +1430,23 @@ static void SeekAdditionalPoints( const IntSurf_Quadric& theQuad1, { theLile->Value(fp).ParametersOnS2(U1f, V1f); theLile->Value(lp).ParametersOnS2(U1l, V1l); + + theLile->Value(fp).ParametersOnS1(U2f, V2f); + theLile->Value(lp).ParametersOnS1(U2l, V2l); } else { theLile->Value(fp).ParametersOnS1(U1f, V1f); theLile->Value(lp).ParametersOnS1(U1l, V1l); + + theLile->Value(fp).ParametersOnS2(U2f, V2f); + theLile->Value(lp).ParametersOnS2(U2l, V2l); + } + + if(Abs(U1l - U1f) <= theTol2D) + { + //Step is minimal. It is not necessary to divide it. + continue; } U1prec = 0.5*(U1f+U1l); @@ -1402,31 +1458,21 @@ static void SeekAdditionalPoints( const IntSurf_Quadric& theQuad1, anArg = -1.0; U2prec = theCoeffs.mFI2 + theArccosFactor*acos(anArg); - InscribePoint(theU2f, theU2l, U2prec, theTol2D, thePeriodOfSurf2); + InscribePoint(theU2f, theU2l, U2prec, theTol2D, thePeriodOfSurf2, Standard_False); gp_Pnt aP1, aP2; - gp_Vec aVec1, aVec2; - if(isTheReverse) - { - V1prec = theCoeffs.mK21 * sin(U2prec) + theCoeffs.mK11 * sin(U1prec) + theCoeffs.mL21 * cos(U2prec) + theCoeffs.mL11 * cos(U1prec) + theCoeffs.mM1; - V2prec = theCoeffs.mK22 * sin(U2prec) + theCoeffs.mK12 * sin(U1prec) + theCoeffs.mL22 * cos(U2prec) + theCoeffs.mL12 * cos(U1prec) + theCoeffs.mM2; + V1prec = theCoeffs.mK21 * sin(U2prec) + + theCoeffs.mK11 * sin(U1prec) + + theCoeffs.mL21 * cos(U2prec) + + theCoeffs.mL11 * cos(U1prec) + theCoeffs.mM1; + V2prec = theCoeffs.mK22 * sin(U2prec) + + theCoeffs.mK12 * sin(U1prec) + + theCoeffs.mL22 * cos(U2prec) + + theCoeffs.mL12 * cos(U1prec) + theCoeffs.mM2; - gp_Pnt aP3, aP4; - theQuad1.D1(U2prec, V2prec, aP3, aVec1, aVec2); - theQuad2.D1(U1prec, V1prec, aP4, aVec1, aVec2); - - theQuad1.D1(U1prec, V1prec, aP1, aVec1, aVec2); - theQuad2.D1(U2prec, V2prec, aP2, aVec1, aVec2); - } - else - { - V1prec = theCoeffs.mK21 * sin(U2prec) + theCoeffs.mK11 * sin(U1prec) + theCoeffs.mL21 * cos(U2prec) + theCoeffs.mL11 * cos(U1prec) + theCoeffs.mM1; - V2prec = theCoeffs.mK22 * sin(U2prec) + theCoeffs.mK12 * sin(U1prec) + theCoeffs.mL22 * cos(U2prec) + theCoeffs.mL12 * cos(U1prec) + theCoeffs.mM2; - - theQuad1.D1(U1prec, V1prec, aP1, aVec1, aVec2); - theQuad2.D1(U2prec, V2prec, aP2, aVec1, aVec2); - } + aP1 = theQuad1.Value(U1prec, V1prec); + aP2 = theQuad2.Value(U2prec, V2prec); gp_Pnt aPInt(0.5*(aP1.XYZ() + aP2.XYZ())); @@ -1743,7 +1789,7 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1, //[2...3] - First and last U1 parameter. //[4...5] - in these points parameter U2 goes through // the seam-edge of the second cylinder. - //[6...9] - in these points an intersetion line goes through + //[6...9] - in these points an intersection line goes through // U-boundaries of the second surface. const Standard_Integer aNbCritPointsMax = 10; Standard_Real anU1crit[aNbCritPointsMax] = {Precision::Infinite(), @@ -1810,7 +1856,8 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1, } } - Standard_Real anArg = anEquationCoeffs.mB * cos(anU1 - anEquationCoeffs.mFI1) + anEquationCoeffs.mC; + Standard_Real anArg = anEquationCoeffs.mB * + cos(anU1 - anEquationCoeffs.mFI1) + anEquationCoeffs.mC; if(aNulValue > 1.0 - anArg) anArg = 1.0; @@ -1818,10 +1865,109 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1, anArg = -1.0; Standard_Real aU21 = anEquationCoeffs.mFI2 + acos(anArg); - InscribePoint(aUSurf2f, aUSurf2l, aU21, theTol2D, aPeriod); + InscribePoint(aUSurf2f, aUSurf2l, aU21, theTol2D, aPeriod, Standard_False); + + + const Standard_Integer aNbPntsWL1 = aWLine1.IsNull() ? 0 : + aWLine1->Curve()->NbPoints(); + if(aNbPntsWL1 == 0) + {//the line have not contained any points yet + if(((aUSurf2l - aUSurf2f) >= aPeriod) && + ((Abs(aU21-aUSurf2f) < theTol2D) || (Abs(aU21-aUSurf2l) < theTol2D))) + { + const Standard_Real anU1Temp = anU1 + aStepMin; + Standard_Real anArgTemp = anEquationCoeffs.mB * + cos(anU1Temp - anEquationCoeffs.mFI1) + anEquationCoeffs.mC; + + if(aNulValue > 1.0 - anArg) + anArg = 1.0; + if(anArg + 1.0 < aNulValue) + anArg = -1.0; + + Standard_Real aU2Temp = anEquationCoeffs.mFI2 + acos(anArgTemp); + InscribePoint(aUSurf2f, aUSurf2l, aU2Temp, theTol2D, aPeriod, Standard_False); + if(2.0*Abs(aU2Temp - aU21) > aPeriod) + { + if(aU2Temp > aU21) + aU21 += aPeriod; + else + aU21 -= aPeriod; + } + } + } + + if(aNbPntsWL1 > 0) + {//end of the line + if(((aUSurf2l - aUSurf2f) >= aPeriod) && + ((Abs(aU21-aUSurf2f) < theTol2D) || (Abs(aU21-aUSurf2l) < theTol2D))) + { + Standard_Real aU2prev = 0.0, aV2prev = 0.0; + if(isTheReverse) + aWLine1->Curve()->Value(aNbPntsWL1).ParametersOnS1(aU2prev, aV2prev); + else + aWLine1->Curve()->Value(aNbPntsWL1).ParametersOnS2(aU2prev, aV2prev); + + if(2.0*Abs(aU2prev - aU21) > aPeriod) + { + if(aU2prev > aU21) + aU21 += aPeriod; + else + aU21 -= aPeriod; + } + } + } Standard_Real aU22 = anEquationCoeffs.mFI2 - acos(anArg); - InscribePoint(aUSurf2f, aUSurf2l, aU22, theTol2D, aPeriod); + InscribePoint(aUSurf2f, aUSurf2l, aU22, theTol2D, aPeriod, Standard_False); + + const Standard_Integer aNbPntsWL2 = aWLine2.IsNull() ? 0 : + aWLine2->Curve()->NbPoints(); + if(aNbPntsWL2 == 0) + {//the line have not contained any points yet + if(((aUSurf2l - aUSurf2f) >= aPeriod) && + ((Abs(aU22-aUSurf2f) < theTol2D) || (Abs(aU22-aUSurf2l) < theTol2D))) + { + const Standard_Real anU1Temp = anU1 + aStepMin; + Standard_Real anArgTemp = anEquationCoeffs.mB * + cos(anU1Temp - anEquationCoeffs.mFI1) + anEquationCoeffs.mC; + + if(aNulValue > 1.0 - anArg) + anArg = 1.0; + if(anArg + 1.0 < aNulValue) + anArg = -1.0; + + Standard_Real aU2Temp = anEquationCoeffs.mFI2 - acos(anArgTemp); + InscribePoint(aUSurf2f, aUSurf2l, aU2Temp, theTol2D, aPeriod, Standard_False); + if(2.0*Abs(aU2Temp - aU22) > aPeriod) + { + if(aU2Temp > aU21) + aU22 += aPeriod; + else + aU22 -= aPeriod; + } + } + } + + if(aNbPntsWL2 > 0) + {//end of the line + if(((aUSurf2l - aUSurf2f) >= aPeriod) && + ((Abs(aU22-aUSurf2f) < theTol2D) || (Abs(aU22-aUSurf2l) < theTol2D))) + { + Standard_Real aU2prev = 0.0, aV2prev = 0.0; + if(isTheReverse) + aWLine2->Curve()->Value(aNbPntsWL2).ParametersOnS1(aU2prev, aV2prev); + else + aWLine2->Curve()->Value(aNbPntsWL2).ParametersOnS2(aU2prev, aV2prev); + + if(2.0*Abs(aU2prev - aU22) > aPeriod) + { + if(aU2prev > aU22) + aU22 += aPeriod; + else + aU22 -= aPeriod; + } + } + } const Standard_Real aV11 = anEquationCoeffs.mK21 * sin(aU21) + anEquationCoeffs.mK11 * sin(anU1) + @@ -1855,13 +2001,21 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1, ((aV11 - aVSurf1l) <= theTol2D) && ((aVSurf2f - aV21) <= theTol2D) && ((aV21 - aVSurf2l) <= theTol2D)) { + Standard_Boolean isForce = Standard_False; if(!aWL1FindStatus) { Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False; - AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs, theUVSurf1, theUVSurf2, - theTol2D, aPeriod, aNulValue, anU1, aU21, - aV11, aV11Prev, aV21, aV21Prev, isTheReverse, 1.0, isFound1, isFound2); + if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D)) + { + isForce = Standard_True; + } + + AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs, + theUVSurf1, theUVSurf2, theTol2D, aPeriod, + aNulValue, anU1, aU21, aV11, aV11Prev, + aV21, aV21Prev, isTheReverse, + 1.0, isForce, isFound1, isFound2); if(isFound1 || isFound2) { @@ -1871,8 +2025,10 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1, if((aWL1FindStatus != 2) || (aWLine1->NbPnts() >= 1)) { - if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse, gp_Pnt2d(anU1, aV11), - gp_Pnt2d(aU21, aV21), aUSurf1f, aUSurf1l, aPeriod, aWLine1->Curve(), theTol2D)) + if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse, + gp_Pnt2d(anU1, aV11), gp_Pnt2d(aU21, aV21), + aUSurf1f, aUSurf1l, aPeriod, + aWLine1->Curve(), theTol2D, isForce)) { if(!aWL1FindStatus) { @@ -1887,8 +2043,11 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1, { Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False; - AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs, theUVSurf1, theUVSurf2, - theTol2D, aPeriod, aNulValue, anU1, aU21, aV11, aV11Prev, aV21, aV21Prev, isTheReverse, 1.0, isFound1, isFound2); + AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs, + theUVSurf1, theUVSurf2, theTol2D, aPeriod, + aNulValue, anU1, aU21, aV11, aV11Prev, + aV21, aV21Prev, isTheReverse, + 1.0, Standard_False, isFound1, isFound2); if(isFound1 || isFound2) aWL1FindStatus = 2; //start a new line @@ -1902,13 +2061,22 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1, ((aVSurf2f - aV22) <= theTol2D) && ((aV22 - aVSurf2l) <= theTol2D)) { + Standard_Boolean isForce = Standard_False; + if(!aWL2FindStatus) { Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False; - AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs, theUVSurf1, theUVSurf2, - theTol2D, aPeriod, aNulValue, anU1, aU22, - aV12, aV12Prev, aV22, aV22Prev, isTheReverse, -1.0, isFound1, isFound2); + if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D)) + { + isForce = Standard_True; + } + + AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs, + theUVSurf1, theUVSurf2, theTol2D, aPeriod, + aNulValue, anU1, aU22, aV12, aV12Prev, + aV22, aV22Prev, isTheReverse, + -1.0, isForce, isFound1, isFound2); if(isFound1 || isFound2) { @@ -1918,8 +2086,10 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1, if((aWL2FindStatus != 2) || (aWLine2->NbPnts() >= 1)) { - if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse, gp_Pnt2d(anU1, aV12), - gp_Pnt2d(aU22, aV22), aUSurf1f, aUSurf1l, aPeriod, aWLine2->Curve(), theTol2D)) + if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse, + gp_Pnt2d(anU1, aV12), gp_Pnt2d(aU22, aV22), + aUSurf1f, aUSurf1l, aPeriod, + aWLine2->Curve(), theTol2D, isForce)) { if(!aWL2FindStatus) { @@ -1934,9 +2104,11 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1, { Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False; - AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs, theUVSurf1, theUVSurf2, - theTol2D, aPeriod, aNulValue, anU1, aU22, - aV12, aV12Prev, aV22, aV22Prev, isTheReverse, -1.0, isFound1, isFound2); + AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs, + theUVSurf1, theUVSurf2, theTol2D, aPeriod, + aNulValue, anU1, aU22, aV12, aV12Prev, + aV22, aV22Prev, isTheReverse, + -1.0, Standard_False, isFound1, isFound2); if(isFound1 || isFound2) aWL2FindStatus = 2; //start a new line @@ -2068,7 +2240,9 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1, isTheEmpty = Standard_False; isAddedIntoWL1 = Standard_True; - SeekAdditionalPoints(theQuad1, theQuad2, aWLine1->Curve(), anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l, theTol2D, aPeriod, 1.0, isTheReverse); + SeekAdditionalPoints(theQuad1, theQuad2, aWLine1->Curve(), + anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l, + theTol2D, aPeriod, 1.0, isTheReverse); aWLine1->ComputeVertexParameters(theTol3D); theSlin.Append(aWLine1); @@ -2096,7 +2270,9 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1, isTheEmpty = Standard_False; isAddedIntoWL2 = Standard_True; - SeekAdditionalPoints(theQuad1, theQuad2, aWLine2->Curve(), anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l, theTol2D, aPeriod, -1.0, isTheReverse); + SeekAdditionalPoints(theQuad1, theQuad2, aWLine2->Curve(), + anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l, + theTol2D, aPeriod, -1.0, isTheReverse); aWLine2->ComputeVertexParameters(theTol3D); theSlin.Append(aWLine2); diff --git a/src/IntPatch/IntPatch_Intersection.cxx b/src/IntPatch/IntPatch_Intersection.cxx index 55911c2068..3698adde4c 100644 --- a/src/IntPatch/IntPatch_Intersection.cxx +++ b/src/IntPatch/IntPatch_Intersection.cxx @@ -908,11 +908,21 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1, ListOfPnts.Clear(); if(isGeomInt) { - GeomGeomPerfom(theS1, theD1, theS2, theD2, TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); + if(theD1->DomainIsInfinite() || theD2->DomainIsInfinite()) + { + GeomGeomPerfom(theS1, theD1, theS2, theD2, TolArc, + TolTang, ListOfPnts, RestrictLine, typs1, typs2); + } + else + { + GeomGeomPerfomTrimSurf(theS1, theD1, theS2, theD2, + TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); + } } else { - ParamParamPerfom(theS1, theD1, theS2, theD2, TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); + ParamParamPerfom(theS1, theD1, theS2, theD2, + TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); } } @@ -929,7 +939,8 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1, IntSurf_ListOfPntOn2S ListOfPnts; ListOfPnts.Clear(); - ParamParamPerfom(theS1, theD1, theS2, theD2, TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); + ParamParamPerfom(theS1, theD1, theS2, theD2, TolArc, + TolTang, ListOfPnts, RestrictLine, typs1, typs2); } } @@ -1125,7 +1136,8 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1, if(!isGeomInt) { - ParamParamPerfom(theS1, theD1, theS2, theD2, TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); + ParamParamPerfom(theS1, theD1, theS2, theD2, + TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); } else if(ts1 != ts2) { @@ -1133,7 +1145,8 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1, } else if (ts1 == 0) { - ParamParamPerfom(theS1, theD1, theS2, theD2, TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); + ParamParamPerfom(theS1, theD1, theS2, theD2, + TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); } else if(ts1 == 1) { @@ -1362,7 +1375,8 @@ void IntPatch_Intersection::GeomGeomPerfom(const Handle(Adaptor3d_HSurface)& the } } else - ParamParamPerfom(theS1, theD1, theS2, theD2, TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); + ParamParamPerfom(theS1, theD1, theS2, theD2, + TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); } //======================================================================= @@ -1472,28 +1486,40 @@ void IntPatch_Intersection:: if((theTyps1 == GeomAbs_Cylinder) && (theTyps2 == GeomAbs_Cylinder)) { IntPatch_ImpImpIntersection anInt; - anInt.Perform(theS1, theD1, theS2, theD2, theTolArc, theTolTang, Standard_True); + anInt.Perform(theS1, theD1, theS2, theD2, myTolArc, myTolTang, Standard_True); done = anInt.IsDone(); - const Standard_Integer aNbLin = anInt.NbLines(); - const Standard_Integer aNbPts = anInt.NbPnts(); - - for(Standard_Integer aLID = 1; aLID <= aNbLin; aLID++) + if(done) { - const Handle(IntPatch_Line)& aLine = anInt.Line(aLID); - slin.Append(aLine); - } + empt = anInt.IsEmpty(); + if (!empt) + { + tgte = anInt.TangentFaces(); + if (tgte) + oppo = anInt.OppositeFaces(); - for(Standard_Integer aPID = 1; aPID <= aNbPts; aPID++) - { - const IntPatch_Point& aPoint = anInt.Point(aPID); - spnt.Append(aPoint); + const Standard_Integer aNbLin = anInt.NbLines(); + const Standard_Integer aNbPts = anInt.NbPnts(); + + for(Standard_Integer aLID = 1; aLID <= aNbLin; aLID++) + { + const Handle(IntPatch_Line)& aLine = anInt.Line(aLID); + slin.Append(aLine); + } + + for(Standard_Integer aPID = 1; aPID <= aNbPts; aPID++) + { + const IntPatch_Point& aPoint = anInt.Point(aPID); + spnt.Append(aPoint); + } + } } } else { - GeomGeomPerfom(theS1, theD1, theS2, theD2, theTolArc, theTolTang, theListOfPnts, RestrictLine, theTyps1, theTyps2); + GeomGeomPerfom(theS1, theD1, theS2, theD2, + theTolArc, theTolTang, theListOfPnts, RestrictLine, theTyps1, theTyps2); } } diff --git a/tests/bugs/begin b/tests/bugs/begin index 9dad5fa399..10c93fc92d 100755 --- a/tests/bugs/begin +++ b/tests/bugs/begin @@ -251,3 +251,22 @@ proc CheckTriArea {shape {eps 0}} { puts "area by geometry: $g_area" expr ($t_area - $g_area) / $g_area * 100 } + +# Check if list of xdistcs-command is valid +proc checkList {List Tolerance D_good} { + set L1 [llength ${List}] + set L2 10 + set L3 5 + set N [expr (${L1} - ${L2})/${L3} + 1] + + for {set i 1} {${i} <= ${N}} {incr i} { + set j1 [expr ${L2} + (${i}-1)*${L3}] + set j2 [expr ${j1} + 2] + set T [lindex ${List} ${j1}] + set D [lindex ${List} ${j2}] + #puts "i=${i} j1=${j1} j2=${j2} T=${T} D=${D}" + if { [expr abs(${D} - ${D_good})] > ${Tolerance} } { + puts "Error: i=${i} T=${T} D=${D}" + } + } +} diff --git a/tests/bugs/modalg_1/bug16517_1 b/tests/bugs/modalg_1/bug16517_1 index bb2ddb036b..e8c776d4c5 100755 --- a/tests/bugs/modalg_1/bug16517_1 +++ b/tests/bugs/modalg_1/bug16517_1 @@ -22,16 +22,16 @@ if { ${Result_Numbers} != 2 } { renamevar p_1 result set status 0 - set length 110.167 - set nb_v_good 1 - set nb_e_good 1 + set length 110.161 + set nb_v_good 4 + set nb_e_good 4 set nb_w_good 1 set nb_f_good 0 set nb_sh_good 0 set nb_sol_good 0 set nb_compsol_good 0 set nb_compound_good 0 - set nb_shape_good 3 + set nb_shape_good 9 } if { ${mistake} != 0 } { diff --git a/tests/bugs/modalg_1/bug16517_2 b/tests/bugs/modalg_1/bug16517_2 index 6a1e214c0c..db0aec0ec6 100755 --- a/tests/bugs/modalg_1/bug16517_2 +++ b/tests/bugs/modalg_1/bug16517_2 @@ -22,16 +22,16 @@ if { ${Result_Numbers} != 2 } { renamevar p_2 result set status 0 - set length 110.167 - set nb_v_good 1 - set nb_e_good 1 + set length 110.171 + set nb_v_good 4 + set nb_e_good 4 set nb_w_good 1 set nb_f_good 0 set nb_sh_good 0 set nb_sol_good 0 set nb_compsol_good 0 set nb_compound_good 0 - set nb_shape_good 3 + set nb_shape_good 9 } # Resume diff --git a/tests/bugs/modalg_5/bug24915 b/tests/bugs/modalg_5/bug24915 index e2d5079cf9..4c9d065352 100755 --- a/tests/bugs/modalg_5/bug24915 +++ b/tests/bugs/modalg_5/bug24915 @@ -44,7 +44,7 @@ bbuild r checkshape r # 2. geometry -set MaxTol 1.5e-6 +set MaxTol 3.0e-6 set log [bopcurves b1 b2] mksurface s1 b1 diff --git a/tests/bugs/modalg_5/bug25292_11 b/tests/bugs/modalg_5/bug25292_11 new file mode 100644 index 0000000000..5bc75c410e --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_11 @@ -0,0 +1,139 @@ +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# bopcurves command + +restore [locate_data_file bug25292_Input_0.brep] b1 +restore [locate_data_file bug25292_Input_1.brep] b2 + +explode b1 f +copy b1_2 f1 +explode b2 f +copy b2_2 f2 + +############################# +set log [bopcurves f1 f2 -2d] +############################# + +regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv +set MaxTol 1.e-7 +if {${Toler} > ${MaxTol}} { + puts "Error: Tolerance is too big!" +} +set GoodNbCurv 7 +if {${NbCurv} != ${GoodNbCurv}} { + puts "Error: Curve Number is bad!" +} + +#------------- + +# 1 +puts "" +puts "First curve" + +mksurface s1 f1 +mksurface s2 f2 + +dlog reset +dlog on +xdistcs c_1 s1 0 1 10 +set Log1 [dlog get] + +set List1 [split ${Log1} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List1} ${Tolerance} ${D_good} + +# 2 +puts "" +puts "Second curve" + +dlog reset +dlog on +xdistcs c_2 s1 0 1 10 +set Log2 [dlog get] + +set List2 [split ${Log2} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List2} ${Tolerance} ${D_good} + +# 3 +puts "" +puts "Third curve" + +dlog reset +dlog on +xdistcs c_3 s1 0 1 10 +set Log3 [dlog get] + +set List3 [split ${Log3} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List3} ${Tolerance} ${D_good} + +# 4 +puts "" +puts "Fourth curve" + +dlog reset +dlog on +xdistcs c_4 s1 0 1 10 +set Log4 [dlog get] + +set List4 [split ${Log4} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List4} ${Tolerance} ${D_good} + +# 5 +puts "" +puts "Fifth curve" + +dlog reset +dlog on +xdistcs c_5 s1 0 1 10 +set Log5 [dlog get] + +set List5 [split ${Log5} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List5} ${Tolerance} ${D_good} + +# 6 +puts "" +puts "Sixth curve" + +dlog reset +dlog on +xdistcs c_6 s1 0 1 10 +set Log6 [dlog get] + +set List6 [split ${Log6} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List6} ${Tolerance} ${D_good} + +# 7 +puts "" +puts "Seventh curve" + +dlog reset +dlog on +xdistcs c_7 s1 0 1 10 +set Log7 [dlog get] + +set List7 [split ${Log7} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List7} ${Tolerance} ${D_good} + + +v2d +2dfit +set only_screen_axo 1 diff --git a/tests/bugs/modalg_5/bug25292_12 b/tests/bugs/modalg_5/bug25292_12 new file mode 100644 index 0000000000..98e21c5776 --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_12 @@ -0,0 +1,147 @@ +puts "TODO OCC225404 Debian60-64 Windows: Error: Curve Number is bad!" + +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# bopcurves command + +restore [locate_data_file bug25292_Input_0.brep] b1 +restore [locate_data_file bug25292_Input_1.brep] b2 + +explode b1 f +copy b1_2 f1 +explode b2 f +copy b2_2 f2 + +############################# +set log [bopcurves f2 f1 -2d] +############################# + +regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv +set MaxTol 1.e-7 +if {${Toler} > ${MaxTol}} { + puts "Error: Tolerance is too big!" +} +set GoodNbCurv 7 +if {${NbCurv} != ${GoodNbCurv}} { + puts "Error: Curve Number is bad!" +} + +#------------- + +# 1 +puts "" +puts "First curve" + +mksurface s1 f1 +mksurface s2 f2 + +dlog reset +dlog on +xdistcs c_1 s1 0 1 10 +set Log1 [dlog get] + +set List1 [split ${Log1} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List1} ${Tolerance} ${D_good} + +# 2 +puts "" +puts "Second curve" + +dlog reset +dlog on +xdistcs c_2 s1 0 1 10 +set Log2 [dlog get] + +set List2 [split ${Log2} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List2} ${Tolerance} ${D_good} + +# 3 +puts "" +puts "Third curve" + +dlog reset +dlog on +xdistcs c_3 s1 0 1 10 +set Log3 [dlog get] + +set List3 [split ${Log3} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List3} ${Tolerance} ${D_good} + +# 4 +puts "" +puts "Fourth curve" + +dlog reset +dlog on +xdistcs c_4 s1 0 1 10 +set Log4 [dlog get] + +set List4 [split ${Log4} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List4} ${Tolerance} ${D_good} + +# 5 +if { [info exist c_5] } { +puts "" +puts "Fifth curve" + +dlog reset +dlog on +xdistcs c_5 s1 0 1 10 +set Log5 [dlog get] + +set List5 [split ${Log5} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List5} ${Tolerance} ${D_good} +} + +# 6 +if { [info exist c_6] } { +puts "" +puts "Sixth curve" + +dlog reset +dlog on +xdistcs c_6 s1 0 1 10 +set Log6 [dlog get] + +set List6 [split ${Log6} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List6} ${Tolerance} ${D_good} +} + +# 7 +if { [info exist c_7] } { +puts "" +puts "Seventh curve" + +dlog reset +dlog on +xdistcs c_7 s1 0 1 10 +set Log7 [dlog get] + +set List7 [split ${Log7} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List7} ${Tolerance} ${D_good} +} + + +v2d +2dfit +set only_screen_axo 1 diff --git a/tests/bugs/modalg_5/bug25292_13 b/tests/bugs/modalg_5/bug25292_13 new file mode 100644 index 0000000000..e949eb601d --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_13 @@ -0,0 +1,36 @@ +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# Boolean operations + +restore [locate_data_file bug25292_Input_0.brep] b1 +restore [locate_data_file bug25292_Input_1.brep] b2 + +bclearobjects +bcleartools + +################# +baddobjects b1 b2 +################# + +bfillds +bbuild result + +set square 289.348 + +set nb_v_good 12 +set nb_e_good 18 +set nb_w_good 10 +set nb_f_good 10 +set nb_sh_good 3 +set nb_sol_good 3 +set nb_compsol_good 0 +set nb_compound_good 1 +set nb_shape_good 57 + +set 3dviewer 1 diff --git a/tests/bugs/modalg_5/bug25292_14 b/tests/bugs/modalg_5/bug25292_14 new file mode 100644 index 0000000000..4038ca060f --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_14 @@ -0,0 +1,40 @@ +puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 12 vertices instead of 9" +puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 18 edges instead of 15" +puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 57 shapes instead of 51" + +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# Boolean operations + +restore [locate_data_file bug25292_Input_0.brep] b1 +restore [locate_data_file bug25292_Input_1.brep] b2 + +bclearobjects +bcleartools + +################# +baddobjects b2 b1 +################# + +bfillds +bbuild result + +set square 289.348 + +set nb_v_good 12 +set nb_e_good 18 +set nb_w_good 10 +set nb_f_good 10 +set nb_sh_good 3 +set nb_sol_good 3 +set nb_compsol_good 0 +set nb_compound_good 1 +set nb_shape_good 57 + +set 3dviewer 1 diff --git a/tests/bugs/modalg_5/bug25292_15 b/tests/bugs/modalg_5/bug25292_15 new file mode 100644 index 0000000000..e0dfc911cc --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_15 @@ -0,0 +1,30 @@ +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# intersect command + +restore [locate_data_file bug25292_Input_0.brep] b1 +restore [locate_data_file bug25292_Input_1.brep] b2 + +explode b1 f +copy b1_2 f1 +explode b2 f +copy b2_2 f2 + +mksurface s1 f1 +mksurface s2 f2 + +################# +intersect i s1 s2 +################# + +if { [info exist i_7] } { + puts "OK: Curve Number is good!" +} else { + puts "Error: Curve Number is bad!" +} diff --git a/tests/bugs/modalg_5/bug25292_16 b/tests/bugs/modalg_5/bug25292_16 new file mode 100644 index 0000000000..961b699758 --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_16 @@ -0,0 +1,32 @@ +puts "TODO OCC225404 Debian60-64 Windows: Error: Curve Number is bad!" + +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# intersect command + +restore [locate_data_file bug25292_Input_0.brep] b1 +restore [locate_data_file bug25292_Input_1.brep] b2 + +explode b1 f +copy b1_2 f1 +explode b2 f +copy b2_2 f2 + +mksurface s1 f1 +mksurface s2 f2 + +################# +intersect i s2 s1 +################# + +if { [info exist i_7] } { + puts "OK: Curve Number is good!" +} else { + puts "Error: Curve Number is bad!" +} diff --git a/tests/bugs/modalg_5/bug25292_21 b/tests/bugs/modalg_5/bug25292_21 new file mode 100644 index 0000000000..22ace81d02 --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_21 @@ -0,0 +1,83 @@ +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# bopcurves command + +restore [locate_data_file bug25292_Input_3.brep] b1 +restore [locate_data_file bug25292_Input_11.brep] b2 + +explode b1 f +copy b1_1 f1 +explode b2 f +copy b2_1 f2 + +######################### +set log [bopcurves f1 f2] +######################### + +regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv +set MaxTol 1.e-7 +if {${Toler} > ${MaxTol}} { + puts "Error: Tolerance is too big!" +} +set GoodNbCurv 3 +if {${NbCurv} != ${GoodNbCurv}} { + puts "Error: Curve Number is bad!" +} + +#------------- + +# 1 +puts "" +puts "First curve" + +mksurface s1 f1 +mksurface s2 f2 + +dlog reset +dlog on +xdistcs c_1 s1 0 1 10 +set Log1 [dlog get] + +set List1 [split ${Log1} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List1} ${Tolerance} ${D_good} + +# 2 +puts "" +puts "Second curve" + +dlog reset +dlog on +xdistcs c_2 s1 0 1 10 +set Log2 [dlog get] + +set List2 [split ${Log2} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List2} ${Tolerance} ${D_good} + +# 3 +puts "" +puts "Third curve" + +dlog reset +dlog on +xdistcs c_3 s1 0 1 10 +set Log3 [dlog get] + +set List3 [split ${Log3} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List3} ${Tolerance} ${D_good} + + +smallview +fit +set only_screen_axo 1 diff --git a/tests/bugs/modalg_5/bug25292_22 b/tests/bugs/modalg_5/bug25292_22 new file mode 100644 index 0000000000..1845de5e8c --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_22 @@ -0,0 +1,87 @@ +puts "TODO OCC225404 Debian60-64 Windows: Error: Curve Number is bad!" + +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# bopcurves command + +restore [locate_data_file bug25292_Input_3.brep] b1 +restore [locate_data_file bug25292_Input_11.brep] b2 + +explode b1 f +copy b1_1 f1 +explode b2 f +copy b2_1 f2 + +######################### +set log [bopcurves f2 f1] +######################### + +regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv +set MaxTol 1.e-7 +if {${Toler} > ${MaxTol}} { + puts "Error: Tolerance is too big!" +} +set GoodNbCurv 3 +if {${NbCurv} != ${GoodNbCurv}} { + puts "Error: Curve Number is bad!" +} + +#------------- + +# 1 +puts "" +puts "First curve" + +mksurface s1 f1 +mksurface s2 f2 + +dlog reset +dlog on +xdistcs c_1 s1 0 1 10 +set Log1 [dlog get] + +set List1 [split ${Log1} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List1} ${Tolerance} ${D_good} + +# 2 +puts "" +puts "Second curve" + +dlog reset +dlog on +xdistcs c_2 s1 0 1 10 +set Log2 [dlog get] + +set List2 [split ${Log2} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List2} ${Tolerance} ${D_good} + +# 3 +if { [info exist c_3] } { +puts "" +puts "Third curve" + +dlog reset +dlog on +xdistcs c_3 s1 0 1 10 +set Log3 [dlog get] + +set List3 [split ${Log3} {TD= \t\n}] +set Tolerance 1.0e-7 +set D_good 0. +checkList ${List3} ${Tolerance} ${D_good} +} + + +smallview +fit +set only_screen_axo 1 diff --git a/tests/bugs/modalg_5/bug25292_23 b/tests/bugs/modalg_5/bug25292_23 new file mode 100644 index 0000000000..348266cd48 --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_23 @@ -0,0 +1,36 @@ +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# Boolean operations + +restore [locate_data_file bug25292_Input_3.brep] b1 +restore [locate_data_file bug25292_Input_11.brep] b2 + +bclearobjects +bcleartools + +################# +baddobjects b1 b2 +################# + +bfillds +bbuild result + +set square 31.6797 + +set nb_v_good 11 +set nb_e_good 20 +set nb_w_good 13 +set nb_f_good 13 +set nb_sh_good 3 +set nb_sol_good 3 +set nb_compsol_good 0 +set nb_compound_good 1 +set nb_shape_good 64 + +set 3dviewer 1 diff --git a/tests/bugs/modalg_5/bug25292_24 b/tests/bugs/modalg_5/bug25292_24 new file mode 100644 index 0000000000..6198ce9f0a --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_24 @@ -0,0 +1,41 @@ +puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 11 vertices instead of 10" +puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 20 edges instead of 19" +puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 64 shapes instead of 62" + + +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# Boolean operations + +restore [locate_data_file bug25292_Input_3.brep] b1 +restore [locate_data_file bug25292_Input_11.brep] b2 + +bclearobjects +bcleartools + +################# +baddobjects b2 b1 +################# + +bfillds +bbuild result + +set square 31.6797 + +set nb_v_good 11 +set nb_e_good 20 +set nb_w_good 13 +set nb_f_good 13 +set nb_sh_good 3 +set nb_sol_good 3 +set nb_compsol_good 0 +set nb_compound_good 1 +set nb_shape_good 64 + +set 3dviewer 1 diff --git a/tests/bugs/modalg_5/bug25292_25 b/tests/bugs/modalg_5/bug25292_25 new file mode 100644 index 0000000000..f4a72d3b02 --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_25 @@ -0,0 +1,30 @@ +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# intersect command + +restore [locate_data_file bug25292_Input_3.brep] b1 +restore [locate_data_file bug25292_Input_11.brep] b2 + +explode b1 f +copy b1_1 f1 +explode b2 f +copy b2_1 f2 + +mksurface s1 f1 +mksurface s2 f2 + +################# +intersect i s1 s2 +################# + +if { [info exist i_3] } { + puts "OK: Curve Number is good!" +} else { + puts "Error: Curve Number is bad!" +} diff --git a/tests/bugs/modalg_5/bug25292_26 b/tests/bugs/modalg_5/bug25292_26 new file mode 100644 index 0000000000..97d49c6930 --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_26 @@ -0,0 +1,33 @@ +puts "TODO OCC225404 Debian60-64 Windows: Error: Curve Number is bad!" + +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# intersect command + +restore [locate_data_file bug25292_Input_3.brep] b1 +restore [locate_data_file bug25292_Input_11.brep] b2 + +explode b1 f +copy b1_1 f1 +explode b2 f +copy b2_1 f2 + +mksurface s1 f1 +mksurface s2 f2 + +################# +intersect i s2 s1 +################# + +if { [info exist i_3] } { + puts "OK: Curve Number is good!" +} else { + puts "Error: Curve Number is bad!" +} + diff --git a/tests/bugs/modalg_5/bug25292_31 b/tests/bugs/modalg_5/bug25292_31 new file mode 100644 index 0000000000..e4b87e0b1f --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_31 @@ -0,0 +1,64 @@ +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# bopcurves command + +restore [locate_data_file bug25292_f1.brep] f1 +restore [locate_data_file bug25292_f2.brep] f2 + +############################# +set log [bopcurves f1 f2 -2d] +############################# + +regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv +set MaxTol 1.e-3 +if {${Toler} > ${MaxTol}} { + puts "Error: Tolerance is too big!" +} +set GoodNbCurv 2 +if {${NbCurv} != ${GoodNbCurv}} { + puts "Error: Curve Number is bad!!" +} + +#------------- + +# 1 +puts "" +puts "First curve" + +mksurface s1 f1 +mksurface s2 f2 + +dlog reset +dlog on +xdistcs c_1 s1 0 1 10 +set Log1 [dlog get] + +set List1 [split ${Log1} {TD= \t\n}] +set Tolerance 1.0e-4 +set D_good 0. +checkList ${List1} ${Tolerance} ${D_good} + +# 2 +puts "" +puts "Second curve" + +dlog reset +dlog on +xdistcs c_2 s1 0 1 10 +set Log2 [dlog get] + +set List2 [split ${Log2} {TD= \t\n}] +set Tolerance 1.0e-4 +set D_good 0. +checkList ${List2} ${Tolerance} ${D_good} + + +smallview +fit +set only_screen_axo 1 diff --git a/tests/bugs/modalg_5/bug25292_32 b/tests/bugs/modalg_5/bug25292_32 new file mode 100644 index 0000000000..8fabda3d67 --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_32 @@ -0,0 +1,64 @@ +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# bopcurves command + +restore [locate_data_file bug25292_f1.brep] f1 +restore [locate_data_file bug25292_f2.brep] f2 + +############################# +set log [bopcurves f2 f1 -2d] +############################# + +regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv +set MaxTol 1.e-3 +if {${Toler} > ${MaxTol}} { + puts "Error: Tolerance is too big!" +} +set GoodNbCurv 2 +if {${NbCurv} != ${GoodNbCurv}} { + puts "Error: Curve Number is bad!!" +} + +#------------- + +# 1 +puts "" +puts "First curve" + +mksurface s1 f1 +mksurface s2 f2 + +dlog reset +dlog on +xdistcs c_1 s1 0 1 10 +set Log1 [dlog get] + +set List1 [split ${Log1} {TD= \t\n}] +set Tolerance 1.0e-4 +set D_good 0. +checkList ${List1} ${Tolerance} ${D_good} + +# 2 +puts "" +puts "Second curve" + +dlog reset +dlog on +xdistcs c_2 s1 0 1 10 +set Log2 [dlog get] + +set List2 [split ${Log2} {TD= \t\n}] +set Tolerance 1.0e-4 +set D_good 0. +checkList ${List2} ${Tolerance} ${D_good} + + +smallview +fit +set only_screen_axo 1 diff --git a/tests/bugs/modalg_5/bug25292_33 b/tests/bugs/modalg_5/bug25292_33 new file mode 100644 index 0000000000..86939aabd9 --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_33 @@ -0,0 +1,25 @@ +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# intersect command + +restore [locate_data_file bug25292_f1.brep] f1 +restore [locate_data_file bug25292_f2.brep] f2 + +mksurface s1 f1 +mksurface s2 f2 + +################# +intersect i s1 s2 +################# + +if { [info exist i] } { + puts "OK: Curve Number is good!" +} else { + puts "Error: Curve Number is bad!" +} diff --git a/tests/bugs/modalg_5/bug25292_34 b/tests/bugs/modalg_5/bug25292_34 new file mode 100644 index 0000000000..a9508336b3 --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_34 @@ -0,0 +1,25 @@ +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# intersect command + +restore [locate_data_file bug25292_f1.brep] f1 +restore [locate_data_file bug25292_f2.brep] f2 + +mksurface s1 f1 +mksurface s2 f2 + +################# +intersect i s2 s1 +################# + +if { [info exist i] } { + puts "OK: Curve Number is good!" +} else { + puts "Error: Curve Number is bad!" +} diff --git a/tests/bugs/modalg_5/bug25292_35 b/tests/bugs/modalg_5/bug25292_35 new file mode 100644 index 0000000000..cfedf6f95a --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_35 @@ -0,0 +1,31 @@ +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# intersect command for trimmed surfaces + +restore [locate_data_file bug25292_f1.brep] f1 +restore [locate_data_file bug25292_f2.brep] f2 + +mksurface s1 f1 +mksurface s2 f2 + +# trim s1 in accordance with the UV-bounds of f1: +trimv s1t s1 19.1600000005 19.6600000005 + +# trim s2 in accordance with the UV-bounds of f2: +trim s2t s2 0. 1.570796326795 -275 275 + +################### +intersect k s1t s2t +################### + +if { [info exist k_2] } { + puts "OK: Curve Number is good!" +} else { + puts "Error: Curve Number is bad!" +} diff --git a/tests/bugs/modalg_5/bug25292_36 b/tests/bugs/modalg_5/bug25292_36 new file mode 100644 index 0000000000..95cdcfac97 --- /dev/null +++ b/tests/bugs/modalg_5/bug25292_36 @@ -0,0 +1,31 @@ +puts "================" +puts "OCC25292" +puts "================" +puts "" +####################################################################### +# Face/Face intersection algorithm gives different results for different order of the arguments +####################################################################### + +# intersect command for trimmed surfaces + +restore [locate_data_file bug25292_f1.brep] f1 +restore [locate_data_file bug25292_f2.brep] f2 + +mksurface s1 f1 +mksurface s2 f2 + +# trim s1 in accordance with the UV-bounds of f1: +trimv s1t s1 19.1600000005 19.6600000005 + +# trim s2 in accordance with the UV-bounds of f2: +trim s2t s2 0. 1.570796326795 -275 275 + +################### +intersect k s2t s1t +################### + +if { [info exist k_2] } { + puts "OK: Curve Number is good!" +} else { + puts "Error: Curve Number is bad!" +}