From a8871229bd199422e3004ba708f8b22016fd54eb Mon Sep 17 00:00:00 2001 From: skl Date: Tue, 30 Jan 2007 14:06:11 +0000 Subject: [PATCH] Next version of partition. --- src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx | 85 +++--- src/GEOMAlgo/GEOMAlgo_Gluer.cxx | 159 +++++++---- src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx | 17 +- src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx | 53 +--- src/NMTTools/NMTTools_PaveFiller_4.cxx | 373 +++++++++++++++++++++---- src/NMTTools/NMTTools_PaveFiller_6.cxx | 62 +++- src/NMTTools/NMTTools_PaveFiller_7.cxx | 30 ++ 7 files changed, 573 insertions(+), 206 deletions(-) diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx b/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx index a6661075f..724e9c77f 100755 --- a/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx @@ -578,7 +578,6 @@ void MakeInternalWires(const TopTools_MapOfShape& theME, theWires.Append(aW); } } - //======================================================================= //function : IsInside //purpose : @@ -587,25 +586,39 @@ Standard_Boolean IsInside(const TopoDS_Shape& theHole, const TopoDS_Shape& theF2, IntTools_PContext& theContext) { + Standard_Boolean bRet; Standard_Real aT, aU, aV; + + TopAbs_State aState; TopExp_Explorer aExp; - TopAbs_State aState=TopAbs_UNKNOWN; + TopTools_IndexedMapOfShape aME2; gp_Pnt2d aP2D; // + bRet=Standard_False; + aState=TopAbs_UNKNOWN; const TopoDS_Face& aF2=TopoDS::Face(theF2); // + TopExp::MapShapes(aF2, TopAbs_EDGE, aME2); + // aExp.Init(theHole, TopAbs_EDGE); - if (aExp.More()){ + if (aExp.More()) { const TopoDS_Edge& aE = TopoDS::Edge(aExp.Current()); + if (aME2.Contains(aE)) { + return bRet; + } + // aT=BOPTools_Tools2D::IntermediatePoint(aE); BOPTools_Tools2D::PointOnSurface(aE, aF2, aT, aU, aV); aP2D.SetCoord(aU, aV); // IntTools_FClass2d& aClsf=theContext->FClass2d(aF2); aState=aClsf.Perform(aP2D); + bRet=(aState==TopAbs_IN); } - return (aState==TopAbs_IN); + // + return bRet; } + //======================================================================= //function : IsGrowthWire //purpose : @@ -628,49 +641,39 @@ Standard_Boolean IsGrowthWire(const TopoDS_Shape& theWire, } return bRet; } -//modified by NIZNHY-PKV Mon Sep 18 13:18:27 2006f -/* -static - Standard_Boolean IsHole(const TopoDS_Shape& , - const TopoDS_Face& , - IntTools_PContext& ); -*/ -//modified by NIZNHY-PKV Mon Sep 18 13:18:34 2006t -//modified by NIZNHY-PKV Mon Sep 18 13:18:13 2006f + +//BRepTools::Write(aFF, "ff"); +// +// ErrorStatus : +// 11 - Null Context +// 12 - Null face generix + /* //======================================================================= -//function : IsHole +//function : IsInside //purpose : //======================================================================= -Standard_Boolean IsHole(const TopoDS_Shape& theS2, - const TopoDS_Face& theFace, - IntTools_PContext& theContext) +Standard_Boolean IsInside(const TopoDS_Shape& theHole, + const TopoDS_Shape& theF2, + IntTools_PContext& theContext) { - Standard_Boolean bIsHole; - Standard_Real aTol; - Handle(Geom_Surface) aS; - TopLoc_Location aLoc; - TopoDS_Face aF; - BRep_Builder aBB; - // - aTol=BRep_Tool::Tolerance(theFace); - aS=BRep_Tool::Surface(theFace, aLoc); - aBB.MakeFace(aF, aS, aLoc, aTol); - aBB.Add (aF, theS2); - // - IntTools_FClass2d& aClsf=theContext->FClass2d(aF); - // - bIsHole=aClsf.IsHole(); + Standard_Real aT, aU, aV; + TopExp_Explorer aExp; + TopAbs_State aState=TopAbs_UNKNOWN; + gp_Pnt2d aP2D; // - return bIsHole; + const TopoDS_Face& aF2=TopoDS::Face(theF2); // + aExp.Init(theHole, TopAbs_EDGE); + if (aExp.More()){ + const TopoDS_Edge& aE = TopoDS::Edge(aExp.Current()); + aT=BOPTools_Tools2D::IntermediatePoint(aE); + BOPTools_Tools2D::PointOnSurface(aE, aF2, aT, aU, aV); + aP2D.SetCoord(aU, aV); + // + IntTools_FClass2d& aClsf=theContext->FClass2d(aF2); + aState=aClsf.Perform(aP2D); + } + return (aState==TopAbs_IN); } */ -//modified by NIZNHY-PKV Mon Sep 18 13:18:06 2006t - -//BRepTools::Write(aFF, "ff"); -// -// ErrorStatus : -// 11 - Null Context -// 12 - Null face generix - diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx index cb2b0d424..9c27ede44 100755 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx @@ -25,6 +25,11 @@ #include +#include +#include + +#include +#include #include #include @@ -77,8 +82,8 @@ #include #include -#include //qft -#include //qft +#include +#include #include // @@ -179,11 +184,9 @@ void GEOMAlgo_Gluer::MakeVertices() { myErrorStatus=0; // - Standard_Integer j, i, aNbV, aIndex, aNbVSD; + Standard_Integer j, i, aNbV, aNbVSD; TColStd_ListIteratorOfListOfInteger aIt; - Handle(Bnd_HArray1OfBox) aHAB; - Bnd_BoundSortBox aBSB; - TopoDS_Shape aSTmp, aVF; + TopoDS_Shape aVF; TopoDS_Vertex aVnew; TopTools_IndexedMapOfShape aMV, aMVProcessed; TopTools_ListIteratorOfListOfShape aItS; @@ -192,6 +195,11 @@ void GEOMAlgo_Gluer::MakeVertices() GEOMAlgo_IndexedDataMapOfIntegerShape aMIS; GEOMAlgo_IndexedDataMapOfShapeBox aMSB; // + NMTDS_BoxBndTreeSelector aSelector; + NMTDS_BoxBndTree aBBTree; + NCollection_UBTreeFiller aTreeFiller(aBBTree); + // + // TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV); aNbV=aMV.Extent(); if (!aNbV) { @@ -199,21 +207,23 @@ void GEOMAlgo_Gluer::MakeVertices() return; } // - aHAB=new Bnd_HArray1OfBox(1, aNbV); - // for (i=1; i<=aNbV; ++i) { const TopoDS_Shape& aV=aMV(i); Bnd_Box aBox; // aBox.SetGap(myTol); BRepBndLib::Add(aV, aBox); - aHAB->SetValue(i, aBox); + // + aTreeFiller.Add(i, aBox); + // aMIS.Add(i, aV); aMSB.Add(aV, aBox); } // - aBSB.Initialize(aHAB); + aTreeFiller.Fill(); // + //------------------------------ + // Chains for (i=1; i<=aNbV; ++i) { const TopoDS_Shape& aV=aMV(i); // @@ -221,31 +231,86 @@ void GEOMAlgo_Gluer::MakeVertices() continue; } // - const Bnd_Box& aBoxV=aMSB.FindFromKey(aV); - const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV); - aNbVSD=aLI.Extent(); - if (!aNbVSD) { - myErrorStatus=3; // it must not be - return; - } + Standard_Integer aNbIP, aIP, aNbIP1, aIP1; + TopTools_ListOfShape aLVSD; + TColStd_MapOfInteger aMIP, aMIP1, aMIPC; + TColStd_MapIteratorOfMapOfInteger aIt1; // - // Images + aMIP.Add(i); + while(1) { + aNbIP=aMIP.Extent(); + aIt1.Initialize(aMIP); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + if (aMIPC.Contains(aIP)) { + continue; + } + // + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP); + // + aSelector.Clear(); + aSelector.SetBox(aBoxVP); + // + aNbVSD=aBBTree.Select(aSelector); + if (!aNbVSD) { + continue; // it must not be + } + // + const TColStd_ListOfInteger& aLI=aSelector.Indices(); + aIt.Initialize(aLI); + for (; aIt.More(); aIt.Next()) { + aIP1=aIt.Value(); + if (aMIP.Contains(aIP1)) { + continue; + } + aMIP1.Add(aIP1); + } //for (; aIt.More(); aIt.Next()) { + }//for(; aIt1.More(); aIt1.Next()) { + // + aNbIP1=aMIP1.Extent(); + if (!aNbIP1) { + break; + } + // + aIt1.Initialize(aMIP); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + aMIPC.Add(aIP); + } + // + aMIP.Clear(); + aIt1.Initialize(aMIP1); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + aMIP.Add(aIP); + } + aMIP1.Clear(); + }// while(1) // - TopTools_ListOfShape aLVSD; + // Fill myImages + aNbIP=aMIPC.Extent(); // - aIt.Initialize(aLI); - for (j=0; aIt.More(); aIt.Next(), ++j) { - aIndex=aIt.Value(); - const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex); - if(!j) { - aVF=aVx; + if (!aNbIP) {// no SD vertices founded + aVF=aV; + aLVSD.Append(aV); + aMVProcessed.Add(aV); + } + else { // SD vertices founded [ aMIPC ] + aIt1.Initialize(aMIPC); + for(j=0; aIt1.More(); aIt1.Next(), ++j) { + aIP=aIt1.Key(); + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + if (!j) { + aVF=aVP; + } + aLVSD.Append(aVP); + aMVProcessed.Add(aVP); } - aLVSD.Append(aVx); - aMVProcessed.Add(aVx); } - // myImages.Bind(aVF, aLVSD); - } + }// for (i=1; i<=aNbV; ++i) { + //------------------------------ // // Make new vertices aMV.Clear(); @@ -281,7 +346,6 @@ void GEOMAlgo_Gluer::MakeVertices() for (; aItIm.More(); aItIm.Next()) { const TopoDS_Shape& aV=aItIm.Key(); const TopTools_ListOfShape& aLVSD=aItIm.Value(); - // aItS.Initialize(aLVSD); for (; aItS.More(); aItS.Next()) { const TopoDS_Shape& aVSD=aItS.Value(); @@ -424,8 +488,8 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) TopoDS_Shape aNewShape; TopTools_IndexedMapOfShape aMF; TopTools_ListIteratorOfListOfShape aItS; - GEOMAlgo_PassKeyShape aPKF;//qft - GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF;//qft + GEOMAlgo_PassKeyShape aPKF; + GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF; // TopExp::MapShapes(myShape, aType, aMF); // @@ -433,7 +497,6 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) for (i=1; i<=aNbF; ++i) { const TopoDS_Shape& aS=aMF(i); // - //aPKF.Clear();//qft if (aType==TopAbs_FACE) { const TopoDS_Face& aF=TopoDS::Face(aS); FacePassKey(aF, aPKF); @@ -622,21 +685,12 @@ void GEOMAlgo_Gluer::InnerTolerance() void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF, GEOMAlgo_PassKeyShape& aPK) { - Standard_Integer i, aNbE;//, aNbMax;//qft + Standard_Integer i, aNbE; TopTools_ListOfShape aLE; TopTools_IndexedMapOfShape aME; // TopExp::MapShapes(aF, TopAbs_EDGE, aME); aNbE=aME.Extent(); - //qf - /* - aNbMax=aPK.NbMax(); - if (!aNbE || aNbE>aNbMax) { - myErrorStatus=101; // temprorary - return; - } - */ - //qt // for (i=1; i<=aNbE; ++i) { const TopoDS_Shape& aE=aME(i); @@ -647,10 +701,7 @@ void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF, const TopoDS_Shape& aER=myOrigins.Find(aE); aLE.Append(aER); } - //qf - //aPK.SetIds(aLE); aPK.SetShapes(aLE); - //qt } //======================================================================= //function : EdgePassKey @@ -669,10 +720,7 @@ void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE, } const TopoDS_Shape& aVR1=myOrigins.Find(aV1); const TopoDS_Shape& aVR2=myOrigins.Find(aV2); - //qf - //aPK.SetIds(aVR1, aVR2); aPK.SetShapes(aVR1, aVR2); - //qt } //======================================================================= //function : MakeVertex @@ -774,7 +822,6 @@ void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE, BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge); } } -// //======================================================================= //function : MakeFace //purpose : @@ -834,15 +881,13 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF, // aBB.Add(newWire, aER); } - //modified by NIZNHY-PKV Mon Jan 31 17:26:36 2005f - // + // xf TopTools_ListOfShape aLW; // aLW.Append(aW); myImages.Bind(newWire, aLW); myOrigins.Bind(aW, newWire); - // - //modified by NIZNHY-PKV Mon Jan 31 17:26:41 2005 t + // xt aBB.Add(newFace, newWire); } aNewFace=newFace; @@ -963,10 +1008,10 @@ const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS) aType=aS.ShapeType(); if (aType==TopAbs_VERTEX || aType==TopAbs_EDGE || - aType==TopAbs_WIRE || //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft + aType==TopAbs_WIRE || aType==TopAbs_FACE || - aType==TopAbs_SHELL || //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft - aType==TopAbs_SOLID) { //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft + aType==TopAbs_SHELL || + aType==TopAbs_SOLID) { if(myOrigins.IsBound(aS)) { const TopoDS_Shape& aSnew=myOrigins.Find(aS); if (!aSnew.IsSame(aS)) { diff --git a/src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx b/src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx index 8cac72b9e..1b5a04035 100755 --- a/src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx +++ b/src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx @@ -115,7 +115,7 @@ static //======================================================================= void GEOMAlgo_WESCorrector::DoConnexityBlocks() { - Standard_Boolean bRegular; + Standard_Boolean bRegular, bClosed; Standard_Integer i, aNbV, j, aNbC, aNbVP, aNbVS; TopTools_ListIteratorOfListOfShape aIt; TopoDS_Iterator aItE; @@ -208,17 +208,17 @@ static aER=aMEC(j); // if (aMER.Contains(aER)) { - Standard_Boolean bClosed; - // aER.Orientation(TopAbs_FORWARD); aLEC.Append(aER); aER.Orientation(TopAbs_REVERSED); aLEC.Append(aER); // - bClosed=BRep_Tool::IsClosed(TopoDS::Edge(aER), myWES->Face()); - if (!bClosed) { + //modified by NIZNHY-PKV Tue Nov 28 12:02:29 2006f + //bClosed=BRep_Tool::IsClosed(TopoDS::Edge(aER), myWES->Face()); + //if (!bClosed) { bRegular=Standard_False; - } + //} + //modified by NIZNHY-PKV Tue Nov 28 12:02:33 2006t } else { aLEC.Append(aER); @@ -234,11 +234,12 @@ static // aNbVR=aMVER.Extent(); for (k=1; k<=aNbVR; ++k) { - const TopTools_ListOfShape& aLER=aMVER(k);//?? it was aMVE(k) + const TopTools_ListOfShape& aLER=aMVER(k); aNbER=aLER.Extent(); if (aNbER==1) { const TopoDS_Edge& aEx=TopoDS::Edge(aER); - if (!BRep_Tool::IsClosed(aEx, myWES->Face())) { + bClosed=BRep_Tool::IsClosed(aEx, myWES->Face()); + if (!bClosed) { bRegular=!bRegular; break; } diff --git a/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx b/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx index 3860f82fe..e4671d3a2 100755 --- a/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx +++ b/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx @@ -489,14 +489,6 @@ static aTol=2.*Tolerance2D(aVb, aGAS); aTol2=aTol*aTol; // - //modified by NIZNHY-PKV Tue Nov 14 16:56:19 2006f - /* - UVTolerance2D(aVb, aGAS, aTolUVb, aTolVVb); - aTolUVb = 2.*aTolUVb; - aTolVVb = 2.*aTolVVb; - */ - //modified by NIZNHY-PKV Tue Nov 14 16:56:26 2006t - // aNb=aLS.Length(); if (aNb>0) { // @@ -517,20 +509,6 @@ static // aD2=aPaPrev.SquareDistance(aPb); anIsSameV2d =aD2 aTolUVb) || (vdist > aTolVVb)) { - anIsSameV2d=!anIsSameV2d; - } - } - */ - //modified by NIZNHY-PKV Tue Nov 14 16:56:54 2006t }//if (anIsSameV) { // if (anIsSameV && anIsSameV2d) { @@ -685,7 +663,10 @@ static aTol2D=(aVr>anUr) ? aVr : anUr; // if (aType==GeomAbs_BSplineSurface|| - aType==GeomAbs_Sphere) { + aType==GeomAbs_Sphere|| + //modified by NIZNHY-PKV Wed Nov 29 10:18:50 2006f + GeomAbs_SurfaceOfRevolution) { + //modified by NIZNHY-PKV Wed Nov 29 10:18:55 2006t if (aTol2D < aTolV3D) { aTol2D=aTolV3D; } @@ -895,29 +876,3 @@ Standard_Integer NbWaysOut(const BOP_ListOfEdgeInfo& aLEInfo) } return iCnt; } -//modified by NIZNHY-PKV Tue Nov 14 16:55:31 2006f -/* -static - void UVTolerance2D (const TopoDS_Vertex& aV, - const GeomAdaptor_Surface& aGAS, - Standard_Real& aTolU, - Standard_Real& aTolV); -*/ -/* -//======================================================================= -//function : UVTolerance2D -//purpose : -//======================================================================= -void UVTolerance2D (const TopoDS_Vertex& aV, - const GeomAdaptor_Surface& aGAS, - Standard_Real& aTolU, - Standard_Real& aTolV) -{ - Standard_Real aTolV3D; - // - aTolV3D = BRep_Tool::Tolerance(aV); - aTolU=aGAS.UResolution(aTolV3D); - aTolV=aGAS.VResolution(aTolV3D); -} -*/ -//modified by NIZNHY-PKV Tue Nov 14 16:55:39 2006 diff --git a/src/NMTTools/NMTTools_PaveFiller_4.cxx b/src/NMTTools/NMTTools_PaveFiller_4.cxx index af8d70fda..3a9a1c5c9 100644 --- a/src/NMTTools/NMTTools_PaveFiller_4.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_4.cxx @@ -25,27 +25,11 @@ #include // -// Modified Thu Sep 14 14:35:18 2006 -// Contribution of Samtech www.samcef.com BEGIN -#include -#include -#include -#include -#include -// Contribution of Samtech www.samcef.com END - #include #include -#include - #include #include -#include -#include - -#include -#include #include #include @@ -53,17 +37,11 @@ #include #include -#include -#include -#include -#include -#include #include #include #include -#include #include #include @@ -97,15 +75,46 @@ #include #include -#include -#include -#include #include #include #include #include +// Modified Thu Sep 14 14:35:18 2006 +// Contribution of Samtech www.samcef.com BEGIN +#include +#include +#include +#include +#include +// Contribution of Samtech www.samcef.com END +// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +#include +#include +#include +#include + static void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI, @@ -117,7 +126,6 @@ static TopoDS_Vertex& aNewVertex); - static void VertexParameters(const IntTools_CommonPrt& aCPart, Standard_Real& aT1, @@ -137,6 +145,7 @@ static static void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, NMTTools_ListOfCommonBlock& aLCB); + //======================================================================= // function: PerformEE // purpose: @@ -447,6 +456,9 @@ static }//for (; aIt.More(); aIt.Next()) { }// for (; aItIm.More(); aItIm.Next()) } +// +// case: use_02 +// completely rewritten //======================================================================= //function : TreatNewVertices //purpose : @@ -455,7 +467,7 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap TopTools_DataMapOfShapeListOfShape& myImages, TopTools_DataMapOfShapeShape& myOrigins) { - Standard_Integer j, i, aNbV, aIndex, aNbVSD; + Standard_Integer j, i, aNbV, aNbVSD; Standard_Real aTol; TColStd_ListIteratorOfListOfInteger aIt; TopoDS_Shape aSTmp, aVF; @@ -467,12 +479,10 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap NMTDS_IndexedDataMapOfIntegerShape aMIS; NMTDS_IndexedDataMapOfShapeBox aMSB; // - // NMTDS_BoxBndTreeSelector aSelector; NMTDS_BoxBndTree aBBTree; NCollection_UBTreeFiller aTreeFiller(aBBTree); // - // myImages.Clear(); myOrigins.Clear(); // @@ -498,6 +508,7 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap // aTreeFiller.Fill(); // + // Chains for (i=1; i<=aNbV; ++i) { const TopoDS_Shape& aV=aMV(i); // @@ -505,33 +516,84 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap continue; } // - const Bnd_Box& aBoxV=aMSB.FindFromKey(aV); - aSelector.Clear(); - aSelector.SetBox(aBoxV); - // - aNbVSD=aBBTree.Select(aSelector); - if (!aNbVSD) { - continue; // it must not be - } - // - // Images - // + Standard_Integer aNbIP, aIP, aNbIP1, aIP1; TopTools_ListOfShape aLVSD; + TColStd_MapOfInteger aMIP, aMIP1, aMIPC; + TColStd_MapIteratorOfMapOfInteger aIt1; // - const TColStd_ListOfInteger& aLI=aSelector.Indices(); - aIt.Initialize(aLI); - for (j=0; aIt.More(); aIt.Next(), ++j) { - aIndex=aIt.Value(); - const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex); - if(!j) { - aVF=aVx; + aMIP.Add(i); + while(1) { + aNbIP=aMIP.Extent(); + aIt1.Initialize(aMIP); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + if (aMIPC.Contains(aIP)) { + continue; + } + // + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP); + // + aSelector.Clear(); + aSelector.SetBox(aBoxVP); + // + aNbVSD=aBBTree.Select(aSelector); + if (!aNbVSD) { + continue; // it must not be + } + // + const TColStd_ListOfInteger& aLI=aSelector.Indices(); + aIt.Initialize(aLI); + for (; aIt.More(); aIt.Next()) { + aIP1=aIt.Value(); + if (aMIP.Contains(aIP1)) { + continue; + } + aMIP1.Add(aIP1); + } //for (; aIt.More(); aIt.Next()) { + }//for(; aIt1.More(); aIt1.Next()) { + // + aNbIP1=aMIP1.Extent(); + if (!aNbIP1) { + break; // from while(1) + } + // + aIt1.Initialize(aMIP); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + aMIPC.Add(aIP); + } + // + aMIP.Clear(); + aIt1.Initialize(aMIP1); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + aMIP.Add(aIP); } - aLVSD.Append(aVx); - aMVProcessed.Add(aVx); + aMIP1.Clear(); + }// while(1) + //... + aNbIP=aMIPC.Extent(); + if (!aNbIP) { + //modified by NIZNHY-PKV Tue Jan 9 14:26:09 2007f + aMIPC.Add(i); + //continue; + //modified by NIZNHY-PKV Tue Jan 9 14:26:12 2007t } // + aIt1.Initialize(aMIPC); + for(j=0; aIt1.More(); aIt1.Next(), ++j) { + aIP=aIt1.Key(); + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + if (!j) { + aVF=aVP; + } + aLVSD.Append(aVP); + aMVProcessed.Add(aVP); + } myImages.Bind(aVF, aLVSD); - } + }// for (i=1; i<=aNbV; ++i) { + //------------------------------ // // Make new vertices aMV.Clear(); @@ -577,6 +639,7 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap } } } +// //======================================================================= //function : MakeNewVertex //purpose : @@ -1364,3 +1427,213 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB, } } // Contribution of Samtech www.samcef.com END +/* +//======================================================================= +// function:EENewVertices +// purpose: +//======================================================================= + void NMTTools_PaveFiller::EENewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) +{ + Standard_Integer aNb, i, j, aNewShape, aNbEdges, aNbIEE, aNbVV, aNbSimple; + Standard_Integer aWhat, aWith, i1, i2, nE1, nE2, nE, nV, aFlag; + Standard_Real aT; + TopoDS_Compound aCompound; + BRep_Builder aBB; + NMTTools_IndexedDataMapOfIndexedMapOfInteger aMNVE, aMNVIEE; + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + BOPTools_Pave aPave; + TopoDS_Vertex aNewVertex; + TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple; + // + BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + // + aNb=aMapVI.Extent(); + // + if (!aNb) { // no new vertices, no new problems + return; + } + // + // 0. + if (aNb==1) { + aNewVertex=TopoDS::Vertex(aMapVI.FindKey(1)); + EENewVertices(aNewVertex, aMapVI); + return; + } + // + // 1. Make compound from new vertices + aBB.MakeCompound(aCompound); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aV=aMapVI.FindKey(i); + aBB.Add(aCompound, aV); + } + // + // 2. VV intersection between these vertices + // using the auxiliary Filler + NMTDS_ShapesDataStructure tDS; + // + tDS.SetCompositeShape(aCompound); + tDS.Init(); + // + BOPTools_InterferencePool tInterfPool(tDS); + NMTTools_PaveFiller tPaveFiller(tInterfPool); + // + tPaveFiller.Init(); + // + tPaveFiller.PerformVV(); + tPaveFiller.PerformNewVertices(); + // + const BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterfs(); + // + // 3. Separate Comlex and Simple new vertices + aNbVV=aVVInterfs.Extent(); + for (i=1; i<=aNbVV; ++i) { + const BOPTools_VVInterference& aVV=aVVInterfs(i); + aVV.Indices(aWhat, aWith); + const TopoDS_Shape& aV1=tDS.Shape(aWhat); + const TopoDS_Shape& aV2=tDS.Shape(aWith); + aMNVComplex.Add(aV1); + aMNVComplex.Add(aV2); + } + // + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aV=aMapVI.FindKey(i); + if (!aMNVComplex.Contains(aV)) { + aMNVSimple.Add(aV); + } + } + // + // 4. Treat Simple new Vertices + aNbSimple=aMNVSimple.Extent(); + for (i=1; i<=aNbSimple; ++i) { + const TopoDS_Vertex& aV=TopoDS::Vertex(aMNVSimple(i)); + EENewVertices(aV, aMapVI); + } + // + // 3. Fill Maps : NewVertex-edges (aMNVE) + // NewVertex-interferences (aMNVIEE) + for (i=1; i<=aNbVV; ++i) { + const BOPTools_VVInterference& aVV=aVVInterfs(i); + aNewShape=aVV.NewShape(); + if (!aNewShape) { + continue; + } + // + if (!aMNVE.Contains(aNewShape)) { + TColStd_IndexedMapOfInteger aMx; + aMNVE.Add(aNewShape, aMx); + } + if (!aMNVIEE.Contains(aNewShape)) { + TColStd_IndexedMapOfInteger aMx; + aMNVIEE.Add(aNewShape, aMx); + } + // + TColStd_IndexedMapOfInteger& aME=aMNVE.ChangeFromKey(aNewShape); + TColStd_IndexedMapOfInteger& aMIEE=aMNVIEE.ChangeFromKey(aNewShape); + // + aVV.Indices(aWhat, aWith); + //aWhat + const TopoDS_Shape& aV1=tDS.Shape(aWhat); + i1=aMapVI.FindFromKey(aV1); + const BOPTools_EEInterference& aEE1=aEEs(i1); + aEE1.Indices(nE1, nE2); + aME.Add(nE1); + aME.Add(nE2); + aMIEE.Add(i1); + //aWith + const TopoDS_Shape& aV2=tDS.Shape(aWith); + i2=aMapVI.FindFromKey(aV2); + const BOPTools_EEInterference& aEE2=aEEs(i2); + aEE2.Indices(nE1, nE2); + aME.Add(nE1); + aME.Add(nE2); + aMIEE.Add(i2); + // + //printf(" VV: (%d, %d) -> %d\n", aWhat, aWith, aNewShape); + } + // + // 4. Process new vertices + aNb=aMNVE.Extent(); + for (i=1; i<=aNb; ++i) { // xx + // + // new Vertex + nV=aMNVE.FindKey(i); + aNewVertex=TopoDS::Vertex(tDS.Shape(nV)); + // + // Insert New Vertex in DS; + myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); + aNewShape=myDS->NumberOfInsertedShapes(); + myDS->SetState (aNewShape, BooleanOperations_ON); + // + // Update index of NewShape in EE interferences + const TColStd_IndexedMapOfInteger& aMIEE=aMNVIEE.FindFromKey(nV);//(i); + aNbIEE=aMIEE.Extent(); + for (j=1; j<=aNbIEE; ++j) { + i1=aMIEE(j); + BOPTools_EEInterference& aEE1=aEEs(i1); + aEE1.SetNewShape(aNewShape); + } + // + // Update Paves on edges + const TColStd_IndexedMapOfInteger& aME=aMNVE(i); + aNbEdges=aME.Extent(); + for (j=1; j<=aNbEdges; ++j) { + nE=aME(j); + const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));//mpv + // + aFlag=myContext.ComputeVE (aNewVertex, aE, aT); + // + if (!aFlag) { + aPave.SetInterference(-1); + aPave.SetType (BooleanOperations_EdgeEdge); + aPave.SetIndex(aNewShape); + aPave.SetParam(aT); + // + BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE)); + aPaveSet.Append(aPave); + } + } + }// for (i=1; i<=aNb; ++i) {// xx +} +//======================================================================= +// function:EENewVertices +// purpose: +//======================================================================= + void NMTTools_PaveFiller::EENewVertices (const TopoDS_Vertex& aNewVertex, + const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) +{ + Standard_Integer i, aNewShape, nE1, nE2; + Standard_Real aT1, aT2; + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + BOPTools_Pave aPave; + // + BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + // + // one new vertex case is treated in usual way + // + // Insert New Vertex in DS; + myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); + aNewShape=myDS->NumberOfInsertedShapes(); + myDS->SetState (aNewShape, BooleanOperations_ON); + // Insert New Vertex in EE Interference + i=aMapVI.FindFromKey(aNewVertex); + BOPTools_EEInterference& aEEInterf= aEEs(i); + aEEInterf.SetNewShape(aNewShape); + // Extact interference info + aEEInterf.Indices(nE1, nE2); + const IntTools_CommonPrt& aCPart=aEEInterf.CommonPrt(); + VertexParameters(aCPart, aT1, aT2); + // + // Add Paves to the myPavePoolNew + aPave.SetInterference(i); + aPave.SetType (BooleanOperations_EdgeEdge); + aPave.SetIndex(aNewShape); + // Pave for edge nE1 + aPave.SetParam(aT1); + BOPTools_PaveSet& aPaveSet1=myPavePoolNew(myDS->RefEdge(nE1)); + aPaveSet1.Append(aPave); + // Pave for edge nE2 + aPave.SetParam(aT2); + BOPTools_PaveSet& aPaveSet2=myPavePoolNew(myDS->RefEdge(nE2)); + aPaveSet2.Append(aPave); +} +*/ diff --git a/src/NMTTools/NMTTools_PaveFiller_6.cxx b/src/NMTTools/NMTTools_PaveFiller_6.cxx index a7014e303..d3026cc47 100644 --- a/src/NMTTools/NMTTools_PaveFiller_6.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_6.cxx @@ -107,6 +107,8 @@ #include #include #include +// +#include static Standard_Boolean IsPairFound(const Standard_Integer nF1, @@ -135,6 +137,12 @@ static TopTools_ListOfShape& aLS); // Contribution of Samtech www.samcef.com END +//modified by NIZNHY-PKV Mon Dec 4 12:56:04 2006f +static + Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, + IntTools_Context& aCtx); +//modified by NIZNHY-PKV Mon Dec 4 12:56:08 2006t + //======================================================================= // function: PerformFF // purpose: @@ -272,6 +280,7 @@ static Standard_Boolean bIsExistingPaveBlock, bIsValidIn2D, bIsCoincided; // Contribution of Samtech www.samcef.com END // + Standard_Boolean bIsMicroEdge; Standard_Integer i, aNbFFs, nF1, nF2, aBid=0; Standard_Integer nV1, nV2, j, aNbCurves; Standard_Real aTolR3D, aTol2D, aT1, aT2, aTolPPC=Precision::PConfusion(); @@ -510,6 +519,16 @@ static // BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES); // + //modified by NIZNHY-PKV Mon Dec 4 12:56:35 2006f use_01 + // + NMTTools_Tools::UpdateEdge (aES, aTolR3D); + bIsMicroEdge=IsMicroEdge(aES, myContext); + if (bIsMicroEdge) { + continue; + } + // + //modified by NIZNHY-PKV Mon Dec 4 12:56:38 2006t + // //modified by NIZNHY-PKV Thu Nov 16 11:13:46 2006f SKL/PartC5 { Handle(Geom2d_Curve) aC2D1, aC2D2; @@ -519,7 +538,7 @@ static // NMTTools_Tools::MakePCurve(aES, aF1, aC2D1); NMTTools_Tools::MakePCurve(aES, aF2, aC2D2); - NMTTools_Tools::UpdateEdge (aES, aTolR3D); + //NMTTools_Tools::UpdateEdge (aES, aTolR3D); // ft use_01 } // @@ -1419,3 +1438,44 @@ void SharedEdges1(const TopoDS_Face& aF1, } // // Contribution of Samtech www.samcef.com END + +//modified by NIZNHY-PKV Mon Dec 4 12:30:38 2006f use_01 +//======================================================================= +//function : IsMicroEdge +//purpose : +//======================================================================= +Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, + IntTools_Context& aCtx) +{ + Standard_Boolean bRet; + Standard_Integer iErr; + Standard_Real aT1, aT2, aTmp; + Handle(Geom_Curve) aC3D; + TopoDS_Vertex aV1, aV2; + IntTools_Range aR; + // + bRet=(BRep_Tool::Degenerated(aE) || + !BRep_Tool::IsGeometric(aE)); + if (bRet) { + return bRet; + } + // + aC3D=BRep_Tool::Curve(aE, aT1, aT2); + TopExp::Vertices(aE, aV1, aV2); + aT1=BRep_Tool::Parameter(aV1, aE); + aT2=BRep_Tool::Parameter(aV2, aE); + if (aT2Shape(nEx)); + aTolEx=BRep_Tool::Tolerance(aEx); + if (aTolEx>aTolExMax) { + aTolExMax=aTolEx; + aLPBx.Prepend(aPBx); + } + else{ + aLPBx.Append(aPBx); + } + } + // + pLPB->Clear(); + *pLPB=aLPBx; + } + //modified by NIZNHY-PKV Wed Nov 8 15:59:50 2006t + // BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nE); nSp=SplitIndex(aPB); aPB.SetEdge(nSp); -- 2.39.2