1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025470: Wrong result of COMMON operation

Fix for correct splitting of infinite faces.

Test cases for issue CR25470
This commit is contained in:
emv
2014-11-28 13:25:00 +03:00
committed by bugmaster
parent 7e7bbb3a9e
commit d2d9e8dc0e
2 changed files with 80 additions and 5 deletions

View File

@@ -45,6 +45,10 @@
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
//
#include <Bnd_Box.hxx>
//
#include <BRepBndLib.hxx>
//
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
@@ -451,7 +455,7 @@ void BOPAlgo_BuilderFace::PerformLoops()
void BOPAlgo_BuilderFace::PerformAreas()
{
Standard_Boolean bIsGrowth, bIsHole;
Standard_Integer k, aNbHoles, aNbDMISB, m, aNbMSH, aNbInOutMap;;
Standard_Integer k, aNbS, aNbHoles, aNbDMISB, m, aNbMSH, aNbInOutMap;
Standard_Real aTol;
TopLoc_Location aLoc;
Handle(Geom_Surface) aS;
@@ -469,6 +473,7 @@ void BOPAlgo_BuilderFace::PerformAreas()
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFiller(aBBTree);
//
myErrorStatus=0;
aNbHoles=0;
//
aTol=BRep_Tool::Tolerance(myFace);
aS=BRep_Tool::Surface(myFace, aLoc);
@@ -498,8 +503,8 @@ void BOPAlgo_BuilderFace::PerformAreas()
bIsHole=aClsf.IsHole();
if (bIsHole) {
BOPTools::MapShapes(aWire, TopAbs_EDGE, aMHE);
//
bIsHole=Standard_True;
//
bIsHole=Standard_True;
}
else {
bIsHole=Standard_False;
@@ -525,6 +530,7 @@ void BOPAlgo_BuilderFace::PerformAreas()
if (bIsHole) {
const Bnd_Box2d& aBox2D=aSB2D.Box2D();
aTreeFiller.Add(k, aBox2D);
++aNbHoles;
}
}
//
@@ -546,7 +552,10 @@ void BOPAlgo_BuilderFace::PerformAreas()
aSelector.Clear();
aSelector.SetBox(aBox2DF);
//
aNbHoles=aBBTree.Select(aSelector);
aNbS = aBBTree.Select(aSelector);
if (!aNbS) {
continue;
}
//
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
//
@@ -572,7 +581,7 @@ void BOPAlgo_BuilderFace::PerformAreas()
}
}// for (m=1; m<=aNbDMISB; ++m)
//
// 5. Map [Face/Holes] -> aMSH
// 5.1 Map [Face/Holes] -> aMSH
aNbInOutMap=aInOutMap.Extent();
for (m=1; m<=aNbInOutMap; ++m) {
const TopoDS_Shape& aHole=aInOutMap.FindKey(m);
@@ -589,6 +598,41 @@ void BOPAlgo_BuilderFace::PerformAreas()
}
}
//
// 5.2. Add unused holes to the original face
if (aNbHoles != aNbInOutMap) {
Bnd_Box aBoxF;
BRepBndLib::Add(myFace, aBoxF);
if (aBoxF.IsOpenXmin() || aBoxF.IsOpenXmax() ||
aBoxF.IsOpenYmin() || aBoxF.IsOpenYmax() ||
aBoxF.IsOpenZmin() || aBoxF.IsOpenZmax()) {
//
BOPCol_ListOfShape anUnUsedHoles;
for (m = 1; m <= aNbDMISB; ++m) {
const BOPAlgo_ShapeBox2D& aSB2D=aDMISB.FindFromIndex(m);
if (aSB2D.IsHole()) {
const TopoDS_Shape& aHole = aSB2D.Shape();
if (!aInOutMap.Contains(aHole)) {
anUnUsedHoles.Append(aHole);
}
}
}
//
if (anUnUsedHoles.Extent()) {
TopoDS_Face aFace;
aBB.MakeFace(aFace, aS, aLoc, aTol);
aMSH.Add(aFace, anUnUsedHoles);
//
BOPAlgo_ShapeBox2D aSB2D;
//
aSB2D.SetShape(aFace);
aSB2D.SetIsHole(Standard_False);
//
aDMISB.Add(aNbDMISB, aSB2D);
++aNbDMISB;
}
}
}
//
// 6. Add aHoles to Faces
aNbMSH=aMSH.Extent();
for (m=1; m<=aNbMSH; ++m) {