+
+//=======================================================================
+// function: CheckCoincidence
+// purpose:
+//=======================================================================
+Standard_Boolean NMTTools_PaveFiller::CheckCoincidence(const BOPTools_PaveBlock& aPBNew,
+ const BOPTools_ListOfPaveBlock& aLPBFF)
+{
+ Standard_Boolean bRet;
+ Standard_Real aTE;
+ Standard_Integer nV11, nV12, nV21, nV22, iVV, iVE, nE2;
+ Standard_Integer iV, iCount, iCountExt;
+ BOPTools_ListIteratorOfListOfPaveBlock anIt;
+ // V11
+ const BOPTools_Pave& aPave11=aPBNew.Pave1();
+ nV11=aPave11.Index();
+ const TopoDS_Vertex& aV11=TopoDS::Vertex(myDS->Shape(nV11));
+
+ // V12
+ const BOPTools_Pave& aPave12=aPBNew.Pave2();
+ nV12=aPave12.Index();
+ const TopoDS_Vertex& aV12=TopoDS::Vertex(myDS->Shape(nV12));
+ //
+ iCountExt=1;
+ iCount=0;
+ anIt.Initialize(aLPBFF);
+ for (; anIt.More(); anIt.Next()) {
+ iCount=0;
+ //
+ const BOPTools_PaveBlock& aPBR=anIt.Value();
+ // V21
+ const BOPTools_Pave& aPave21=aPBR.Pave1();
+ nV21=aPave21.Index();
+
+ // V22
+ const BOPTools_Pave& aPave22=aPBR.Pave2();
+ nV22=aPave22.Index();
+ //
+ if (nV11==nV21 || nV11==nV22 || nV12==nV21 || nV12==nV22) {
+ continue;
+ }
+ //
+ // 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
+ iV=0;
+ iVV=IntTools_Tools::ComputeVV (aV11, aV21);
+ if (!iVV) {
+ iCount++;
+ iV++;
+ if (iCount>iCountExt) {
+ break;
+ }
+ }
+ //
+ iVV=IntTools_Tools::ComputeVV (aV11, aV22);
+ if (!iVV) {
+ iCount++;
+ iV++;
+ if (iCount>iCountExt) {
+ break;
+ }
+ }
+ // VE
+ if (!iV) {
+ iVE=myContext->ComputeVE (aV11, aE2, aTE);
+ if (!iVE) {
+ iCount++;
+ if (iCount>iCountExt) {
+ break;
+ }
+ }
+ }
+ // VV
+ iV=0;
+ iVV=IntTools_Tools::ComputeVV (aV12, aV21);
+ if (!iVV) {
+ iCount++;
+ iV++;
+ if (iCount>iCountExt) {
+ break;
+ }
+ }
+ //
+ iVV=IntTools_Tools::ComputeVV (aV12, aV22);
+ if (!iVV) {
+ iCount++;
+ iV++;
+ if (iCount>iCountExt) {
+ break;
+ }
+ }
+ // VE
+ if (!iV) {
+ iVE=myContext->ComputeVE (aV12, aE2, aTE);
+ if (!iVE) {
+ iCount++;
+ if (iCount>iCountExt) {
+ break;
+ }
+ }
+ }
+ } // next aPBR
+ bRet=(Standard_Boolean)(iCount>iCountExt);
+ return bRet;
+}
+
+//=======================================================================
+//function : IsMicroEdge
+//purpose :
+//=======================================================================
+Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
+ const Handle(IntTools_Context)& aCtx)
+{
+ Standard_Boolean bRet;
+ Standard_Integer iErr;
+ Standard_Real aT1, aT2, aTmp;
+ Handle(Geom_Curve) aC3D;
+ TopoDS_Vertex aV1, aV2;
+ IntTools_Range aR;
+ //
+ bRet=(BRep_Tool::Degenerated(aE) ||
+ !BRep_Tool::IsGeometric(aE));
+ if (bRet) {
+ return bRet;
+ }
+ //
+ aC3D=BRep_Tool::Curve(aE, aT1, aT2);
+ TopExp::Vertices(aE, aV1, aV2);
+ aT1=BRep_Tool::Parameter(aV1, aE);
+ aT2=BRep_Tool::Parameter(aV2, aE);
+ if (aT2<aT1) {
+ aTmp=aT1;
+ aT1=aT2;
+ aT2=aTmp;
+ }
+ //
+ aR.SetFirst(aT1);
+ aR.SetLast(aT2);
+ IntTools_ShrunkRange aSR (aE, aV1, aV2, aR, aCtx);
+ iErr=aSR.ErrorStatus();
+ bRet=!aSR.IsDone();
+ //
+ return bRet;
+}