}
}// if (aNbF==1)
}// for (i=1; i<=aNb; ++i)
-
+ //
+ //modified by NIZNHY-PKV Wed Nov 03 14:27:22 2010f
+ Standard_Boolean bFound;
+ TopoDS_Iterator aItS;
+ TopAbs_Orientation aOr;
+ //modified by NIZNHY-PKV Wed Nov 03 14:27:24 2010t
+ //
aNbF=aMFE.Extent();
for (i=1; i<=aNbF; ++i) {
- const TopoDS_Face& aF=TopoDS::Face(aMFE.FindKey(i));
+ //modified by NIZNHY-PKV Wed Nov 03 14:29:03 2010f
+ TopoDS_Face aF=TopoDS::Face(aMFE.FindKey(i));
+ aOr=aF.Orientation();
+ if (aOr==TopAbs_INTERNAL) {
+ aF.Orientation(TopAbs_FORWARD);
+ }
+ //const TopoDS_Face& aF=TopoDS::Face(aMFE.FindKey(i));
+ //modified by NIZNHY-PKV Wed Nov 03 14:29:06 2010t
TopoDS_Face* pF=(TopoDS_Face*)&aF;
const TopTools_ListOfShape& aLE=aMFE(i);
TopTools_ListIteratorOfListOfShape aWIt(aLW);
for (; aWIt.More(); aWIt.Next()) {
const TopoDS_Wire& aW=TopoDS::Wire(aWIt.Value());
+ //
+ //modified by NIZNHY-PKV Wed Nov 03 14:12:48 2010f
+ bFound=Standard_False;
+ aItS.Initialize(aW);
+ for(; aItS.More(); aItS.Next()) {
+ const TopoDS_Shape& aEW=aItS.Value();
+ if (aEW==aE) {
+ bFound=Standard_True;
+ break;
+ }
+ }
+ //
+ if (!bFound) {
+ continue;
+ }
+ //modified by NIZNHY-PKV Wed Nov 03 14:14:22 2010t
+ //
TopoDS_Wire* pW=(TopoDS_Wire*)&aW;
pW->Free(Standard_True);
//
//
pF->Free(Standard_True);
aBB.Remove(*pF, aW);
+ //modified by NIZNHY-PKV Wed Nov 03 14:29:56 2010f
+ pF->Orientation(aOr);
+ //modified by NIZNHY-PKV Wed Nov 03 14:29:59 2010t
myNbRemovedEdges++;
}
}
BooleanOperations_StateOfShape aState, aStateCmp;
TopAbs_Orientation anOr;
TopExp_Explorer anExp;
-
+ TopoDS_Edge aSS;
+ //
iRankF1=aDS.Rank(nF1);
aStateCmp=BOP_BuilderTools::StateToCompare(iRankF1, myOperation);
if (!aNbPB) {
aState=aDS.GetState(nE);
if (aState==aStateCmp) {
- TopoDS_Edge aSS=TopoDS::Edge(anE);
- aSS.Orientation(anOr);
- //
- aWES.AddStartElement (aSS);
+ aSS=TopoDS::Edge(anE);
+ //modified by NIZNHY-PKV Mon Sep 19 09:13:59 2011f
+ if (anOr==TopAbs_INTERNAL) {
+ aSS.Orientation(TopAbs_FORWARD);
+ aWES.AddStartElement (aSS);
+ aSS.Orientation(TopAbs_REVERSED);
+ aWES.AddStartElement (aSS);
+ }
+ else{
+ aSS.Orientation(anOr);
+ aWES.AddStartElement (aSS);
+ }
+ //aSS.Orientation(anOr);
+ //aWES.AddStartElement (aSS);
+ //modified by NIZNHY-PKV Mon Sep 19 09:14:02 2011t
}
continue;
}
aState=aDS.GetState(nSp);
if (aState==aStateCmp) {
const TopoDS_Shape& aSplit=aDS.Shape(nSp);
- TopoDS_Edge aSS=TopoDS::Edge(aSplit);
- aSS.Orientation(anOr);
- //
- aWES.AddStartElement (aSS);
+ aSS=TopoDS::Edge(aSplit);
+ //modified by NIZNHY-PKV Mon Sep 19 08:58:23 2011f
+ if (anOr==TopAbs_INTERNAL) {
+ aSS.Orientation(TopAbs_FORWARD);
+ aWES.AddStartElement (aSS);
+ aSS.Orientation(TopAbs_REVERSED);
+ aWES.AddStartElement (aSS);
+ }
+ else{
+ aSS.Orientation(anOr);
+ aWES.AddStartElement (aSS);
+ }
+ //aSS.Orientation(anOr);
+ //aWES.AddStartElement (aSS);
+ //modified by NIZNHY-PKV Mon Sep 19 08:58:33 2011t
}
}
}
}
return aStPF;
}
-
-// ===========================================================================================
-// function: CheckSameDomainFaceInside
-// purpose: Check if distance between several points of theFace1 and
-// theFace2
-// ===========================================================================================
-Standard_Boolean BOPTools_Tools3D::CheckSameDomainFaceInside(const TopoDS_Face& theFace1,
- const TopoDS_Face& theFace2,
- IntTools_Context& theContext)
-{
- Standard_Real umin = 0., umax = 0., vmin = 0., vmax = 0.;
- BRepTools::UVBounds(theFace1, umin, umax, vmin, vmax);
- Handle(Geom_Surface) aSurface = BRep_Tool::Surface(theFace1);
-
- Standard_Real aTolerance = BRep_Tool::Tolerance(theFace1);
- aTolerance += BRep_Tool::Tolerance(theFace2);
-
- Standard_Integer nbpoints = 5;
- Standard_Real adeltau = (umax - umin) / (nbpoints + 1);
- Standard_Real adeltav = (vmax - vmin) / (nbpoints + 1);
- Standard_Real U = umin + adeltau;
- Standard_Boolean bFoundON = Standard_False;
- GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(theFace2);
-
- for(Standard_Integer i = 1; i <= nbpoints; i++, U+=adeltau) {
- Standard_Real V = vmin + adeltav;
-
- for(Standard_Integer j = 1; j <= nbpoints; j++, V+=adeltav) {
- gp_Pnt2d aPoint(U,V);
-
- if(theContext.IsPointInFace(theFace1, aPoint)) {
- gp_Pnt aP3d = aSurface->Value(U, V);
- aProjector.Perform(aP3d);
-
- if(aProjector.IsDone()) {
- Standard_Real U2 = 0., V2 = 0.;
- aProjector.LowerDistanceParameters(U2, V2);
-
- aPoint = gp_Pnt2d(U2, V2);
-
- if(aProjector.LowerDistance() > aTolerance)
- return Standard_False;
- else if(theContext.IsPointInFace(theFace2, aPoint))
- bFoundON = Standard_True;
- }
- }
- }
- }
-
- return bFoundON;
-}
-
// ===========================================================================================
// function: ComputeFaceState
// purpose:
return Standard_True;
}
+//modified by NIZNHY-PKV Thu Sep 22 10:55:14 2011f
+// ===========================================================================================
+// function: CheckSameDomainFaceInside
+// purpose: Check if distance between several points of theFace1 and
+// theFace2
+// ===========================================================================================
+Standard_Boolean BOPTools_Tools3D::CheckSameDomainFaceInside(const TopoDS_Face& theFace1,
+ const TopoDS_Face& theFace2,
+ IntTools_Context& theContext)
+{
+ Standard_Boolean bFoundON, bPointInFace;
+ Standard_Integer nbpoints, i, j;
+ Standard_Real umin, umax, vmin, vmax, aTol, adeltau, adeltav, U, V, U2, V2, aD, aTolE;
+ gp_Pnt2d aP2D;
+ gp_Pnt aP3D;
+ TopExp_Explorer aExp;
+ //
+ BRepTools::UVBounds(theFace1, umin, umax, vmin, vmax);
+ Handle(Geom_Surface) aS1=BRep_Tool::Surface(theFace1);
+ //
+ aTol=BRep_Tool::Tolerance(theFace1);
+ aExp.Init(theFace1, TopAbs_EDGE);
+ for(; aExp.More(); aExp.Next()) {
+ const TopoDS_Edge& aE = TopoDS::Edge(aExp.Current());
+ aTolE = BRep_Tool::Tolerance(aE);
+ aTol=(aTol < aTolE) ? aTolE : aTol;
+ }
+ aTol=aTol+BRep_Tool::Tolerance(theFace2);
+ //
+ nbpoints=5;
+ adeltau=(umax - umin) / (nbpoints + 1);
+ adeltav=(vmax - vmin) / (nbpoints + 1);
+ bFoundON = Standard_False;
+ //
+ GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(theFace2);
+ //
+ for(i=1; i<=nbpoints; ++i){
+ U=umin+i*adeltau;
+ for(j=1; j<=nbpoints; ++j) {
+ V=vmin+j*adeltav;
+ aP2D.SetCoord(U,V);
+ bPointInFace=theContext.IsPointInFace(theFace1, aP2D);
+ if(bPointInFace) {
+ aP3D=aS1->Value(U, V);
+ aProjector.Perform(aP3D);
+ if(aProjector.IsDone()) {
+ aProjector.LowerDistanceParameters(U2, V2);
+ aP2D.SetCoord(U2, V2);
+ //
+ aD=aProjector.LowerDistance();
+ if(aD > aTol) {
+ return Standard_False;
+ }
+ //
+ bPointInFace=theContext.IsPointInFace(theFace2, aP2D);
+ if (bPointInFace) {
+ bFoundON = Standard_True;
+ }
+ }
+ }
+ }
+ }
+ return bFoundON;
+}
+//modified by NIZNHY-PKV Thu Sep 22 10:55:19 2011t