// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <BOPAlgo_PaveFiller.ixx>
-
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Edge.hxx>
-#include <BRep_Tool.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPCol_NCVector.hxx>
-#include <BOPCol_TBB.hxx>
-
-#include <BOPInt_Context.hxx>
-
-#include <BOPDS_Iterator.hxx>
-#include <BOPDS_VectorOfInterfVE.hxx>
+#include <BOPCol_Parallel.hxx>
+#include <BOPDS_Curve.hxx>
+#include <BOPDS_DS.hxx>
#include <BOPDS_Interf.hxx>
-#include <BOPDS_PassKey.hxx>
+#include <BOPDS_Iterator.hxx>
#include <BOPDS_MapOfPassKey.hxx>
-#include <BRepBndLib.hxx>
+#include <BOPDS_PassKey.hxx>
+#include <BOPDS_PaveBlock.hxx>
+#include <BOPDS_VectorOfInterfVE.hxx>
+#include <BOPTools_AlgoTools.hxx>
#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepBndLib.hxx>
+#include <gp_Pnt.hxx>
+#include <IntTools_Context.hxx>
+#include <IntTools_Tools.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <Precision.hxx>
//=======================================================================
//class : BOPAlgo_VertexEdgeEdge
//purpose :
//=======================================================================
-class BOPAlgo_VertexEdge {
+class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
+
public:
- BOPAlgo_VertexEdge()
- : myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.) {
+ DEFINE_STANDARD_ALLOC
+
+ BOPAlgo_VertexEdge() :
+ BOPAlgo_Algo(),
+ myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.), myTolVNew(-1.) {
};
//
- ~BOPAlgo_VertexEdge(){
+ virtual ~BOPAlgo_VertexEdge(){
};
//
void SetIndices(const Standard_Integer nV,
myV=aV;
}
//
- const TopoDS_Vertex& Vertex()const {
- return myV;
- }
- //
void SetEdge(const TopoDS_Edge& aE) {
myE=aE;
}
//
- const TopoDS_Edge& Edge()const {
+ const TopoDS_Vertex& Vertex() const {
+ return myV;
+ }
+ //
+ const TopoDS_Edge& Edge() const {
return myE;
}
//
return myT;
}
//
- void SetContext(const Handle(BOPInt_Context)& aContext) {
+ Standard_Real VertexNewTolerance()const {
+ return myTolVNew;
+ }
+ //
+ void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
- const Handle(BOPInt_Context)& Context()const {
+ const Handle(IntTools_Context)& Context()const {
return myContext;
}
//
- void Perform() {
- myFlag=myContext->ComputeVE (myV, myE, myT);
+ virtual void Perform() {
+ BOPAlgo_Algo::UserBreak();
+ myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew);
};
//
protected:
Standard_Integer myIVx;
Standard_Integer myFlag;
Standard_Real myT;
+ Standard_Real myTolVNew;
TopoDS_Vertex myV;
TopoDS_Edge myE;
- Handle(BOPInt_Context) myContext;
+ Handle(IntTools_Context) myContext;
};
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_VertexEdge> BOPAlgo_VectorOfVertexEdge;
//
-typedef BOPCol_TBBContextFunctor
+typedef BOPCol_ContextFunctor
<BOPAlgo_VertexEdge,
BOPAlgo_VectorOfVertexEdge,
- Handle_BOPInt_Context,
- BOPInt_Context> BOPAlgo_VertexEdgeFunctor;
+ Handle(IntTools_Context),
+ IntTools_Context> BOPAlgo_VertexEdgeFunctor;
//
-typedef BOPCol_TBBContextCnt
+typedef BOPCol_ContextCnt
<BOPAlgo_VertexEdgeFunctor,
BOPAlgo_VectorOfVertexEdge,
- Handle_BOPInt_Context> BOPAlgo_VertexEdgeCnt;
+ Handle(IntTools_Context)> BOPAlgo_VertexEdgeCnt;
//
//=======================================================================
// function: PerformVE
void BOPAlgo_PaveFiller::PerformVE()
{
Standard_Boolean bJustAdd;
- Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, i, k, aNbVE;;
- Standard_Real aT, aTolE, aTolV;
+ Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, k, aNbVE;
+ Standard_Real aT, aT1, aT2, aTS1, aTS2;
BOPDS_Pave aPave;
BOPDS_PassKey aPK;
BOPDS_MapOfPassKey aMPK;
- BRep_Builder aBB;
BOPAlgo_VectorOfVertexEdge aVVE;
//
myErrorStatus=0;
//
+ FillShrunkData(TopAbs_VERTEX, TopAbs_EDGE);
+ //
myIterator->Initialize(TopAbs_VERTEX, TopAbs_EDGE);
iSize=myIterator->ExpectedLength();
if (!iSize) {
}
//
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
- aVEs.SetStartSize(iSize);
aVEs.SetIncrement(iSize);
- aVEs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nE, bJustAdd);
continue;
}
//
+ const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(nE);
+ if (aLPB.IsEmpty() || !aLPB.First()->HasShrunkData()) {
+ // this is a micro edge, ignore it
+ continue;
+ }
+ //
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
//
aVESolver.SetIndices(nV, nE, nVx);
aVESolver.SetVertex(aV);
aVESolver.SetEdge(aE);
+ aVESolver.SetProgressIndicator(myProgressIndicator);
//
- }// myIterator->Initialize(TopAbs_VERTEX, TopAbs_EDGE);
+ }// for (; myIterator->More(); myIterator->Next()) {
//
aNbVE=aVVE.Extent();
//=============================================================
if (!iFlag) {
aVESolver.Indices(nV, nE, nVx);
aT=aVESolver.Parameter();
- const TopoDS_Vertex& aV=aVESolver.Vertex();
- const TopoDS_Edge& aE=aVESolver.Edge();
+ //
+ // check if vertex hits beyond shrunk range, in such case create V-V interf
+ const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(nE);
+ const Handle(BOPDS_PaveBlock)& aPB = aLPB.First();
+ Bnd_Box aBox;
+ aPB->Range(aT1, aT2);
+ aPB->ShrunkData(aTS1, aTS2, aBox);
+ IntTools_Range aPaveR[2] = { IntTools_Range(aT1, aTS1), IntTools_Range(aTS2, aT2) };
+ Standard_Real aTol = Precision::Confusion();
+ Standard_Boolean isOnPave = Standard_False;
+ for (Standard_Integer i = 0; i < 2; i++) {
+ if (IntTools_Tools::IsOnPave1(aT, aPaveR[i], aTol)) {
+ Standard_Integer nV1 = (i == 0 ? aPB->Pave1().Index() : aPB->Pave2().Index());
+ if (!myDS->HasInterf(nV, nV1)) {
+ BOPCol_ListOfInteger aLI;
+ aLI.Append(nV);
+ aLI.Append(nV1);
+ MakeSDVertices(aLI);
+ }
+ isOnPave = Standard_True;
+ break;
+ }
+ }
+ if (isOnPave)
+ continue;
+ //
// 1
- i=aVEs.Append()-1;
- BOPDS_InterfVE& aVE=aVEs(i);
+ BOPDS_InterfVE& aVE=aVEs.Append1();
aVE.SetIndices(nV, nE);
aVE.SetParameter(aT);
// 2
myDS->AddInterf(nV, nE);
- // 3
- BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE);
- Handle(BOPDS_PaveBlock)& aPB=*((Handle_BOPDS_PaveBlock*)&aLPB.First());
- //
+ //
+ // 3 update vertex V/E if necessary
+ Standard_Real aTolVNew = aVESolver.VertexNewTolerance();
+ nVx=UpdateVertex(nV, aTolVNew);
+ //4
+ if (myDS->IsNewShape(nVx)) {
+ aVE.SetIndexNew(nVx);
+ }
+ //5 append ext pave to pave block
aPave.SetIndex(nVx);
aPave.SetParameter(aT);
aPB->AppendExtPave(aPave);
- aTolV = BRep_Tool::Tolerance(aV);
- aTolE = BRep_Tool::Tolerance(aE);
- if ( aTolV < aTolE) {
- aBB.UpdateVertex(aV, aTolE);
- BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVx);
- Bnd_Box& aBoxDS=aSIDS.ChangeBox();
- BRepBndLib::Add(aV, aBoxDS);
- }
}
}//for (k=0; k < aNbVE; ++k) {
}