From: skl Date: Thu, 23 Nov 2006 13:44:54 +0000 (+0000) Subject: Improvement of partition. X-Git-Tag: V3_2_3~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c5886a79fad297a9d5d5578fa049ff28aafc3502;p=modules%2Fgeom.git Improvement of partition. --- diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSet.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeSet.cxx index dd2d5f7a6..800e3eb3e 100755 --- a/src/GEOMAlgo/GEOMAlgo_ShapeSet.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSet.cxx @@ -52,21 +52,25 @@ //======================================================================= void GEOMAlgo_ShapeSet::Add(const TopoDS_Shape& theShape) { - myMap.Add(theShape); + if (myMap.Add(theShape)) { + myList.Append(theShape); + } } //======================================================================= //function : Add //purpose : //======================================================================= void GEOMAlgo_ShapeSet::Add(const TopoDS_Shape& theShape, - const TopAbs_ShapeEnum theType) + const TopAbs_ShapeEnum theType) { TopExp_Explorer aExp; // aExp.Init(theShape, theType); for (; aExp.More(); aExp.Next()) { const TopoDS_Shape& aS=aExp.Current(); - myMap.Add(aS); + if (myMap.Add(aS)) { + myList.Append(aS); + } } } //======================================================================= @@ -79,7 +83,10 @@ // aIt.Initialize(theLS); for (; aIt.More(); aIt.Next()) { - myMap.Add(aIt.Value()); + const TopoDS_Shape& aS=aIt.Value(); + if (myMap.Add(aS)) { + myList.Append(aS); + } } } //======================================================================= @@ -88,6 +95,7 @@ //======================================================================= const TopTools_ListOfShape& GEOMAlgo_ShapeSet::GetSet()const { + /* TopTools_ListOfShape *pL; TopTools_MapIteratorOfMapOfOrientedShape aIt; // @@ -97,6 +105,7 @@ for (; aIt.More(); aIt.Next()) { pL->Append(aIt.Key()); } + */ return myList; } //======================================================================= @@ -115,7 +124,7 @@ for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aF=aIt.Value(); aOr=aF.Orientation(); - if (aOr==TopAbs_FORWARD||aOr==TopAbs_REVERSED) { + if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) { bRet=myMap.Contains(aF); if (!bRet) { break; @@ -130,6 +139,7 @@ //======================================================================= void GEOMAlgo_ShapeSet::Subtract(const GEOMAlgo_ShapeSet& theOther) { + /* TopTools_MapIteratorOfMapOfOrientedShape aIt; // aIt.Initialize(theOther.myMap); @@ -137,4 +147,21 @@ const TopoDS_Shape& aS=aIt.Key(); myMap.Remove(aS); } + */ + // + TopTools_ListIteratorOfListOfShape aIt; + TopTools_ListOfShape aLS; + // + myMap.Clear(); + aIt.Initialize(myList); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + if (!theOther.myMap.Contains(aS)) { + if(myMap.Add(aS)){ + aLS.Append(aS); + } + } + } + // + myList=aLS; } diff --git a/src/GEOMAlgo/GEOMAlgo_Tools3D.cxx b/src/GEOMAlgo/GEOMAlgo_Tools3D.cxx index 7149d8a3a..6d97c6f61 100755 --- a/src/GEOMAlgo/GEOMAlgo_Tools3D.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Tools3D.cxx @@ -65,9 +65,6 @@ #include #include #include -#include -#include -#include #include @@ -81,8 +78,13 @@ #include #include #include - +#include +#include +#include +#include +#include // + static Standard_Boolean FindFacePairs (const TopoDS_Edge& , const TopTools_ListOfShape& , @@ -212,7 +214,7 @@ static const TopoDS_Face& theFace2) { Standard_Boolean bRet; - Standard_Real aT1, aT2, aT, aDt2D, aD1, aD2, aDt2Dx; + Standard_Real aT1, aT2, aT, aDt2D, aDt2Dx;//aD1, aD2, gp_Pnt aPx, aPF, aPF1, aPF2; gp_Pnt2d aP2D, aPF2D; gp_Dir aDNF1, aDNF2; @@ -247,20 +249,64 @@ static // 3 bRet=Standard_False; // + //modified by NIZNHY-PKV Mon Nov 13 12:12:53 2006f + // BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1); - gp_Pln aPlnF1(aPx, aDNF1); + BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2); // - aD1=BOPTools_Tools3D::SignDistance(aPF, aPlnF1); - if (aD1<=0.) { - BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2); - gp_Pln aPlnF2(aPx, aDNF2); + { + Standard_Real aA12, aA1x, aTwoPI; + // + aTwoPI=2.*PI; + gp_Vec aVBF (aPx, aPF ); + gp_Vec aVBF1(aPx, aPF1); + gp_Vec aVBF2(aPx, aPF2); // - aD2=BOPTools_Tools3D::SignDistance(aPF, aPlnF2); - if (aD2<=0.) { + gp_Dir aDTF1; + gp_Dir aDBF (aVBF); + gp_Dir aDBF1(aVBF1); + gp_Dir aDBF2(aVBF2); + // + aDTF1=aDNF1^aDBF1; + //aA12=aDBF1.AngleWithRef(aDBF2, aDTF1); + aA12=AngleWithRef(aDBF1, aDBF2, aDTF1); + if (aA12<0.) { + aA12=aA12+aTwoPI; + } + //aA1x=aDBF1.AngleWithRef(aDBF , aDTF1); + aA1x=AngleWithRef(aDBF1, aDBF , aDTF1); + if (aA1x<0.) { + aA1x=aA1x+aTwoPI; + } + // + if (aA1x -static - void Path(const TopoDS_Shape& aV1, - const TopTools_IndexedDataMapOfShapeListOfShape& aMVE, - TopTools_MapOfShape& aMVP, - TopTools_MapOfShape& aMEP, - TopTools_MapOfShape& aMEC); static void MakeWire(const TopTools_ListOfShape& aLE, TopoDS_Wire& newWire); @@ -122,20 +116,21 @@ static void GEOMAlgo_WESCorrector::DoConnexityBlocks() { Standard_Boolean bRegular; - Standard_Integer i, aNbV; + Standard_Integer i, aNbV, j, aNbC, aNbVP, aNbVS; TopTools_ListIteratorOfListOfShape aIt; TopoDS_Iterator aItE; TopoDS_Shape aER; - TopTools_MapOfShape aMER, aMEP, aMEC, aMVP; - TopTools_MapIteratorOfMapOfShape aItM; + TopTools_IndexedMapOfShape aMER, aMEP, aMEC, aMVP; + TopTools_IndexedMapOfShape aMVS, aMVAdd; TopTools_IndexedDataMapOfShapeListOfShape aMVE; // // 1. aMVE; - const TopTools_ListOfShape& aLE=myWES->StartElements(); - aIt.Initialize(aLE); + const TopTools_ListOfShape& aLSE=myWES->StartElements(); + aIt.Initialize(aLSE); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aE=aIt.Value(); - if (aMEP.Add(aE)) { + if (!aMEP.Contains(aE)) { + aMEP.Add(aE); TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE); } else { @@ -143,42 +138,74 @@ static } } // - aMEP.Clear(); - // // 2. aNbV=aMVE.Extent(); for (i=1; i<=aNbV; ++i) { const TopoDS_Shape& aV=aMVE.FindKey(i); - if (aMVP.Contains(aV)) { + // + aNbVS=aMVS.Extent(); + if (aNbVS==aNbV) { + break; + } + // + if (aMVS.Contains(aV)) { continue; } + aMVS.Add(aV); // aMVS - globally processed vertices + // + //------------------------------------- goal: aMEC + aMEC.Clear(); // aMEC - edges of CB + aMVP.Clear(); // aMVP - vertices to process right now + aMVAdd.Clear(); // aMVAdd vertices to process on next step of while(1) + // aMVP.Add(aV); // - const TopTools_ListOfShape& aLEi=aMVE(i); - aIt.Initialize(aLEi); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aE=aIt.Value(); - if (aMEP.Contains(aE)) { - continue; + while(1) { + aNbVP=aMVP.Extent(); + for (j=1; j<=aNbVP; ++j) { + const TopoDS_Shape& aVP=aMVP(j); + const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aVP); + aIt.Initialize(aLE); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aE=aIt.Value(); + if (aMEC.Contains(aE)) { + continue; + } + aMEC.Add(aE); + // + aItE.Initialize(aE); + for (; aItE.More(); aItE.Next()) { + const TopoDS_Shape& aVE=aItE.Value(); + if (!aMVS.Contains(aVE)) { + aMVS.Add(aVE); + aMVAdd.Add(aVE); + } + } + } + }//for (j=1; j<=aNbVP; ++j) + // + aNbVP=aMVAdd.Extent(); + if (!aNbVP) { + break; // from while(1) } // - aMEP.Add(aE); - aMEC.Add(aE); - aItE.Initialize(aE); - for (; aItE.More(); aItE.Next()) { - const TopoDS_Shape& aVE=aItE.Value(); - Path(aVE, aMVE, aMVP, aMEP, aMEC); + aMVP.Clear(); + for (j=1; j<=aNbVP; ++j) { + const TopoDS_Shape& aVE=aMVAdd(j); + aMVP.Add(aVE); } - }//for (; aIt.More(); aIt.Next()) { - // + aMVAdd.Clear(); + }// while(1) { + //------------------------------------- BOP_ConnexityBlock aCB; TopTools_ListOfShape aLEC; TopTools_IndexedDataMapOfShapeListOfShape aMVER; // bRegular=Standard_True; - aItM.Initialize(aMEC); - for (; aItM.More(); aItM.Next()) { - aER=aItM.Key(); + + aNbC=aMEC.Extent(); + for (j=1; j<=aNbC; ++j) { + aER=aMEC(j); // if (aMER.Contains(aER)) { Standard_Boolean bClosed; @@ -200,14 +227,14 @@ static if (bRegular) { TopExp::MapShapesAndAncestors(aER, TopAbs_VERTEX, TopAbs_EDGE, aMVER); } - } + }//for (j=1; j<=aNbC; ++j) { // if (bRegular) { - Standard_Integer j, aNbVR, aNbER; + Standard_Integer k, aNbVR, aNbER; // aNbVR=aMVER.Extent(); - for (j=1; j<=aNbVR; ++j) { - const TopTools_ListOfShape& aLER=aMVE(j); + for (k=1; k<=aNbVR; ++k) { + const TopTools_ListOfShape& aLER=aMVER(k);//?? it was aMVE(k) aNbER=aLER.Extent(); if (aNbER==1) { const TopoDS_Edge& aEx=TopoDS::Edge(aER); @@ -229,41 +256,7 @@ static aMEC.Clear(); }//for (i=1; i<=aNbV; ++i) { } -//======================================================================= -// function: Path -// purpose: -//======================================================================= -void Path(const TopoDS_Shape& aV1, - const TopTools_IndexedDataMapOfShapeListOfShape& aMVE, - TopTools_MapOfShape& aMVP, - TopTools_MapOfShape& aMEP, - TopTools_MapOfShape& aMEC) -{ - TopoDS_Iterator aItE; - TopTools_ListIteratorOfListOfShape aIt; - // - if (aMVP.Contains(aV1)) { - return; - } - aMVP.Add(aV1); - // - const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aV1); - aIt.Initialize(aLE); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aE=aIt.Value(); - if (aMEP.Contains(aE)) { - continue; - } - aMEP.Add(aE); - aMEC.Add(aE); - // - aItE.Initialize(aE); - for (; aItE.More(); aItE.Next()) { - const TopoDS_Shape& aVE=aItE.Value(); - Path(aVE, aMVE, aMVP, aMEP, aMEC); - } - } -} + //======================================================================= // function: DoCorrections // purpose: diff --git a/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx b/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx index 201c6d0f0..3860f82fe 100755 --- a/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx +++ b/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx @@ -116,11 +116,6 @@ static Standard_Real Tolerance2D (const TopoDS_Vertex& aV, const GeomAdaptor_Surface& aGAS); -static - void UVTolerance2D (const TopoDS_Vertex& aV, - const GeomAdaptor_Surface& aGAS, - Standard_Real& aTolU, - Standard_Real& aTolV); static Standard_Integer NbWaysOut(const BOP_ListOfEdgeInfo& ); // @@ -456,7 +451,7 @@ static Standard_Integer i,j, aNb, aNbj; Standard_Real aTol, anAngleIn, anAngleOut, anAngle, aMinAngle; Standard_Real aTol2D, aTol2D2; - Standard_Real aTol2, aD2, aTolUVb, aTolVVb; + Standard_Real aTol2, aD2;//, aTolUVb, aTolVVb; Standard_Boolean anIsSameV2d, anIsSameV, anIsFound, anIsOut, anIsNotPassed; BOP_ListIteratorOfListOfEdgeInfo anIt; TopoDS_Vertex aVb; @@ -494,9 +489,13 @@ 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) { @@ -511,7 +510,7 @@ static aBuf.Append(aEPrev); anIsSameV=aVPrev.IsSame(aVb); - anIsSameV2d = Standard_False; + anIsSameV2d=Standard_False; if (anIsSameV) { anIsSameV2d = Standard_True; @@ -519,6 +518,8 @@ static aD2=aPaPrev.SquareDistance(aPb); anIsSameV2d =aD2Shape(nV21)); + // V22 const BOPTools_Pave& aPave22=aPBR.Pave2(); nV22=aPave22.Index(); - const TopoDS_Vertex& aV22=TopoDS::Vertex(myDS->Shape(nV22)); + //modified by NIZNHY-PKV Wed Nov 15 13:08:13 2006f + if (nV11==nV21 || nV11==nV22 || nV12==nV21 || nV12==nV22) { + continue; + } + //modified by NIZNHY-PKV Wed Nov 15 13:08:15 2006t // E2 nE2=aPBR.Edge(); + // + const TopoDS_Vertex& aV21=TopoDS::Vertex(myDS->Shape(nV21)); + const TopoDS_Vertex& aV22=TopoDS::Vertex(myDS->Shape(nV22)); const TopoDS_Edge& aE2=TopoDS::Edge(myDS->Shape(nE2)); // // VV diff --git a/src/NMTTools/NMTTools_Tools.cdl b/src/NMTTools/NMTTools_Tools.cdl index efe6a35fb..cab93959a 100644 --- a/src/NMTTools/NMTTools_Tools.cdl +++ b/src/NMTTools/NMTTools_Tools.cdl @@ -80,12 +80,23 @@ is FindChains(myclass; aM1: IndexedDataMapOfShapeIndexedMapOfShape from NMTTools; aM2:out IndexedDataMapOfShapeIndexedMapOfShape from NMTTools); - + +--modified by NIZNHY-PKV Thu Nov 16 10:58:08 2006f +-- MakePCurve(myclass; +-- aE : Edge from TopoDS; +-- aF : Face from TopoDS; +-- aC2D: Curve from Geom2d; +-- aTolR2D: Real from Standard); + MakePCurve(myclass; - aE : Edge from TopoDS; - aF : Face from TopoDS; - aC2D: Curve from Geom2d; - aTolR2D: Real from Standard); + aE : Edge from TopoDS; + aF : Face from TopoDS; + aC2D : Curve from Geom2d); + + UpdateEdge(myclass; + aE : Edge from TopoDS; + aTol : Real from Standard); +--modified by NIZNHY-PKV Thu Nov 16 10:58:14 2006t --fields end Tools; diff --git a/src/NMTTools/NMTTools_Tools.cxx b/src/NMTTools/NMTTools_Tools.cxx index 8c6357b2b..3f986765e 100644 --- a/src/NMTTools/NMTTools_Tools.cxx +++ b/src/NMTTools/NMTTools_Tools.cxx @@ -70,6 +70,7 @@ // #include #include +#include static void ProcessBlock(const Standard_Integer iV, @@ -82,6 +83,70 @@ static TopTools_IndexedMapOfShape& aProcessed, TopTools_IndexedMapOfShape& aChain); +//modified by NIZNHY-PKV Thu Nov 16 10:46:53 2006f SKL/PartC5 +//======================================================================= +// function: UpdateEdge +// purpose: +//======================================================================= + void NMTTools_Tools::UpdateEdge(const TopoDS_Edge& aE, + const Standard_Real aTolR) +{ + Standard_Real aTolE, aTolES, aTolV; + TopoDS_Iterator aIt; + BRep_Builder aBB; + // + aTolE=BRep_Tool::Tolerance(aE); + aTolES=Max(aTolR, aTolE); + aBB.UpdateEdge(aE, aTolES); + // + aIt.Initialize(aE); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Vertex& aV=TopoDS::Vertex(aIt.Value()); + aTolV=BRep_Tool::Tolerance(aV); + if (aTolVIsPeriodic()) { + BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D, aC2DA); + } + else { + BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, aC2DA); + } + // + aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE); + BRepLib::SameParameter(aE); +} +/* //======================================================================= // function: MakePCurve // purpose: @@ -140,7 +205,8 @@ static aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolFact); BRepLib::SameParameter(aE); } - +*/ +//modified by NIZNHY-PKV Thu Nov 16 10:46:55 2006t //======================================================================= // function: IsSplitInOnFace // purpose: diff --git a/src/NMTTools/NMTTools_Tools.hxx b/src/NMTTools/NMTTools_Tools.hxx index 232b7cc31..96913473b 100644 --- a/src/NMTTools/NMTTools_Tools.hxx +++ b/src/NMTTools/NMTTools_Tools.hxx @@ -1,18 +1,18 @@ // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com @@ -94,7 +94,10 @@ Standard_EXPORT static void FindChains(const NMTTools_ListOfCoupleOfShape& aLCS Standard_EXPORT static void FindChains(const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aM1,NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aM2) ; -Standard_EXPORT static void MakePCurve(const TopoDS_Edge& aE,const TopoDS_Face& aF,const Handle(Geom2d_Curve)& aC2D,const Standard_Real aTolR2D) ; +Standard_EXPORT static void MakePCurve(const TopoDS_Edge& aE,const TopoDS_Face& aF,const Handle(Geom2d_Curve)& aC2D) ; + + +Standard_EXPORT static void UpdateEdge(const TopoDS_Edge& aE,const Standard_Real aTol) ;