1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0026218: Wrong result done by General Fuse algorithm

class BOPAlgo_PaveFiller
1. method
  void BOPAlgo_PaveFiller::MakeBlocks()
 Update of FaceInfo IN information before filling the maps.

2. methods
  void BOPAlgo_PaveFiller::UpdateFaceInfo
    (BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME,
     const BOPCol_DataMapOfIntegerInteger& theDMV)

  void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
    (const Standard_Integer theInt,
     const BOPDS_IndexedMapOfPaveBlock& aMPBOnIn,
     const BOPCol_DataMapOfIntegerListOfInteger& aDMBV,
     BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB,
     BOPCol_DataMapOfShapeInteger& aMVI,
     BOPDS_MapOfPaveBlock& aMPB)

  Small changes in treatment of existing pave blocks when making new ones from intersection curves.
This commit is contained in:
emv 2015-05-14 12:39:16 +03:00 committed by vsr
parent b3b55601fb
commit a5416a8c8c
3 changed files with 136 additions and 64 deletions

View File

@ -240,7 +240,7 @@ is
theF2: Face from TopoDS; theF2: Face from TopoDS;
theTolR3D:Real from Standard; theTolR3D:Real from Standard;
theNC:out Curve from BOPDS; theNC:out Curve from BOPDS;
theMVB:out MapOfInteger from BOPCol) theLBV:out ListOfInteger from BOPCol)
is protected; is protected;
IsExistingPaveBlock(me:out; IsExistingPaveBlock(me:out;
@ -367,9 +367,9 @@ is
ProcessExistingPaveBlocks(me:out; ProcessExistingPaveBlocks(me:out;
theInt : Integer from Standard; theInt : Integer from Standard;
theMPBOnIn : IndexedMapOfPaveBlock from BOPDS; theMPBOnIn : IndexedMapOfPaveBlock from BOPDS;
theDMBV : DataMapOfIntegerListOfInteger from BOPCol;
theMSCPB : out IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS; theMSCPB : out IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS;
theMVI : out DataMapOfShapeInteger from BOPCol; theMVI : out DataMapOfShapeInteger from BOPCol;
theMVB : MapOfInteger from BOPCol;
theMPB : out MapOfPaveBlock from BOPDS) theMPB : out MapOfPaveBlock from BOPDS)
is protected; is protected;
---Purpose: ---Purpose:
@ -403,10 +403,11 @@ is
PreparePostTreatFF(me:out; PreparePostTreatFF(me:out;
aInt : Integer from Standard; aInt : Integer from Standard;
aCur : Integer from Standard;
aPB : PaveBlock from BOPDS; aPB : PaveBlock from BOPDS;
aMSCPB : out IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS; aMSCPB : out IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS;
aMVI : out DataMapOfShapeInteger from BOPCol; aMVI : out DataMapOfShapeInteger from BOPCol;
aVC : out VectorOfCurve from BOPDS) aLPB : out ListOfPaveBlock from BOPDS)
is protected; is protected;
---Purpose: ---Purpose:
-- Keeps data for post treatment -- Keeps data for post treatment

View File

@ -374,10 +374,10 @@ void BOPAlgo_PaveFiller::MakeBlocks()
//-----------------------------------------------------scope f //-----------------------------------------------------scope f
aAllocator=new NCollection_IncAllocator(); aAllocator=new NCollection_IncAllocator();
// //
BOPCol_ListOfInteger aLSE(aAllocator); BOPCol_ListOfInteger aLSE(aAllocator), aLBV(aAllocator);
BOPCol_MapOfInteger aMVOnIn(100, aAllocator), aMF(100, aAllocator), BOPCol_MapOfInteger aMVOnIn(100, aAllocator), aMF(100, aAllocator),
aMVStick(100,aAllocator), aMVEF(100, aAllocator), aMVStick(100,aAllocator), aMVEF(100, aAllocator),
aMVB(100, aAllocator), aMI(100, aAllocator); aMI(100, aAllocator);
BOPDS_IndexedMapOfPaveBlock aMPBOnIn(100, aAllocator); BOPDS_IndexedMapOfPaveBlock aMPBOnIn(100, aAllocator);
BOPDS_MapOfPaveBlock aMPBAdd(100, aAllocator); BOPDS_MapOfPaveBlock aMPBAdd(100, aAllocator);
BOPDS_ListOfPaveBlock aLPB(aAllocator); BOPDS_ListOfPaveBlock aLPB(aAllocator);
@ -385,8 +385,9 @@ void BOPAlgo_PaveFiller::MakeBlocks()
BOPCol_DataMapOfShapeInteger aMVI(100, aAllocator); BOPCol_DataMapOfShapeInteger aMVI(100, aAllocator);
BOPDS_DataMapOfPaveBlockListOfPaveBlock aDMExEdges(100, aAllocator); BOPDS_DataMapOfPaveBlockListOfPaveBlock aDMExEdges(100, aAllocator);
BOPCol_DataMapOfIntegerReal aMVTol(100, aAllocator); BOPCol_DataMapOfIntegerReal aMVTol(100, aAllocator);
BOPCol_DataMapIteratorOfDataMapOfIntegerReal aItMV;
BOPCol_DataMapOfIntegerInteger aDMI(100, aAllocator); BOPCol_DataMapOfIntegerInteger aDMI(100, aAllocator);
BOPCol_DataMapOfIntegerListOfInteger aDMBV(100, aAllocator);
BOPCol_DataMapIteratorOfDataMapOfIntegerReal aItMV;
// //
for (i=0; i<aNbFF; ++i) { for (i=0; i<aNbFF; ++i) {
// //
@ -411,17 +412,19 @@ void BOPAlgo_PaveFiller::MakeBlocks()
// Update face info // Update face info
if (aMF.Add(nF1)) { if (aMF.Add(nF1)) {
myDS->UpdateFaceInfoOn(nF1); myDS->UpdateFaceInfoOn(nF1);
myDS->UpdateFaceInfoIn(nF1);
} }
if (aMF.Add(nF2)) { if (aMF.Add(nF2)) {
myDS->UpdateFaceInfoOn(nF2); myDS->UpdateFaceInfoOn(nF2);
myDS->UpdateFaceInfoIn(nF2);
} }
//
BOPDS_FaceInfo& aFI1=myDS->ChangeFaceInfo(nF1); BOPDS_FaceInfo& aFI1=myDS->ChangeFaceInfo(nF1);
BOPDS_FaceInfo& aFI2=myDS->ChangeFaceInfo(nF2); BOPDS_FaceInfo& aFI2=myDS->ChangeFaceInfo(nF2);
// //
aMVOnIn.Clear(); aMVOnIn.Clear();
aMPBOnIn.Clear(); aMPBOnIn.Clear();
aMVB.Clear(); aDMBV.Clear();
aMVTol.Clear(); aMVTol.Clear();
// //
myDS->VerticesOnIn(nF1, nF2, aMVOnIn, aMPBOnIn); myDS->VerticesOnIn(nF1, nF2, aMVOnIn, aMPBOnIn);
@ -465,7 +468,13 @@ void BOPAlgo_PaveFiller::MakeBlocks()
} }
// //
if (aIC.HasBounds()) { if (aIC.HasBounds()) {
PutBoundPaveOnCurve(aF1, aF2, aTolR3D, aNC, aMVB); aLBV.Clear();
//
PutBoundPaveOnCurve(aF1, aF2, aTolR3D, aNC, aLBV);
//
if (!aLBV.IsEmpty()) {
aDMBV.Bind(j, aLBV);
}
} }
}//for (j=0; j<aNbC; ++j) { }//for (j=0; j<aNbC; ++j) {
// //
@ -529,7 +538,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
aFI2.PaveBlocksIn().Contains(aPBOut)); aFI2.PaveBlocksIn().Contains(aPBOut));
} }
if (!bInBothFaces) { if (!bInBothFaces) {
PreparePostTreatFF(i, aPBOut, aMSCPB, aMVI, aVC); PreparePostTreatFF(i, j, aPBOut, aMSCPB, aMVI, aLPBC);
} }
} }
continue; continue;
@ -580,7 +589,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
TV->Tolerance(aTol); TV->Tolerance(aTol);
} }
// //
ProcessExistingPaveBlocks(i, aMPBOnIn, aMSCPB, aMVI, aMVB, aMPBAdd); ProcessExistingPaveBlocks(i, aMPBOnIn, aDMBV, aMSCPB, aMVI, aMPBAdd);
}//for (i=0; i<aNbFF; ++i) { }//for (i=0; i<aNbFF; ++i) {
// //
// post treatment // post treatment
@ -913,22 +922,23 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
for (j=0; j<aNbC; ++j) { for (j=0; j<aNbC; ++j) {
BOPDS_Curve& aNC=aVNC(j); BOPDS_Curve& aNC=aVNC(j);
BOPDS_ListOfPaveBlock& aLPBC=aNC.ChangePaveBlocks(); BOPDS_ListOfPaveBlock& aLPBC=aNC.ChangePaveBlocks();
//
// Add section edges to face info
aItLPB.Initialize(aLPBC); aItLPB.Initialize(aLPBC);
for (; aItLPB.More(); ) {
const Handle(BOPDS_PaveBlock)& aPB=aItLPB.Value();
// //
// Treat existing pave blocks // Treat existing pave blocks
if (aItLPB.More() && theDME.IsBound(aLPBC.First())) { if (theDME.IsBound(aPB)) {
const Handle(BOPDS_PaveBlock)& aPB=aLPBC.First();
BOPDS_ListOfPaveBlock& aLPB=theDME.ChangeFind(aPB); BOPDS_ListOfPaveBlock& aLPB=theDME.ChangeFind(aPB);
UpdateExistingPaveBlocks(aPB, aLPB, nF1, nF2); UpdateExistingPaveBlocks(aPB, aLPB, nF1, nF2);
aLPBC.Clear(); aLPBC.Remove(aItLPB);
continue; continue;
} }
// //
// Add section edges to face info
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItLPB.Value();
aFI1.ChangePaveBlocksSc().Add(aPB); aFI1.ChangePaveBlocksSc().Add(aPB);
aFI2.ChangePaveBlocksSc().Add(aPB); aFI2.ChangePaveBlocksSc().Add(aPB);
aItLPB.Next();
} }
} }
// //
@ -1006,6 +1016,11 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
const Handle(BOPDS_PaveBlock)& aPB = aMPBCopy(j); const Handle(BOPDS_PaveBlock)& aPB = aMPBCopy(j);
if (theDME.IsBound(aPB)) { if (theDME.IsBound(aPB)) {
const BOPDS_ListOfPaveBlock& aLPB = theDME.Find(aPB); const BOPDS_ListOfPaveBlock& aLPB = theDME.Find(aPB);
if (aLPB.IsEmpty()) {
aMPBOnIn.Add(aPB);
continue;
}
//
aItLPB.Initialize(aLPB); aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) { for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB1 = aItLPB.Value(); const Handle(BOPDS_PaveBlock)& aPB1 = aItLPB.Value();
@ -1189,7 +1204,7 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
const TopoDS_Face& aF2, const TopoDS_Face& aF2,
const Standard_Real aTolR3D, const Standard_Real aTolR3D,
BOPDS_Curve& aNC, BOPDS_Curve& aNC,
BOPCol_MapOfInteger& aMVB) BOPCol_ListOfInteger& aLVB)
{ {
Standard_Boolean bVF; Standard_Boolean bVF;
Standard_Integer nV, iFlag, nVn, j, aNbEP; Standard_Integer nV, iFlag, nVn, j, aNbEP;
@ -1277,7 +1292,8 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVn); BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVn);
Bnd_Box& aBoxDS=aSIDS.ChangeBox(); Bnd_Box& aBoxDS=aSIDS.ChangeBox();
BRepBndLib::Add(aVn, aBoxDS); BRepBndLib::Add(aVn, aBoxDS);
aMVB.Add(nVn); //
aLVB.Append(nVn);
} }
} }
} }
@ -1769,22 +1785,37 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
(const Standard_Integer theInt, (const Standard_Integer theInt,
const BOPDS_IndexedMapOfPaveBlock& aMPBOnIn, const BOPDS_IndexedMapOfPaveBlock& aMPBOnIn,
const BOPCol_DataMapOfIntegerListOfInteger& aDMBV,
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB, BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB,
BOPCol_DataMapOfShapeInteger& aMVI, BOPCol_DataMapOfShapeInteger& aMVI,
const BOPCol_MapOfInteger& aMVB,
BOPDS_MapOfPaveBlock& aMPB) BOPDS_MapOfPaveBlock& aMPB)
{ {
Standard_Integer nV, nE, iFlag, i, aNbPB; if (aDMBV.IsEmpty()) {
return;
}
//
Standard_Real aT; Standard_Real aT;
BOPCol_MapIteratorOfMapOfInteger aItB; Standard_Integer i, nV, nE, iC, aNbPB, iFlag;
BOPCol_ListIteratorOfListOfInteger aItLI;
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItBV;
// //
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF(); BOPDS_VectorOfInterfFF& aFFs = myDS->InterfFF();
BOPDS_InterfFF& aFF = aFFs(theInt); BOPDS_InterfFF& aFF = aFFs(theInt);
BOPDS_VectorOfCurve& aVC=aFF.ChangeCurves(); BOPDS_VectorOfCurve& aVC = aFF.ChangeCurves();
// //
aItB.Initialize(aMVB); aNbPB = aMPBOnIn.Extent();
for (; aItB.More(); aItB.Next()) { //
nV = aItB.Value(); aItBV.Initialize(aDMBV);
for (; aItBV.More(); aItBV.Next()) {
iC = aItBV.Key();
const BOPCol_ListOfInteger& aLBV = aItBV.Value();
//
BOPDS_Curve& aNC = aVC.ChangeValue(iC);
BOPDS_ListOfPaveBlock& aLPBC = aNC.ChangePaveBlocks();
//
aItLI.Initialize(aLBV);
for (; aItLI.More(); aItLI.Next()) {
nV = aItLI.Value();
const BOPDS_ShapeInfo& aSIV=myDS->ShapeInfo(nV); const BOPDS_ShapeInfo& aSIV=myDS->ShapeInfo(nV);
const Bnd_Box& aBoxV=aSIV.Box(); const Bnd_Box& aBoxV=aSIV.Box();
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&aSIV.Shape(); const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&aSIV.Shape();
@ -1792,7 +1823,6 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
continue; continue;
} }
// //
aNbPB = aMPBOnIn.Extent();
for (i = 1; i <= aNbPB; ++i) { for (i = 1; i <= aNbPB; ++i) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBOnIn(i); const Handle(BOPDS_PaveBlock)& aPB = aMPBOnIn(i);
if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) { if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) {
@ -1802,18 +1832,21 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
if (aMPB.Contains(aPB)) { if (aMPB.Contains(aPB)) {
continue; continue;
} }
nE=aPB->Edge();
const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
const Bnd_Box& aBoxE=aSIE.Box();
// //
if (!aBoxV.IsOut(aBoxE)) { nE = aPB->Edge();
const BOPDS_ShapeInfo& aSIE = myDS->ShapeInfo(nE);
const Bnd_Box& aBoxE = aSIE.Box();
//
if (aBoxV.IsOut(aBoxE)) {
continue;
}
//
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aSIE.Shape(); const TopoDS_Edge& aE = *(TopoDS_Edge*)&aSIE.Shape();
// //
iFlag=myContext->ComputeVE (aV, aE, aT); iFlag = myContext->ComputeVE(aV, aE, aT);
if (!iFlag) { if (!iFlag) {
aMPB.Add(aPB); aMPB.Add(aPB);
// PreparePostTreatFF(theInt, iC, aPB, aMSCPB, aMVI, aLPBC);
PreparePostTreatFF(theInt, aPB, aMSCPB, aMVI, aVC);
} }
} }
} }
@ -1888,10 +1921,11 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
// 3. Update pave blocks // 3. Update pave blocks
if (bCB) { if (bCB) {
//create new common blocks //create new common blocks
BOPDS_ListOfPaveBlock aLPBNew;
const BOPCol_ListOfInteger& aFaces = aCB1->Faces(); const BOPCol_ListOfInteger& aFaces = aCB1->Faces();
aIt.Initialize(aLPB); aIt.Initialize(aLPB);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
Handle(BOPDS_PaveBlock)& aPB = aIt.ChangeValue(); const Handle(BOPDS_PaveBlock)& aPB = aIt.Value();
// //
aCB = new BOPDS_CommonBlock; aCB = new BOPDS_CommonBlock;
aIt1.Initialize(aLPB1); aIt1.Initialize(aLPB1);
@ -1911,8 +1945,11 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
aCB->AddFaces(aFaces); aCB->AddFaces(aFaces);
myDS->SortPaveBlocks(aCB); myDS->SortPaveBlocks(aCB);
// //
aPB=aCB->PaveBlocks().First(); const Handle(BOPDS_PaveBlock)& aPBNew = aCB->PaveBlocks().First();
aLPBNew.Append(aPBNew);
} }
//
aLPB = aLPBNew;
} }
else { else {
nE = aPBf->OriginalEdge(); nE = aPBf->OriginalEdge();
@ -2038,16 +2075,14 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::PreparePostTreatFF void BOPAlgo_PaveFiller::PreparePostTreatFF
(const Standard_Integer aInt, (const Standard_Integer aInt,
const Standard_Integer aCur,
const Handle(BOPDS_PaveBlock)& aPB, const Handle(BOPDS_PaveBlock)& aPB,
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB, BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB,
BOPCol_DataMapOfShapeInteger& aMVI, BOPCol_DataMapOfShapeInteger& aMVI,
BOPDS_VectorOfCurve& aVC) BOPDS_ListOfPaveBlock& aLPBC)
{ {
Standard_Integer nV1, nV2, iC; Standard_Integer nV1, nV2;
// //
aVC.Append1();
iC=aVC.Extent()-1;
BOPDS_ListOfPaveBlock& aLPBC = aVC(iC).ChangePaveBlocks();
aLPBC.Append(aPB); aLPBC.Append(aPB);
// //
aPB->Indices(nV1, nV2); aPB->Indices(nV1, nV2);
@ -2057,7 +2092,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
// Keep info for post treatment // Keep info for post treatment
BOPDS_CoupleOfPaveBlocks aCPB; BOPDS_CoupleOfPaveBlocks aCPB;
aCPB.SetIndexInterf(aInt); aCPB.SetIndexInterf(aInt);
aCPB.SetIndex(iC); aCPB.SetIndex(aCur);
aCPB.SetPaveBlock1(aPB); aCPB.SetPaveBlock1(aPB);
// //
aMSCPB.Add(aE, aCPB); aMSCPB.Add(aE, aCPB);

36
tests/bugs/modalg_6/bug26218 Executable file
View File

@ -0,0 +1,36 @@
puts "============"
puts "OCC26218"
puts "============"
puts ""
###############################
## Wrong result done by General Fuse algorithm
###############################
restore [locate_data_file bug26218_b11.brep] b1
restore [locate_data_file bug26218_b21.brep] b2
bclearobjects
bcleartools
baddobjects b1
baddcompound b2
bfillds
bbuild result
set square 2728.77
set nbshapes_expected "
Number of shapes in shape
VERTEX : 31
EDGE : 52
WIRE : 25
FACE : 25
SHELL : 4
SOLID : 4
COMPSOLID : 0
COMPOUND : 1
SHAPE : 142
"
checknbshapes result -ref ${nbshapes_expected} -t -m "result done by General Fuse algorithm"
set 3dviewer 1