myInterfVF(myAllocator),
myInterfEE(myAllocator),
myInterfEF(myAllocator),
- myInterfFF(myAllocator)
+ myInterfFF(myAllocator),
+ myInterfVZ(myAllocator),
+ myInterfEZ(myAllocator),
+ myInterfFZ(myAllocator),
+ myInterfZZ(myAllocator)
{
myNbShapes=0;
myNbSourceShapes=0;
myInterfVF(myAllocator),
myInterfEE(myAllocator),
myInterfEF(myAllocator),
- myInterfFF(myAllocator)
+ myInterfFF(myAllocator),
+ myInterfVZ(myAllocator),
+ myInterfEZ(myAllocator),
+ myInterfFZ(myAllocator),
+ myInterfZZ(myAllocator)
{
myNbShapes=0;
myNbSourceShapes=0;
myInterfEE.Clear();
myInterfEF.Clear();
myInterfFF.Clear();
+ myInterfVZ.Clear();
+ myInterfEZ.Clear();
+ myInterfFZ.Clear();
+ myInterfZZ.Clear();
}
//=======================================================================
//function : SetArguments
void BOPDS_DS::Init()
{
Standard_Integer i1, i2, j, aI, aNb, aNbS, aNbE, aNbSx, nV, nW, nE, aNbF;
+ Standard_Integer n1, n2, n3;
Standard_Real aTol;
TopAbs_ShapeEnum aTS;
+ TopoDS_Iterator aItS;
BOPCol_ListIteratorOfListOfInteger aIt1, aIt2, aIt3;
BOPCol_ListIteratorOfListOfShape aIt;
BOPDS_IndexRange aR;
}
}//for (; aIt1.More(); aIt1.Next()) {
//
+ // pure internal vertices on the face
+ aItS.Initialize(aS);
+ for (; aItS.More(); aItS.Next()) {
+ const TopoDS_Shape& aSx=aItS.Value();
+ if (aSx.ShapeType()==TopAbs_VERTEX){
+ nV=Index(aSx);
+ aMI.Add(nV);
+ }
+ }
+ //
//
// For a Face: change wires for BRep sub-shapes
aLW.Clear();
}//if (aTS==TopAbs_FACE) {
}//for (j=0; j<myNbSourceShapes; ++j) {
//
+ // 2.4 Solids
+ for (j=0; j<myNbSourceShapes; ++j) {
+ BOPDS_ShapeInfo& aSI=ChangeShapeInfo(j);
+ //
+ aTS=aSI.ShapeType();
+ if (aTS!=TopAbs_SOLID) {
+ continue;
+ }
+ Bnd_Box& aBox=aSI.ChangeBox();
+ BuildBndBoxSolid(j, aBox);
+ //
+ //
+ // update sub-shapes by BRep comprising ones
+ aMI.Clear();
+ BOPCol_ListOfInteger& aLI1=aSI.ChangeSubShapes();
+ //
+ aIt1.Initialize(aLI1);
+ for (; aIt1.More(); aIt1.Next()) {
+ n1=aIt1.Value();
+ BOPDS_ShapeInfo& aSI1=ChangeShapeInfo(n1);
+ if (aSI1.ShapeType()!=TopAbs_SHELL) {
+ continue;
+ }
+ //
+ const BOPCol_ListOfInteger& aLI2=aSI1.SubShapes();
+ aIt2.Initialize(aLI2);
+ for (; aIt2.More(); aIt2.Next()) {
+ n2=aIt2.Value();
+ BOPDS_ShapeInfo& aSI2=ChangeShapeInfo(n2);
+ if (aSI2.ShapeType()!=TopAbs_FACE) {
+ continue;
+ }
+ //
+ aMI.Add(n2);
+ //
+ const BOPCol_ListOfInteger& aLI3=aSI2.SubShapes();
+ aIt3.Initialize(aLI3);
+ for (; aIt3.More(); aIt3.Next()) {
+ n3=aIt3.Value();
+ aMI.Add(n3);
+ }
+ }
+ }
+ //
+ aLI1.Clear();
+ aItMI.Initialize(aMI);
+ for (; aItMI.More(); aItMI.Next()) {
+ n1=aItMI.Value();
+ aLI1.Append(n1);
+ }
+ aMI.Clear();
+ }//for (j=0; j<myNbSourceShapes; ++j) {
+ //
aMI.Clear();
aAllocator.Nullify();
//-----------------------------------------------------scope_1 t
//
return bRet;
}
-
//=======================================================================
//function : HasInterfShapeSubShapes
//purpose :
//=======================================================================
-Standard_Boolean BOPDS_DS::HasInterfShapeSubShapes(const Standard_Integer theI1,
- const Standard_Integer theI2)const
+Standard_Boolean BOPDS_DS::HasInterfShapeSubShapes
+ (const Standard_Integer theI1,
+ const Standard_Integer theI2,
+ const Standard_Boolean theFlag)const
{
Standard_Boolean bRet;
Standard_Integer n2;
for (; aIt.More(); aIt.Next()) {
n2=aIt.Value();
bRet=HasInterf(theI1, n2);
- if(bRet) {
- break;
+ if (theFlag) {
+ if(bRet) {
+ break;
+ }
+ }
+ else {
+ if(!bRet) {
+ break;
+ }
}
}
return bRet;
}
-
//=======================================================================
//function : HasInterfSubShapes
//purpose :
BOPDS_IndexedMapOfPaveBlock& theMPB,
BOPCol_MapOfInteger& theMI)
{
- Standard_Integer i, aNbVF, aNbEF, nV, nE;
+ Standard_Integer i, aNbVF, aNbEF, nV, nE, nVSD;
+ TopoDS_Iterator aItS;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
//
+ // 1. Pure internal vertices on the face
+ const TopoDS_Shape& aF=Shape(theF);
+ aItS.Initialize(aF);
+ for (; aItS.More(); aItS.Next()) {
+ const TopoDS_Shape& aSx=aItS.Value();
+ if (aSx.ShapeType()==TopAbs_VERTEX){
+ nV=Index(aSx);
+ if (HasShapeSD(nV, nVSD)) {
+ nV=nVSD;
+ }
+ theMI.Add(nV);
+ }
+ }
+ //
+ // 2. aVFs
BOPDS_VectorOfInterfVF& aVFs=InterfVF();
aNbVF=aVFs.Extent();
for (i=0; i<aNbVF; ++i) {
}
}
//
+ // 3. aEFs
BOPDS_VectorOfInterfEF& aEFs=InterfEF();
aNbEF=aEFs.Extent();
for (i=0; i<aNbEF; ++i) {
}//for (i=0; i<nd; ++i)
}//while (1)
}
+//=======================================================================
+//function : BuildBndBoxSolid
+//purpose :
+//=======================================================================
+void BOPDS_DS::BuildBndBoxSolid(const Standard_Integer theIndex,
+ Bnd_Box& aBoxS)
+{
+ Standard_Boolean bIsOpenBox, bIsInverted;
+ Standard_Integer nSh, nFc;
+ Standard_Real aTolS, aTolFc;
+ BOPCol_ListIteratorOfListOfInteger aItLI, aItLI1;
+ //
+ const BOPDS_ShapeInfo& aSI=ShapeInfo(theIndex);
+ const TopoDS_Shape& aS=aSI.Shape();
+ const TopoDS_Solid& aSolid=(*(TopoDS_Solid*)(&aS));
+ //
+ bIsOpenBox=Standard_False;
+ //
+ aTolS=0.;
+ const BOPCol_ListOfInteger& aLISh=aSI.SubShapes();
+ aItLI.Initialize(aLISh);
+ for (; aItLI.More(); aItLI.Next()) {
+ nSh=aItLI.Value();
+ const BOPDS_ShapeInfo& aSISh=ShapeInfo(nSh);
+ if (aSISh.ShapeType()!=TopAbs_SHELL) {
+ continue;
+ }
+ //
+ const BOPCol_ListOfInteger& aLIFc=aSISh.SubShapes();
+ aItLI1.Initialize(aLIFc);
+ for (; aItLI1.More(); aItLI1.Next()) {
+ nFc=aItLI1.Value();
+ const BOPDS_ShapeInfo& aSIFc=ShapeInfo(nFc);
+ if (aSIFc.ShapeType()!=TopAbs_FACE) {
+ continue;
+ }
+ //
+ const Bnd_Box& aBFc=aSIFc.Box();
+ aBoxS.Add(aBFc);
+ //
+ if (!bIsOpenBox) {
+ bIsOpenBox=(aBFc.IsOpenXmin() || aBFc.IsOpenXmax() ||
+ aBFc.IsOpenYmin() || aBFc.IsOpenYmax() ||
+ aBFc.IsOpenZmin() || aBFc.IsOpenZmax());
+ if (bIsOpenBox) {
+ break;
+ }
+ }
+ //
+ const TopoDS_Face& aFc=*((TopoDS_Face*)&aSIFc.Shape());
+ aTolFc=BRep_Tool::Tolerance(aFc);
+ if (aTolFc>aTolS) {
+ aTolS=aTolFc;
+ }
+ }//for (; aItLI1.More(); aItLI1.Next()) {
+ if (bIsOpenBox) {
+ break;
+ }
+ //
+ const TopoDS_Shell& aSh=*((TopoDS_Shell*)&aSISh.Shape());
+ bIsOpenBox=BOPTools_AlgoTools::IsOpenShell(aSh);
+ if (bIsOpenBox) {
+ break;
+ }
+ }//for (; aItLI.More(); aItLI.Next()) {
+ //
+ if (bIsOpenBox) {
+ aBoxS.SetWhole();
+ }
+ else {
+ bIsInverted=BOPTools_AlgoTools::IsInvertedSolid(aSolid);
+ if (bIsInverted) {
+ aBoxS.SetWhole();
+ }
+ }
+}