Improvement of partition.

This commit is contained in:
skl 2006-11-23 13:44:54 +00:00
parent bb799cae63
commit c5886a79fa
8 changed files with 417 additions and 129 deletions

View File

@ -52,21 +52,25 @@
//======================================================================= //=======================================================================
void GEOMAlgo_ShapeSet::Add(const TopoDS_Shape& theShape) void GEOMAlgo_ShapeSet::Add(const TopoDS_Shape& theShape)
{ {
myMap.Add(theShape); if (myMap.Add(theShape)) {
myList.Append(theShape);
}
} }
//======================================================================= //=======================================================================
//function : Add //function : Add
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_ShapeSet::Add(const TopoDS_Shape& theShape, void GEOMAlgo_ShapeSet::Add(const TopoDS_Shape& theShape,
const TopAbs_ShapeEnum theType) const TopAbs_ShapeEnum theType)
{ {
TopExp_Explorer aExp; TopExp_Explorer aExp;
// //
aExp.Init(theShape, theType); aExp.Init(theShape, theType);
for (; aExp.More(); aExp.Next()) { for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aS=aExp.Current(); const TopoDS_Shape& aS=aExp.Current();
myMap.Add(aS); if (myMap.Add(aS)) {
myList.Append(aS);
}
} }
} }
//======================================================================= //=======================================================================
@ -79,7 +83,10 @@
// //
aIt.Initialize(theLS); aIt.Initialize(theLS);
for (; aIt.More(); aIt.Next()) { 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 const TopTools_ListOfShape& GEOMAlgo_ShapeSet::GetSet()const
{ {
/*
TopTools_ListOfShape *pL; TopTools_ListOfShape *pL;
TopTools_MapIteratorOfMapOfOrientedShape aIt; TopTools_MapIteratorOfMapOfOrientedShape aIt;
// //
@ -97,6 +105,7 @@
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
pL->Append(aIt.Key()); pL->Append(aIt.Key());
} }
*/
return myList; return myList;
} }
//======================================================================= //=======================================================================
@ -115,7 +124,7 @@
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value(); const TopoDS_Shape& aF=aIt.Value();
aOr=aF.Orientation(); aOr=aF.Orientation();
if (aOr==TopAbs_FORWARD||aOr==TopAbs_REVERSED) { if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) {
bRet=myMap.Contains(aF); bRet=myMap.Contains(aF);
if (!bRet) { if (!bRet) {
break; break;
@ -130,6 +139,7 @@
//======================================================================= //=======================================================================
void GEOMAlgo_ShapeSet::Subtract(const GEOMAlgo_ShapeSet& theOther) void GEOMAlgo_ShapeSet::Subtract(const GEOMAlgo_ShapeSet& theOther)
{ {
/*
TopTools_MapIteratorOfMapOfOrientedShape aIt; TopTools_MapIteratorOfMapOfOrientedShape aIt;
// //
aIt.Initialize(theOther.myMap); aIt.Initialize(theOther.myMap);
@ -137,4 +147,21 @@
const TopoDS_Shape& aS=aIt.Key(); const TopoDS_Shape& aS=aIt.Key();
myMap.Remove(aS); 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;
} }

View File

@ -65,9 +65,6 @@
#include <TopTools_IndexedMapOfShape.hxx> #include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <BRepClass3d_SolidClassifier.hxx> #include <BRepClass3d_SolidClassifier.hxx>
@ -81,8 +78,13 @@
#include <NMTTools_ListOfCoupleOfShape.hxx> #include <NMTTools_ListOfCoupleOfShape.hxx>
#include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx> #include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
#include <NMTTools_CoupleOfShape.hxx> #include <NMTTools_CoupleOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
// //
static static
Standard_Boolean FindFacePairs (const TopoDS_Edge& , Standard_Boolean FindFacePairs (const TopoDS_Edge& ,
const TopTools_ListOfShape& , const TopTools_ListOfShape& ,
@ -212,7 +214,7 @@ static
const TopoDS_Face& theFace2) const TopoDS_Face& theFace2)
{ {
Standard_Boolean bRet; 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_Pnt aPx, aPF, aPF1, aPF2;
gp_Pnt2d aP2D, aPF2D; gp_Pnt2d aP2D, aPF2D;
gp_Dir aDNF1, aDNF2; gp_Dir aDNF1, aDNF2;
@ -247,20 +249,64 @@ static
// 3 // 3
bRet=Standard_False; bRet=Standard_False;
// //
BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1); //modified by NIZNHY-PKV Mon Nov 13 12:12:53 2006f
gp_Pln aPlnF1(aPx, aDNF1);
// //
aD1=BOPTools_Tools3D::SignDistance(aPF, aPlnF1); BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1);
if (aD1<=0.) { BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2);
BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2); //
gp_Pln aPlnF2(aPx, aDNF2); {
Standard_Real aA12, aA1x, aTwoPI;
// //
aD2=BOPTools_Tools3D::SignDistance(aPF, aPlnF2); aTwoPI=2.*PI;
if (aD2<=0.) { gp_Vec aVBF (aPx, aPF );
gp_Vec aVBF1(aPx, aPF1);
gp_Vec aVBF2(aPx, aPF2);
//
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<aA12) {
bRet=!bRet; //TopAbs_IN; bRet=!bRet; //TopAbs_IN;
} }
} }
//
/*
{
Standard_Real aD1, aD2;
//
//BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1);
gp_Pln aPlnF1(aPx, aDNF1);
//
aD1=BOPTools_Tools3D::SignDistance(aPF, aPlnF1);
if (aD1<=0.) {
//BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2);
gp_Pln aPlnF2(aPx, aDNF2);
//
aD2=BOPTools_Tools3D::SignDistance(aPF, aPlnF2);
if (aD2<=0.) {
bRet=!bRet; //TopAbs_IN;
}
}
}
*/
//modified by NIZNHY-PKV Mon Nov 13 12:12:55 2006t
//
return bRet; return bRet;
} }
//======================================================================= //=======================================================================
//function : GetFaceOff //function : GetFaceOff
@ -1012,3 +1058,98 @@ Standard_Real AngleWithRef(const gp_Dir& theD1,
} }
return aBeta; return aBeta;
} }
//
/*
static
void Path(const TopoDS_Shape& ,
const TopoDS_Shape& ,
const TopTools_IndexedDataMapOfShapeListOfShape& ,
const TopTools_IndexedMapOfShape& ,
TopTools_IndexedMapOfShape& );
//=======================================================================
// function: MakeConnexityBlock.
// purpose:
//=======================================================================
void GEOMAlgo_Tools3D::MakeConnexityBlock (const TopTools_ListOfShape& theLFIn,
const TopTools_IndexedMapOfShape& theMEAvoid,
TopTools_ListOfShape& theLCB)
{
Standard_Integer j, aNbF;
TopTools_IndexedDataMapOfShapeListOfShape aEFMap;
TopTools_IndexedMapOfShape aMFP, aCBMap;
TopTools_ListIteratorOfListOfShape aIt;
TopExp_Explorer aExp;
TopAbs_ShapeEnum aType;
//
aIt.Initialize(theLFIn);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
aType=aF.ShapeType();
TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aEFMap);
}
//
aCBMap.Clear();
const TopoDS_Shape& aF=theLFIn.First();
//
aCBMap.Add(aF);
//
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()){
const TopoDS_Shape& aE=aExp.Current();
if (theMEAvoid.Contains(aE)){
continue;
}
//
const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE);
aIt.Initialize(aLF);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF1=aIt.Value();
if (!aF1.IsSame(aF)) {
Path (aE, aF1, aEFMap, theMEAvoid, aCBMap);
}
}
}
//
aNbF=aCBMap.Extent();
for (j=1; j<=aNbF; ++j) {
const TopoDS_Shape& aFx=aCBMap(j);
theLCB.Append(aFx);
}
}
//=======================================================================
// function: Path
// purpose:
//=======================================================================
void Path(const TopoDS_Shape& theE1,
const TopoDS_Shape& theF1,
const TopTools_IndexedDataMapOfShapeListOfShape& theEFMap,
const TopTools_IndexedMapOfShape& theMEAvoid,
TopTools_IndexedMapOfShape& theCBMap)
{
TopTools_ListIteratorOfListOfShape aIt;
TopExp_Explorer aExp;
//
if (theCBMap.Contains(theF1)){
return;
}
theCBMap.Add(theF1);
//
aExp.Init(theF1, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()){
const TopoDS_Shape& aE=aExp.Current();
if (!aE.IsSame(theE1)){
if (theMEAvoid.Contains(aE)) {
continue;
}
//
const TopTools_ListOfShape& aLF=theEFMap.FindFromKey(aE);
aIt.Initialize(aLF);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
Path (aE, aF, theEFMap, theMEAvoid, theCBMap);
}
}
}
}
*/

View File

@ -53,12 +53,6 @@
#include <GEOMAlgo_WireSplitter.hxx> #include <GEOMAlgo_WireSplitter.hxx>
static
void Path(const TopoDS_Shape& aV1,
const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
TopTools_MapOfShape& aMVP,
TopTools_MapOfShape& aMEP,
TopTools_MapOfShape& aMEC);
static static
void MakeWire(const TopTools_ListOfShape& aLE, void MakeWire(const TopTools_ListOfShape& aLE,
TopoDS_Wire& newWire); TopoDS_Wire& newWire);
@ -122,20 +116,21 @@ static
void GEOMAlgo_WESCorrector::DoConnexityBlocks() void GEOMAlgo_WESCorrector::DoConnexityBlocks()
{ {
Standard_Boolean bRegular; Standard_Boolean bRegular;
Standard_Integer i, aNbV; Standard_Integer i, aNbV, j, aNbC, aNbVP, aNbVS;
TopTools_ListIteratorOfListOfShape aIt; TopTools_ListIteratorOfListOfShape aIt;
TopoDS_Iterator aItE; TopoDS_Iterator aItE;
TopoDS_Shape aER; TopoDS_Shape aER;
TopTools_MapOfShape aMER, aMEP, aMEC, aMVP; TopTools_IndexedMapOfShape aMER, aMEP, aMEC, aMVP;
TopTools_MapIteratorOfMapOfShape aItM; TopTools_IndexedMapOfShape aMVS, aMVAdd;
TopTools_IndexedDataMapOfShapeListOfShape aMVE; TopTools_IndexedDataMapOfShapeListOfShape aMVE;
// //
// 1. aMVE; // 1. aMVE;
const TopTools_ListOfShape& aLE=myWES->StartElements(); const TopTools_ListOfShape& aLSE=myWES->StartElements();
aIt.Initialize(aLE); aIt.Initialize(aLSE);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aE=aIt.Value(); 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); TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
} }
else { else {
@ -143,42 +138,74 @@ static
} }
} }
// //
aMEP.Clear();
//
// 2. // 2.
aNbV=aMVE.Extent(); aNbV=aMVE.Extent();
for (i=1; i<=aNbV; ++i) { for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMVE.FindKey(i); const TopoDS_Shape& aV=aMVE.FindKey(i);
if (aMVP.Contains(aV)) { //
aNbVS=aMVS.Extent();
if (aNbVS==aNbV) {
break;
}
//
if (aMVS.Contains(aV)) {
continue; 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); aMVP.Add(aV);
// //
const TopTools_ListOfShape& aLEi=aMVE(i); while(1) {
aIt.Initialize(aLEi); aNbVP=aMVP.Extent();
for (; aIt.More(); aIt.Next()) { for (j=1; j<=aNbVP; ++j) {
const TopoDS_Shape& aE=aIt.Value(); const TopoDS_Shape& aVP=aMVP(j);
if (aMEP.Contains(aE)) { const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aVP);
continue; 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); aMVP.Clear();
aMEC.Add(aE); for (j=1; j<=aNbVP; ++j) {
aItE.Initialize(aE); const TopoDS_Shape& aVE=aMVAdd(j);
for (; aItE.More(); aItE.Next()) { aMVP.Add(aVE);
const TopoDS_Shape& aVE=aItE.Value();
Path(aVE, aMVE, aMVP, aMEP, aMEC);
} }
}//for (; aIt.More(); aIt.Next()) { aMVAdd.Clear();
// }// while(1) {
//-------------------------------------
BOP_ConnexityBlock aCB; BOP_ConnexityBlock aCB;
TopTools_ListOfShape aLEC; TopTools_ListOfShape aLEC;
TopTools_IndexedDataMapOfShapeListOfShape aMVER; TopTools_IndexedDataMapOfShapeListOfShape aMVER;
// //
bRegular=Standard_True; bRegular=Standard_True;
aItM.Initialize(aMEC);
for (; aItM.More(); aItM.Next()) { aNbC=aMEC.Extent();
aER=aItM.Key(); for (j=1; j<=aNbC; ++j) {
aER=aMEC(j);
// //
if (aMER.Contains(aER)) { if (aMER.Contains(aER)) {
Standard_Boolean bClosed; Standard_Boolean bClosed;
@ -200,14 +227,14 @@ static
if (bRegular) { if (bRegular) {
TopExp::MapShapesAndAncestors(aER, TopAbs_VERTEX, TopAbs_EDGE, aMVER); TopExp::MapShapesAndAncestors(aER, TopAbs_VERTEX, TopAbs_EDGE, aMVER);
} }
} }//for (j=1; j<=aNbC; ++j) {
// //
if (bRegular) { if (bRegular) {
Standard_Integer j, aNbVR, aNbER; Standard_Integer k, aNbVR, aNbER;
// //
aNbVR=aMVER.Extent(); aNbVR=aMVER.Extent();
for (j=1; j<=aNbVR; ++j) { for (k=1; k<=aNbVR; ++k) {
const TopTools_ListOfShape& aLER=aMVE(j); const TopTools_ListOfShape& aLER=aMVER(k);//?? it was aMVE(k)
aNbER=aLER.Extent(); aNbER=aLER.Extent();
if (aNbER==1) { if (aNbER==1) {
const TopoDS_Edge& aEx=TopoDS::Edge(aER); const TopoDS_Edge& aEx=TopoDS::Edge(aER);
@ -229,41 +256,7 @@ static
aMEC.Clear(); aMEC.Clear();
}//for (i=1; i<=aNbV; ++i) { }//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 // function: DoCorrections
// purpose: // purpose:

View File

@ -116,11 +116,6 @@ static
Standard_Real Tolerance2D (const TopoDS_Vertex& aV, Standard_Real Tolerance2D (const TopoDS_Vertex& aV,
const GeomAdaptor_Surface& aGAS); const GeomAdaptor_Surface& aGAS);
static
void UVTolerance2D (const TopoDS_Vertex& aV,
const GeomAdaptor_Surface& aGAS,
Standard_Real& aTolU,
Standard_Real& aTolV);
static static
Standard_Integer NbWaysOut(const BOP_ListOfEdgeInfo& ); Standard_Integer NbWaysOut(const BOP_ListOfEdgeInfo& );
// //
@ -456,7 +451,7 @@ static
Standard_Integer i,j, aNb, aNbj; Standard_Integer i,j, aNb, aNbj;
Standard_Real aTol, anAngleIn, anAngleOut, anAngle, aMinAngle; Standard_Real aTol, anAngleIn, anAngleOut, anAngle, aMinAngle;
Standard_Real aTol2D, aTol2D2; Standard_Real aTol2D, aTol2D2;
Standard_Real aTol2, aD2, aTolUVb, aTolVVb; Standard_Real aTol2, aD2;//, aTolUVb, aTolVVb;
Standard_Boolean anIsSameV2d, anIsSameV, anIsFound, anIsOut, anIsNotPassed; Standard_Boolean anIsSameV2d, anIsSameV, anIsFound, anIsOut, anIsNotPassed;
BOP_ListIteratorOfListOfEdgeInfo anIt; BOP_ListIteratorOfListOfEdgeInfo anIt;
TopoDS_Vertex aVb; TopoDS_Vertex aVb;
@ -494,9 +489,13 @@ static
aTol=2.*Tolerance2D(aVb, aGAS); aTol=2.*Tolerance2D(aVb, aGAS);
aTol2=aTol*aTol; aTol2=aTol*aTol;
// //
//modified by NIZNHY-PKV Tue Nov 14 16:56:19 2006f
/*
UVTolerance2D(aVb, aGAS, aTolUVb, aTolVVb); UVTolerance2D(aVb, aGAS, aTolUVb, aTolVVb);
aTolUVb = 2.*aTolUVb; aTolUVb = 2.*aTolUVb;
aTolVVb = 2.*aTolVVb; aTolVVb = 2.*aTolVVb;
*/
//modified by NIZNHY-PKV Tue Nov 14 16:56:26 2006t
// //
aNb=aLS.Length(); aNb=aLS.Length();
if (aNb>0) { if (aNb>0) {
@ -511,7 +510,7 @@ static
aBuf.Append(aEPrev); aBuf.Append(aEPrev);
anIsSameV=aVPrev.IsSame(aVb); anIsSameV=aVPrev.IsSame(aVb);
anIsSameV2d = Standard_False; anIsSameV2d=Standard_False;
if (anIsSameV) { if (anIsSameV) {
anIsSameV2d = Standard_True; anIsSameV2d = Standard_True;
@ -519,6 +518,8 @@ static
aD2=aPaPrev.SquareDistance(aPb); aD2=aPaPrev.SquareDistance(aPb);
anIsSameV2d =aD2<aTol2; anIsSameV2d =aD2<aTol2;
// //
//modified by NIZNHY-PKV Tue Nov 14 16:56:49 2006f
/*
if(anIsSameV2d) { if(anIsSameV2d) {
Standard_Real udist, vdist; Standard_Real udist, vdist;
// //
@ -528,6 +529,8 @@ static
anIsSameV2d=!anIsSameV2d; anIsSameV2d=!anIsSameV2d;
} }
} }
*/
//modified by NIZNHY-PKV Tue Nov 14 16:56:54 2006t
}//if (anIsSameV) { }//if (anIsSameV) {
// //
if (anIsSameV && anIsSameV2d) { if (anIsSameV && anIsSameV2d) {
@ -892,6 +895,15 @@ Standard_Integer NbWaysOut(const BOP_ListOfEdgeInfo& aLEInfo)
} }
return iCnt; 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 //function : UVTolerance2D
//purpose : //purpose :
@ -907,3 +919,5 @@ void UVTolerance2D (const TopoDS_Vertex& aV,
aTolU=aGAS.UResolution(aTolV3D); aTolU=aGAS.UResolution(aTolV3D);
aTolV=aGAS.VResolution(aTolV3D); aTolV=aGAS.VResolution(aTolV3D);
} }
*/
//modified by NIZNHY-PKV Tue Nov 14 16:55:39 2006

View File

@ -269,7 +269,7 @@ static
// //
// Modified Thu Sep 14 14:35:18 2006 // Modified Thu Sep 14 14:35:18 2006
// Contribution of Samtech www.samcef.com BEGIN // Contribution of Samtech www.samcef.com BEGIN
Standard_Boolean bIsExistingPaveBlock, bIsValidIn2D;//, bIsCoincided; Standard_Boolean bIsExistingPaveBlock, bIsValidIn2D, bIsCoincided;
// Contribution of Samtech www.samcef.com END // Contribution of Samtech www.samcef.com END
// //
Standard_Integer i, aNbFFs, nF1, nF2, aBid=0; Standard_Integer i, aNbFFs, nF1, nF2, aBid=0;
@ -285,7 +285,7 @@ static
// //
NMTTools_DataMapOfIntegerListOfPaveBlock aMFInOn; NMTTools_DataMapOfIntegerListOfPaveBlock aMFInOn;
NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock aItMF; NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock aItMF;
// //---
{ {
Standard_Integer aNbS, aNbF, nF, aNbOn, nSp; Standard_Integer aNbS, aNbF, nF, aNbOn, nSp;
TopAbs_ShapeEnum aType; TopAbs_ShapeEnum aType;
@ -364,6 +364,7 @@ static
aLPB.Append(aLPBX); aLPB.Append(aLPBX);
} }
} }
//---
// //
// 1. Produce Section Edges from intersection curves // 1. Produce Section Edges from intersection curves
// between each pair of faces // between each pair of faces
@ -381,6 +382,7 @@ static
// //
BOPTools_ListOfPaveBlock aLPB; BOPTools_ListOfPaveBlock aLPB;
// //
//---
{ {
BOPTools_ListIteratorOfListOfPaveBlock anItPB; BOPTools_ListIteratorOfListOfPaveBlock anItPB;
NMTTools_MapOfPaveBlock aMPB; NMTTools_MapOfPaveBlock aMPB;
@ -409,6 +411,7 @@ static
} }
} }
} }
//---
// //
TopTools_ListOfShape aLSE; TopTools_ListOfShape aLSE;
TColStd_ListOfInteger aLNE; TColStd_ListOfInteger aLNE;
@ -468,17 +471,23 @@ static
} }
// //
// 1 // 1
bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLPB, aTolR3D); bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLPB, aTolR3D);
if (bIsExistingPaveBlock) { if (bIsExistingPaveBlock) {
continue; continue;
} }
// //
bIsCoincided=CheckCoincidence(aPBNew, aLPB);
if(bIsCoincided) {
continue;
}
//
// Modified // Modified
// to provide checking whether aPBNew already exists in list // to provide checking whether aPBNew already exists in list
// of section edges aLSE // of section edges aLSE
// Thu Sep 14 14:35:18 2006 // Thu Sep 14 14:35:18 2006
// Contribution of Samtech www.samcef.com BEGIN // Contribution of Samtech www.samcef.com BEGIN
// 3 // 2
bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLSE, aTolR3D); bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLSE, aTolR3D);
if (bIsExistingPaveBlock) { if (bIsExistingPaveBlock) {
continue; continue;
@ -492,7 +501,6 @@ static
continue; continue;
} }
// //
//aBC.AppendNewBlock(aPBNew);
// //
// Make Section Edge // Make Section Edge
TopoDS_Edge aES; TopoDS_Edge aES;
@ -502,16 +510,33 @@ static
// //
BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES); BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES);
// //
//modified by NIZNHY-PKV Thu Nov 16 11:13:46 2006f SKL/PartC5
{
Handle(Geom2d_Curve) aC2D1, aC2D2;
//
aC2D1=aIC.FirstCurve2d();
aC2D2=aIC.SecondCurve2d();
//
NMTTools_Tools::MakePCurve(aES, aF1, aC2D1);
NMTTools_Tools::MakePCurve(aES, aF2, aC2D2);
NMTTools_Tools::UpdateEdge (aES, aTolR3D);
}
//
/*
{ {
Standard_Real aTolR2D; Standard_Real aTolR2D;
Handle(Geom2d_Curve) aC2D1, aC2D2;
// //
aTolR2D=aFFi.TolR2D(); aTolR2D=aFFi.TolR2D();
Handle(Geom2d_Curve) aC2D1=aIC.FirstCurve2d(); aC2D1=aIC.FirstCurve2d();
Handle(Geom2d_Curve) aC2D2=aIC.SecondCurve2d(); aC2D2=aIC.SecondCurve2d();
// //
NMTTools_Tools::MakePCurve(aES, aF1, aC2D1, aTolR2D); NMTTools_Tools::MakePCurve(aES, aF1, aC2D1, aTolR2D);
NMTTools_Tools::MakePCurve(aES, aF2, aC2D2, aTolR2D); NMTTools_Tools::MakePCurve(aES, aF2, aC2D2, aTolR2D);
} }
*/
//modified by NIZNHY-PKV Thu Nov 16 11:17:34 2006t
// //
aMEPB.Add(aES, aPBNew); aMEPB.Add(aES, aPBNew);
aMapEI.Add(aES, i); aMapEI.Add(aES, i);
@ -712,15 +737,18 @@ static
const TopoDS_Edge& aEx=TopoDS::Edge(tDS.Shape(mE)); const TopoDS_Edge& aEx=TopoDS::Edge(tDS.Shape(mE));
aTolEx=BRep_Tool::Tolerance(aEx); aTolEx=BRep_Tool::Tolerance(aEx);
// //
// The code till the if block end is restored from V2_2_2 revision
//
aF1FWD=aF1; aF1FWD=aF1;
aF1FWD.Orientation(TopAbs_FORWARD); aF1FWD.Orientation(TopAbs_FORWARD);
NMTTools_Tools::MakePCurve(aEx, aF1FWD, aC2D1, aTolEx);
//
aF2FWD=aF2; aF2FWD=aF2;
aF2FWD.Orientation(TopAbs_FORWARD); aF2FWD.Orientation(TopAbs_FORWARD);
NMTTools_Tools::MakePCurve(aEx, aF2FWD, aC2D2, aTolEx); //
//modified by NIZNHY-PKV Thu Nov 16 12:49:13 2006f SKL/PartC5
//NMTTools_Tools::MakePCurve(aEx, aF1FWD, aC2D1, aTolEx);
//NMTTools_Tools::MakePCurve(aEx, aF2FWD, aC2D2, aTolEx);
NMTTools_Tools::MakePCurve(aEx, aF1FWD, aC2D1);
NMTTools_Tools::MakePCurve(aEx, aF2FWD, aC2D2);
NMTTools_Tools::UpdateEdge (aEx, aTolEx);
//modified by NIZNHY-PKV Thu Nov 16 12:49:24 2006t
} //if (aCBAPI.IsCommonBlock(aPB)) } //if (aCBAPI.IsCommonBlock(aPB))
// //
// new SE // new SE
@ -1277,8 +1305,7 @@ void SharedEdges1(const TopoDS_Face& aF1,
} }
} }
} }
//modified by NIZNHY-PKV Tue Oct 24 12:00:50 2006
// it seems that the method is not used
//======================================================================= //=======================================================================
// function: CheckCoincidence // function: CheckCoincidence
// purpose: // purpose:
@ -1291,6 +1318,7 @@ void SharedEdges1(const TopoDS_Face& aF1,
Standard_Real aTE; Standard_Real aTE;
Standard_Integer nV11, nV12, nV21, nV22, iVV, iVE, nE2; Standard_Integer nV11, nV12, nV21, nV22, iVV, iVE, nE2;
Standard_Integer iV, iCount, iCountExt; Standard_Integer iV, iCount, iCountExt;
BOPTools_ListIteratorOfListOfPaveBlock anIt;
// V11 // V11
const BOPTools_Pave& aPave11=aPBNew.Pave1(); const BOPTools_Pave& aPave11=aPBNew.Pave1();
nV11=aPave11.Index(); nV11=aPave11.Index();
@ -1303,9 +1331,7 @@ void SharedEdges1(const TopoDS_Face& aF1,
// //
iCountExt=1; iCountExt=1;
iCount=0; iCount=0;
BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPBFF); anIt.Initialize(aLPBFF);
//
for (; anIt.More(); anIt.Next()) { for (; anIt.More(); anIt.Next()) {
iCount=0; iCount=0;
// //
@ -1313,13 +1339,20 @@ void SharedEdges1(const TopoDS_Face& aF1,
// V21 // V21
const BOPTools_Pave& aPave21=aPBR.Pave1(); const BOPTools_Pave& aPave21=aPBR.Pave1();
nV21=aPave21.Index(); nV21=aPave21.Index();
const TopoDS_Vertex& aV21=TopoDS::Vertex(myDS->Shape(nV21));
// V22 // V22
const BOPTools_Pave& aPave22=aPBR.Pave2(); const BOPTools_Pave& aPave22=aPBR.Pave2();
nV22=aPave22.Index(); 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 // E2
nE2=aPBR.Edge(); 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)); const TopoDS_Edge& aE2=TopoDS::Edge(myDS->Shape(nE2));
// //
// VV // VV

View File

@ -80,12 +80,23 @@ is
FindChains(myclass; FindChains(myclass;
aM1: IndexedDataMapOfShapeIndexedMapOfShape from NMTTools; aM1: IndexedDataMapOfShapeIndexedMapOfShape from NMTTools;
aM2:out 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; MakePCurve(myclass;
aE : Edge from TopoDS; aE : Edge from TopoDS;
aF : Face from TopoDS; aF : Face from TopoDS;
aC2D: Curve from Geom2d; aC2D : Curve from Geom2d);
aTolR2D: Real from Standard);
UpdateEdge(myclass;
aE : Edge from TopoDS;
aTol : Real from Standard);
--modified by NIZNHY-PKV Thu Nov 16 10:58:14 2006t
--fields --fields
end Tools; end Tools;

View File

@ -70,6 +70,7 @@
// //
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx> #include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopoDS_Iterator.hxx>
static static
void ProcessBlock(const Standard_Integer iV, void ProcessBlock(const Standard_Integer iV,
@ -82,6 +83,70 @@ static
TopTools_IndexedMapOfShape& aProcessed, TopTools_IndexedMapOfShape& aProcessed,
TopTools_IndexedMapOfShape& aChain); 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 (aTolV<aTolES) {
aBB.UpdateVertex(aV, aTolES);
}
}
}
//=======================================================================
// function: MakePCurve
// purpose:
//=======================================================================
void NMTTools_Tools::MakePCurve(const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Handle(Geom2d_Curve)& aC2Dx1)
{
Standard_Real aTolE, aT1, aT2, aOutFirst, aOutLast, aOutTol;
Handle(Geom2d_Curve) aC2D, aC2DA;
TopoDS_Face aFFWD;
BRep_Builder aBB;
//
aFFWD=aF;
aFFWD.Orientation(TopAbs_FORWARD);
//
aTolE=BRep_Tool::Tolerance(aE);
//
const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aT1, aT2);
Handle(Geom_TrimmedCurve)aC3DETrim=new Geom_TrimmedCurve(aC3DE, aT1, aT2);
//
aC2D=aC2Dx1;
if (aC2D.IsNull()) { // ?
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aFFWD);
BOPTools_Tools2D::CurveOnSurface(aE, aFFWD, aC2D, aOutFirst, aOutLast, aOutTol, Standard_True);
}
//
if (aC3DE->IsPeriodic()) {
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 // function: MakePCurve
// purpose: // purpose:
@ -140,7 +205,8 @@ static
aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolFact); aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolFact);
BRepLib::SameParameter(aE); BRepLib::SameParameter(aE);
} }
*/
//modified by NIZNHY-PKV Thu Nov 16 10:46:55 2006t
//======================================================================= //=======================================================================
// function: IsSplitInOnFace // function: IsSplitInOnFace
// purpose: // purpose:

View File

@ -1,18 +1,18 @@
// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2005 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
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // 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. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful // This library is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // 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 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) ;