theInParts:out DataMapOfShapeListOfShape from BOPCol;
theDraftSolids:out DataMapOfShapeShape from BOPCol;
theAllocator:BaseAllocator from BOPCol)
- is protected;
-
- BuildBndBox(me:out;
- theIndex:Integer from Standard;
- theBox: out Box from Bnd)
- is protected;
-
+ is protected;
+
FillInternalShapes(me:out)
is protected;
--
---Purpose: The algorithm to build solids from set of faces
uses
- BaseAllocator from BOPCol
-
+ BaseAllocator from BOPCol,
+ Solid from TopoDS
+
--raises
is
Create (theAllocator: BaseAllocator from BOPCol)
returns BuilderSolid from BOPAlgo;
+
+ SetSolid(me:out;
+ theSolid:Solid from TopoDS);
+ ---Purpose: Sets the source solid <theSolid>
+
+ Solid(me)
+ returns Solid from TopoDS;
+ ---C++: return const &
+ ---Purpose: Returns the source solid
Perform(me:out)
---Purpose: Performs the algorithm
---Purpose: Build finalized solids with internal shells
is redefined protected;
---fields
+fields
+ mySolid:Solid from TopoDS is protected;
end BuilderSolid;
//function :
//purpose :
//=======================================================================
- BOPAlgo_BuilderSolid::BOPAlgo_BuilderSolid(const Handle(NCollection_BaseAllocator)& theAllocator)
+BOPAlgo_BuilderSolid::BOPAlgo_BuilderSolid(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_BuilderArea(theAllocator)
{
//function : ~
//purpose :
//=======================================================================
- BOPAlgo_BuilderSolid::~BOPAlgo_BuilderSolid()
+BOPAlgo_BuilderSolid::~BOPAlgo_BuilderSolid()
{
}
//=======================================================================
+//function : SetSolid
+//purpose :
+//=======================================================================
+void BOPAlgo_BuilderSolid::SetSolid(const TopoDS_Solid& aS)
+{
+ mySolid=aS;
+}
+//=======================================================================
+//function : Solid
+//purpose :
+//=======================================================================
+const TopoDS_Solid& BOPAlgo_BuilderSolid::Solid()const
+{
+ return mySolid;
+}
+//=======================================================================
//function : Perform
//purpose :
//=======================================================================
- void BOPAlgo_BuilderSolid::Perform()
+void BOPAlgo_BuilderSolid::Perform()
{
myErrorStatus=0;
//
//function :PerformShapesToAvoid
//purpose :
//=======================================================================
- void BOPAlgo_BuilderSolid::PerformShapesToAvoid()
+void BOPAlgo_BuilderSolid::PerformShapesToAvoid()
{
Standard_Boolean bFound;
Standard_Integer i, iCnt, aNbE, aNbF;
//function : PerformLoops
//purpose :
//=======================================================================
- void BOPAlgo_BuilderSolid::PerformLoops()
+void BOPAlgo_BuilderSolid::PerformLoops()
{
myErrorStatus=0;
//
//function : PerformAreas
//purpose :
//=======================================================================
- void BOPAlgo_BuilderSolid::PerformAreas()
+void BOPAlgo_BuilderSolid::PerformAreas()
{
myErrorStatus=0;
//
//function : PerformInternalShapes
//purpose :
//=======================================================================
- void BOPAlgo_BuilderSolid::PerformInternalShapes()
+void BOPAlgo_BuilderSolid::PerformInternalShapes()
{
myErrorStatus=0;
//
#include <BOPInt_Context.hxx>
#include <BOPAlgo_BuilderFace.hxx>
+#include <BOPAlgo_BuilderSolid.hxx>
-//=======================================================================
-//class : BOPAlgo_VectorOfBuilderFace
-//purpose :
-//=======================================================================
typedef BOPCol_NCVector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
//
//=======================================================================
//class : BOPAlgo_BuilderFaceFunctor
-//purpose :
+//purpose : The class provides the interface and implementation
+// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderFaceFunctor {
protected:
};
//=======================================================================
//class : BOPAlgo_BuilderFaceCnt
-//purpose :
+//purpose : The class provides the interface and implementation
+// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderFaceCnt {
public:
//
};
//
-//-------------------------------------------------------------------------
typedef BOPCol_NCVector<TopoDS_Shape> BOPAlgo_VectorOfShape;
-typedef BOPCol_NCVector<BOPAlgo_VectorOfShape> BOPAlgo_VectorOfVectorOfShape;
-
+//
+typedef BOPCol_NCVector<BOPAlgo_VectorOfShape> \
+ BOPAlgo_VectorOfVectorOfShape;
+//
typedef NCollection_IndexedDataMap\
<BOPTools_Set, Standard_Integer, BOPTools_SetMapHasher> \
BOPAlgo_IndexedDataMapOfSetInteger;
TopoDS_Shape myShape1;
TopoDS_Shape myShape2;
};
-
-typedef BOPCol_NCVector<BOPAlgo_PairOfShapeBoolean> BOPAlgo_VectorOfPairOfShapeBoolean;
//
-
+typedef BOPCol_NCVector<BOPAlgo_PairOfShapeBoolean> \
+ BOPAlgo_VectorOfPairOfShapeBoolean;
+//
//=======================================================================
//function : BOPAlgo_BuilderSDFaceFunctor
-//purpose :
+//purpose : The class provides the interface and implementation
+// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSDFaceFunctor {
protected:
//
//=======================================================================
//function : BOPAlgo_BuilderSDFaceCnt
-//purpose :
+//purpose : The class provides the interface and implementation
+// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSDFaceCnt {
public:
}
//
};
-
+//
+typedef BOPCol_NCVector<BOPAlgo_BuilderSolid> BOPAlgo_VectorOfBuilderSolid;
+//
+//=======================================================================
+//class : BOPAlgo_BuilderSolidFunctor
+//purpose : The class provides the interface and implementation
+// of the parallel computations
+//=======================================================================
+class BOPAlgo_BuilderSolidFunctor {
+ protected:
+ BOPAlgo_VectorOfBuilderSolid* myPVBS;
+ //
+ public:
+ //
+ BOPAlgo_BuilderSolidFunctor(BOPAlgo_VectorOfBuilderSolid& aVBS)
+ : myPVBS(&aVBS) {
+ }
+ //
+ void operator()( const flexible_range<Standard_Integer>& aBR ) const{
+ Standard_Integer i, iBeg, iEnd;
+ //
+ BOPAlgo_VectorOfBuilderSolid& aVBS=*myPVBS;
+ //
+ iBeg=aBR.begin();
+ iEnd=aBR.end();
+ for(i=iBeg; i!=iEnd; ++i) {
+ BOPAlgo_BuilderSolid& aBS=aVBS(i);
+ //
+ aBS.Perform();
+ }
+ }
+};
+//=======================================================================
+//class : BOPAlgo_BuilderSolidCnt
+//purpose : The class provides the interface and implementation
+// of the parallel computations
+//=======================================================================
+class BOPAlgo_BuilderSolidCnt {
+ public:
+ //-------------------------------
+ // Perform
+ Standard_EXPORT static void Perform(const Standard_Boolean bRunParallel,
+ BOPAlgo_VectorOfBuilderSolid& aVBS) {
+
+ Standard_Size aNbBS=aVBS.Extent();
+ BOPAlgo_BuilderSolidFunctor aBSF(aVBS);
+ //
+ if (bRunParallel) {
+ flexible_for(flexible_range<Standard_Integer>(0,aNbBS), aBSF);
+ }
+ else {
+ aBSF.operator()(flexible_range<Standard_Integer>(0,aNbBS));
+ }
+ }
+ //
+};
#endif
#include <BOPDS_BoxBndTree.hxx>
#include <BOPCol_ListOfInteger.hxx>
#include <BOPInt_Context.hxx>
+#include <BOPAlgo_Builder_2Cnt.hxx>
-static
- Standard_Boolean IsClosedShell(const TopoDS_Shell& aSh);
-
static
void OwnInternalShapes(const TopoDS_Shape& ,
BOPCol_IndexedMapOfShape& );
Handle(NCollection_IncAllocator) aAlr;
//
aAlr=new NCollection_IncAllocator();
- //
BOPCol_DataMapOfShapeListOfShape theInParts(100, aAlr);
BOPCol_DataMapOfShapeShape theDraftSolids(100, aAlr);
//
- FillIn3DParts(theInParts, theDraftSolids, aAlr);
+ FillIn3DParts(theInParts, theDraftSolids, aAlr);
BuildSplitSolids(theInParts, theDraftSolids, aAlr);
FillInternalShapes();
//
myErrorStatus=0;
theDraftSolids.Clear();
//
- // 1. aDMISB map Index/FaceBox
+ // 1. aDMISB map Index/FaceBox
k=0;
aNbS=myDS->NbSourceShapes();
for (i=0; i<aNbS; ++i) {
}
}//for (i=0; i<aNbS; ++i) {
//
+ // 1.2. Prepare TreeFiller
+ BOPDS_BoxBndTree aBBTree;
+ NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
+ //
+ aItDMISB.Initialize(aDMISB);
+ for (; aItDMISB.More(); aItDMISB.Next()) {
+ k=aItDMISB.Key();
+ const BOPAlgo_ShapeBox& aSBk=aItDMISB.Value();
+ const Bnd_Box& aBk=aSBk.Box();
+ //
+ aTreeFiller.Add(k, aBk);
+ }
+ //
+ // 1.3. Shake TreeFiller
+ aTreeFiller.Fill();
+ //
+ //---------------------------------------------
// 2. Solids
for (i=0; i<aNbS; ++i) {
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
BOPCol_ListOfShape aLIF(aAlr1);
BOPCol_IndexedMapOfShape aMF(100, aAlr1);
BOPCol_IndexedDataMapOfShapeListOfShape aMEF(100, aAlr1);
- //
BOPDS_BoxBndTreeSelector aSelector;
- BOPDS_BoxBndTree aBBTree;
- NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
Bnd_Box aBoxS;
//
const TopoDS_Shape& aS=aSI.Shape();
}
}
//
- // 2.1 Compute Bnd_Box for the solid aS [ aBoxS ]
- BuildBndBox(i, aBoxS);
+ // 2.1 Bounding box for the solid aS [ aBoxS ]
+ aBoxS=aSI.Box();
//-----
//
// 2.2 Build Draft Solid [aSD]
aMF.Add(aFI);
}
//
- // 2.4. Prepare TreeFiller
- aItDMISB.Initialize(aDMISB);
- for (; aItDMISB.More(); aItDMISB.Next()) {
- k=aItDMISB.Key();
- const BOPAlgo_ShapeBox& aSBk=aItDMISB.Value();
- const TopoDS_Shape& aFk=aSBk.Shape();
- if (aMF.Contains(aFk)) {
- continue;
- }
- //
- const Bnd_Box& aBk=aSBk.Box();
- //
- aTreeFiller.Add(k, aBk);
- }
- //
- // 2.5. Shake TreeFiller
- aTreeFiller.Fill();
- //
- // 2.6. Select boxes of faces that are not out of aBoxS
+ // 2.4. Select boxes of faces that are not out of aBoxS
aSelector.Clear();
aSelector.SetBox(aBoxS);
//
//
const BOPCol_ListOfInteger& aLIFP=aSelector.Indices();
//
- // 2.7. Collect faces that are IN aSolid [ aLFIN ]
+ // 2.5. Collect faces that are IN aSolid [ aLFIN ]
BOPCol_ListOfShape aLFP(aAlr1);
BOPCol_ListOfShape aLCBF(aAlr1);
BOPCol_MapOfShape aMFDone(100, aAlr1);
nFP=aItLI.Value();
const BOPAlgo_ShapeBox& aSBF=aDMISB.Find(nFP);
const TopoDS_Face& aFP=(*(TopoDS_Face*)&aSBF.Shape());
+ if (aMF.Contains(aFP)) {
+ continue;
+ }
if (aMFDone.Contains(aFP)) {
continue;
}
}
}// for (; aItLI.More(); aItLI.Next()) {
//
- // 2.8. Store the results in theInParts, theDraftSolids
+ // 2.6. Store the results in theInParts, theDraftSolids
aNbFIN=aLFIN.Extent();
if (aNbFIN || aNbLIF) {
aItLS.Initialize(aLIF);
myErrorStatus=0;
//
Standard_Boolean bFlagSD;
- Standard_Integer i, aNbS, iErr, aNbSFS;
+ Standard_Integer i, aNbS, aNbSFS;//, iErr
TopExp_Explorer aExp;
BOPCol_ListIteratorOfListOfShape aIt;
BOPCol_DataMapIteratorOfDataMapOfShapeShape aIt1;
BOPCol_ListOfShape aSFS(aAlr0), aLSEmpty(aAlr0);
BOPCol_MapOfShape aMFence(100, aAlr0);
BOPTools_MapOfSet aMST(100, aAlr0);
+ BOPAlgo_VectorOfBuilderSolid aVBS;
//
// 0. Find same domain solids for non-interferred solids
aNbS=myDS->NbSourceShapes();
}
//
const TopoDS_Shape& aS=aSI.Shape();
+ const TopoDS_Solid& aSolid=(*(TopoDS_Solid*)(&aS));
if(!theDraftSolids.IsBound(aS)) {
continue;
}
Handle(NCollection_IncAllocator) aAlr1;
aAlr1=new NCollection_IncAllocator();
//
- BOPAlgo_BuilderSolid aSB(aAlr1);
- //
- //aSB.SetContext(myContext);
- aSB.SetShapes(aSFS);
- aSB.Perform();
- iErr=aSB.ErrorStatus();
- if (iErr) {
- myErrorStatus=30; // SolidBuilder failed
- return;
- }
- //
- const BOPCol_ListOfShape& aLSR=aSB.Areas();
+ BOPAlgo_BuilderSolid& aBS=aVBS.Append1();
+ aBS.SetSolid(aSolid);
+ aBS.SetShapes(aSFS);
+ }//for (i=0; i<aNbS; ++i) {
+ //
+ Standard_Integer k, aNbBS;
+ //
+ aNbBS=aVBS.Extent();
+ //
+ //===================================================
+ BOPAlgo_BuilderSolidCnt::Perform(myRunParallel, aVBS);
+ //===================================================
+ //
+ for (k=0; k<aNbBS; ++k) {
+ BOPAlgo_BuilderSolid& aBS=aVBS(k);
+ const TopoDS_Solid& aS=aBS.Solid();
+ const BOPCol_ListOfShape& aLSR=aBS.Areas();
//
- // 1.4 Collect resulting solids and theirs set of faces.
- // Update Images.
if (!myImages.IsBound(aS)) {
BOPCol_ListOfShape aLSx;
//
}
}
}
- }// for (i=0; i<aNbS; ++i) {
+ }
}
-
//=======================================================================
//function :FillInternalShapes
//purpose :
aMSx.Clear();
}
//=======================================================================
-//function : BuildBndBox
-//purpose :
-//=======================================================================
-void BOPAlgo_Builder::BuildBndBox(const Standard_Integer theIndex,
- Bnd_Box& aBoxS)
-{
- Standard_Boolean bIsOpenBox;
- Standard_Integer nSh, nFc;
- Standard_Real aTolS, aTolFc;
- TopAbs_State aState;
- BOPCol_ListIteratorOfListOfInteger aItLI, aItLI1;
- //
- const BOPDS_ShapeInfo& aSI=myDS->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=myDS->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=myDS->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=IsClosedShell(aSh);
- if (bIsOpenBox) {
- break;
- }
- }//for (; aItLI.More(); aItLI.Next()) {
- //
- if (bIsOpenBox) {
- aBoxS.SetWhole();
- }
- else {
- BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(aSolid);
- aSC.PerformInfinitePoint(aTolS);
- aState=aSC.State();
- if (aState==TopAbs_IN) {
- aBoxS.SetWhole();
- }
- }
-}
-//=======================================================================
//function : OwnInternalShapes
//purpose :
//=======================================================================
}
}
//=======================================================================
-//function : IsClosedShell
-//purpose :
-//=======================================================================
-Standard_Boolean IsClosedShell(const TopoDS_Shell& aSh)
-{
- Standard_Boolean bRet;
- Standard_Integer i, aNbE, aNbF;
- TopAbs_Orientation aOrF;
- BOPCol_IndexedDataMapOfShapeListOfShape aMEF;
- BOPCol_ListIteratorOfListOfShape aItLS;
- //
- bRet=Standard_False;
- //
- BOPTools::MapShapesAndAncestors(aSh, TopAbs_EDGE, TopAbs_FACE, aMEF);
- //
- aNbE=aMEF.Extent();
- for (i=1; i<=aNbE; ++i) {
- const TopoDS_Edge& aE=*((TopoDS_Edge*)&aMEF.FindKey(i));
- if (BRep_Tool::Degenerated(aE)) {
- continue;
- }
- //
- aNbF=0;
- const BOPCol_ListOfShape& aLF=aMEF(i);
- aItLS.Initialize(aLF);
- for (; aItLS.More(); aItLS.Next()) {
- const TopoDS_Shape& aF=aItLS.Value();
- aOrF=aF.Orientation();
- if (aOrF==TopAbs_INTERNAL || aOrF==TopAbs_EXTERNAL) {
- continue;
- }
- ++aNbF;
- }
- //
- if (aNbF==1) {
- bRet=!bRet; // True
- break;
- }
- }
- //
- return bRet;
-}
-//=======================================================================
//function : TreatCompound
//purpose :
//=======================================================================
-- myInterfVV,..myInterfFF]
uses
- ShapeEnum from TopAbs,
+ ShapeEnum from TopAbs,
+ Box from Bnd,
Shape from TopoDS,
--
ListOfShape from BOPCol,
---Purpose:
--- Updates tolerance of the sub-shapes of the shape with index <theIndex>.
---
-
+
+ BuildBndBoxSolid (me:out;
+ theIndex:Integer from Standard;
+ theBox:out Box from Bnd)
+ is protected;
+ ---Purpose:
+ --- Computes bouding box <theBox> for the solid with DS-index <theIndex>
+ ---
fields
myAllocator : BaseAllocator from BOPCol is protected;
myArguments : ListOfShape from BOPCol is protected;
}//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) {
+ Bnd_Box& aBox=aSI.ChangeBox();
+ BuildBndBoxSolid(j, aBox);
+ }
+ }//for (j=0; j<myNbSourceShapes; ++j) {
+ //
aMI.Clear();
aAllocator.Nullify();
//-----------------------------------------------------scope_1 t
}//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();
+ }
+ }
+}
Vertex from TopoDS,
Edge from TopoDS,
Face from TopoDS,
- Wire from TopoDS,
+ Wire from TopoDS,
+ Shell from TopoDS,
Solid from TopoDS,
--
BaseAllocator from BOPCol,
returns Integer from Standard;
---Purpose:
--- Retutns dimension of the shape <theS>.
-
+
+ IsOpenShell(myclass;
+ theShell:Shell from TopoDS)
+ returns Boolean from Standard;
+ ---Purpose: Returns true if the shell <theShell> is open
+
+ IsInvertedSolid(myclass;
+ theSolid:Solid from TopoDS)
+ returns Boolean from Standard;
+ ---Purpose: Returns true if the solid <theSolid> is inverted
+
end AlgoTools;
bRet = aDist < Precision::Angular();
return bRet;
}
+//=======================================================================
+//function : IsOpenShell
+//purpose :
+//=======================================================================
+Standard_Boolean
+ BOPTools_AlgoTools::IsOpenShell(const TopoDS_Shell& aSh)
+{
+ Standard_Boolean bRet;
+ Standard_Integer i, aNbE, aNbF;
+ TopAbs_Orientation aOrF;
+ BOPCol_IndexedDataMapOfShapeListOfShape aMEF;
+ BOPCol_ListIteratorOfListOfShape aItLS;
+ //
+ bRet=Standard_False;
+ //
+ BOPTools::MapShapesAndAncestors(aSh, TopAbs_EDGE, TopAbs_FACE, aMEF);
+ //
+ aNbE=aMEF.Extent();
+ for (i=1; i<=aNbE; ++i) {
+ const TopoDS_Edge& aE=*((TopoDS_Edge*)&aMEF.FindKey(i));
+ if (BRep_Tool::Degenerated(aE)) {
+ continue;
+ }
+ //
+ aNbF=0;
+ const BOPCol_ListOfShape& aLF=aMEF(i);
+ aItLS.Initialize(aLF);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aF=aItLS.Value();
+ aOrF=aF.Orientation();
+ if (aOrF==TopAbs_INTERNAL || aOrF==TopAbs_EXTERNAL) {
+ continue;
+ }
+ ++aNbF;
+ }
+ //
+ if (aNbF==1) {
+ bRet=!bRet; // True
+ break;
+ }
+ }
+ //
+ return bRet;
+}
+//=======================================================================
+//function : IsInvertedSolid
+//purpose :
+//=======================================================================
+Standard_Boolean
+ BOPTools_AlgoTools::IsInvertedSolid(const TopoDS_Solid& aSolid)
+{
+ Standard_Real aTolS;
+ TopAbs_State aState;
+ BRepClass3d_SolidClassifier aSC(aSolid);
+ //
+ aTolS=1.e-7;
+ aSC.PerformInfinitePoint(aTolS);
+ aState=aSC.State();
+ return (aState==TopAbs_IN);
+}