Mantis issue 0020853: EDF 1394 GEOM: Partition fails between 2 faces. A patch by PKV.

This commit is contained in:
jfa 2010-06-17 07:19:16 +00:00
parent 882ddc2548
commit 22b9c99081

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
// //
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -19,14 +19,12 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File: NMTTools_PaveFiller_4.cxx // File: NMTTools_PaveFiller_4.cxx
// Created: Mon Dec 8 17:08:58 2003 // Created: Mon Dec 8 17:08:58 2003
// Author: Peter KURNEV // Author: Peter KURNEV
// <pkv@irinox>
//
#include <NMTTools_PaveFiller.ixx> #include <NMTTools_PaveFiller.ixx>
//
#include <stdio.h> #include <stdio.h>
#include <Precision.hxx> #include <Precision.hxx>
@ -99,7 +97,6 @@
#include <NMTTools_CommonBlock.hxx> #include <NMTTools_CommonBlock.hxx>
#include <NMTTools_ListIteratorOfListOfCommonBlock.hxx> #include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
#include <TColStd_ListOfInteger.hxx> #include <TColStd_ListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx> #include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <BRepBndLib.hxx> #include <BRepBndLib.hxx>
@ -108,7 +105,6 @@
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx> #include <TColStd_MapIteratorOfMapOfInteger.hxx>
static static
void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI, void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI,
TopTools_DataMapOfShapeListOfShape& myImages, TopTools_DataMapOfShapeListOfShape& myImages,
@ -118,15 +114,16 @@ static
void MakeNewVertex(const TopTools_ListOfShape& aLV, void MakeNewVertex(const TopTools_ListOfShape& aLV,
TopoDS_Vertex& aNewVertex); TopoDS_Vertex& aNewVertex);
static static
void VertexParameters(const IntTools_CommonPrt& aCPart, void VertexParameters(const IntTools_CommonPrt& aCPart,
Standard_Real& aT1, Standard_Real& aT1,
Standard_Real& aT2); Standard_Real& aT2);
static static
Standard_Boolean IsOnPave(const Standard_Real& aT1, Standard_Boolean IsOnPave(const Standard_Real& aT1,
const IntTools_Range& aRange, const IntTools_Range& aRange,
const Standard_Real& aTolerance); const Standard_Real& aTolerance);
static static
void EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB); void EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB);
@ -135,6 +132,7 @@ static
const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
BOPTools_IMapOfPaveBlock& aProcessedBlocks, BOPTools_IMapOfPaveBlock& aProcessedBlocks,
BOPTools_IMapOfPaveBlock& aChain); BOPTools_IMapOfPaveBlock& aChain);
static static
void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
NMTTools_ListOfCommonBlock& aLCB); NMTTools_ListOfCommonBlock& aLCB);
@ -187,7 +185,6 @@ static
// //
const TopoDS_Edge aE1=TopoDS::Edge(myDS->Shape(nE1));//mpv const TopoDS_Edge aE1=TopoDS::Edge(myDS->Shape(nE1));//mpv
const TopoDS_Edge aE2=TopoDS::Edge(myDS->Shape(nE2));//mpv const TopoDS_Edge aE2=TopoDS::Edge(myDS->Shape(nE2));//mpv
// //
if (BRep_Tool::Degenerated(aE1) || BRep_Tool::Degenerated(aE2)){ if (BRep_Tool::Degenerated(aE1) || BRep_Tool::Degenerated(aE2)){
continue; continue;
@ -203,7 +200,7 @@ static
// Contribution of Samtech www.samcef.com BEGIN // Contribution of Samtech www.samcef.com BEGIN
aNbLPB1=aLPB1.Extent(); aNbLPB1=aLPB1.Extent();
aNbLPB2=aLPB2.Extent(); aNbLPB2=aLPB2.Extent();
//
//if (aE1.IsSame(aE2) && aNbLPB1==1 && aNbLPB2==1) { //if (aE1.IsSame(aE2) && aNbLPB1==1 && aNbLPB2==1) {
// continue; // continue;
//} //}
@ -219,7 +216,7 @@ static
for (anIt2.Initialize(aLPB2); anIt2.More(); anIt2.Next()) { for (anIt2.Initialize(aLPB2); anIt2.More(); anIt2.Next()) {
BOPTools_PaveBlock& aPB2=anIt2.Value(); BOPTools_PaveBlock& aPB2=anIt2.Value();
const IntTools_ShrunkRange& aShrunkRange2=aPB2.ShrunkRange(); const IntTools_ShrunkRange& aShrunkRange2=aPB2.ShrunkRange();
//
const IntTools_Range& aSR2=aShrunkRange2.ShrunkRange(); const IntTools_Range& aSR2=aShrunkRange2.ShrunkRange();
const Bnd_Box& aBB2=aShrunkRange2.BndBox(); const Bnd_Box& aBB2=aShrunkRange2.BndBox();
// //
@ -244,7 +241,7 @@ static
// //
aEE.SetRange1(anewSR1); aEE.SetRange1(anewSR1);
aEE.SetRange2(anewSR2); aEE.SetRange2(anewSR2);
//
aEE.Perform(); aEE.Perform();
// //
anIndexIn=0; anIndexIn=0;
@ -284,6 +281,9 @@ static
aR1 = (aEE.Order()) ? anewSR2 : anewSR1; aR1 = (aEE.Order()) ? anewSR2 : anewSR1;
aR2 = (aEE.Order()) ? anewSR1 : anewSR2; aR2 = (aEE.Order()) ? anewSR1 : anewSR2;
// //
//modified by NIZNHY-PKV Mon Jun 07 11:01:40 2010f
aTol=0.8*aTol;
//modified by NIZNHY-PKV Mon Jun 07 11:01:43 2010t
bIsOnPave1=IsOnPave(aT1, aR1, aTol); bIsOnPave1=IsOnPave(aT1, aR1, aTol);
bIsOnPave2=IsOnPave(aT2, aR2, aTol); bIsOnPave2=IsOnPave(aT2, aR2, aTol);
// //
@ -406,11 +406,6 @@ static
} // for (; anIt1.More(); anIt1.Next()) } // for (; anIt1.More(); anIt1.Next())
}// for (; myDSIt.More(); myDSIt.Next()) }// for (; myDSIt.More(); myDSIt.Next())
// //
//modified by NIZNHY-PKV Thu Mar 19 14:13:34 2009f
//
//EENewVertices (aMapVI);
//EECommonBlocks(aMapCB);
{ {
NMTTools_ListOfCommonBlock aLCB; NMTTools_ListOfCommonBlock aLCB;
// //
@ -420,13 +415,12 @@ static
TreatPaveBlocks(aLCB); TreatPaveBlocks(aLCB);
ReplaceCommonBlocks(aLCB); ReplaceCommonBlocks(aLCB);
} }
//modified by NIZNHY-PKV Thu Mar 19 14:13:42 2009t
// //
PerformVF1(); PerformVF1();
// //
myIsDone=Standard_True; myIsDone=Standard_True;
} }
//modified by NIZNHY-PKV Thu Mar 19 14:13:52 2009f
//======================================================================= //=======================================================================
// function:TreatPaveBlocks // function:TreatPaveBlocks
// purpose: // purpose:
@ -506,7 +500,7 @@ static
}//for (; anItLPB.More(); anItLPB.Next()) { }//for (; anItLPB.More(); anItLPB.Next()) {
} }
} }
//modified by NIZNHY-PKV Thu Mar 19 14:14:13 2009t
//======================================================================= //=======================================================================
// function:EECommonBlocks // function:EECommonBlocks
// purpose: // purpose:
@ -518,6 +512,7 @@ static
FindChains(aMapCB, aLCB); FindChains(aMapCB, aLCB);
ReplaceCommonBlocks(aLCB); ReplaceCommonBlocks(aLCB);
} }
//======================================================================= //=======================================================================
// function:EENewVertices // function:EENewVertices
// purpose: // purpose:
@ -775,7 +770,7 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap
} }
} }
} }
//
//======================================================================= //=======================================================================
//function : MakeNewVertex //function : MakeNewVertex
//purpose : //purpose :
@ -822,6 +817,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
// //
aBB.MakeVertex (aNewVertex, aPGC, aDmax); aBB.MakeVertex (aNewVertex, aPGC, aDmax);
} }
//======================================================================= //=======================================================================
// function:EENewVertices // function:EENewVertices
// purpose: // purpose:
@ -864,6 +860,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
BOPTools_PaveSet& aPaveSet2=myPavePoolNew(myDS->RefEdge(nE2)); BOPTools_PaveSet& aPaveSet2=myPavePoolNew(myDS->RefEdge(nE2));
aPaveSet2.Append(aPave); aPaveSet2.Append(aPave);
} }
//======================================================================= //=======================================================================
// function: RefinePavePool // function: RefinePavePool
// purpose: // purpose:
@ -897,6 +894,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
} }
} }
//======================================================================= //=======================================================================
// function: PreparePaveBlocks // function: PreparePaveBlocks
// purpose: // purpose:
@ -909,7 +907,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
Standard_Boolean bOk1, bOk2, bOk3, bFlag; Standard_Boolean bOk1, bOk2, bOk3, bFlag;
Standard_Integer i, aNb, nE[2], n1, n2, aNbSplits; Standard_Integer i, aNb, nE[2], n1, n2, aNbSplits;
TColStd_MapOfInteger aMap; TColStd_MapOfInteger aMap;
//
bOk1= (aType1==TopAbs_VERTEX) && (aType2==TopAbs_EDGE) ; bOk1= (aType1==TopAbs_VERTEX) && (aType2==TopAbs_EDGE) ;
bOk2= (aType1==TopAbs_EDGE) && (aType2==TopAbs_EDGE) ; bOk2= (aType1==TopAbs_EDGE) && (aType2==TopAbs_EDGE) ;
bOk3= (aType1==TopAbs_EDGE) && (aType2==TopAbs_FACE) ; bOk3= (aType1==TopAbs_EDGE) && (aType2==TopAbs_FACE) ;
@ -945,6 +943,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
}// for (; myDSIt.More(); myDSIt.Next()) }// for (; myDSIt.More(); myDSIt.Next())
myIsDone=Standard_True; myIsDone=Standard_True;
} }
//======================================================================= //=======================================================================
// function: PreparePaveBlocks // function: PreparePaveBlocks
// purpose: // purpose:
@ -967,7 +966,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
// //
BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE)); BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE));
//
BOPTools_PaveBlockIterator aPBIt(nE, aPS); BOPTools_PaveBlockIterator aPBIt(nE, aPS);
for (; aPBIt.More(); aPBIt.Next()) { for (; aPBIt.More(); aPBIt.Next()) {
BOPTools_PaveBlock& aPB=aPBIt.Value(); BOPTools_PaveBlock& aPB=aPBIt.Value();
@ -1008,6 +1007,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} //for (; aPBIt.More(); aPBIt.Next()) } //for (; aPBIt.More(); aPBIt.Next())
myIsDone=Standard_True; myIsDone=Standard_True;
} }
//======================================================================= //=======================================================================
// function: CorrectShrunkRanges // function: CorrectShrunkRanges
// purpose: // purpose:
@ -1079,12 +1079,12 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
} }
} }
//======================================================================= //=======================================================================
// function: IsBlocksCoinside // function: IsBlocksCoinside
// purpose: // purpose:
//======================================================================= //=======================================================================
Standard_Boolean Standard_Boolean NMTTools_PaveFiller::IsBlocksCoinside(const BOPTools_PaveBlock& aPB1,
NMTTools_PaveFiller::IsBlocksCoinside(const BOPTools_PaveBlock& aPB1,
const BOPTools_PaveBlock& aPB2) const const BOPTools_PaveBlock& aPB2) const
{ {
Standard_Boolean bRetFlag=Standard_True; Standard_Boolean bRetFlag=Standard_True;
@ -1128,6 +1128,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
return !bRetFlag; return !bRetFlag;
} }
//======================================================================= //=======================================================================
// function: ReplaceCommonBlocks // function: ReplaceCommonBlocks
// purpose: // purpose:
@ -1137,6 +1138,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
RemoveCommonBlocks(aLCB); RemoveCommonBlocks(aLCB);
SplitCommonBlocks(aLCB); SplitCommonBlocks(aLCB);
} }
//======================================================================= //=======================================================================
// function: SplitCommonBlocks // function: SplitCommonBlocks
// purpose: // purpose:
@ -1231,6 +1233,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
}//for (nE=1; nE<=aNb; ++nE) { }//for (nE=1; nE<=aNb; ++nE) {
// Contribution of Samtech www.samcef.com END // Contribution of Samtech www.samcef.com END
} }
//======================================================================= //=======================================================================
// function: RemoveCommonBlocks // function: RemoveCommonBlocks
// purpose: // purpose:
@ -1265,6 +1268,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
} }
} }
//======================================================================= //=======================================================================
// function: SplitCommonBlock // function: SplitCommonBlock
// purpose: // purpose:
@ -1272,17 +1276,16 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
void NMTTools_PaveFiller::SplitCommonBlock(const NMTTools_CommonBlock& aCB, void NMTTools_PaveFiller::SplitCommonBlock(const NMTTools_CommonBlock& aCB,
NMTTools_ListOfCommonBlock& aLCBx) NMTTools_ListOfCommonBlock& aLCBx)
{ {
Standard_Integer i, j, k, nE, aNbE, aNbSPBx, aNbPB; Standard_Integer i, j,nE, aNbE, aNbSPBx, aNbPB, k;
BOPTools_SequenceOfPaveBlock aSPBx; BOPTools_SequenceOfPaveBlock aSPBx;
BOPTools_ListIteratorOfListOfPaveBlock anItLPB; BOPTools_ListIteratorOfListOfPaveBlock anItLPB;
BOPTools_ListIteratorOfListOfPave anIt; BOPTools_ListIteratorOfListOfPave anIt;
BOPTools_PaveBlockIterator anPBIt; BOPTools_PaveBlockIterator anPBIt;
// //
const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks(); const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks();
aNbE=aLPB.Extent(); aNbE=aLPB.Extent();
// //
// 1. Whether we realy need to split the common block ? // 1. Checking: Whether we realy need to split the common block ?
anItLPB.Initialize(aLPB); anItLPB.Initialize(aLPB);
for (; anItLPB.More(); anItLPB.Next()) { for (; anItLPB.More(); anItLPB.Next()) {
const BOPTools_PaveBlock& aPB=anItLPB.Value(); const BOPTools_PaveBlock& aPB=anItLPB.Value();
@ -1352,6 +1355,37 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
aNbSPBx=aSPBx.Length(); aNbSPBx=aSPBx.Length();
aNbPB=aNbSPBx/aNbE; aNbPB=aNbSPBx/aNbE;
// //
//modified by NIZNHY-PKV Fri Jun 04 14:07:37 2010f
//
Standard_Integer k1, k2, n11, n12, n21, n22;
//
for (i=1; i<=aNbPB; ++i) {
NMTTools_CommonBlock aCBx;
//
aCBx.AddFaces(aLF);
//
const BOPTools_PaveBlock& aPB1=aSPBx(i);
n11=aPB1.Pave1().Index();
n12=aPB1.Pave2().Index();
//
aCBx.AddPaveBlock(aPB1);
//
for (j=2; j<=aNbE; ++j) {
k1=(j-1)*aNbPB+1;
k2=k1+aNbPB-1;
for(k=k1; k<=k2; ++k) {
const BOPTools_PaveBlock& aPB2=aSPBx(k);
n21=aPB2.Pave1().Index();
n22=aPB2.Pave2().Index();
if ((n21==n11 && n22==n12) || (n21==n12 && n22==n11)) {
aCBx.AddPaveBlock(aPB2);
break;
}
}
}
aLCBx.Append(aCBx);
}
/*
for (i=1; i<=aNbPB; ++i) { for (i=1; i<=aNbPB; ++i) {
NMTTools_CommonBlock aCBx; NMTTools_CommonBlock aCBx;
// //
@ -1364,6 +1398,8 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
aLCBx.Append(aCBx); aLCBx.Append(aCBx);
} }
*/
//modified by NIZNHY-PKV Fri Jun 04 14:07:42 2010t
} }
//======================================================================= //=======================================================================
@ -1391,6 +1427,7 @@ void VertexParameters(const IntTools_CommonPrt& aCPart,
aT2 = aCPart.VertexParameter2(); aT2 = aCPart.VertexParameter2();
} }
} }
//======================================================================= //=======================================================================
// function: KeepPave // function: KeepPave
// purpose: // purpose:
@ -1445,6 +1482,7 @@ void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
aChain.Clear(); aChain.Clear();
} }
} }
//======================================================================= //=======================================================================
// function:ProcessBlock // function:ProcessBlock
// purpose: // purpose:
@ -1469,6 +1507,7 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB,
ProcessBlock(aPBx, aMapCB, aProcessedBlocks, aChain); ProcessBlock(aPBx, aMapCB, aProcessedBlocks, aChain);
} }
} }
// Modified to provide VS interference between // Modified to provide VS interference between
// vertex as result of EE and a Face of argument // vertex as result of EE and a Face of argument
// Thu Sep 14 14:35:18 2006 // Thu Sep 14 14:35:18 2006