From 33463eef63b49915024a8dd2e461cd68d7efd69b Mon Sep 17 00:00:00 2001 From: ifv Date: Mon, 25 Apr 2022 18:14:18 +0300 Subject: [PATCH] 0032942: Modeling Algorithms - Boolean operation Common has no result in specific example IntTools/IntTools_BeanFaceIntersector.cxx - calculation of deflection for surface bnd box is added tests/bugs/modalg_8/bug32942,bug32943,bug32944,bug32945 - new test cases added --- src/IntTools/IntTools_BeanFaceIntersector.cxx | 143 +++++++++--------- tests/bugs/modalg_8/bug32942 | 19 +++ tests/bugs/modalg_8/bug32943 | 19 +++ tests/bugs/modalg_8/bug32944 | 19 +++ tests/bugs/modalg_8/bug32945 | 19 +++ 5 files changed, 151 insertions(+), 68 deletions(-) create mode 100644 tests/bugs/modalg_8/bug32942 create mode 100644 tests/bugs/modalg_8/bug32943 create mode 100644 tests/bugs/modalg_8/bug32944 create mode 100644 tests/bugs/modalg_8/bug32945 diff --git a/src/IntTools/IntTools_BeanFaceIntersector.cxx b/src/IntTools/IntTools_BeanFaceIntersector.cxx index 0909c74360..96b9c0c369 100644 --- a/src/IntTools/IntTools_BeanFaceIntersector.cxx +++ b/src/IntTools/IntTools_BeanFaceIntersector.cxx @@ -1813,7 +1813,6 @@ Standard_Boolean IntTools_BeanFaceIntersector::ComputeLocalized() { return Standard_False; } - IntTools_ListOfCurveRangeSample aListCurveRangeSort; IntTools_ListOfSurfaceRangeSample aListSurfaceRangeSort; @@ -1860,7 +1859,7 @@ Standard_Boolean IntTools_BeanFaceIntersector::ComputeLocalized() { for(indIt = nMinIndex ; indIt <= nMaxIndex; indIt++) { if(myRangeManager.Flag(indIt) == 2) { bFound = Standard_True; - break; + break; } } @@ -2179,88 +2178,96 @@ void ComputeGridPoints gp_Pnt aPnt; Standard_Real aParU; Standard_Real aParV; + gp_Vec aDU, aDV; + Standard_Real du = 0, dv = 0; + Standard_Boolean isCalcDefl = aNbGridPnts[0] < 30 && aNbGridPnts[1] < 30; + + Bnd_Box aGridBox, anExtBox; for (i = 1; i <= aNbGridPnts[0]; i++) { aParU = theSurfaceData.GetUParam(i); + + if (isCalcDefl && i < aNbGridPnts[0]) + { + du = 0.5 * (theSurfaceData.GetUParam(i + 1) - aParU); + } for (j = 1; j <= aNbGridPnts[1]; j++) { aParV = theSurfaceData.GetVParam(j); + + if (isCalcDefl) + { + theSurf->D1(aParU, aParV, aPnt, aDU, aDV); + } + else + { + theSurf->D0(aParU, aParV, aPnt); + } - theSurf->D0(aParU, aParV, aPnt); theSurfaceData.SetGridPoint(i, j, aPnt); + // + if (isCalcDefl) + { + aGridBox.Add(aPnt); + if (i < aNbGridPnts[0] && j < aNbGridPnts[1]) + { + dv = 0.5 * (theSurfaceData.GetVParam(j + 1) - aParV); + gp_Vec aShift = du * aDU + dv * aDV; + aPnt.Translate(aShift); + anExtBox.Add(aPnt); + } + } } } // Compute deflection. Standard_Real aDef = 0.; -// Standard_Real aDefLin; -// Standard_Real aParMid; -// Standard_Real aParConst; -// Standard_Real aDistPP; -// gp_Pnt aPntMid; -// gp_Vec aVec; -// gp_XYZ aCoord; - -// // Compute DU deflection. -// for (i = 1; i < aNbGridPnts[0]; i++) { -// aParMid = 0.5*(theSurfaceData.GetUParam(i + 1) + -// theSurfaceData.GetUParam(i)); - -// for (j = 1; j <= aNbGridPnts[1]; j++) { -// const gp_Pnt &thePnt1 = theSurfaceData.GetGridPoint(i, j); -// const gp_Pnt &thePnt2 = theSurfaceData.GetGridPoint(i + 1, j); - -// aVec.SetXYZ(thePnt2.XYZ().Subtracted(thePnt1.XYZ())); -// aDistPP = aVec.Magnitude(); - -// if (aDistPP > theTolerance) { -// // Computation of a distance of a middle point from the line P1 - P2. -// aParConst = theSurfaceData.GetVParam(j); -// theSurf->D0(aParMid, aParConst, aPntMid); -// aCoord = aPntMid.XYZ(); -// aCoord.Subtract(thePnt1.XYZ()); -// aCoord.Cross (aVec.XYZ()); -// aCoord.Divide(aDistPP); -// aDefLin = aCoord.Modulus(); - -// if (aDefLin > aDef) -// aDef = aDefLin; -// } -// } -// } - -// // Compute DV deflection. -// for (j = 1; j < aNbGridPnts[1]; j++) { -// aParMid = 0.5*(theSurfaceData.GetVParam(j + 1) + -// theSurfaceData.GetVParam(j)); - -// for (i = 1; i <= aNbGridPnts[0]; i++) { -// const gp_Pnt &thePnt1 = theSurfaceData.GetGridPoint(i, j); -// const gp_Pnt &thePnt2 = theSurfaceData.GetGridPoint(i, j + 1); - -// aVec.SetXYZ(thePnt2.XYZ().Subtracted(thePnt1.XYZ())); -// aDistPP = aVec.Magnitude(); - -// if (aDistPP > theTolerance) { -// // Computation of a distance of a middle point from the line P1 - P2. -// aParConst = theSurfaceData.GetUParam(i); -// theSurf->D0(aParConst, aParMid, aPntMid); -// aCoord = aPntMid.XYZ(); -// aCoord.Subtract(thePnt1.XYZ()); -// aCoord.Cross (aVec.XYZ()); -// aCoord.Divide(aDistPP); -// aDefLin = aCoord.Modulus(); - -// if (aDefLin > aDef) -// aDef = aDefLin; -// } -// } -// } + if (isCalcDefl) + { + Standard_Real xmin, ymin, zmin, xmax, ymax, zmax; + Standard_Real xmin1, ymin1, zmin1, xmax1, ymax1, zmax1; + aGridBox.Get(xmin, ymin, zmin, xmax, ymax, zmax); + anExtBox.Get(xmin1, ymin1, zmin1, xmax1, ymax1, zmax1); + Standard_Integer anExtCount = 0; + if (xmin1 < xmin) + { + aDef = Max(xmin - xmin1, aDef); + anExtCount++; + } + if (ymin1 < ymin) + { + aDef = Max(ymin - ymin1, aDef); + anExtCount++; + } + if (zmin1 < zmin) + { + aDef = Max(zmin - zmin1, aDef); + anExtCount++; + } + if (xmax1 > xmax) + { + aDef = Max(xmax1 - xmax, aDef); + anExtCount++; + } + if (ymax1 > ymax) + { + aDef = Max(ymax1 - ymax, aDef); + anExtCount++; + } + if (zmax1 > zmax) + { + aDef = Max(zmax1 - zmax, aDef); + anExtCount++; + } + if (anExtCount < 3) + { + aDef /= 2.; + } + } if (theTolerance > aDef) - aDef = theTolerance; + aDef = 2. * theTolerance; - aDef *= 2.; theSurfaceData.SetGridDeflection(aDef); } diff --git a/tests/bugs/modalg_8/bug32942 b/tests/bugs/modalg_8/bug32942 new file mode 100644 index 0000000000..ece1cbaf87 --- /dev/null +++ b/tests/bugs/modalg_8/bug32942 @@ -0,0 +1,19 @@ +puts "=========================================================================" +puts "OCC32942: Modeling Algorithms - Boolean operation Common has no result in specific example" +puts "=========================================================================" +puts "" + +restore [locate_data_file bug32942.brep] a +explode a + +bcommon result a_1 a_2 + +checkshape result + +checknbshapes result -vertex 8 -edge 12 -wire 6 -face 6 -shell 1 -solid 1 + +checkmaxtol result -min_tol 1.e-5 + +checkprops result -s 21746.8 + +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_8/bug32943 b/tests/bugs/modalg_8/bug32943 new file mode 100644 index 0000000000..b232df52d5 --- /dev/null +++ b/tests/bugs/modalg_8/bug32943 @@ -0,0 +1,19 @@ +puts "=========================================================================" +puts "OCC32943: Modeling Algorithms - Boolean operation Common has no result in specific example" +puts "=========================================================================" +puts "" + +restore [locate_data_file bug32943.brep] a +explode a + +bcommon result a_1 a_2 + +checkshape result + +checknbshapes result -vertex 8 -edge 12 -wire 6 -face 6 -shell 1 -solid 1 + +checkmaxtol result -min_tol 1.e-5 + +checkprops result -s 17615.5 + +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_8/bug32944 b/tests/bugs/modalg_8/bug32944 new file mode 100644 index 0000000000..362791bc56 --- /dev/null +++ b/tests/bugs/modalg_8/bug32944 @@ -0,0 +1,19 @@ +puts "=========================================================================" +puts "OCC32944: Modeling Algorithms - Boolean operation Common has no result in specific example" +puts "=========================================================================" +puts "" + +restore [locate_data_file bug32944.brep] a +explode a + +bcommon result a_1 a_2 + +checkshape result + +checknbshapes result -vertex 8 -edge 12 -wire 6 -face 6 -shell 1 -solid 1 + +checkmaxtol result -min_tol 1.e-5 + +checkprops result -s 36741.6 + +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_8/bug32945 b/tests/bugs/modalg_8/bug32945 new file mode 100644 index 0000000000..6b2fb69925 --- /dev/null +++ b/tests/bugs/modalg_8/bug32945 @@ -0,0 +1,19 @@ +puts "=========================================================================" +puts "OCC32945: Modeling Algorithms - Boolean operation Common has no result in specific example" +puts "=========================================================================" +puts "" + +restore [locate_data_file bug32945.brep] a +explode a + +bcommon result a_1 a_2 + +checkshape result + +checknbshapes result -vertex 8 -edge 12 -wire 6 -face 6 -shell 1 -solid 1 + +checkmaxtol result -min_tol 1.e-5 + +checkprops result -s 83754.8 + +checkview -display result -2d -path ${imagedir}/${test_image}.png