mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +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:
parent
7e7bbb3a9e
commit
d2d9e8dc0e
@ -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);
|
||||
@ -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) {
|
||||
|
31
tests/bugs/modalg_5/bug25470
Normal file
31
tests/bugs/modalg_5/bug25470
Normal file
@ -0,0 +1,31 @@
|
||||
puts "=========="
|
||||
puts "OCC25470"
|
||||
puts "=========="
|
||||
puts ""
|
||||
####################################################
|
||||
# Wrong result of COMMON operation
|
||||
####################################################
|
||||
|
||||
restore [locate_data_file bug25470_s.brep] b1
|
||||
restore [locate_data_file bug25470_t.brep] b2
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects b1
|
||||
baddtools b2
|
||||
bfillds -s
|
||||
bbop result 0
|
||||
|
||||
set square 893.011
|
||||
|
||||
set nb_v_good 45
|
||||
set nb_e_good 77
|
||||
set nb_w_good 32
|
||||
set nb_f_good 32
|
||||
set nb_sh_good 1
|
||||
set nb_sol_good 1
|
||||
set nb_compsol_good 0
|
||||
set nb_compound_good 1
|
||||
set nb_shape_good 189
|
||||
|
||||
set 2dviewer 1
|
Loading…
x
Reference in New Issue
Block a user