+//modified by NIZNHY-PKV Fri Feb 25 16:59:57 2005f XX
+//=======================================================================
+//function : GetPlanes
+//purpose :
+//=======================================================================
+void GetPlanes (const TopoDS_Edge& anEx,
+ const TopTools_IndexedDataMapOfShapeListOfShape& anEFMapx,
+ const TopoDS_Face& aF1,
+ TopAbs_State& aStPF1)
+
+{
+ Standard_Boolean bIsAdjExists;
+ Standard_Real aT, aT1, aT2;
+ TopAbs_Orientation anOrEx, anOr;
+ gp_Dir aDNFx1, aDNFx2, aDNF1;
+ gp_Pnt aPx, aPx1, aPx2, aPF1;
+ TopoDS_Edge aERight, aSpxSimm;
+ TopoDS_Face aFx1, aFx2, aFF1;
+ TopTools_ListIteratorOfListOfShape anIt;
+ //
+ // Point on Edge
+ Handle(Geom_Curve)aC3D =BRep_Tool::Curve(anEx, aT1, aT2);
+ aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
+
+ aC3D->D0(aT, aPx);
+ //
+ anOrEx=anEx.Orientation();
+
+ aSpxSimm=anEx;
+ if (anOrEx==TopAbs_FORWARD) {
+ aSpxSimm.Orientation(TopAbs_REVERSED);
+ }
+ else if (anOrEx==TopAbs_REVERSED){
+ aSpxSimm.Orientation(TopAbs_FORWARD);
+ }
+ //
+ const TopTools_ListOfShape& aLF=anEFMapx.FindFromKey(anEx);
+ anIt.Initialize(aLF);
+ for (; anIt.More(); anIt.Next()) {
+ const TopoDS_Shape& aFE=anIt.Value();
+ aFx1=TopoDS::Face(aFE);
+ anOr=BOPTools_Tools3D::Orientation(anEx, aFx1);
+ if (anOr==anOrEx){
+ break;
+ }
+ }
+ //
+ BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (anEx, aFx1, aT, aPx1, aDNFx1);
+ //
+ bIsAdjExists=BOPTools_Tools3D::GetAdjacentFace (aFx1, anEx, anEFMapx, aFx2);
+ if (!bIsAdjExists) {
+ BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx1, aT, aPx2, aDNFx2);
+ }
+ else {
+ BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx2, aT, aPx2, aDNFx2);
+ }
+ //
+ aFF1=aF1;
+ aFF1.Orientation(TopAbs_FORWARD);
+ BOPTools_Tools3D::OrientEdgeOnFace (anEx, aFF1, aERight);
+ BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aERight, aFF1, aT, aPF1, aDNF1);
+ //
+ {
+ Standard_Real d12, d1, anAlfa12, anAlfa1, aTwoPI;
+
+ aTwoPI=Standard_PI+Standard_PI;
+
+ gp_Vec aVx1(aPx, aPx1);
+ gp_Dir aDBx1 (aVx1);
+ gp_Pln aPlnToCompare (aPx, aDNFx1);
+
+ gp_Vec aVx2(aPx, aPx2);
+ gp_Dir aDBx2 (aVx2);
+
+ anAlfa12=aDBx1.Angle(aDBx2);
+ d12=BOPTools_Tools3D::SignDistance(aPx2, aPlnToCompare);
+ if (d12 < 0.) {
+ anAlfa12=aTwoPI-anAlfa12;
+ }
+
+ gp_Vec aVF1(aPx, aPF1);
+ gp_Dir aDBF1 (aVF1);
+ anAlfa1=aDBx1.Angle(aDBF1);
+ d1=BOPTools_Tools3D::SignDistance(aPF1, aPlnToCompare);
+ if (d1 < 0.) {
+ anAlfa1=aTwoPI-anAlfa1;
+ }
+
+ aStPF1=TopAbs_OUT;
+ if (anAlfa1 > anAlfa12) {
+ aStPF1=TopAbs_IN;
+ }
+ }
+}
+//modified by NIZNHY-PKV Fri Feb 25 17:00:03 2005t XX
+/*
+ A
+ //
+ TopoDS_Shape aFace2;
+ if ( !isSectionE ) {
+ while (itl.More()) {
+ aFace2 = itl.Value();
+ //
+ TopoDS_Shape anOrigFace2 = aFace2;
+ if (myImagesFaces.IsImage(aFace2)) {
+ anOrigFace2 = myImagesFaces.Root(aFace2);
+ }
+ //
+ if (!MFP.Contains( aFace2 )) {
+ LSF.Remove( itl );
+ continue;
+ }
+ //if (anOrigFace.IsSame( myImagesFaces.Root( aFace2 )))
+ if (anOrigFace.IsSame(anOrigFace2)) {
+ break;
+ }
+ itl.Next();
+ }
+ if (itl.More()) { // aFace2 found, remove it from maps
+ LSF.Remove( itl );
+ MFP.Remove(aFace2);
+ }
+ else{
+ aFace2.Nullify();
+ }
+ itl.Initialize( LSF );
+ }
+ */