From decdfc9499ff9c3084ea6363411a90e2fbfcb389 Mon Sep 17 00:00:00 2001 From: emv Date: Thu, 6 Mar 2014 15:02:08 +0400 Subject: [PATCH] 0024628: Intersection result is unfixed The map for collecting pave blocks of two faces has been replaced with indexed map to ensure the constant order of pave blocks when checking section curves for existents. Test case for issue CR24628 --- src/BOPAlgo/BOPAlgo_PaveFiller.cdl | 5 +++-- src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx | 26 ++++++++++++-------------- src/BOPDS/BOPDS_DS.cdl | 2 +- src/BOPDS/BOPDS_DS.cxx | 26 +++++++++++++------------- tests/bugs/modalg_5/bug24628 | 18 ++++++++++++++++++ 5 files changed, 47 insertions(+), 30 deletions(-) create mode 100644 tests/bugs/modalg_5/bug24628 diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.cdl b/src/BOPAlgo/BOPAlgo_PaveFiller.cdl index d9c3d5fe59..5391514a11 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.cdl +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.cdl @@ -49,6 +49,7 @@ uses Curve from BOPDS, IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS, MapOfPaveBlock from BOPDS, + IndexedMapOfPaveBlock from BOPDS, ListOfPaveBlock from BOPDS, ListOfPave from BOPDS, ListOfPntOn2S from IntSurf, @@ -214,7 +215,7 @@ is thePB:PaveBlock from BOPDS; theNC:Curve from BOPDS; theTolR3D:Real from Standard; - theMPB:MapOfPaveBlock from BOPDS; + theMPB:IndexedMapOfPaveBlock from BOPDS; thePBOut:out PaveBlock from BOPDS) returns Boolean from Standard is protected; @@ -333,7 +334,7 @@ is ProcessExistingPaveBlocks(me:out; theInt : Integer from Standard; - theMPBOnIn : MapOfPaveBlock from BOPDS; + theMPBOnIn : IndexedMapOfPaveBlock from BOPDS; theMSCPB : out IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS; theMVI : out DataMapOfShapeInteger from BOPCol; theMVB : MapOfInteger from BOPCol; diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index 07bbb714d2..81801efe05 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -284,8 +284,8 @@ void BOPAlgo_PaveFiller::MakeBlocks() BOPCol_MapOfInteger aMVOnIn(100, aAllocator), aMF(100, aAllocator), aMVStick(100,aAllocator), aMVEF(100, aAllocator), aMVB(100, aAllocator), aMI(100, aAllocator); - BOPDS_MapOfPaveBlock aMPBOnIn(100, aAllocator), - aMPBAdd(100, aAllocator); + BOPDS_IndexedMapOfPaveBlock aMPBOnIn(100, aAllocator); + BOPDS_MapOfPaveBlock aMPBAdd(100, aAllocator); BOPDS_ListOfPaveBlock aLPB(aAllocator); BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMSCPB(100, aAllocator); BOPCol_DataMapOfShapeInteger aMVI(100, aAllocator); @@ -965,15 +965,14 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock& (const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC, const Standard_Real theTolR3D, - const BOPDS_MapOfPaveBlock& theMPBOnIn, + const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn, Handle(BOPDS_PaveBlock&) aPBOut) { Standard_Boolean bRet; Standard_Real aT1, aT2, aTm, aTx; - Standard_Integer nSp, iFlag1, iFlag2, nV11, nV12, nV21, nV22; + Standard_Integer nSp, iFlag1, iFlag2, nV11, nV12, nV21, nV22, i, aNbPB; gp_Pnt aP1, aPm, aP2; Bnd_Box aBoxP1, aBoxPm, aBoxP2; - BOPDS_MapIteratorOfMapOfPaveBlock aIt; // bRet=Standard_False; const IntTools_Curve& aIC=theNC.Curve(); @@ -994,9 +993,9 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock& aBoxP2.Add(aP2); aBoxP2.Enlarge(theTolR3D); // - aIt.Initialize(theMPBOnIn); - for (; aIt.More(); aIt.Next()) { - const Handle(BOPDS_PaveBlock)& aPB=aIt.Value(); + aNbPB = theMPBOnIn.Extent(); + for (i = 1; i <= aNbPB; ++i) { + const Handle(BOPDS_PaveBlock)& aPB = theMPBOnIn(i); aPB->Indices(nV21, nV22); nSp=aPB->Edge(); const BOPDS_ShapeInfo& aSISp=myDS->ChangeShapeInfo(nSp); @@ -1616,16 +1615,15 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC, //======================================================================= void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks (const Standard_Integer theInt, - const BOPDS_MapOfPaveBlock& aMPBOnIn, + const BOPDS_IndexedMapOfPaveBlock& aMPBOnIn, BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB, BOPCol_DataMapOfShapeInteger& aMVI, const BOPCol_MapOfInteger& aMVB, BOPDS_MapOfPaveBlock& aMPB) { - Standard_Integer nV, nE, iFlag; + Standard_Integer nV, nE, iFlag, i, aNbPB; Standard_Real aT; BOPCol_MapIteratorOfMapOfInteger aItB; - BOPDS_MapIteratorOfMapOfPaveBlock aItPB; // BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF(); BOPDS_InterfFF& aFF = aFFs(theInt); @@ -1641,9 +1639,9 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC, continue; } // - aItPB.Initialize(aMPBOnIn); - for (; aItPB.More(); aItPB.Next()) { - const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value(); + aNbPB = aMPBOnIn.Extent(); + for (i = 1; i <= aNbPB; ++i) { + const Handle(BOPDS_PaveBlock)& aPB = aMPBOnIn(i); if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) { continue; } diff --git a/src/BOPDS/BOPDS_DS.cdl b/src/BOPDS/BOPDS_DS.cdl index 3ad5c81820..af39c6d1f3 100644 --- a/src/BOPDS/BOPDS_DS.cdl +++ b/src/BOPDS/BOPDS_DS.cdl @@ -396,7 +396,7 @@ is theF1:Integer from Standard; theF2:Integer from Standard; theMI:out MapOfInteger from BOPCol; - aMPB: out MapOfPaveBlock from BOPDS); + aMPB: out IndexedMapOfPaveBlock from BOPDS); ---Purpose: --- Returns the indices of vertices and pave blocks --- that are On/In for the faces with indices theF1, theF2 diff --git a/src/BOPDS/BOPDS_DS.cxx b/src/BOPDS/BOPDS_DS.cxx index fa3106c3f5..3aef4337bf 100644 --- a/src/BOPDS/BOPDS_DS.cxx +++ b/src/BOPDS/BOPDS_DS.cxx @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include @@ -45,7 +47,6 @@ #include #include #include -#include // static @@ -1426,25 +1427,24 @@ void BOPDS_DS::VerticesOnIn (const Standard_Integer nF1, const Standard_Integer nF2, BOPCol_MapOfInteger& aMI, - BOPDS_MapOfPaveBlock& aMPB)const + BOPDS_IndexedMapOfPaveBlock& aMPB)const { - Standard_Integer i, nV, nV1, nV2; + Standard_Integer i, j, nV, nV1, nV2, aNbPB; BOPCol_MapIteratorOfMapOfInteger aIt; - BOPDS_IndexedMapOfPaveBlock* pMPB[4]; - BOPDS_MapIteratorOfMapOfPaveBlock aItMPB; + BOPDS_IndexedMapOfPaveBlock pMPB[4]; // const BOPDS_FaceInfo& aFI1=FaceInfo(nF1); const BOPDS_FaceInfo& aFI2=FaceInfo(nF2); // - pMPB[0]=(BOPDS_IndexedMapOfPaveBlock*)&aFI1.PaveBlocksOn(); - pMPB[1]=(BOPDS_IndexedMapOfPaveBlock*)&aFI1.PaveBlocksIn(); - pMPB[2]=(BOPDS_IndexedMapOfPaveBlock*)&aFI2.PaveBlocksOn(); - pMPB[3]=(BOPDS_IndexedMapOfPaveBlock*)&aFI2.PaveBlocksIn(); + pMPB[0]=aFI1.PaveBlocksOn(); + pMPB[1]=aFI1.PaveBlocksIn(); + pMPB[2]=aFI2.PaveBlocksOn(); + pMPB[3]=aFI2.PaveBlocksIn(); // for (i=0; i<4; ++i) { - aItMPB.Initialize(*pMPB[i]); - for (; aItMPB.More(); aItMPB.Next()) { - const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value(); + aNbPB = pMPB[i].Extent(); + for (j = 1; j <= aNbPB; ++j) { + const Handle(BOPDS_PaveBlock)& aPB = pMPB[i](j); aMPB.Add(aPB); aPB->Indices(nV1, nV2); aMI.Add(nV1); @@ -1463,7 +1463,7 @@ void BOPDS_DS::VerticesOnIn for (; aIt.More(); aIt.Next()) { nV=aIt.Value(); if (aMVOn2.Contains(nV) || aMVIn2.Contains(nV)) { - aMI.Add(nV); + aMI.Add(nV); } } } diff --git a/tests/bugs/modalg_5/bug24628 b/tests/bugs/modalg_5/bug24628 new file mode 100644 index 0000000000..a2e0062385 --- /dev/null +++ b/tests/bugs/modalg_5/bug24628 @@ -0,0 +1,18 @@ +puts "=========" +puts "OCC24628" +puts "=========" +puts "" +################################################################################# +# Intersection result is unfixed +################################################################################# + +restore [locate_data_file bug24628_shell2.brep] shell +restore [locate_data_file bug24628_shellcut2.brep] cut + +bsection result shell cut + +set nb_v_good 15 +set nb_e_good 14 + +set 2dviewer 1 +