Skip to content

Commit

Permalink
0033361: Modeling Algorithm - Fuse operation generates incomplete result
Browse files Browse the repository at this point in the history
Added additional check of Face-Face intersection to avoid missing section edges because of sequence of Face-Face interference processing
  • Loading branch information
akaftase authored and vglukhik committed May 18, 2023
1 parent c36205a commit c28dd7f
Show file tree
Hide file tree
Showing 2 changed files with 185 additions and 6 deletions.
35 changes: 29 additions & 6 deletions src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -606,13 +606,23 @@ void BOPAlgo_PaveFiller::MakeBlocks(const Message_ProgressRange& theRange)
// Map of PaveBlocks with the faces to which it has to be added
BOPAlgo_DataMapOfPaveBlockListOfInteger aPBFacesMap;
//
for (i=0; i<aNbFF; ++i, aPS.Next()) {
// The vector aFFToRecheck contains indices of potentially problematic Face-Face intersections
NCollection_Vector<Standard_Integer> aFFToRecheck;
// aNbFF may be increased while processing this loop, because it is necessary to recheck
// some of Face-Face intersections to avoid missing section edges
// aNbFF will be increased to the number of potentially problematic Face-Face intersections
const Standard_Integer aNbFFPrev = aNbFF;
for (i = 0; i < aNbFF; ++i, aPS.Next())
{
if (UserBreak(aPS))
{
return;
}
// after passing through all of Face-Face intersections it is necessary to return
// to potentially problematic Face-Face intersections and process them one more time
const Standard_Integer aCurInd = i < aNbFFPrev ? i : aFFToRecheck[i - aNbFFPrev];
//
BOPDS_InterfFF& aFF=aFFs(i);
BOPDS_InterfFF& aFF=aFFs(aCurInd);
aFF.Indices(nF1, nF2);
//
BOPDS_VectorOfPoint& aVP=aFF.ChangePoints();
Expand Down Expand Up @@ -735,6 +745,9 @@ void BOPAlgo_PaveFiller::MakeBlocks(const Message_ProgressRange& theRange)
}
}

// Added additional check of Face-Face intersection to avoid missing section edges
// because of sequence of Face-Face interference processing
Standard_Boolean isToRecheck = aNbC > 0 && i < aNbFFPrev;
//
// 3. Make section edges
for (j=0; j<aNbC; ++j) {
Expand All @@ -748,6 +761,11 @@ void BOPAlgo_PaveFiller::MakeBlocks(const Message_ProgressRange& theRange)
aLPB.Clear();
aPB1->Update(aLPB, Standard_False);
//
if (aLPB.Extent() != 0)
{
isToRecheck = false;
}

aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
Handle(BOPDS_PaveBlock)& aPB=aItLPB.ChangeValue();
Expand Down Expand Up @@ -849,7 +867,7 @@ void BOPAlgo_PaveFiller::MakeBlocks(const Message_ProgressRange& theRange)
if (aMPBAdd.Add(aPBOut))
{
// Add edge for processing as the section edge
PreparePostTreatFF(i, j, aPBOut, aMSCPB, aMVI, aLPBC);
PreparePostTreatFF(aCurInd, j, aPBOut, aMSCPB, aMVI, aLPBC);
}
}
continue;
Expand All @@ -868,7 +886,7 @@ void BOPAlgo_PaveFiller::MakeBlocks(const Message_ProgressRange& theRange)
//
// Keep info for post treatment
BOPDS_CoupleOfPaveBlocks aCPB;
aCPB.SetIndexInterf(i);
aCPB.SetIndexInterf(aCurInd);
aCPB.SetIndex(j);
aCPB.SetPaveBlock1(aPB);
//
Expand All @@ -880,12 +898,17 @@ void BOPAlgo_PaveFiller::MakeBlocks(const Message_ProgressRange& theRange)
aMVTol.UnBind(nV2);

// Add existing pave blocks for post treatment
ProcessExistingPaveBlocks (i, j, nF1, nF2, aES, aMPBOnIn, aPBTree,
ProcessExistingPaveBlocks (aCurInd, j, nF1, nF2, aES, aMPBOnIn, aPBTree,
aMSCPB, aMVI, aLPBC, aPBFacesMap, aMPBAdd);
}
//
aLPBC.RemoveFirst();
}//for (j=0; j<aNbC; ++j) {
if (isToRecheck)
{
aFFToRecheck.Append(aCurInd);
++aNbFF;
}
//
//back to previous tolerance values for unused vertices
//and forget about SD groups of such vertices
Expand All @@ -909,7 +932,7 @@ void BOPAlgo_PaveFiller::MakeBlocks(const Message_ProgressRange& theRange)
aDMVLV.UnBind(nV1);
}
//
ProcessExistingPaveBlocks(i, nF1, nF2, aMPBOnIn, aPBTree, aDMBV, aMSCPB, aMVI, aPBFacesMap, aMPBAdd);
ProcessExistingPaveBlocks(aCurInd, nF1, nF2, aMPBOnIn, aPBTree, aDMBV, aMSCPB, aMVI, aPBFacesMap, aMPBAdd);
}//for (i=0; i<aNbFF; ++i) {

// Remove "micro" section edges
Expand Down
156 changes: 156 additions & 0 deletions tests/bugs/modalg_8/bug33361
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
puts "============"
puts "0033361: Modeling Algorithm - Fuse operation generates incomplete result"
puts "============"
puts ""

