0024157: Parallelization of assembly part of BO
[occt.git] / src / BRepOffset / BRepOffset_Tool.cxx
index e41b1f0..6b3b282 100755 (executable)
 
 //tma: for new boolean operation
 #include <TopTools_SequenceOfShape.hxx>
-#include <BOPTools_DSFiller.hxx>
 #include <Geom_BSplineCurve.hxx>
 #include <GeomConvert_CompCurveToBSplineCurve.hxx>
 #include <Geom2dConvert_CompCurveToBSplineCurve.hxx>
 #include <GeomConvert_ApproxCurve.hxx>
 #include <Geom2dConvert_ApproxCurve.hxx>
-//#include <BRepAlgoAPI_Section.hxx>
-#include <BooleanOperations_ShapesDataStructure.hxx>
-#include <BOPTools_InterferencePool.hxx>
-#include <BOPTools_SSInterference.hxx>
-#include <BOPTools_SequenceOfCurves.hxx>
-#include <BOPTools_Curve.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
-#include <BOPTools_PaveBlock.hxx>
-#include <BRepAlgoAPI_Section.hxx>
-#include <BOPTools_SSIntersectionAttribute.hxx>
-#include <BOPTools_PaveFiller.hxx>
-#include <BOPTools_Tools2D.hxx>
-#include <BOPTools_ListIteratorOfListOfPave.hxx>
 #include <TopoDS_Compound.hxx>
 #include <GCPnts_UniformAbscissa.hxx>
 #include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
 #include <ShapeCustom_Curve2d.hxx>
 #include <GeomAPI_ExtremaCurveCurve.hxx>
 
+#include <BOPDS_DS.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+#include <BOPTools_AlgoTools2D.hxx>
 
 #ifdef DRAW
 #include <DBRep.hxx>