# prepare first solid
vertex v1 -13.1319809553115 86.7822037750006 -0.00566973476865229
vertex v2 -128.558636709231 86.5345485791916 -0.00570258843333704
vertex v3 -100.69915263562 -4.39311321186025 -0.00566084285433277
vertex v4 -79.6175928285065 -4.39310160958954 -0.0056548256445943
vertex v5 -14.129603767474 86.2679145189996 -19.5413698283793
vertex v6 -127.672333074639 86.0243014066245 -19.5414021458256
vertex v7 -99.9691824161271 -4.39312007067491 -19.5413606345018
vertex v8 -80.240198192502 -4.39310921279638 -19.5413550033513
edge e1 v1 v2
edge e2 v2 v3
edge e3 v3 v4
edge e4 v4 v1
edge e5 v1 v5
edge e6 v2 v6
edge e7 v3 v7
edge e8 v4 v8
edge e9 v5 v6
edge e10 v6 v7
edge e11 v7 v8
edge e12 v8 v5
wire w1 e1 e2 e3 e4
wire w2 e1 e6 e9 e5
wire w3 e2 e7 e10 e6
wire w4 e3 e8 e11 e7
wire w5 e4 e5 e12 e8
wire w6 e9 e10 e11 e12
mkplane f1 w1
mkplane f2 w2
mkplane f3 w3
mkplane f4 w4
mkplane f5 w5
mkplane f6 w6
sewing s1 f1 f2 f3 f4 f5 f6
ssolid s1 s1

# prepare second solid
vertex v1 127.874808332641 87.0848242748098 -0.00573631640736139
vertex v2 4.13755363440343 86.8193381629493 -0.00577153550167253
vertex v3 87.7714933163724 -4.39312459253253 -0.00571376462476536
vertex v4 108.964655532952 -4.39311292884125 -0.00570771556087379
vertex v5 127.250964034433 86.5713396058731 -19.5413363036311
vertex v6 5.24619819968578 86.3095706585265 -19.5413710296105
vertex v7 88.4127315018899 -4.39313150014382 -19.5413135815986
vertex v8 108.446956291808 -4.39312047427561 -19.5413078633248
edge e1 v1 v2
edge e2 v2 v3
edge e3 v3 v4
edge e4 v4 v1
edge e5 v1 v5
edge e6 v2 v6
edge e7 v3 v7
edge e8 v4 v8
edge e9 v5 v6
edge e10 v6 v7
edge e11 v7 v8
edge e12 v8 v5
wire w1 e1 e2 e3 e4
wire w2 e1 e6 e9 e5
wire w3 e2 e7 e10 e6
wire w4 e3 e8 e11 e7
wire w5 e4 e5 e12 e8
wire w6 e9 e10 e11 e12
mkplane f1 w1
mkplane f2 w2
mkplane f3 w3
mkplane f4 w4
mkplane f5 w5
mkplane f6 w6
sewing s2 f1 f2 f3 f4 f5 f6
ssolid s2 s2

# prepare third solid
vertex v1 108.933394491783 -4.52270499989385 -0.0678854291688111
vertex v2 71.6392583557696 -4.82783796975667 0.111191412258037
vertex v3 71.3588792617103 151.745015502843 0.0366204967163988
vertex v4 127.845048470054 86.9672826319557 -0.202979251077327
vertex v5 109.955308180154 -5.58542764710532 46.9881961078522
vertex v6 70.0688762581537 -5.90713971196433 46.9762651891041
vertex v7 69.7567011034265 151.061981157248 47.828071244823
vertex v8 128.441716305279 83.7679782847199 47.4778456953173
edge e1 v1 v2
edge e2 v2 v3
edge e3 v3 v4
edge e4 v4 v1
edge e5 v1 v5
edge e6 v2 v6
edge e7 v3 v7
edge e8 v4 v8
edge e9 v5 v6
edge e10 v6 v7
edge e11 v7 v8
edge e12 v8 v5
wire w1 e1 e2 e3 e4
wire w2 e1 e6 e9 e5
wire w3 e2 e7 e10 e6
wire w4 e3 e8 e11 e7
wire w5 e4 e5 e12 e8
wire w6 e9 e10 e11 e12
mkplane f1 w1
mkplane f2 w2
mkplane f3 w3
mkplane f4 w4
mkplane f5 w5
mkplane f6 w6
sewing s3 f1 f2 f3 f4 f5 f6
ssolid s3 s3

# prepare fourth solid
vertex v1 -122.825413548196 67.8222420317801 -0.00583425335077337
vertex v2 121.414994525437 55.8353479065558 -0.00563439528369258
vertex v3 127.874867553719 87.0848594871004 -0.00564196037409204
vertex v4 -128.558663169796 86.5344601820726 -0.00584644818335889
vertex v5 -122.343446023918 68.6316879811904 -19.5414411166127
vertex v6 121.07295954832 56.6852348873057 -19.5412518461508
vertex v7 127.250997928568 86.5713737315812 -19.5412353309277
vertex v8 -127.67235532236 86.0242158147956 -19.5414386144761
edge e1 v1 v2
edge e2 v2 v3
edge e3 v3 v4
edge e4 v4 v1
edge e5 v1 v5
edge e6 v2 v6
edge e7 v3 v7
edge e8 v4 v8
edge e9 v5 v6
edge e10 v6 v7
edge e11 v7 v8
edge e12 v8 v5
wire w1 e1 e2 e3 e4
wire w2 e1 e6 e9 e5
wire w3 e2 e7 e10 e6
wire w4 e3 e8 e11 e7
wire w5 e4 e5 e12 e8
wire w6 e9 e10 e11 e12
mkplane f1 w1
mkplane f2 w2
mkplane f3 w3
mkplane f4 w4
mkplane f5 w5
mkplane f6 w6
sewing s4 f1 f2 f3 f4 f5 f6
ssolid s4 s4

# perform fuse operations
bfuse result s1 s2
bfuse result result s3
bfuse result result s4

checkshape result
checkview -display result -2d -path ${imagedir}/${test_image}.png

0 comments on commit c28dd7f

Please sign in to comment.