@@ -523,6 +511,7 @@ void BRepOffset_Tool::OrientSection (const TopoDS_Edge&  E,
   TopLoc_Location L;
   Standard_Real   f,l;
   
+  
   Handle (Geom_Surface) S1 = BRep_Tool::Surface(F1);
   Handle (Geom_Surface) S2 = BRep_Tool::Surface(F2);    
   Handle (Geom2d_Curve) C1 = BRep_Tool::CurveOnSurface(E,F1,f,l);
@@ -530,8 +519,14 @@ void BRepOffset_Tool::OrientSection (const TopoDS_Edge&  E,
   Handle (Geom_Curve)   C  = BRep_Tool::Curve(E,L,f,l);
 
   BRepAdaptor_Curve BAcurve( E );
-  GCPnts_UniformAbscissa Distribution( BAcurve, 3 );
-  Standard_Real ParOnC = Distribution.Parameter(2); //0.5*(f+l);
+  
+  GCPnts_AbscissaPoint AP(BAcurve,GCPnts_AbscissaPoint::Length(BAcurve)/2.0,f);
+  Standard_Real ParOnC;
+
+  if(AP.IsDone())
+    ParOnC = AP.Parameter();
+  else
+    ParOnC = BOPTools_AlgoTools2D::IntermediatePoint(f, l);
 
   gp_Vec T1 = C->DN(ParOnC,1).Transformed(L.Transformation());
   if (T1.SquareMagnitude() > gp::Resolution()) {
@@ -808,74 +803,67 @@ void BRepOffset_Tool::PipeInter(const TopoDS_Face& F1,
 static Standard_Boolean IsAutonomVertex(const TopoDS_Shape& aVertex,
                                        const TopoDS_Shape& F1,
                                        const TopoDS_Shape& F2,
-                                       const BooleanOperations_ShapesDataStructure& theDS,
-                                       const BOPTools_PaveFiller& thePaveFiller)
+                                        const BOPDS_PDS& pDS)
 {
-  Standard_Integer i, index = theDS.ShapeIndex( aVertex, 1 );
-  if (index == 0)
-    {
-      index = theDS.ShapeIndex( aVertex, 2 );
-      if (index == 0)
-       {
-         for (i = theDS.NumberOfSourceShapes()+1; i <= theDS.NumberOfInsertedShapes(); i++)
-           {
-             const TopoDS_Shape& aShape = theDS.GetShape(i);
-             if (aVertex.IsSame(aShape))
-               {
+  Standard_Integer index, indF1, indF2; 
+  Standard_Integer aNbVVs, aNbEEs, aNbEFs, aInt;
+  //
+  index = pDS->Index(aVertex);
+  if (index == -1) {
+    Standard_Integer i, i1, i2;
+    i1=pDS->NbSourceShapes();
+    i2=pDS->NbShapes();
+    for (i=i1; i<i2; ++i) {
+      const TopoDS_Shape& aSx=pDS->Shape(i);
+      if(aSx.IsSame(aVertex)) {
                  index = i;
                  break;
                }
            }
        }
+  //
+  indF1 = pDS->Index(F1);
+  indF2 = pDS->Index(F2);
+  //
+  if (!pDS->IsNewShape(index)) {
+    return Standard_False;
     }
-  
-  Standard_Integer indF1 = theDS.ShapeIndex( F1, 1 );
-  Standard_Integer indF2 = theDS.ShapeIndex( F2, 2 );
-
-  BooleanOperations_KindOfInterference theTypeInterf;
-  const BOPTools_PavePool& thePavePool = thePaveFiller.PavePool();
-  BOPTools_ListIteratorOfListOfPave itpave;
-  for (i = 1; i <= thePavePool.Length(); i++)
-    {
-      const BOPTools_ListOfPave& aPaveList = thePavePool(i).Set();
-      for (itpave.Initialize( aPaveList ); itpave.More(); itpave.Next())
-       {
-         BOPTools_Pave aPave = itpave.Value();
-         if (aPave.Index() == index)
-           {
-             theTypeInterf = aPave.Type();
-             if (theTypeInterf != BooleanOperations_SurfaceSurface &&
-                 theTypeInterf != BooleanOperations_UnknownInterference)
+  //check if vertex with index "index" is not created in VV or EE or EF interference
+  //VV
+  BOPDS_VectorOfInterfVV& aVVs=pDS->InterfVV();
+  aNbVVs = aVVs.Extent();
+  for(aInt = 0; aInt < aNbVVs; aInt++) {
+    const BOPDS_InterfVV& aVV = aVVs(aInt);
+    if (aVV.HasIndexNew()) {
+      if (aVV.IndexNew() == index) {
                return Standard_False;
            }
        }
     }
-
-  BOPTools_PaveFiller * pPF = (BOPTools_PaveFiller*) &thePaveFiller;
-  BOPTools_PaveFiller& thePF = *pPF;
-  BOPTools_CArray1OfSSInterference& aFFs = thePF.InterfPool()->SSInterferences();
-  Standard_Integer aNbFFs=aFFs.Extent();
-  for (i = 1; i <= aNbFFs; i++)
-    {
-      BOPTools_SSInterference& aFFi = aFFs(i);
-
-      if (aFFi.Index1() == indF1 && aFFi.Index2() == indF2)
-       {
-         const BOPTools_ListOfPave& aPaveList = aFFi.NewPaveSet().Set();
-         for (itpave.Initialize( aPaveList ); itpave.More(); itpave.Next())
-           {
-             BOPTools_Pave aPave = itpave.Value();
-             if (aPave.Index() == index)
-               {
-                 theTypeInterf = aPave.Type();
-                 if (theTypeInterf != BooleanOperations_SurfaceSurface &&
-                     theTypeInterf != BooleanOperations_UnknownInterference)
+  //EE
+  BOPDS_VectorOfInterfEE& aEEs=pDS->InterfEE();
+  aNbEEs = aEEs.Extent();
+  for(aInt = 0; aInt < aNbEEs; aInt++) {
+    const BOPDS_InterfEE& aEE = aEEs(aInt);
+    IntTools_CommonPrt aCP = aEE.CommonPart();
+    if(aCP.Type() == TopAbs_VERTEX) {
+      if (aEE.IndexNew() == index) {
                    return Standard_False;
                }
            }
        }
+  //EF
+  BOPDS_VectorOfInterfEF& aEFs=pDS->InterfEF();
+  aNbEFs = aEFs.Extent();
+  for(aInt = 0; aInt < aNbEFs; aInt++) {
+    const BOPDS_InterfEF& aEF = aEFs(aInt);
+    IntTools_CommonPrt aCP = aEF.CommonPart();
+    if(aCP.Type() == TopAbs_VERTEX) {
+      if (aEF.IndexNew() == index) {
+        return Standard_False;
     }
-
+    }
+  }
   return Standard_True;
 }
 
@@ -889,7 +877,7 @@ static Standard_Boolean AreConnex(const TopoDS_Wire& W1,
                                  const TopoDS_Wire& W2,
                                  const TopoDS_Shape& F1,
                                  const TopoDS_Shape& F2,
-                                 const BOPTools_DSFiller* pDF)
+                                  const BOPDS_PDS& pDS)
 {
   TopoDS_Vertex V11, V12, V21, V22;
   TopExp::Vertices( W1, V11, V12 );
@@ -900,14 +888,14 @@ static Standard_Boolean AreConnex(const TopoDS_Wire& W1,
     {
       Standard_Boolean isCV1 = V11.IsSame(V21) || V11.IsSame(V22);
       Standard_Boolean isCV2 = V12.IsSame(V21) || V12.IsSame(V22);
-      if (isCV1 && !IsAutonomVertex(V11, F1, F2, pDF->DS(), pDF->PaveFiller()))
+      if (isCV1 && !IsAutonomVertex(V11, F1, F2, pDS))
        {
          if (!isCV2)
            return Standard_False;
-         if (!IsAutonomVertex(V12, F1, F2, pDF->DS(), pDF->PaveFiller()))
+          if (!IsAutonomVertex(V12, F1, F2, pDS))
            return Standard_False;
        }
-      if (!isCV1 && !IsAutonomVertex(V12, F1, F2, pDF->DS(), pDF->PaveFiller()))
+      if (!isCV1 && !IsAutonomVertex(V12, F1, F2, pDS))
        return Standard_False;
 
       TopoDS_Vertex CV = (V11.IsSame(V21) || V11.IsSame(V22))? V11 : V12;
@@ -962,8 +950,8 @@ static Standard_Boolean AreClosed(const TopoDS_Edge& E1,
   TopExp::Vertices( E1, V11, V12 );
   TopExp::Vertices( E2, V21, V22 );
 
-  if (V11.IsSame(V21) && V12.IsSame(V22) ||
-      V11.IsSame(V22) && V12.IsSame(V21))
+  if ((V11.IsSame(V21) && V12.IsSame(V22)) ||
+      (V11.IsSame(V22) && V12.IsSame(V21)))
     return Standard_True;
 
   return Standard_False;
@@ -1279,44 +1267,44 @@ static TopoDS_Edge Glue(const TopoDS_Edge& E1,
 //purpose  : 
 //=======================================================================
 
-static void FindNewVerticesOnBoundsOfFace(const BOPTools_DSFiller& pDF,
+static void FindNewVerticesOnBoundsOfFace(const BOPDS_PDS& pDS,
                                          const TopoDS_Face& aFace,
-                                         const Standard_Integer iFace,
                                          TopTools_DataMapOfShapeShape& VEmap)
 {
   TopTools_IndexedMapOfShape OldVertices;
   TopExp::MapShapes( aFace, TopAbs_VERTEX, OldVertices );
-
-  const BOPTools_SplitShapesPool& aPool = pDF.SplitShapesPool();
+  BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
+  TopoDS_Vertex V1, V2;
 
   TopExp_Explorer Explo( aFace, TopAbs_EDGE );
-  for (; Explo.More(); Explo.Next())
-    {
-      TopoDS_Shape anEdge = Explo.Current();
-      Standard_Integer eind = pDF.DS().ShapeIndex(anEdge,iFace);
-      const BOPTools_ListOfPaveBlock& aSplitEdges = aPool( pDF.DS().RefEdge(eind) );
-      BOPTools_ListIteratorOfListOfPaveBlock itpb( aSplitEdges );
-      for (; itpb.More(); itpb.Next())
-       {
-         BOPTools_PaveBlock& aPaveBlock = itpb.Value();
-         TopoDS_Shape aSplit = pDF.DS().GetShape( aPaveBlock.Edge() );
-         TopoDS_Edge aNewEdge = TopoDS::Edge(aSplit);
-         TopoDS_Vertex V1, V2;
-         TopExp::Vertices( aNewEdge, V1, V2 );
-         if (!OldVertices.Contains( V1 ))
-           VEmap.Bind( V1, anEdge );
-         if (!OldVertices.Contains( V2 ))
-           VEmap.Bind( V2, anEdge );
+  for (; Explo.More(); Explo.Next()) {
+    const TopoDS_Shape& aE = Explo.Current();
+    Standard_Integer nE = pDS->Index(aE);
+    //
+    const BOPDS_ListOfPaveBlock& aLPB = pDS->PaveBlocks(nE);
+    aItLPB.Initialize(aLPB);
+    for (; aItLPB.More(); aItLPB.Next()) {
+      const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
+      const TopoDS_Edge& aESp = *(TopoDS_Edge*)&pDS->Shape(aPB->Edge());
+      //
+      TopExp::Vertices( aESp, V1, V2 );
+      if (!OldVertices.Contains( V1 )) {
+        VEmap.Bind( V1, aE );
        }
+      //
+      if (!OldVertices.Contains( V2 )) {
+        VEmap.Bind( V2, aE );
     }
 }
+  }
+}
                                   
 //=======================================================================
 //function : CheckIntersFF
 //purpose  : 
 //=======================================================================
 
-static Standard_Boolean CheckIntersFF(const BOPTools_DSFiller& pDF,
+static Standard_Boolean CheckIntersFF(const BOPDS_PDS& pDS,
                                      const TopoDS_Edge& RefEdge,
                                      const TopoDS_Face& F1,
                                      const TopoDS_Face& F2,
@@ -1347,32 +1335,31 @@ static Standard_Boolean CheckIntersFF(const BOPTools_DSFiller& pDF,
   if (isEl1 && isEl2)
     return Standard_True;
 
-  const BooleanOperations_ShapesDataStructure& aDS = pDF.DS();
-  BOPTools_InterferencePool* anIntrPool = (BOPTools_InterferencePool*)&pDF.InterfPool();
-  BOPTools_CArray1OfSSInterference& aFFs = anIntrPool->SSInterferences();
+  BOPDS_VectorOfInterfFF& aFFs = pDS->InterfFF();
   Standard_Integer aNb = aFFs.Extent();
   Standard_Integer i, j, nbe = 0;
 
   TopTools_SequenceOfShape Edges;
   
-  for (i = 1; i <= aNb; i++)
+  for (i = 0; i < aNb; ++i) 
     {
-      BOPTools_SSInterference& aFFi = aFFs(i);
-      BOPTools_SequenceOfCurves& aBCurves = aFFi.Curves();
-      Standard_Integer aNbCurves = aBCurves.Length();
+      BOPDS_InterfFF& aFFi=aFFs(i);
+      const BOPDS_VectorOfCurve& aBCurves=aFFi.Curves();
+      Standard_Integer aNbCurves = aBCurves.Extent();
       
-      for (j = 1; j <= aNbCurves; j++)
+      for (j = 0; j < aNbCurves; ++j) 
        {
-         BOPTools_Curve& aBC = aBCurves(j);
-         const BOPTools_ListOfPaveBlock& aSectEdges = aBC.NewPaveBlocks();
+          const BOPDS_Curve& aBC=aBCurves(j);
+          const BOPDS_ListOfPaveBlock& aSectEdges = aBC.PaveBlocks();
          
-         BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSectEdges);
+          BOPDS_ListIteratorOfListOfPaveBlock aPBIt;
+          aPBIt.Initialize(aSectEdges);
          
          for (; aPBIt.More(); aPBIt.Next())
            {
-             BOPTools_PaveBlock& aPB=aPBIt.Value();
-             Standard_Integer nSect = aPB.Edge();
-             TopoDS_Edge anEdge = TopoDS::Edge(aDS.Shape(nSect));
+              const Handle(BOPDS_PaveBlock)& aPB = aPBIt.Value();
+              Standard_Integer nSect = aPB->Edge();
+              const TopoDS_Edge& anEdge = *(TopoDS_Edge*)&pDS->Shape(nSect);
              Edges.Append( anEdge );
              nbe++;
            }
@@ -1391,8 +1378,8 @@ static Standard_Boolean CheckIntersFF(const BOPTools_DSFiller& pDF,
   TopoDS_Edge StartEdge; //, StartEonF1, StartEonF2, EndEonF1, EndEonF2;
 
   TopTools_DataMapOfShapeShape VEmapF1, VEmapF2;
-  FindNewVerticesOnBoundsOfFace( pDF, F1, 1, VEmapF1 );
-  FindNewVerticesOnBoundsOfFace( pDF, F2, 2, VEmapF2 );
+  FindNewVerticesOnBoundsOfFace( pDS, F1, VEmapF1 );
+  FindNewVerticesOnBoundsOfFace( pDS, F2, VEmapF2 );
 
   Standard_Real AngTol = 0.1;
   Standard_Boolean V1onBound = Standard_False;
@@ -1430,14 +1417,14 @@ static Standard_Boolean CheckIntersFF(const BOPTools_DSFiller& pDF,
 
   if (V1onBound && V2onBound)
     {
-      if (TangFirst.IsParallel(RefTangFirst,AngTol) && TangLast.IsParallel(RefTangLast,AngTol) ||
-         TangFirst.IsParallel(RefTangLast,AngTol)  && TangLast.IsParallel(RefTangFirst,AngTol))
-       {
-         TrueEdges.Add( Edges(i) );
-         return Standard_True;
-       }
+      if ((TangFirst.IsParallel(RefTangFirst,AngTol) && TangLast.IsParallel(RefTangLast,AngTol)) ||
+          (TangFirst.IsParallel(RefTangLast,AngTol)  && TangLast.IsParallel(RefTangFirst,AngTol)))
+      {
+        TrueEdges.Add( Edges(i) );
+        return Standard_True;
+      }
       else
-       return Standard_False;
+        return Standard_False;
     }
 
   //StartEonF1 = (V1onBound)? VEmapF1( V1 ) : VEmapF1( V2 );
@@ -1517,7 +1504,7 @@ static Standard_Boolean CheckIntersFF(const BOPTools_DSFiller& pDF,
 //purpose  : 
 //=======================================================================
 
-static TopoDS_Edge AssembleEdge(const BOPTools_DSFiller* pDF,
+static TopoDS_Edge AssembleEdge(const BOPDS_PDS& pDS,
                                const TopoDS_Face& F1,
                                const TopoDS_Face& F2,
                                const Standard_Boolean addPCurve1,
@@ -1534,7 +1521,7 @@ static TopoDS_Edge AssembleEdge(const BOPTools_DSFiller* pDF,
        {
          TopoDS_Vertex V1, V2;
          TopExp::Vertices( CurEdge, V1, V2 );
-         if (IsAutonomVertex( V1, F1, F2, pDF->DS(), pDF->PaveFiller() ))
+          if (IsAutonomVertex( V1, F1, F2, pDS ))
            {
              After = Standard_False;
              Vfirst = Vlast = V2;
@@ -1612,50 +1599,58 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
   BRepLib::BuildCurves3d(cpF1);
   BRepLib::BuildCurves3d(cpF2);
  
-  BOPTools_DSFiller pDF1, pDF2;
-  pDF1.SetShapes(cpF1, cpF2);
+  BOPAlgo_PaveFiller aPF1, aPF2;
+  BOPCol_ListOfShape aLS;
+  aLS.Append(cpF1);
+  aLS.Append(cpF2);
+  aPF1.SetArguments(aLS);
+  //
+  aPF1.Perform();
   
-  pDF1.Perform();
+  BOPAlgo_PaveFiller *pPF = &aPF1;
 
-  BOPTools_DSFiller * pDF = &pDF1;
+  aLS.Clear();
   TopTools_IndexedMapOfShape TrueEdges;
-  if (IsRefEdgeDefined && !CheckIntersFF( pDF1, RefEdge, cpF1, cpF2, TrueEdges ))
+  if (IsRefEdgeDefined && !CheckIntersFF( pPF->PDS(), RefEdge, cpF1, cpF2, TrueEdges ))
     {
       cpF1 = F2;
       cpF2 = F1;
-      pDF2.SetShapes(cpF1, cpF2);
-      pDF2.Perform();
-      CheckIntersFF( pDF2, RefEdge, cpF1, cpF2, TrueEdges );
-      pDF = &pDF2;
+      aLS.Append(cpF1);
+      aLS.Append(cpF2);
+      aPF2.SetArguments(aLS);
+      aPF2.Perform();
+      pPF = &aPF2;
+      CheckIntersFF( pPF->PDS(), RefEdge, cpF1, cpF2, TrueEdges );
    }
 
-  Standard_Boolean addPCurve1 = pDF->PaveFiller().SectionAttribute().PCurveOnS1();
-  Standard_Boolean addPCurve2 = pDF->PaveFiller().SectionAttribute().PCurveOnS2();
+  Standard_Boolean addPCurve1 = 1;
+  Standard_Boolean addPCurve2 = 1;
   
-  const BooleanOperations_ShapesDataStructure& aDS = pDF->DS();
-  BOPTools_InterferencePool* anIntrPool = (BOPTools_InterferencePool*)& pDF->InterfPool();
-  BOPTools_CArray1OfSSInterference& aFFs = anIntrPool->SSInterferences();
+  const BOPDS_PDS& pDS = pPF->PDS();
+  BOPDS_VectorOfInterfFF& aFFs=pDS->InterfFF();
   Standard_Integer aNb = aFFs.Extent();
   Standard_Integer i = 0, j = 0, k;
   // Store Result
   L1.Clear(); L2.Clear();
   TopAbs_Orientation O1,O2;
   
-  for (i = 1; i <= aNb; i++) {
-    BOPTools_SSInterference& aFFi = aFFs(i);
-    BOPTools_SequenceOfCurves& aBCurves = aFFi.Curves();
-    Standard_Integer aNbCurves = aBCurves.Length();
+  for (i = 0; i < aNb; i++) {
+    BOPDS_InterfFF& aFFi=aFFs(i);
+    const BOPDS_VectorOfCurve& aBCurves=aFFi.Curves();
         
-    for (j = 1; j <= aNbCurves; j++) {
-      BOPTools_Curve& aBC = aBCurves(j);
-      const BOPTools_ListOfPaveBlock& aSectEdges = aBC.NewPaveBlocks();
+    Standard_Integer aNbCurves = aBCurves.Extent();
+      
+    for (j = 0; j < aNbCurves; j++) {
+      const BOPDS_Curve& aBC=aBCurves(j);
+      const BOPDS_ListOfPaveBlock& aSectEdges = aBC.PaveBlocks();
       
-      BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSectEdges);
+      BOPDS_ListIteratorOfListOfPaveBlock aPBIt;
+      aPBIt.Initialize(aSectEdges);
       
       for (; aPBIt.More(); aPBIt.Next()) {
-       BOPTools_PaveBlock& aPB=aPBIt.Value();
-       Standard_Integer nSect = aPB.Edge();
-        TopoDS_Edge anEdge = TopoDS::Edge(aDS.Shape(nSect));
+        const Handle(BOPDS_PaveBlock)& aPB = aPBIt.Value();
+        Standard_Integer nSect = aPB->Edge();
+        const TopoDS_Edge& anEdge = *(TopoDS_Edge*)&pDS->Shape(nSect);
        if (!TrueEdges.IsEmpty() && !TrueEdges.Contains(anEdge))
          continue;
         
@@ -1669,32 +1664,32 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
         BRep_Builder aBB;
        Standard_Real aTolEdge = BRep_Tool::Tolerance(anEdge);
                
-        if (!BOPTools_Tools2D::HasCurveOnSurface(anEdge, cpF1)) {
+        if (!BOPTools_AlgoTools2D::HasCurveOnSurface(anEdge, cpF1)) {
           Handle(Geom2d_Curve) aC2d = aBC.Curve().FirstCurve2d();
           if(!aC3DETrim.IsNull()) {
                Handle(Geom2d_Curve) aC2dNew;
                
                if(aC3DE->IsPeriodic()) {
-                 BOPTools_Tools2D::AdjustPCurveOnFace(cpF1, f, l,  aC2d, aC2dNew);
+                  BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF1, f, l,  aC2d, aC2dNew);
                  }
                else {
-                 BOPTools_Tools2D::AdjustPCurveOnFace(cpF1, aC3DETrim, aC2d, aC2dNew); 
+                  BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF1, aC3DETrim, aC2d, aC2dNew); 
                  }
                aC2d = aC2dNew;
              }
              aBB.UpdateEdge(anEdge, aC2d, cpF1, aTolEdge);
         }
         
-        if (!BOPTools_Tools2D::HasCurveOnSurface(anEdge, cpF2)) {
+        if (!BOPTools_AlgoTools2D::HasCurveOnSurface(anEdge, cpF2)) {
           Handle(Geom2d_Curve) aC2d = aBC.Curve().SecondCurve2d();
           if(!aC3DETrim.IsNull()) {
                Handle(Geom2d_Curve) aC2dNew;
                
                if(aC3DE->IsPeriodic()) {
-                 BOPTools_Tools2D::AdjustPCurveOnFace(cpF2, f, l,  aC2d, aC2dNew);
+                  BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF2, f, l,  aC2d, aC2dNew);
                  }
                else {
-                 BOPTools_Tools2D::AdjustPCurveOnFace(cpF2, aC3DETrim, aC2d, aC2dNew); 
+                  BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF2, aC3DETrim, aC2d, aC2dNew); 
                  }
                aC2d = aC2dNew;
              }
@@ -1750,12 +1745,11 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
        for (i = TrueEdges.Extent(); i >= 1; i--)
          EdgesForConcat.Append( TrueEdges(i) );
        TopoDS_Edge theEdge =
-         AssembleEdge( pDF, cpF1, cpF2, addPCurve1, addPCurve2, EdgesForConcat );
+          AssembleEdge( pDS, cpF1, cpF2, addPCurve1, addPCurve2, EdgesForConcat );
        eseq.Append(theEdge);
       }
     else
       {
-       const BOPTools_PaveFiller& thePaveFiller = pDF->PaveFiller();
        
        TopTools_SequenceOfShape wseq;
        TopTools_SequenceOfShape edges;
@@ -1770,7 +1764,7 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
            for (k = 1; k <= wseq.Length(); k++)
              {
                resWire = TopoDS::Wire(wseq(k));
-               if (AreConnex( resWire, aWire, cpF1, cpF2, pDF ))
+                if (AreConnex( resWire, aWire, cpF1, cpF2, pDS ))
                  {
                    Candidates.Append( 1 );
                    break;
@@ -1789,7 +1783,7 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
                    //if (anEdge.IsSame(edges(Candidates.First())))
                    //continue;
                    aWire = BRepLib_MakeWire( anEdge );
-                   if (AreConnex( resWire, aWire, cpF1, cpF2, pDF ))
+                    if (AreConnex( resWire, aWire, cpF1, cpF2, pDS ))
                      Candidates.Append( j );
                  }
                Standard_Integer minind = 1;
@@ -1834,13 +1828,13 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
                      {
                        TopoDS_Vertex V1, V2;
                        TopExp::Vertices( anEdge, V1, V2 );
-                       if (!IsAutonomVertex( V1, cpF1, cpF2, aDS, thePaveFiller ))
+                        if (!IsAutonomVertex( V1, cpF1, cpF2, pDS ))
                          {
                            StartVertex = V2;
                            StartEdge = anEdge;
                            StartFound = Standard_True;
                          }
-                       else if (!IsAutonomVertex( V2, cpF1, cpF2, aDS, thePaveFiller ))
+                        else if (!IsAutonomVertex( V2, cpF1, cpF2, pDS ))
                          {
                            StartVertex = V1;
                            StartEdge = anEdge;
@@ -1892,7 +1886,7 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
              }
            
            TopoDS_Edge theEdge =
-             AssembleEdge( pDF, cpF1, cpF2, addPCurve1, addPCurve2, EdgesForConcat );
+              AssembleEdge( pDS, cpF1, cpF2, addPCurve1, addPCurve2, EdgesForConcat );
            eseq.Append( theEdge );
          }
       } //end of else (when TrueEdges is empty)
@@ -2530,8 +2524,8 @@ void BRepOffset_Tool::Inter2d (const TopoDS_Face&    F,
 //purpose  : 
 //=======================================================================
 
-static void SelectEdge (const TopoDS_Face& F,
-                       const TopoDS_Face& EF,
+static void SelectEdge (const TopoDS_Face& /*F*/,
+                       const TopoDS_Face& /*EF*/,
                        const TopoDS_Edge& E,
                        TopTools_ListOfShape& LInt)
 {