From d23d81a1104d75ec874cef38661c3cc776d48239 Mon Sep 17 00:00:00 2001
From: nbv <nbv@opencascade.com>
Date: Fri, 29 Sep 2017 16:22:44 +0300
Subject: [PATCH 2/3] 0029203: Ambiguous behavior of Point-Face-classification
 algorithms: shall it return ON-status?

Correction of algorithm for check ON-status.

Now it uses native tolerance of edge (not external input tolerance).

Check, whether the classified point matches some vertex shall be added.
---
 src/AIS/AIS.cxx                                    |   2 +-
 src/AIS/AIS_LengthDimension.cxx                    |   2 +-
 src/BOPAlgo/BOPAlgo_BuilderFace.cxx                |   2 +-
 src/BOPTest/BOPTest_LowCommands.cxx                |  37 +-
 src/BOPTest/BOPTest_TolerCommands.cxx              |  42 +--
 src/BOPTools/BOPTools_AlgoTools2D.cxx              |   4 +-
 src/BRepAlgo/BRepAlgo_FaceRestrictor.cxx           |   4 +-
 src/BRepAlgo/BRepAlgo_NormalProjection.cxx         |   6 +-
 src/BRepBndLib/BRepBndLib.cxx                      |   2 +-
 src/BRepCheck/BRepCheck_Face.cxx                   |   2 +-
 src/BRepClass/BRepClass_FaceClassifier.cxx         | 372 ++++++++-------------
 src/BRepClass/BRepClass_FaceClassifier.hxx         |  13 +-
 src/BRepClass/BRepClass_Intersector.cxx            |  69 +++-
 src/BRepClass/BRepClass_Intersector.hxx            |   2 +-
 src/BRepClass3d/BRepClass3d_Intersector3d.cxx      |   2 +-
 src/BRepClass3d/BRepClass3d_SolidExplorer.cxx      |   6 +-
 src/BRepExtrema/BRepExtrema_DistanceSS.cxx         |  27 +-
 src/BRepExtrema/BRepExtrema_ExtCF.cxx              |   3 +-
 src/BRepExtrema/BRepExtrema_ExtFF.cxx              |   7 +-
 src/BRepExtrema/BRepExtrema_ExtPF.cxx              |   3 +-
 src/BRepFeat/BRepFeat.cxx                          |   2 +-
 src/BRepFeat/BRepFeat_MakeRevolutionForm.cxx       |   2 +-
 src/BRepFeat/BRepFeat_RibSlot.cxx                  |   6 +-
 src/BRepLib/BRepLib.cxx                            |  34 +-
 src/BRepLib/BRepLib_FindSurface.cxx                |   2 +-
 src/BRepLib/BRepLib_MakeFace.cxx                   |   2 +-
 src/BRepOffset/BRepOffset_MakeOffset.cxx           |   2 +-
 src/BRepOffset/BRepOffset_Tool.cxx                 |   3 +-
 src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx     |   2 +-
 src/BRepTopAdaptor/BRepTopAdaptor_FClass2d.cxx     |  37 +-
 src/BRepTopAdaptor/BRepTopAdaptor_FClass2d.hxx     |  11 +-
 src/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx    |   6 +-
 src/BRepTopAdaptor/BRepTopAdaptor_TopolTool.hxx    |   3 +-
 src/DsgPrs/DsgPrs_ShapeDirPresentation.cxx         |   2 +-
 src/Geom2dHatch/Geom2dHatch_Intersector.hxx        |   4 +-
 src/GeomliteTest/GeomliteTest_API2dCommands.cxx    |  28 +-
 src/IntImpParGen/IntImpParGen.cxx                  |  24 +-
 src/IntTools/IntTools_Context.cxx                  |   3 +-
 src/IntTools/IntTools_Tools.cxx                    |  11 +-
 src/LocOpe/LocOpe_SplitShape.cxx                   |   6 +-
 src/LocOpe/LocOpe_WiresOnShape.cxx                 |   2 +-
 src/SWDRAW/SWDRAW_ShapeAnalysis.cxx                |   3 +-
 src/SWDRAW/SWDRAW_ShapeFix.cxx                     |   2 +-
 src/ShapeAnalysis/ShapeAnalysis.cxx                |   3 +-
 src/ShapeFix/ShapeFix_ComposeShell.cxx             |   4 +-
 src/ShapeFix/ShapeFix_Face.cxx                     |   6 +-
 src/TNaming/TNaming.cxx                            |   3 +-
 src/TopClass/TopClass_Classifier2d.gxx             |  76 ++---
 .../TopOpeBRep_VPointInterClassifier.cxx           |  10 +-
 src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1.cxx   |   2 +-
 .../TopOpeBRepBuild_CorrectFace2d.cxx              |   2 +-
 src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.cxx      |   2 +-
 .../TopOpeBRepBuild_WireEdgeClassifier.cxx         |   3 +-
 src/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx      |   3 +-
 src/TopOpeBRepTool/TopOpeBRepTool_CLASSI.cxx       |   4 +-
 .../TopOpeBRepTool_ShapeClassifier.cxx             |   3 +-
 src/TopOpeBRepTool/TopOpeBRepTool_face.cxx         |   2 +-
 tests/bugs/modalg_6/bug27341_206                   |  32 ++
 tests/lowalgos/classifier/bug23849_2               |  21 +-
 tests/lowalgos/classifier/bug29203_1               |   2 +-
 tests/lowalgos/classifier/bug29203_2               |   3 +-
 tests/lowalgos/classifier/bug538                   |   8 +-
 62 files changed, 478 insertions(+), 515 deletions(-)

diff --git a/src/AIS/AIS.cxx b/src/AIS/AIS.cxx
index 95203a1..b1cc36d 100644
--- a/src/AIS/AIS.cxx
+++ b/src/AIS/AIS.cxx
@@ -1219,7 +1219,7 @@ void AIS::InitLengthBetweenCurvilinearFaces (const TopoDS_Face&    theFirstFace,
     aProjector.Parameters (aBestPointIndex, aPU, aPV);
 
     // Now there is projection of FirstAttach onto SecondSurf in aProjector
-    BRepTopAdaptor_FClass2d aClassifier (theSecondFace, Precision::Confusion());
+    BRepTopAdaptor_FClass2d aClassifier (theSecondFace);
 
     TopAbs_State aState = aClassifier.Perform (gp_Pnt2d (aPU, aPV), Standard_True);
 
diff --git a/src/AIS/AIS_LengthDimension.cxx b/src/AIS/AIS_LengthDimension.cxx
index 6b91988..0e797e9 100755
--- a/src/AIS/AIS_LengthDimension.cxx
+++ b/src/AIS/AIS_LengthDimension.cxx
@@ -590,7 +590,7 @@ Standard_Boolean AIS_LengthDimension::InitTwoShapesPoints (const TopoDS_Shape& t
           Standard_Real anU, aV;
           ElSLib::Parameters (aSecondPlane, mySecondPoint, anU, aV);
 
-          BRepTopAdaptor_FClass2d aClassifier (aSecondFace, Precision::Confusion());
+          BRepTopAdaptor_FClass2d aClassifier (aSecondFace);
           TopAbs_State aState = aClassifier.Perform (gp_Pnt2d (anU, aV), Standard_False);
 
           if (aState == TopAbs_OUT || aState == TopAbs_UNKNOWN)
diff --git a/src/BOPAlgo/BOPAlgo_BuilderFace.cxx b/src/BOPAlgo/BOPAlgo_BuilderFace.cxx
index 570636a..7d45e31 100644
--- a/src/BOPAlgo/BOPAlgo_BuilderFace.cxx
+++ b/src/BOPAlgo/BOPAlgo_BuilderFace.cxx
@@ -567,7 +567,7 @@ void BOPAlgo_BuilderFace::PerformAreas()
       }
 
       // update classifier
-      myContext->FClass2d(aFace).Init(aFace, aTol);
+      myContext->FClass2d(aFace).Init(aFace);
     }
 
     // The face is just a draft that does not contain any internal shapes
diff --git a/src/BOPTest/BOPTest_LowCommands.cxx b/src/BOPTest/BOPTest_LowCommands.cxx
index f682861..03ce4d3 100644
--- a/src/BOPTest/BOPTest_LowCommands.cxx
+++ b/src/BOPTest/BOPTest_LowCommands.cxx
@@ -74,9 +74,7 @@ static  Standard_Integer polyclassify( Draw_Interpretor&, Standard_Integer, cons
   const char* g = "BOPTest commands";
   theCommands.Add("bclassify"    , "use bclassify Solid Point [Tolerance=1.e-7]",
                   __FILE__, bclassify   , g);
-  theCommands.Add("b2dclassify", "use b2dclassify Face Point2d "
-                  "[-t Tol3D = <FaceToler>] :\n "
-                  "Tol3D is 3D-tolerance used for check ON-status.",
+  theCommands.Add("b2dclassify", "use b2dclassify Face Point2d \n "
                   __FILE__, b2dclassify , g);
   theCommands.Add("b2dclassifx"  , "use b2dclassifx Face Point2d "
                   "[-t Tol3D = <FaceToler>] [-na] :\n "
@@ -106,9 +104,8 @@ Standard_Integer b2dclassifx (Draw_Interpretor& theDI,
                               const char**      theArgVec)
 {
   if (theArgNb < 3)  {
-    theDI << "Use b2dclassifx Face Point2d [-t Tol3D = <FaceToler>] [-na]:\n";
-    theDI << "Tol3D is 3D-tolerance used for check ON-status;\n"
-             "The option \"-na\" disables adjustment of 2d point in "
+    theDI << "Use b2dclassifx Face Point2d [-na]:\n";
+    theDI << "The option \"-na\" disables adjustment of 2d point in "
              "the domain of periodic face.\n";
     return 1;
   }
@@ -128,7 +125,6 @@ Standard_Integer b2dclassifx (Draw_Interpretor& theDI,
   DrawTrSurf::GetPoint2d (theArgVec[2], aP);
   const TopoDS_Face&  aF   = TopoDS::Face(aS);
   
-  Standard_Real aTol3D = BRep_Tool::Tolerance(aF);
   Standard_Boolean isReqToAdjust = Standard_True;
 
   for (Standard_Integer aCurrArg = 3; aCurrArg < theArgNb; aCurrArg++)
@@ -138,9 +134,6 @@ Standard_Integer b2dclassifx (Draw_Interpretor& theDI,
 
     switch (theArgVec[aCurrArg][1])
     {
-    case 't' :
-      aTol3D = Draw::Atof(theArgVec[++aCurrArg]);
-      break;
     case 'n' :
       if(!strncmp(theArgVec[aCurrArg], "-na", 3))
         isReqToAdjust = Standard_False;
@@ -150,7 +143,7 @@ Standard_Integer b2dclassifx (Draw_Interpretor& theDI,
     }
   }
 
-  BRepTopAdaptor_FClass2d aClassifier(aF, aTol3D);
+  BRepTopAdaptor_FClass2d aClassifier(aF);
   const TopAbs_State aState = aClassifier.Perform(aP, isReqToAdjust);
   PrintState (theDI, aState);
   //
@@ -166,7 +159,7 @@ Standard_Integer b2dclassify (Draw_Interpretor& theDI,
                               const char**      theArgVec)
 {
   if (theArgNb < 3)  {
-    theDI << " use b2dclassify Face Point2d [-t Tol3D = <FaceToler>]\n";
+    theDI << " use b2dclassify Face Point2d\n";
     return 1;
   }
 
@@ -184,13 +177,14 @@ Standard_Integer b2dclassify (Draw_Interpretor& theDI,
   //
   DrawTrSurf::GetPoint2d (theArgVec[2], aP);
   const TopoDS_Face&  aF   = TopoDS::Face(aS);
-  Standard_Real aTol3D = BRep_Tool::Tolerance(aF);
 
   if ((theArgNb > 3) && (theArgVec[3][0] == '-') && (theArgVec[3][1] == 't'))
-    aTol3D = Draw::Atof(theArgVec[4]);
+  {
+    theDI << "ERROR!!! Wrong option \"-t\".\n";
+  }
 
   BRepClass_FaceClassifier aClassifier;
-  aClassifier.Perform(aF, aP, aTol3D);
+  aClassifier.Perform(aF, aP);
   PrintState (theDI, aClassifier.State());
   //
   return 0;
@@ -206,22 +200,13 @@ Standard_Integer IsHole(Draw_Interpretor& theDI,
 {
   if (theArgNb < 2)
   {
-    theDI << "Use: ishole face [-t Tol3D = <FaceToler>]\n";
+    theDI << "Use: ishole face \n";
     return 1;
   }
 
   TopoDS_Face aF = TopoDS::Face(DBRep::Get(theArgVec[1]));
 
-  Standard_Real aTol = BRep_Tool::Tolerance(aF);
-  for (Standard_Integer i = 2; i < theArgNb; i++)
-  {
-    if ((theArgVec[i][0] == '-') && (theArgVec[i][1] == 't'))
-    {
-      aTol = Draw::Atof(theArgVec[++i]);
-    }
-  }
-
-  BRepTopAdaptor_FClass2d aClassifier(aF, aTol);
+  BRepTopAdaptor_FClass2d aClassifier(aF);
   if (aClassifier.PerformInfinitePoint() == TopAbs_IN)
   {
     theDI << "The face is hole\n";
diff --git a/src/BOPTest/BOPTest_TolerCommands.cxx b/src/BOPTest/BOPTest_TolerCommands.cxx
index c8ac62d..5fac900 100644
--- a/src/BOPTest/BOPTest_TolerCommands.cxx
+++ b/src/BOPTest/BOPTest_TolerCommands.cxx
@@ -27,6 +27,7 @@
 #include <Draw.hxx>
 #include <Geom2d_Curve.hxx>
 #include <Geom_Curve.hxx>
+#include <GeomLib_CheckCurveOnSurface.hxx>
 #include <Geom_Surface.hxx>
 #include <gp_Pnt2d.hxx>
 #include <TCollection_AsciiString.hxx>
@@ -210,12 +211,8 @@ void ReduceVertexTolerance (const TopoDS_Shape& aS)
 //=======================================================================
 void ProcessEdge(const TopoDS_Edge& aE, const Standard_Real aTolTreshold)
 {
-  Standard_Integer i, aNb=23;
-  Standard_Real aD2, aTolMax2, aT1, aT2, aT, dT;
-  gp_Pnt aPC3D, aP3D;
-  gp_Pnt2d aPC2D;
+  Standard_Real aT1, aT2;
 
-  //TopTools_ListIteratorOfListOfShape anIt;// Wng in Gcc 3.0
   BRep_ListIteratorOfListOfCurveRepresentation itcr;
   //
   Handle(Geom_Curve) aC3D=BRep_Tool::Curve(aE, aT1, aT2);
@@ -223,12 +220,10 @@ void ProcessEdge(const TopoDS_Edge& aE, const Standard_Real aTolTreshold)
     return;
   }
   //
-  dT=(aT2-aT1)/aNb;
-  //
   Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&aE.TShape());
   const TopLoc_Location& Eloc = aE.Location();
   //
-  aTolMax2=-1.e6;
+  Standard_Real aTolMax2=-1.e6;
   const BRep_ListOfCurveRepresentation& aLCR=TE->Curves();
   //
   itcr.Initialize(aLCR);
@@ -250,22 +245,13 @@ void ProcessEdge(const TopoDS_Edge& aE, const Standard_Real aTolTreshold)
       }
       // Surface
       const Handle(Geom_Surface)& aS=cr->Surface();
-      //
-      // 2D-point treatment
-      for (i=0; i<=aNb; ++i) {
-        aT=aT1+i*dT;
-        if (i==aNb) {
-          aT=aT2;
-        }
-        aPC3D=aC3D->Value(aT);
-        aPC2D=aC2D->Value(aT);
-        aS->D0(aPC2D.X(), aPC2D.Y(), aP3D);
-        aP3D.Transform(L.Transformation());
-        aD2=aPC3D.SquareDistance(aP3D);
-        if (aD2 > aTolMax2) {
-          aTolMax2=aD2;
-        }
-      }
+
+      GeomLib_CheckCurveOnSurface aGLCOS(aC3D, aS, aT1, aT2);
+      aGLCOS.Perform(aC2D);
+      if (aGLCOS.IsDone())
+        continue;
+
+      aTolMax2 = aGLCOS.MaxDistance();
     } //if (cr->IsCurveOnSurface())
   }//for (; itcr.More(); itcr.Next())
 
@@ -274,10 +260,12 @@ void ProcessEdge(const TopoDS_Edge& aE, const Standard_Real aTolTreshold)
   if (aTolMax2<0.){
     return;
   }
-  //
-  //
-  aTolMax2=sqrt(aTolMax2); 
   
+  // The same constant as in 
+  // the function defining
+  // "checkcurveonsurf" DRAW-command
+  aTolMax2 *= 1.001;
+
   //printf(" aTolMax=%15.10lf, aTolWas=%15.10lf\n", aTolMax2, aTolE);
 
   Standard_Real aTolSet;
diff --git a/src/BOPTools/BOPTools_AlgoTools2D.cxx b/src/BOPTools/BOPTools_AlgoTools2D.cxx
index babb563..22d0095 100644
--- a/src/BOPTools/BOPTools_AlgoTools2D.cxx
+++ b/src/BOPTools/BOPTools_AlgoTools2D.cxx
@@ -390,7 +390,7 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
         if ((u > (UMin + aDelta + aUPeriod)) ||
             (u < (UMax - aDelta - aUPeriod))) {
           BRepClass_FaceClassifier aClassifier;
-          aClassifier.Perform(aF, gp_Pnt2d(u, v), BRep_Tool::Tolerance(aF));
+          aClassifier.Perform(aF, gp_Pnt2d(u, v));
           TopAbs_State Status = aClassifier.State();
           if (Status == TopAbs_OUT) {
             du += (u > (UMin + aDelta + aUPeriod)) ? -aUPeriod : aUPeriod;
@@ -406,7 +406,7 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
         if ((v > (VMin + aDelta + aVPeriod)) ||
             (v < (VMax - aDelta - aVPeriod))) {
           BRepClass_FaceClassifier aClassifier;
-          aClassifier.Perform(aF, gp_Pnt2d(u, v), BRep_Tool::Tolerance(aF));
+          aClassifier.Perform(aF, gp_Pnt2d(u, v));
           TopAbs_State Status = aClassifier.State();
           if (Status == TopAbs_OUT) {
             dv += (v > (VMin + aDelta + aVPeriod)) ? -aVPeriod : aVPeriod;
diff --git a/src/BRepAlgo/BRepAlgo_FaceRestrictor.cxx b/src/BRepAlgo/BRepAlgo_FaceRestrictor.cxx
index a89605f..5210f15 100644
--- a/src/BRepAlgo/BRepAlgo_FaceRestrictor.cxx
+++ b/src/BRepAlgo/BRepAlgo_FaceRestrictor.cxx
@@ -276,7 +276,7 @@ static Standard_Boolean IsInside(const TopoDS_Wire&       wir,
     }
 
     gp_Pnt2d pt2d(C2d->Value(prm));
-    BRepTopAdaptor_FClass2d FClass2d(F,Precision::Confusion());
+    BRepTopAdaptor_FClass2d FClass2d(F);
     TopAbs_State st2=FClass2d.Perform(pt2d,Standard_False);
     return(st2 == TopAbs_IN);
   }
@@ -392,7 +392,7 @@ void BRepAlgo_FaceRestrictor::PerformWithCorrection()
     B.Add(NF,W);
     
     if (IsClosed(W)) {  
-      BRepTopAdaptor_FClass2d FClass2d(NF,Precision::Confusion());
+      BRepTopAdaptor_FClass2d FClass2d(NF);
       if(FClass2d.PerformInfinitePoint() != TopAbs_OUT) { 
         W.Reverse();
       }
diff --git a/src/BRepAlgo/BRepAlgo_NormalProjection.cxx b/src/BRepAlgo/BRepAlgo_NormalProjection.cxx
index af045b2..d9c75b5 100644
--- a/src/BRepAlgo/BRepAlgo_NormalProjection.cxx
+++ b/src/BRepAlgo/BRepAlgo_NormalProjection.cxx
@@ -495,8 +495,7 @@ void BRepAlgo_NormalProjection::SetDefaultParams()
               }
               else {
                 // if the common operation has failed, try to classify the part
-                 BRepTopAdaptor_FClass2d classifier(TopoDS::Face(Faces->Value(j)),
-                                                    Precision::Confusion());
+                 BRepTopAdaptor_FClass2d classifier(TopoDS::Face(Faces->Value(j)));
 	         gp_Pnt2d Puv;
 	         Standard_Real f = PCur2d->FirstParameter();
 	         Standard_Real l = PCur2d->LastParameter();
@@ -517,8 +516,7 @@ void BRepAlgo_NormalProjection::SetDefaultParams()
                  cout << " BooleanOperations : no solution " << endl;
 #endif
 
-              BRepTopAdaptor_FClass2d classifier(TopoDS::Face(Faces->Value(j)),
-                                                 Precision::Confusion());
+              BRepTopAdaptor_FClass2d classifier(TopoDS::Face(Faces->Value(j)));
 	      gp_Pnt2d Puv;
 	      Standard_Real f = PCur2d->FirstParameter();
 	      Standard_Real l = PCur2d->LastParameter();
diff --git a/src/BRepBndLib/BRepBndLib.cxx b/src/BRepBndLib/BRepBndLib.cxx
index 871a54b..f50990a 100644
--- a/src/BRepBndLib/BRepBndLib.cxx
+++ b/src/BRepBndLib/BRepBndLib.cxx
@@ -701,7 +701,7 @@ void AdjustFaceBox(const BRepAdaptor_Surface& BS,
   FaceBox.Get(fxmin, fymin, fzmin, fxmax, fymax, fzmax);
   EdgeBox.Get(exmin, eymin, ezmin, exmax, eymax, ezmax);
   //
-  BRepTopAdaptor_FClass2d FClass(BS.Face(), Tol);
+  BRepTopAdaptor_FClass2d FClass(BS.Face());
   const Standard_Real TolU = Max(BS.UResolution(Tol), Precision::PConfusion());
   const Standard_Real TolV = Max(BS.VResolution(Tol), Precision::PConfusion());
   //
diff --git a/src/BRepCheck/BRepCheck_Face.cxx b/src/BRepCheck/BRepCheck_Face.cxx
index 3b53dc1..da83b2c 100644
--- a/src/BRepCheck/BRepCheck_Face.cxx
+++ b/src/BRepCheck/BRepCheck_Face.cxx
@@ -323,7 +323,7 @@ BRepCheck_Status BRepCheck_Face::ClassifyWires(const Standard_Boolean Update)
     newFace.Orientation(TopAbs_FORWARD);
     B.Add(newFace,wir1);
 
-    BRepTopAdaptor_FClass2d FClass2d(newFace,Precision::Confusion());
+    BRepTopAdaptor_FClass2d FClass2d(newFace);
     Standard_Boolean WireBienOriente = Standard_False;
     TopAbs_State aState = FClass2d.PerformInfinitePoint();
     if (aState == TopAbs_UNKNOWN) {
diff --git a/src/BRepClass/BRepClass_FaceClassifier.cxx b/src/BRepClass/BRepClass_FaceClassifier.cxx
index f95a945..faa3d49 100644
--- a/src/BRepClass/BRepClass_FaceClassifier.cxx
+++ b/src/BRepClass/BRepClass_FaceClassifier.cxx
@@ -29,7 +29,6 @@
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
 
-#if 0
 Standard_Boolean Check2D(const TopoDS_Edge &theTopE,
                          const TopoDS_Face &theTopF,
                          const Standard_Real theCurvParam,
@@ -41,14 +40,7 @@ Standard_Boolean Check2D(const TopoDS_Vertex &theTopV,
                          const TopoDS_Face &theTopF,
                          const gp_Pnt2d& thePRef,
                          const Standard_Real theTol3D);
-#else
-Standard_Boolean Check2D(const TopClass_GeomEdge& theGE,
-                         const Standard_Real theCurvParam,
-                         const gp_Pnt2d& thePRef,
-                         const Standard_Real theTol3D,
-                         gp_Pnt2d& thePOnC);
 
-#endif
 //=======================================================================
 //function : BRepClass_FaceClassifier
 //purpose  : 
@@ -62,7 +54,7 @@ BRepClass_FaceClassifier::BRepClass_FaceClassifier():myFEx(TopoDS_Face())
 //purpose  : 
 //=======================================================================
 BRepClass_FaceClassifier::BRepClass_FaceClassifier(const TopoDS_Face& theF, 
-                                                   const gp_Pnt& theP, 
+                                                   const gp_Pnt& theP,
                                                    const Standard_Real theTol3D)
 : myFEx(theF)
 {
@@ -74,10 +66,9 @@ BRepClass_FaceClassifier::BRepClass_FaceClassifier(const TopoDS_Face& theF,
 //=======================================================================
 BRepClass_FaceClassifier::
             BRepClass_FaceClassifier(const TopoDS_Face& theF, 
-                                     const gp_Pnt2d& theP,
-                                     const Standard_Real theTol3D) : myFEx(theF)
+                                     const gp_Pnt2d& theP) : myFEx(theF)
 {
-  Perform(theF, theP, theTol3D);
+  Perform(theF, theP);
 }
 
 //=======================================================================
@@ -85,166 +76,52 @@ BRepClass_FaceClassifier::
 //purpose  : 
 //=======================================================================
 void  BRepClass_FaceClassifier::Perform(const TopoDS_Face& theF, 
-                                        const gp_Pnt2d& theP, 
+                                        const gp_Pnt2d& theP,
                                         const Standard_Real theTol3D)
 {
   // First, let's check of ON-status
   
-#if 0
-  // Indeed, this code is more optimal than existing.
-  // However, it cannot be implemented until the bug #29288
-  // will be fixed.
-
-  const Standard_Real aSqTol = theTol3D*theTol3D;
-  const BRepAdaptor_Surface anAS(theF, Standard_False);
-  const gp_Pnt aPt(anAS.Value(theP.X(), theP.Y()));
-  TopoDS_Vertex aVert;
-  BRep_Builder aBB;
-  aBB.MakeVertex(aVert, aPt, Precision::Confusion());
-  TopoDS_Iterator aWirExp(theF);
-  for(; aWirExp.More(); aWirExp.Next())
   {
-    // aWir is a wire
-    const TopoDS_Shape& aWir = aWirExp.Value();
-    BRepExtrema_DistShapeShape anExtr(aWir, aVert);
-    if(!anExtr.IsDone() || (anExtr.NbSolution() < 1))
+    // Case of "ON": direct check of belonging to edge
+    // taking into account the tolerance.
+
+    //ON-status is checked in 3D-space.
+
+    const BRepAdaptor_Surface anAS(theF, Standard_False);
+    const gp_Pnt aPt(anAS.Value(theP.X(), theP.Y()));
+    TopoDS_Vertex aVert;
+    BRep_Builder aBB;
+    aBB.MakeVertex(aVert, aPt, Precision::Confusion());
+    TopoDS_Iterator aWirExp(theF);
+    for (; aWirExp.More(); aWirExp.Next())
     {
-      continue;
-    }
-
-    if(anExtr.Value() > theTol3D)
-    {
-      continue;
-    }
-
-    // It is necessary for periodic and quasi-periodic (e.g. sphere)
-    // surfaces (tests bug28211_18, bug28211_32, bug28211_33 and
-    // bug28211_35 in "tests/lowalgos/classifier/").
-    // E.g. if 2D-distance between theP and the p-curve of some edge
-    // is equal to T (the surface period) then 3D-point
-    // corresponding to theP can be exactly in the edge.
-    // So, 3D-distance is less than theTol3D however,
-    // returning ON-status is wrong in this case.
-    // Therefore, check in 2D-space is executed.
-    
-    // ATTENTION!!!
-    // This check will be wrong if theTol3D covers the 2D-distance
-    // of the surface. I.e. if two 3D-points of any cylinder (for example)
-    // having 2D-coordinates (0, 0) and (PI, 0) can
-    // be considered as same with precision theTol3D.
-    // But for periodic surfaces, Check2D(...) method
-    // can return FALSE even if theTol3D is big
-    // (because this check is based on period value
-    // instead of tolerance).
-
-    for(Standard_Integer i = 1; i <= anExtr.NbSolution(); i++)
-    {
-      if(anExtr.PointOnShape1(i).SquareDistance(aPt) > aSqTol)
-        continue;
-
-      switch(anExtr.SupportTypeShape1(i))
+      // aWir is a wire
+      const TopoDS_Shape& aWir = aWirExp.Value();
+      const Standard_Real anExtTol = (theTol3D<0.0) ? BRep_Tool::MaxTolerance(aWir, TopAbs_EDGE) : theTol3D;
+
+      // Using of BRepExtrema_DistShapeShape can give wrong result in case
+      // when the nearest edge has small tolerance and is quite big
+      // from the classified point but furthest edge has big tolerance
+      // and (therefore) contains the classified point.
+      // Moreover, it requires bug #29288 to be fixed.
+
+      BRepExtrema_DistShapeShape anExtr(aWir, aVert);
+      if (!anExtr.IsDone() || (anExtr.NbSolution() < 1))
       {
-        case BRepExtrema_IsVertex:
-        {
-          const TopoDS_Shape aSh = anExtr.SupportOnShape1(i);
-          if(Check2D(TopoDS::Vertex(aSh), theF, theP, theTol3D))
-          {
-            myState = TopAbs_ON;
-            TopTools_IndexedDataMapOfShapeListOfShape aM;
-            TopExp::MapShapesAndAncestors(theF, TopAbs_VERTEX, TopAbs_EDGE, aM);
-            const TopoDS_Shape &anE = aM.FindFromKey(aSh).First();
-            myEdgeParameter = BRep_Tool::Parameter(TopoDS::Vertex(aSh), TopoDS::Edge(anE));
-            myEdge = TopClass_GeomEdge(TopoDS::Edge(anE), theF);
-            return;
-          }
-        }
-        break;
-
-        case BRepExtrema_IsOnEdge:
-        {
-          const TopoDS_Shape aSh = anExtr.SupportOnShape1(i);
-          const TopoDS_Edge &anE = TopoDS::Edge(aSh);
-
-          //Indeed, seam-edge is included to the wire aWir twice.
-          //However, BRepExtrema_DistShapeShape will return only one
-          //representation of the nearest edge (at that this representation
-          //is chosen randomly). Maybe the edge will be chosen whose p-curve
-          //is farer from the classified point. Therefore, we must
-          //check all CurveRepresentation of this edge. For that,
-          //the flag isOnClosedSurface is used.
-          Standard_Boolean isOnClosedSurface = BRep_Tool::IsClosed(anE, theF);
-
-          if(isOnClosedSurface)
-          {
-            // See face_with_rejected_seam.brep file attached to
-            // the issue #28211 (classified point has
-            // (-1.0000000000000004 0.48095952536907932) coordinates).
-            // This face contains the edge with two p-curves (on this face)
-            // but this edge is included in the face once (i.e. indeed it is
-            // not seam). It seems that the excess p-curve was not deleted
-            // after splitting of the face but it must not be taken into
-            // account when classifying.
-            // So, we need extend check here whether this edge is really met
-            // in the wire twice.
-
-            // Take edges
-            TopoDS_Iterator anItr(aWir);
-            for(; anItr.More(); anItr.Next())
-            {
-              const TopoDS_Edge &WE = TopoDS::Edge(anItr.Value());
-              if(anE.IsSame(WE))
-              {
-                isOnClosedSurface = !isOnClosedSurface;
-              }
-            }
-          }
-
-          Standard_Real aPar = 0.0;
-          anExtr.ParOnEdgeS1(i, aPar);
-          if(Check2D(anE, theF, aPar, theP, theTol3D, isOnClosedSurface))
-          {
-            myState = TopAbs_ON;
-            myEdgeParameter = aPar;
-            myEdge = TopClass_GeomEdge(TopoDS::Edge(aSh), theF);
-            return;
-          }
-        }
-        break;
-
-        default:
-          break;
+        continue;
       }
-    }
-  }
-#else
-  const Handle(Geom_Surface) aS = BRep_Tool::Surface(theF);
-  gp_Pnt aP3d = aS->Value(theP.X(), theP.Y());
-  TopoDS_Iterator aWirExp(theF);
-  for(; aWirExp.More(); aWirExp.Next())
-  {
-    // aWir is a wire
-    const TopoDS_Shape& aWir = aWirExp.Value();
-    
-    TopoDS_Iterator anEExp(aWir);
-    for(; anEExp.More(); anEExp.Next())
-    {
-      // anE is an edge
-      const TopoDS_Edge& anE = TopoDS::Edge(anEExp.Value());
 
-      Bnd_Box aBox;
-      BRepBndLib::Add(anE, aBox);
-      aBox.Enlarge(theTol3D);
-      if (aBox.IsOut(aP3d))
+      if (anExtr.Value() > anExtTol)
+      {
         continue;
+      }
 
-      Standard_Real aFPar, aLPar;
-      const Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(anE, theF, aFPar, aLPar);
-      const TopClass_GeomEdge aGE(anE, aS, aC2d, aFPar, aLPar);
-
-      Standard_Real aParam = RealFirst();
-      const Standard_Real aDist = aGE.Distance3D(aP3d, 0, &aParam);
-      if((0.0 <= aDist) && (aDist <= theTol3D))
+      TopoDS_Iterator anEExp(aWir);
+      for (; anEExp.More(); anEExp.Next())
       {
+        // anE is an edge
+        const TopoDS_Edge& anE = TopoDS::Edge(anEExp.Value());
+
         // It is necessary for periodic and quasi-periodic (e.g. sphere)
         // surfaces (tests bug28211_18, bug28211_32, bug28211_33 and
         // bug28211_35 in "tests/lowalgos/classifier/").
@@ -265,18 +142,100 @@ void  BRepClass_FaceClassifier::Perform(const TopoDS_Face& theF,
         // (because this check is based on period value
         // instead of tolerance).
 
-        gp_Pnt2d aPOnC;
-        if(Check2D(aGE, aParam, theP, theTol3D, aPOnC))
+        const Standard_Real anETol = (theTol3D<0.0) ? BRep_Tool::Tolerance(anE) : theTol3D;
+        const Standard_Real aSqTol = anETol*anETol;
+        for (Standard_Integer i = 1; i <= anExtr.NbSolution(); i++)
         {
-          myState = TopAbs_ON;
-          myEdgeParameter = aParam;
-          myEdge = aGE;
-          return;
+          if (anExtr.PointOnShape1(i).SquareDistance(aPt) > aSqTol)
+            continue;
+
+          switch (anExtr.SupportTypeShape1(i))
+          {
+            case BRepExtrema_IsVertex:
+            {
+              const TopoDS_Vertex aVert = TopoDS::Vertex(anExtr.SupportOnShape1(i));
+              if (Check2D(aVert, theF, theP, 
+                            (theTol3D<0.0) ? BRep_Tool::Tolerance(aVert) : theTol3D))
+              {
+                myState = TopAbs_ON;
+                TopTools_IndexedDataMapOfShapeListOfShape aM;
+                TopExp::MapShapesAndAncestors(theF, TopAbs_VERTEX, TopAbs_EDGE, aM);
+                const TopoDS_Edge &anE = TopoDS::Edge(aM.FindFromKey(aVert).First());
+                myEdgeParameter = BRep_Tool::Parameter(aVert, anE);
+                
+                Standard_Real aFPar, aLPar;
+                const Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(anE, theF, aFPar, aLPar);
+                const Handle(Geom_Surface) aS = BRep_Tool::Surface(theF);
+                const TopClass_GeomEdge aGE(anE, aS, aC2d, aFPar, aLPar);
+                myEdge = TopClass_GeomEdge(anE, aS, aC2d, aFPar, aLPar);
+                return;
+              }
+            }
+            break;
+
+            case BRepExtrema_IsOnEdge:
+            {
+              const TopoDS_Shape aSh = anExtr.SupportOnShape1(i);
+              const TopoDS_Edge &anE = TopoDS::Edge(aSh);
+
+              //Indeed, seam-edge is included to the wire aWir twice.
+              //However, BRepExtrema_DistShapeShape will return only one
+              //representation of the nearest edge (at that this representation
+              //is chosen randomly). Maybe the edge will be chosen whose p-curve
+              //is farer from the classified point. Therefore, we must
+              //check all CurveRepresentation of this edge. For that,
+              //the flag isOnClosedSurface is used.
+              Standard_Boolean isOnClosedSurface = BRep_Tool::IsClosed(anE, theF);
+
+              if (isOnClosedSurface)
+              {
+                // See face_with_rejected_seam.brep file attached to
+                // the issue #28211 (classified point has
+                // (-1.0000000000000004 0.48095952536907932) coordinates).
+                // This face contains the edge with two p-curves (on this face)
+                // but this edge is included in the face once (i.e. indeed it is
+                // not seam). It seems that the excess p-curve was not deleted
+                // after splitting of the face but it must not be taken into
+                // account when classifying.
+                // So, we need extend check here whether this edge is really met
+                // in the wire twice.
+
+                // Take edges
+                TopoDS_Iterator anItr(aWir);
+                for (; anItr.More(); anItr.Next())
+                {
+                  const TopoDS_Edge &WE = TopoDS::Edge(anItr.Value());
+                  if (anE.IsSame(WE))
+                  {
+                    isOnClosedSurface = !isOnClosedSurface;
+                  }
+                }
+              }
+
+              Standard_Real aPar = 0.0;
+              anExtr.ParOnEdgeS1(i, aPar);
+              if (Check2D(anE, theF, aPar, theP, anETol, isOnClosedSurface))
+              {
+                myState = TopAbs_ON;
+                myEdgeParameter = aPar;
+
+                Standard_Real aFPar, aLPar;
+                const Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(anE, theF, aFPar, aLPar);
+                const Handle(Geom_Surface) aS = BRep_Tool::Surface(theF);
+                const TopClass_GeomEdge aGE(anE, aS, aC2d, aFPar, aLPar);
+                myEdge = TopClass_GeomEdge(anE, aS, aC2d, aFPar, aLPar);
+                return;
+              }
+            }
+            break;
+
+            default:
+              break;
+          }
         }
       }
     }
   }
-#endif
 
   // For information only.
   // BRepClass_FaceClassifier works wrong with small faces
@@ -295,7 +254,7 @@ void  BRepClass_FaceClassifier::Perform(const TopoDS_Face& theF,
 //purpose  : 
 //=======================================================================
 void  BRepClass_FaceClassifier::Perform(const TopoDS_Face& theF, 
-                                        const gp_Pnt& theP, 
+                                        const gp_Pnt& theP,
                                         const Standard_Real theTol3D)
 {
   Standard_Integer aNbExt, aIndice, i; 
@@ -332,7 +291,7 @@ void  BRepClass_FaceClassifier::Perform(const TopoDS_Face& theF,
   if(aIndice) { 
     aExtrema.Point(aIndice).Parameter(aU1, aU2);
     aPuv.SetCoord(aU1, aU2);
-    Perform(theF, aPuv, theTol3D);
+    Perform(theF, aPuv);
   }
 }
 
@@ -362,7 +321,7 @@ static Standard_Real DeltaUMax(const Adaptor3d_Surface &theAS)
 static Standard_Real DeltaVMax(const Adaptor3d_Surface &theAS,
                                const Standard_Real theTol3D)
 {
-  switch(theAS.GetType())
+  switch (theAS.GetType())
   {
     case GeomAbs_OffsetSurface:
       //See lowalgos/classifier/bug28211_39 test case.
@@ -385,7 +344,6 @@ static Standard_Real DeltaVMax(const Adaptor3d_Surface &theAS,
   return theAS.IsVPeriodic() ? 0.25*theAS.VPeriod() : -1.0;
 }
 
-#if 0
 //=======================================================================
 //function : Check2D
 //purpose  : Returns TRUE if theP and theProjPt are the same points
@@ -398,17 +356,17 @@ Standard_Boolean Check2D(const TopoDS_Face &theTopF,
 {
   const BRepAdaptor_Surface anAS(theTopF, Standard_False);
 
-  if(anAS.GetType() == GeomAbs_OtherSurface)
+  if (anAS.GetType() == GeomAbs_OtherSurface)
     return Standard_False;
 
   const Standard_Real aDU = Abs(theProjPt.X() - thePRef.X());
   const Standard_Real aDUMax = DeltaUMax(anAS);
-  if((aDUMax >= 0.0) && (aDU > aDUMax))
+  if ((aDUMax >= 0.0) && (aDU > aDUMax))
     return Standard_False;
 
   const Standard_Real aDV = Abs(theProjPt.Y() - thePRef.Y());
   const Standard_Real aDVMax = DeltaVMax(anAS, theTol3D);
-  if((aDVMax >= 0.0) && (aDV > aDVMax))
+  if ((aDVMax >= 0.0) && (aDV > aDVMax))
     return Standard_False;
 
   return Standard_True;
@@ -427,21 +385,21 @@ Standard_Boolean Check2D(const TopoDS_Edge &theTopE,
                          const Standard_Boolean theIsOnClosedSurf)
 {
   gp_Pnt2d aPOnC;
-  if(BRep_Tool::SameParameter(theTopE) && BRep_Tool::SameRange(theTopE))
+  Standard_Real aFPar, aLPar;
+  const Handle(Geom2d_Curve) aC1 = BRep_Tool::CurveOnSurface(theTopE, theTopF, aFPar, aLPar);
+  if (BRep_Tool::SameParameter(theTopE) && BRep_Tool::SameRange(theTopE))
   {
-    Standard_Real aFPar, aLPar;
-    const Handle(Geom2d_Curve) aC1 = BRep_Tool::CurveOnSurface(theTopE, theTopF, aFPar, aLPar);
     aC1->D0(theCurvParam, aPOnC);
 
     // If theTopE is a seam-edge.
-    if(theIsOnClosedSurf)
+    if (theIsOnClosedSurf)
     {
       const Handle(Geom2d_Curve) aC2 = BRep_Tool::CurveOnSurface(TopoDS::Edge(theTopE.Reversed()),
                                                                  theTopF, aFPar, aLPar);
 
       const gp_Pnt2d aPtemp(aC2->Value(theCurvParam));
 
-      if(thePRef.SquareDistance(aPtemp) < thePRef.SquareDistance(aPOnC))
+      if (thePRef.SquareDistance(aPtemp) < thePRef.SquareDistance(aPOnC))
       {
         aPOnC = aPtemp;
       }
@@ -449,9 +407,9 @@ Standard_Boolean Check2D(const TopoDS_Edge &theTopE,
   }
   else
   {
-    TopClass_GeomEdge aGE(theTopE, theTopF);
+    TopClass_GeomEdge aGE(theTopE, BRep_Tool::Surface(theTopF), aC1, aFPar, aLPar);
     const Standard_Real aDist = aGE.Distance2D(thePRef, &aPOnC);
-    if(aDist < 0.0)
+    if (aDist < 0.0)
       return Standard_False;
   }
 
@@ -471,55 +429,3 @@ Standard_Boolean Check2D(const TopoDS_Vertex &theTopV,
   const gp_Pnt2d aPt = BRep_Tool::Parameters(theTopV, theTopF);
   return Check2D(theTopF, thePRef, aPt, theTol3D);
 }
-
-#else
-//=======================================================================
-//function : Check2D
-//purpose  : Returns TRUE if theP and thePRef are the same points.
-//           E.g. if X-coord of thePRef is equal to 0 and X-coord of theP
-//            is equal to T (the period of theSurf) then, most likely,
-//            theP and thePRef will be the same point in 3D-space.
-//           However, these points must be considered as different.
-//            It is made by this function.
-//           Another example why this function is useful is described in
-//            the test script "lowalgos/classifier/bug28211_18" (please see
-//            comment there).
-//=======================================================================
-Standard_Boolean Check2D(const TopClass_GeomEdge& theGE,
-                         const Standard_Real theCurvParam,
-                         const gp_Pnt2d& thePRef,
-                         const Standard_Real theTol3D,
-                         gp_Pnt2d& thePOnC)
-{
-  if(theGE.IsSameParameter())
-  {
-    const Geom2dAdaptor_Curve &aC = theGE.Get2DCurve();
-    aC.D0(theCurvParam, thePOnC);
-  }
-  else
-  {
-    const Standard_Real aDist = theGE.Distance2D(thePRef, &thePOnC);
-    if(aDist < 0.0)
-      return Standard_False;
-  }
-
-  const Adaptor3d_Surface &anAS = theGE.GetSurface();
-
-  if(anAS.GetType() == GeomAbs_OtherSurface)
-    return Standard_False;
-
-  const Standard_Real aDU = Abs(thePOnC.X() - thePRef.X());
-  const Standard_Real aDUMax = DeltaUMax(anAS);
-  if((aDUMax >= 0.0) && (aDU > aDUMax))
-    return Standard_False;
-
-  const Standard_Real aDV = Abs(thePOnC.Y() - thePRef.Y());
-  const Standard_Real aDVMax = DeltaVMax(anAS, theTol3D);
-  if((aDVMax >= 0.0) && (aDV > aDVMax))
-    return Standard_False;
-
-  return Standard_True;
-}
-#endif
-
-
diff --git a/src/BRepClass/BRepClass_FaceClassifier.hxx b/src/BRepClass/BRepClass_FaceClassifier.hxx
index 9b65b57..023d4ea 100644
--- a/src/BRepClass/BRepClass_FaceClassifier.hxx
+++ b/src/BRepClass/BRepClass_FaceClassifier.hxx
@@ -43,23 +43,24 @@ public:
   //! the face <theF> with 3D-tolerance <theTol3D> (used only for check ON-status).
   Standard_EXPORT 
     BRepClass_FaceClassifier(const TopoDS_Face& theF,
-                             const gp_Pnt2d& theP,
-                             const Standard_Real theTol3D);
+                             const gp_Pnt2d& theP);
   
   //! Creates an algorithm to classify the point theP relatively to
-  //! the face <theF> with 3D-tolerance <theTol3D> (used only for check ON-status).
+  //! the face <theF> with 3D-tolerance <theTol3D>.
   Standard_EXPORT BRepClass_FaceClassifier(const TopoDS_Face& theF,
                                            const gp_Pnt& theP,
                                            const Standard_Real theTol3D);
 
-  //! Classify the Point theP with 3D-tolerance <theTol3D> (used only for check ON-status)
+  //! Classify the Point theP with 3D-tolerance <theTol3D> 
+  //! (used only for check ON-status)
   //! relatively to the face <theF>.
+  //! If theTol3D < 0 then internal tolerance is used.
   Standard_EXPORT void Perform(const TopoDS_Face& theF,
                                const gp_Pnt2d& theP,
-                               const Standard_Real theTol3D);
+                               const Standard_Real theTol3D=-1.0);
   
   //! Classifies the point theP relatively to
-  //! the face <theF> with 3D-tolerance <theTol3D> (used only for check ON-status).
+  //! the face <theF> with 3D-tolerance <theTol3D>.
   Standard_EXPORT void Perform(const TopoDS_Face& theF,
                                const gp_Pnt& theP,
                                const Standard_Real theTol3D);
diff --git a/src/BRepClass/BRepClass_Intersector.cxx b/src/BRepClass/BRepClass_Intersector.cxx
index 01c7a6a..111279d 100644
--- a/src/BRepClass/BRepClass_Intersector.cxx
+++ b/src/BRepClass/BRepClass_Intersector.cxx
@@ -22,6 +22,7 @@
 #include <Geom2dInt_GInter.hxx>
 #include <Geom2dLProp_CLProps2d.hxx>
 #include <TopClass_GeomEdge.hxx>
+#include <BRep_Tool.hxx>
 
 //=======================================================================
 //function : BRepClass_Intersector
@@ -57,11 +58,14 @@ void  BRepClass_Intersector::Perform(const gp_Lin2d& theLin,
   anAdC2d.D0(aParF, pdeb);
   anAdC2d.D0(aParL, pfin);
 
+  // Domain of the line
   IntRes2d_Domain DL;
-  if (thePar != RealLast()) {
+  if (thePar != RealLast())
+  {
     DL.SetValues(aPnt2D, 0., theTol2D, ElCLib::Value(thePar, theLin), thePar, theTol2D);
   }
-  else { 
+  else
+  {
     DL.SetValues(aPnt2D, 0., theTol2D, Standard_True);
   }
 
@@ -82,4 +86,63 @@ void  BRepClass_Intersector::Perform(const gp_Lin2d& theLin,
                          Precision::PConfusion(), Precision::PIntersection());
   //
   SetValues(Inter);
-}
\ No newline at end of file
+}
+
+//=======================================================================
+//function : Check2D
+//purpose  : Returns TRUE if theP and thePRef are the same points.
+//           E.g. if X-coord of thePRef is equal to 0 and X-coord of theP
+//            is equal to T (the period of theSurf) then, most likely,
+//            theP and thePRef will be the same point in 3D-space.
+//           However, these points must be considered as different.
+//            It is made by this function.
+//           Another example why this function is useful is described in
+//            the test script "bugs modalg_6 bug28211_18" (please see
+//            comment there).
+//=======================================================================
+Standard_Boolean Check2D(const TopClass_GeomEdge& theGE,
+                         const Standard_Real theCurvParam,
+                         const gp_Pnt2d& thePRef,
+                         const Standard_Real theTol3D,
+                         gp_Pnt2d& thePOnC)
+{
+  if (theGE.IsSameParameter())
+  {
+    const Geom2dAdaptor_Curve &aC = theGE.Get2DCurve();
+    aC.D0(theCurvParam, thePOnC);
+  }
+  else
+  {
+    const Standard_Real aDist = theGE.Distance2D(thePRef, &thePOnC);
+    if (aDist < 0.0)
+      return Standard_False;
+  }
+
+  const Adaptor3d_Surface &anAS = theGE.GetSurface();
+
+  if (anAS.GetType() == GeomAbs_OtherSurface)
+    return Standard_False;
+  
+  gp_Pnt aP;
+  gp_Vec aDerU, aDerV;
+  anAS.D1(thePOnC.X(), thePOnC.Y(), aP, aDerU, aDerV);
+
+  // Resolution() method is sometimes poor
+  // it returns the value less than reality
+  // (e.g. "bugs modalg_6 bug27341_206" test case).
+  const Standard_Real aDU = Abs(thePOnC.X() - thePRef.X());
+  const Standard_Real aSqDerU = aDerU.SquareMagnitude();
+  const Standard_Real aDUMax = (aSqDerU < Precision::SquarePConfusion()) ?
+                                anAS.UResolution(theTol3D) : theTol3D / Sqrt(aSqDerU);
+  if (aDU > aDUMax)
+    return Standard_False;
+
+  const Standard_Real aDV = Abs(thePOnC.Y() - thePRef.Y());
+  const Standard_Real aSqDerV = aDerV.SquareMagnitude();
+  const Standard_Real aDVMax = (aSqDerV < Precision::SquarePConfusion()) ?
+                                anAS.VResolution(theTol3D) : theTol3D / Sqrt(aSqDerV);
+  if (aDV > aDVMax)
+    return Standard_False;
+
+  return Standard_True;
+}
diff --git a/src/BRepClass/BRepClass_Intersector.hxx b/src/BRepClass/BRepClass_Intersector.hxx
index 2d79634..98fbc87 100644
--- a/src/BRepClass/BRepClass_Intersector.hxx
+++ b/src/BRepClass/BRepClass_Intersector.hxx
@@ -39,7 +39,7 @@ public:
                                const Standard_Real thePar,
                                const Standard_Real theTol2D,
                                const TopClass_GeomEdge& theGE);
-
+  
 protected:
 
 private:
diff --git a/src/BRepClass3d/BRepClass3d_Intersector3d.cxx b/src/BRepClass3d/BRepClass3d_Intersector3d.cxx
index a1da6cf..a7b4bb8 100644
--- a/src/BRepClass3d/BRepClass3d_Intersector3d.cxx
+++ b/src/BRepClass3d/BRepClass3d_Intersector3d.cxx
@@ -96,7 +96,7 @@ void BRepClass3d_Intersector3d::Perform(const gp_Lin& L,
         Puv.SetY(Y - vperiod * N2);
       }
 
-      classifier2d.Perform(Face, Puv, theTol3D);
+      classifier2d.Perform(Face, Puv);
       TopAbs_State currentstate = classifier2d.State();
       if(currentstate==TopAbs_IN || currentstate==TopAbs_ON) { 
         const IntCurveSurface_IntersectionPoint& HICSPoint = HICS.Point(index);
diff --git a/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx b/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx
index 91246b2..db9e13f 100644
--- a/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx
+++ b/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx
@@ -187,7 +187,7 @@ Standard_Boolean BRepClass3d_SolidExplorer::FindAPointInTheFace
       v_ = P.Y() + ParamInit* T.Y();
 
       //Additional check
-      BRepTopAdaptor_FClass2d Classifier(face, Precision::Confusion());
+      BRepTopAdaptor_FClass2d Classifier(face);
       gp_Pnt2d aPnt2d(u_, v_);
       TopAbs_State StateOfResultingPoint = Classifier.Perform(aPnt2d);
       if (StateOfResultingPoint != TopAbs_IN)
@@ -486,7 +486,7 @@ Standard_Integer BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P,
       Handle(BRepAdaptor_HSurface) surf = new BRepAdaptor_HSurface();
       if(aTestInvert)
       {
-        BRepTopAdaptor_FClass2d aClass(face, Precision::Confusion());
+        BRepTopAdaptor_FClass2d aClass(face);
         if(aClass.PerformInfinitePoint() == TopAbs_IN)
         {
           aRestr = Standard_False;
@@ -565,7 +565,7 @@ Standard_Integer BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P,
 
             gp_Pnt2d aPuv(aU, aV);
 
-            classifier2d.Perform(face,aPuv,Precision::Confusion());
+            classifier2d.Perform(face,aPuv);
 
             TopAbs_State aState = classifier2d.State();
 
diff --git a/src/BRepExtrema/BRepExtrema_DistanceSS.cxx b/src/BRepExtrema/BRepExtrema_DistanceSS.cxx
index 877f91d..f43cdd5 100644
--- a/src/BRepExtrema/BRepExtrema_DistanceSS.cxx
+++ b/src/BRepExtrema/BRepExtrema_DistanceSS.cxx
@@ -791,7 +791,6 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Face&
         gp_Pnt Pt,P1=BRep_Tool::Pnt(S1);
         BRepClass_FaceClassifier classifier;
         BRepAdaptor_Surface anAS(S2, Standard_False);
-        const Standard_Real aTol = BRep_Tool::Tolerance(S2);
  
         for (i = 1; i <= NbExtrema; i++)
         {
@@ -803,7 +802,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Face&
               // Check if the parameter does not correspond to a vertex
               Ext.Parameter(i,U,V);
               const gp_Pnt2d PUV(U,V);
-              classifier.Perform(S2, PUV, aTol);
+              classifier.Perform(S2, PUV);
               if (classifier.State()==TopAbs_IN)
               {
                 if (myDstRef > Dstmin)
@@ -847,8 +846,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Vertex&
         Standard_Real U,V;
         gp_Pnt Pt,P2=BRep_Tool::Pnt(S2);
         BRepClass_FaceClassifier classifier;
-        const Standard_Real aTol = BRep_Tool::Tolerance(S1);
- 
+
         for (i = 1; i <= NbExtrema; i++)
         {
           if (fabs(Dstmin-sqrt(Ext.SquareDistance(i)))<myEps)
@@ -859,7 +857,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Vertex&
               // Check if the parameter does not correspond to a vertex
               Ext.Parameter(i,U,V);
               const gp_Pnt2d PUV(U,V);
-              classifier.Perform(S1, PUV, aTol);
+              classifier.Perform(S1, PUV);
               if (classifier.State()==TopAbs_IN)
               {
                 if (myDstRef > Dstmin)
@@ -992,7 +990,6 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Face& S
       {
         Standard_Real Udeb,Ufin,U,V;
         BRep_Tool::Range(S1,Udeb,Ufin);
-        const Standard_Real aTol = BRep_Tool::Tolerance(S2);
         gp_Pnt Pt1,Pt2;
         const Standard_Real epsP=Precision::PConfusion();
 
@@ -1010,7 +1007,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Face& S
               {
                 Ext.ParameterOnFace(i,U,V);
                 const gp_Pnt2d PUV(U,V);
-                classifier.Perform(S2, PUV, aTol);
+                classifier.Perform(S2, PUV);
                 if (classifier.State()==TopAbs_IN)
                 {
                   if (myDstRef > Dstmin)
@@ -1043,7 +1040,6 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Face& S
 
       gp_Pnt Pt;
       Standard_Real U,V;
-      const Standard_Real aTol = BRep_Tool::Tolerance(S2);
       Standard_Integer i;
       for (i = 1; i <= arrInter.Length(); i++)
       {
@@ -1075,7 +1071,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Face& S
                 // Check if the parameter does not correspond to a vertex
                 ExtPF.Parameter(ii,U,V);
                 const gp_Pnt2d PUV(U,V);
-                classifier.Perform(S2, PUV, aTol);
+                classifier.Perform(S2, PUV);
                 if (classifier.State()==TopAbs_IN)
                 {
                   if (myDstRef > Dstmin)
@@ -1135,7 +1131,6 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Edge& S
       {
         Standard_Real Udeb,Ufin,U,V;
         BRep_Tool::Range(S2,Udeb,Ufin);
-        const Standard_Real aTol = BRep_Tool::Tolerance(S1);
         gp_Pnt Pt1,Pt2;
         const Standard_Real epsP=Precision::PConfusion();
 
@@ -1153,7 +1148,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Edge& S
               {
                 Ext.ParameterOnFace(i,U,V);
                 const gp_Pnt2d PUV(U,V);
-                classifier.Perform(S1, PUV, aTol);
+                classifier.Perform(S1, PUV);
                 if (classifier.State()==TopAbs_IN)
                 {
                   if (myDstRef > Dstmin)
@@ -1186,7 +1181,6 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Edge& S
 
       gp_Pnt Pt;
       Standard_Real U,V;
-      const Standard_Real aTol = BRep_Tool::Tolerance(S1);
       Standard_Integer i;
       for (i = 1; i <= arrInter.Length(); i++)
       {
@@ -1218,7 +1212,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Edge& S
                 // Check if the parameter does not correspond to a vertex
                 ExtPF.Parameter(ii,U,V);
                 const gp_Pnt2d PUV(U,V);
-                classifier.Perform(S1, PUV, aTol);
+                classifier.Perform(S1, PUV);
                 if (classifier.State()==TopAbs_IN)
                 {
                   if (myDstRef > Dstmin)
@@ -1273,9 +1267,6 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Face& S
       Dstmin = sqrt(Dstmin);
       if ((Dstmin < myDstRef - myEps) || (fabs(Dstmin-myDstRef) < myEps))
       {
-        const Standard_Real aTol1=BRep_Tool::Tolerance(S1);
-        const Standard_Real aTol2=BRep_Tool::Tolerance(S2);
-
         gp_Pnt Pt1,Pt2;
         gp_Pnt2d PUV;
         Standard_Real U1,V1,U2,V2;
@@ -1292,12 +1283,12 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Face& S
               // Check if the parameter does not correspond to a vertex
               Ext.ParameterOnFace1(i,U1,V1);
               PUV.SetCoord(U1,V1);
-              classifier.Perform(S1, PUV, aTol1);
+              classifier.Perform(S1, PUV);
               if (classifier.State()==TopAbs_IN)
               {
                 Ext.ParameterOnFace2(i,U2,V2);
                 PUV.SetCoord(U2,V2);
-                classifier.Perform(S2, PUV, aTol2);
+                classifier.Perform(S2, PUV);
                 if (classifier.State()==TopAbs_IN)
                 {
                   if (myDstRef > Dstmin)
diff --git a/src/BRepExtrema/BRepExtrema_ExtCF.cxx b/src/BRepExtrema/BRepExtrema_ExtCF.cxx
index 22fecc8..d05c84e 100644
--- a/src/BRepExtrema/BRepExtrema_ExtCF.cxx
+++ b/src/BRepExtrema/BRepExtrema_ExtCF.cxx
@@ -95,7 +95,6 @@ void BRepExtrema_ExtCF::Perform(const TopoDS_Edge& E, const TopoDS_Face& F2)
   {
     // Exploration of points and classification
     BRepClass_FaceClassifier classifier;
-    const Standard_Real aTol = BRep_Tool::Tolerance(F2);
     Extrema_POnCurv P1;
     Extrema_POnSurf P2;
 
@@ -104,7 +103,7 @@ void BRepExtrema_ExtCF::Perform(const TopoDS_Edge& E, const TopoDS_Face& F2)
       myExtCS.Points(i, P1, P2);
       P2.Parameter(U1, U2);
       const gp_Pnt2d Puv(U1, U2);
-      classifier.Perform(F2, Puv, aTol);
+      classifier.Perform(F2, Puv);
       const TopAbs_State state = classifier.State();
       if (state == TopAbs_ON || state == TopAbs_IN)
       {
diff --git a/src/BRepExtrema/BRepExtrema_ExtFF.cxx b/src/BRepExtrema/BRepExtrema_ExtFF.cxx
index 252f744..a795ad8 100644
--- a/src/BRepExtrema/BRepExtrema_ExtFF.cxx
+++ b/src/BRepExtrema/BRepExtrema_ExtFF.cxx
@@ -76,8 +76,7 @@ void BRepExtrema_ExtFF::Perform(const TopoDS_Face& F1, const TopoDS_Face& F2)
     return; // protect against non-geometric type (e.g. triangulation)
 
   Handle(BRepAdaptor_HSurface) HS1 = new BRepAdaptor_HSurface(Surf1);
-  const Standard_Real aTol1 = BRep_Tool::Tolerance(F1),
-                      aTol2 = BRep_Tool::Tolerance(F2);
+  const Standard_Real aTol1 = BRep_Tool::Tolerance(F1);
   Standard_Real U1, U2, V1, V2;
   BRepTools::UVBounds(F1, U1, U2, V1, V2);
   myExtSS.Perform(HS1->Surface(), U1, U2, V1, V2, Max(Min(Surf1.UResolution(aTol1),
@@ -101,13 +100,13 @@ void BRepExtrema_ExtFF::Perform(const TopoDS_Face& F1, const TopoDS_Face& F2)
       myExtSS.Points(i, P1, P2);
       P1.Parameter(U1, U2);
       const gp_Pnt2d Puv1(U1, U2);
-      classifier.Perform(F1, Puv1, aTol1);
+      classifier.Perform(F1, Puv1);
       const TopAbs_State state1 = classifier.State();
       if (state1 == TopAbs_ON || state1 == TopAbs_IN)
       {
         P2.Parameter(U1, U2);
         const gp_Pnt2d Puv2(U1, U2);
-        classifier.Perform(F2, Puv2, aTol2);
+        classifier.Perform(F2, Puv2);
         const TopAbs_State state2 = classifier.State();
         if (state2 == TopAbs_ON || state2 == TopAbs_IN)
         {
diff --git a/src/BRepExtrema/BRepExtrema_ExtPF.cxx b/src/BRepExtrema/BRepExtrema_ExtPF.cxx
index de93cb0..22bd820 100644
--- a/src/BRepExtrema/BRepExtrema_ExtPF.cxx
+++ b/src/BRepExtrema/BRepExtrema_ExtPF.cxx
@@ -86,12 +86,11 @@ void BRepExtrema_ExtPF::Perform(const TopoDS_Vertex& TheVertex, const TopoDS_Fac
     BRepClass_FaceClassifier classifier;
     Standard_Real U1, U2;
     BRepAdaptor_Surface anAS(TheFace, Standard_False);
-    const Standard_Real aTol = BRep_Tool::Tolerance(TheFace);
     for (Standard_Integer i = 1; i <= myExtPS.NbExt(); i++)
     {
       myExtPS.Point(i).Parameter(U1, U2);
       const gp_Pnt2d Puv(U1, U2);
-      classifier.Perform(TheFace, Puv, aTol);
+      classifier.Perform(TheFace, Puv);
       const TopAbs_State state = classifier.State();
       if(state == TopAbs_ON || state == TopAbs_IN)
       {
diff --git a/src/BRepFeat/BRepFeat.cxx b/src/BRepFeat/BRepFeat.cxx
index 09e7ec8..65a024c 100644
--- a/src/BRepFeat/BRepFeat.cxx
+++ b/src/BRepFeat/BRepFeat.cxx
@@ -452,7 +452,7 @@ Standard_Boolean BRepFeat::IsInside(const TopoDS_Face& F1,
     vperiod = S->VPeriod();
   }
   TopoDS_Shape aLocalShape = F2.Oriented(TopAbs_FORWARD);
-  BRepTopAdaptor_FClass2d FC (TopoDS::Face(aLocalShape),Precision::Confusion());
+  BRepTopAdaptor_FClass2d FC (TopoDS::Face(aLocalShape));
 //  BRepTopAdaptor_FClass2d FC (TopoDS::Face(F2.Oriented(TopAbs_FORWARD)),
 //                                Precision::Confusion());
   for(; exp.More(); exp.Next()) {
diff --git a/src/BRepFeat/BRepFeat_MakeRevolutionForm.cxx b/src/BRepFeat/BRepFeat_MakeRevolutionForm.cxx
index 83bb715..750179c 100644
--- a/src/BRepFeat/BRepFeat_MakeRevolutionForm.cxx
+++ b/src/BRepFeat/BRepFeat_MakeRevolutionForm.cxx
@@ -876,7 +876,7 @@ void BRepFeat_MakeRevolutionForm::Init(const TopoDS_Shape& Sbase,
     BRepLib_MakeFace newbndface(myPln->Pln(), Wiwiwi, Standard_True);
     TopoDS_Face NewBndFace = TopoDS::Face(newbndface.Shape());
 
-    BRepTopAdaptor_FClass2d Cl(NewBndFace, Precision::Confusion());
+    BRepTopAdaptor_FClass2d Cl(NewBndFace);
     Standard_Real paru, parv;
     ElSLib::Parameters(myPln->Pln(), CheckPnt, paru, parv);
     gp_Pnt2d checkpnt2d(paru, parv);
diff --git a/src/BRepFeat/BRepFeat_RibSlot.cxx b/src/BRepFeat/BRepFeat_RibSlot.cxx
index 7172bef..ce35431 100644
--- a/src/BRepFeat/BRepFeat_RibSlot.cxx
+++ b/src/BRepFeat/BRepFeat_RibSlot.cxx
@@ -1519,8 +1519,7 @@ Standard_Boolean BRepFeat_RibSlot::SlidingProfile(TopoDS_Face& Prof,
 // CheckPnt : point slightly inside the material side
 // Bndface  : face/cut of the bounding box in the plane of the profile
     
-    const Standard_Real aTolF = BRep_Tool::Tolerance(fac);
-    BRepTopAdaptor_FClass2d Cl(fac, aTolF);
+    BRepTopAdaptor_FClass2d Cl(fac);
     Standard_Real u, v;
     ElSLib::Parameters(myPln->Pln(), CheckPnt, u, v);
     gp_Pnt2d checkpnt2d(u, v);
@@ -2207,8 +2206,7 @@ Standard_Boolean BRepFeat_RibSlot::NoSlidingProfile(TopoDS_Face& Prof,
   
 //    if(!Concavite) {
   if(Concavite == 3) {
-    const Standard_Real aTolF = BRep_Tool::Tolerance(fac);
-    BRepTopAdaptor_FClass2d Cl(fac, aTolF);
+    BRepTopAdaptor_FClass2d Cl(fac);
     Standard_Real u, v;
     ElSLib::Parameters(myPln->Pln(), CheckPnt, u, v);
     gp_Pnt2d checkpnt2d(u, v);
diff --git a/src/BRepLib/BRepLib.cxx b/src/BRepLib/BRepLib.cxx
index 7ac087c..78e428f 100644
--- a/src/BRepLib/BRepLib.cxx
+++ b/src/BRepLib/BRepLib.cxx
@@ -444,26 +444,30 @@ Standard_Boolean  BRepLib::BuildCurve3d(const TopoDS_Edge& AnEdge,
       Handle(Geom_Curve) NewCurvePtr ;
 
       GeomLib::BuildCurve3d(Tolerance,
-        CurveOnSurface,
-        f,
-        l,
-        NewCurvePtr,
-        max_deviation,
-        average_deviation,
-        Continuity,
-        MaxDegree,
-        evaluateMaxSegment(MaxSegment,CurveOnSurface)) ;
-      BRep_Builder B;	
-      tolerance = BRep_Tool::Tolerance(AnEdge) ;
+                            CurveOnSurface,
+                            f,
+                            l,
+                            NewCurvePtr,
+                            max_deviation,
+                            average_deviation,
+                            Continuity,
+                            MaxDegree,
+                            evaluateMaxSegment(MaxSegment, CurveOnSurface));
+      BRep_Builder B;
+      tolerance = BRep_Tool::Tolerance(AnEdge);
       //Patch
       //max_deviation = Max(tolerance, max_deviation) ;
-      max_deviation = Max( tolerance, Tolerance );
+      max_deviation = Max(tolerance, Tolerance);
       if (NewCurvePtr.IsNull())
         return Standard_False;
+
       B.UpdateEdge(TopoDS::Edge(AnEdge),
-        NewCurvePtr,
-        L[0],
-        max_deviation) ;
+                   NewCurvePtr,
+                   L[0],
+                   max_deviation);
+
+      SameParameter(AnEdge, max_deviation, Standard_True);
+
       if (jj == 1 ) {
         //
         // if there is only one curve on surface attached to the edge
diff --git a/src/BRepLib/BRepLib_FindSurface.cxx b/src/BRepLib/BRepLib_FindSurface.cxx
index 965d008..3daac04 100644
--- a/src/BRepLib/BRepLib_FindSurface.cxx
+++ b/src/BRepLib/BRepLib_FindSurface.cxx
@@ -565,7 +565,7 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape&    S,
       TopoDS_Face aTmpFace = BRepLib_MakeFace(mySurface, Precision::Confusion());
       BRep_Builder BB;
       BB.Add(aTmpFace, aW);
-      BRepTopAdaptor_FClass2d FClass(aTmpFace, gp::Resolution());
+      BRepTopAdaptor_FClass2d FClass(aTmpFace);
       if ( FClass.PerformInfinitePoint() == TopAbs_IN ) 
       {
         gp_Dir aN = aPlane->Position().Direction();
diff --git a/src/BRepLib/BRepLib_MakeFace.cxx b/src/BRepLib/BRepLib_MakeFace.cxx
index 90336af..6165abc 100644
--- a/src/BRepLib/BRepLib_MakeFace.cxx
+++ b/src/BRepLib/BRepLib_MakeFace.cxx
@@ -849,7 +849,7 @@ void BRepLib_MakeFace::CheckInside()
 {
   // compute the area and return the face if the area is negative
   TopoDS_Face F = TopoDS::Face(myShape);
-  BRepTopAdaptor_FClass2d FClass(F,gp::Resolution());
+  BRepTopAdaptor_FClass2d FClass(F);
   if ( FClass.PerformInfinitePoint() == TopAbs_IN) {
     BRep_Builder B;
     TopoDS_Shape S = myShape.EmptyCopied();
diff --git a/src/BRepOffset/BRepOffset_MakeOffset.cxx b/src/BRepOffset/BRepOffset_MakeOffset.cxx
index 1ded0aa..db81633 100644
--- a/src/BRepOffset/BRepOffset_MakeOffset.cxx
+++ b/src/BRepOffset/BRepOffset_MakeOffset.cxx
@@ -2678,7 +2678,7 @@ void BRepOffset_MakeOffset::MakeMissingWalls ()
                 TopoDS_Face aFace;
                 BB.MakeFace(aFace, aPL, Precision::Confusion());
                 BB.Add (aFace, aW);
-                aClsf.Init(aFace, Precision::Confusion());
+                aClsf.Init(aFace);
                 bIsHole=aClsf.IsHole();
                 if ((bIsHole && !i) || (!bIsHole && i)) {
                   aW.Nullify();
diff --git a/src/BRepOffset/BRepOffset_Tool.cxx b/src/BRepOffset/BRepOffset_Tool.cxx
index ff88c98..3606850 100644
--- a/src/BRepOffset/BRepOffset_Tool.cxx
+++ b/src/BRepOffset/BRepOffset_Tool.cxx
@@ -4026,8 +4026,7 @@ void BRepOffset_Tool::CorrectOrientation(const TopoDS_Shape&        SI,
       }
       if (YaInt) {
         TopoDS_Shape aLocalFace = FI.Oriented(TopAbs_FORWARD);
-        BRepTopAdaptor_FClass2d FC (TopoDS::Face(aLocalFace),
-                                    Precision::Confusion());
+        BRepTopAdaptor_FClass2d FC (TopoDS::Face(aLocalFace));
 	for (itE.Initialize(LOE); itE.More(); itE.Next()) {
 	  TopoDS_Shape&   OE   = itE.Value();
 	  if (NewEdges.Contains(OE)) {
diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx
index 419912e..79f578e 100644
--- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx
+++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx
@@ -234,7 +234,7 @@ static void BuildDomains(TopoDS_Face&               myFace,
     BRepAdaptor_Surface   S(F,0);
     Standard_Real         Tol = BRep_Tool::Tolerance(F); 
 
-    BRepTopAdaptor_FClass2d CL(F,Precision::Confusion());
+    BRepTopAdaptor_FClass2d CL(F);
 
     TopTools_ListIteratorOfListOfShape itW(LOW);
     while (itW.More()) {
diff --git a/src/BRepTopAdaptor/BRepTopAdaptor_FClass2d.cxx b/src/BRepTopAdaptor/BRepTopAdaptor_FClass2d.cxx
index decc3b4..fb9fc3d 100644
--- a/src/BRepTopAdaptor/BRepTopAdaptor_FClass2d.cxx
+++ b/src/BRepTopAdaptor/BRepTopAdaptor_FClass2d.cxx
@@ -127,8 +127,7 @@ private:
 //function : Default constructor
 //purpose  : 
 //=======================================================================
-BRepTopAdaptor_FClass2d::BRepTopAdaptor_FClass2d() : myTol3D(Precision::Confusion()),
-                                                     myUmin(RealLast()),
+BRepTopAdaptor_FClass2d::BRepTopAdaptor_FClass2d() : myUmin(RealLast()),
                                                      myVmin(RealLast()),
                                                      myUmax(-myUmin),
                                                      myVmax(-myVmin)
@@ -139,14 +138,12 @@ BRepTopAdaptor_FClass2d::BRepTopAdaptor_FClass2d() : myTol3D(Precision::Confusio
 //function : Constructor
 //purpose  : 
 //=======================================================================
-BRepTopAdaptor_FClass2d::BRepTopAdaptor_FClass2d(const TopoDS_Face& theFace,
-                                                 const Standard_Real theTol3D):
+BRepTopAdaptor_FClass2d::BRepTopAdaptor_FClass2d(const TopoDS_Face& theFace):
                                                  myFace(theFace),
-                                                 myTol3D(theTol3D),
                                                  myUmin(RealLast()), myVmin(RealLast()),
                                                  myUmax(-myUmin), myVmax(-myVmin)
 {
-  Init(myFace, theTol3D);
+  Init(myFace);
 }
 
 //=======================================================================
@@ -176,8 +173,7 @@ static Standard_Boolean ComputeDeviation(const gp_Pnt2d& thePf,
 //function : Init
 //purpose  : 
 //=======================================================================
-void BRepTopAdaptor_FClass2d::Init(const TopoDS_Face& theFace,
-                                   const Standard_Real theTol3D)
+void BRepTopAdaptor_FClass2d::Init(const TopoDS_Face& theFace)
 {
   Standard_Boolean WireIsEmpty, Ancienpnt3dinitialise, degenerated;
   Standard_Integer nbpnts, firstpoint, NbEdges;
@@ -205,9 +201,6 @@ void BRepTopAdaptor_FClass2d::Init(const TopoDS_Face& theFace,
   //
   myFace = theFace;
   myFace.Orientation(TopAbs_FORWARD);
-  myTol3D = theTol3D;
-  const Standard_Real aTolU = anAS.UResolution(theTol3D),
-                      aTolV = anAS.VResolution(theTol3D);
   //const Standard_Real aMaxGapU = Max(aTolU, Precision::PConfusion());
   //const Standard_Real aMaxGapV = Max(aTolV, Precision::PConfusion());
   //
@@ -226,8 +219,6 @@ void BRepTopAdaptor_FClass2d::Init(const TopoDS_Face& theFace,
     //
     nbpnts = 0;
     firstpoint = 1;
-    FlecheU = aTolU;
-    FlecheV = aTolV;
     WireIsEmpty = Standard_True;
     Ancienpnt3dinitialise = Standard_False;
     Ancienpnt3d.SetCoord(0., 0., 0.);
@@ -237,6 +228,7 @@ void BRepTopAdaptor_FClass2d::Init(const TopoDS_Face& theFace,
     // NbEdges
     NbEdges = 0;
     aExp.Init(aW, TopAbs_EDGE);
+    FlecheU = FlecheV = 0.0;
     for (; aExp.More(); aExp.Next())
     {
       const TopoDS_Edge& anE = TopoDS::Edge(aExp.Current());
@@ -256,6 +248,7 @@ void BRepTopAdaptor_FClass2d::Init(const TopoDS_Face& theFace,
     for (; aWExp.More(); aWExp.Next()) {
       NbEdges--;
       edge = aWExp.Current();
+
       Or = edge.Orientation();
       if (!(Or == TopAbs_FORWARD || Or == TopAbs_REVERSED)) {
         continue;
@@ -333,14 +326,14 @@ void BRepTopAdaptor_FClass2d::Init(const TopoDS_Face& theFace,
       nbs = Geom2dInt_Geom2dCurveTool::NbSamples(C);
       if (nbs > 2) {
         nbs *= 4;
-      }
+        }
       du = (plbid - pfbid) / (Standard_Real)(nbs - 1);
       //
       if (Or == TopAbs_FORWARD) {
         u = pfbid;
         uFirst = pfbid;
         uLast = plbid;
-      }
+        }
       else {
         u = plbid;
         uFirst = plbid;
@@ -357,7 +350,7 @@ void BRepTopAdaptor_FClass2d::Init(const TopoDS_Face& theFace,
         aPrms(1) = uFirst;
         aPrms(2) = uFirst + aCoef*(uLast - uFirst);
         aPrms(3) = uLast;
-      }
+          }
       else if (nbs>2) {
         aNbs1 = nbs;
         aPrms(1) = uFirst;
@@ -382,10 +375,10 @@ void BRepTopAdaptor_FClass2d::Init(const TopoDS_Face& theFace,
         //
         u = aPrms(iX);
         P2d = C.Value(u);
-        if(P2d.X()<myUmin) myUmin = P2d.X();
-        if(P2d.X()>myUmax) myUmax = P2d.X();
-        if(P2d.Y()<myVmin) myVmin = P2d.Y();
-        if(P2d.Y()>myVmax) myVmax = P2d.Y();
+        if (P2d.X() < myUmin) myUmin = P2d.X();
+        if (P2d.X() > myUmax) myUmax = P2d.X();
+        if (P2d.Y() < myVmin) myVmin = P2d.Y();
+        if (P2d.Y() > myVmax) myVmax = P2d.Y();
         //
         aDstX = RealLast();
         if (degenerated == Standard_False) {
@@ -532,7 +525,7 @@ void BRepTopAdaptor_FClass2d::Init(const TopoDS_Face& theFace,
 #endif
 
         {
-          const Standard_Real aToler = Max(myTol3D, Precision::Confusion());
+          const Standard_Real aToler = Precision::Confusion();
           if (Abs(anArea) < aToler*aToler)
           {
             // anArea = |A|*|B|*sin(Angle) < Tol*Tol
@@ -895,7 +888,7 @@ TopAbs_State
     //compute state of the point using face classifier
     if(hasToUseClassifier)
     {
-      myClassifier.Perform(myFace, aPuv, myTol3D);
+      myClassifier.Perform(myFace, aPuv);
       aStatus = myClassifier.State();
     }
 
diff --git a/src/BRepTopAdaptor/BRepTopAdaptor_FClass2d.hxx b/src/BRepTopAdaptor/BRepTopAdaptor_FClass2d.hxx
index a7a240a..d5f69b6 100644
--- a/src/BRepTopAdaptor/BRepTopAdaptor_FClass2d.hxx
+++ b/src/BRepTopAdaptor/BRepTopAdaptor_FClass2d.hxx
@@ -38,13 +38,11 @@ public:
   //! Empty constructor
   Standard_EXPORT BRepTopAdaptor_FClass2d();
 
-  //! Constructs algorithm by theFace and the 3D-tolerance <theTol3D>
-  Standard_EXPORT BRepTopAdaptor_FClass2d(const TopoDS_Face& theFace,
-                                          const Standard_Real theTol3D);
+  //! Constructs algorithm by theFace
+  Standard_EXPORT BRepTopAdaptor_FClass2d(const TopoDS_Face& theFace);
   
-  //! Initializes algorithm by theFace and the 3D-tolerance <theTol3D>
-  Standard_EXPORT void Init(const TopoDS_Face& theFace,
-                            const Standard_Real theTol3D);
+  //! Initializes algorithm by theFace
+  Standard_EXPORT void Init(const TopoDS_Face& theFace);
 
   //! Classifies an infinite 2d point relatively of the Face.
   Standard_EXPORT TopAbs_State PerformInfinitePoint() const;
@@ -90,7 +88,6 @@ private:
   NCollection_Sequence<CSLib_Class2d*> myTabClass;
   NCollection_Sequence<Standard_Integer> myTabOrien;
   TopoDS_Face myFace;
-  Standard_Real myTol3D;
   Standard_Real myUmin;
   Standard_Real myVmin;
   Standard_Real myUmax;
diff --git a/src/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx b/src/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx
index 121bcb2..1a5a6b0 100644
--- a/src/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx
+++ b/src/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx
@@ -189,13 +189,13 @@ static
 //purpose  : 
 //=======================================================================
 TopAbs_State BRepTopAdaptor_TopolTool::Classify(const gp_Pnt2d& P,
-                                                const Standard_Real theTol3D,
+                                                const Standard_Real /*theTol3D*/,
                                                 const Standard_Boolean theIsReqToAdjust)
 {
   if(myFace.IsNull())
     return TopAbs_UNKNOWN;
   if(myFClass2d == NULL) { 
-    myFClass2d = new BRepTopAdaptor_FClass2d(myFace, theTol3D);
+    myFClass2d = new BRepTopAdaptor_FClass2d(myFace);
   } 
 
   const TopAbs_State aState = (myFClass2d->Perform(P,theIsReqToAdjust));
@@ -212,7 +212,7 @@ Standard_Boolean
                                            const Standard_Boolean theIsReqToAdjust)
 {
   if(myFClass2d == NULL) { 
-    myFClass2d = new BRepTopAdaptor_FClass2d(myFace, theTol3D);
+    myFClass2d = new BRepTopAdaptor_FClass2d(myFace);
   } 
   return(TopAbs_ON == myFClass2d->TestOnRestriction(P, theTol3D, theIsReqToAdjust));
 }
diff --git a/src/BRepTopAdaptor/BRepTopAdaptor_TopolTool.hxx b/src/BRepTopAdaptor/BRepTopAdaptor_TopolTool.hxx
index 592295c..8e897c9 100644
--- a/src/BRepTopAdaptor/BRepTopAdaptor_TopolTool.hxx
+++ b/src/BRepTopAdaptor/BRepTopAdaptor_TopolTool.hxx
@@ -80,7 +80,8 @@ public:
   Standard_EXPORT virtual void NextVertex() Standard_OVERRIDE;
   
   //! Classifies theP2d relatively to the domain of myS.
-  //! theTol3D is the 3D-tolerance (is used for check ON-status).
+  //! theTol3D is not used in this method
+  //! (is entered for compatibility with parent class)
   //! If theIsReqToAdjust == TRUE then the coordinates of theP2d
   //! will be inscribed (if it is possible) in the UV-bounds of myFace.
   Standard_EXPORT virtual
diff --git a/src/DsgPrs/DsgPrs_ShapeDirPresentation.cxx b/src/DsgPrs/DsgPrs_ShapeDirPresentation.cxx
index 007a5d6..45b474f 100644
--- a/src/DsgPrs/DsgPrs_ShapeDirPresentation.cxx
+++ b/src/DsgPrs/DsgPrs_ShapeDirPresentation.cxx
@@ -117,7 +117,7 @@ static Standard_Boolean FindPointOnFace(const TopoDS_Face& face, gp_Pnt2d& pt2d)
 
   // verify that (upar vpar) is a point on the face
 
-  BRepClass_FaceClassifier fClass(face, pt2d, gp::Resolution());
+  BRepClass_FaceClassifier fClass(face, pt2d);
 
   if ((fClass.State() == TopAbs_OUT) || (fClass.State() == TopAbs_UNKNOWN)) {
     // try to find a point on face
diff --git a/src/Geom2dHatch/Geom2dHatch_Intersector.hxx b/src/Geom2dHatch/Geom2dHatch_Intersector.hxx
index 69e963f..f8998be 100644
--- a/src/Geom2dHatch/Geom2dHatch_Intersector.hxx
+++ b/src/Geom2dHatch/Geom2dHatch_Intersector.hxx
@@ -55,12 +55,12 @@ public:
   
   Standard_EXPORT Geom2dHatch_Intersector();
   
-  //! Performs the intersection between the 2d line
+  //! Performs the intersection   between the  2d   line
   //! segment (<theLin>, <thePar>) and the Curve <theGE>.
   //! The line segment is the part of the 2d line <theLin> of
   //! parameter range [0, <thePar>] (thePar is positive and can be
   //! RealLast()). theTol2D is the Tolerance on the segment.
-  //! The order is relevant, the first argument is the
+  //! The order  is relevant, the  first argument is the
   //! segment, the second one is the Edge.
   Standard_EXPORT void Perform(const gp_Lin2d& theLin,
                                const Standard_Real thePar,
diff --git a/src/GeomliteTest/GeomliteTest_API2dCommands.cxx b/src/GeomliteTest/GeomliteTest_API2dCommands.cxx
index 89e5f30..619f285 100644
--- a/src/GeomliteTest/GeomliteTest_API2dCommands.cxx
+++ b/src/GeomliteTest/GeomliteTest_API2dCommands.cxx
@@ -301,14 +301,14 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const
 //=======================================================================
 static Standard_Integer intersect(Draw_Interpretor& di, Standard_Integer n, const char** a)
 {
-  if (n < 2)
+  if( n < 2) 
   {
     di.PrintHelp(a[0]);
     return 1;
   }
 
   Handle(Geom2d_Curve) C1 = DrawTrSurf::GetCurve2d(a[1]);
-  if (C1.IsNull())
+  if ( C1.IsNull()) 
   {
     di << "Curve " << a[1] << " is null\n";
     return 1;
@@ -332,19 +332,19 @@ static Standard_Integer intersect(Draw_Interpretor& di, Standard_Integer n, cons
     else
     {
       C2 = DrawTrSurf::GetCurve2d(a[i]);
-      if (C2.IsNull())
+    if ( C2.IsNull())
       {
         di << "Curve " << a[i] << " is null\n";
-        return 1;
-      }
+      return 1;
+  }
     }
   }
 
   Geom2dAPI_InterCurveCurve Intersector;
 
-  if (!C2.IsNull())
+  if(!C2.IsNull())
     // Curves intersection
-    Intersector.Init(C1, C2, Tol);
+    Intersector.Init(C1,C2,Tol);
   else
     // Self-intersection of the curve
     Intersector.Init(C1, Tol);
@@ -364,7 +364,7 @@ static Standard_Integer intersect(Draw_Interpretor& di, Standard_Integer n, cons
   {
     // API simplified result
     gp_Pnt2d P = Intersector.Point(i);
-    di << "Intersection point " << i << " : " << P.X() << " " << P.Y() << "\n";
+    di<<"Intersection point "<<i<<" : "<<P.X()<<" "<<P.Y()<<"\n";
     // Intersection extended results from intersection tool
     const IntRes2d_IntersectionPoint& aPInt = anIntTool.Point(i);
     di << "parameter on the fist: " << aPInt.ParamOnFirst();
@@ -374,20 +374,28 @@ static Standard_Integer intersect(Draw_Interpretor& di, Standard_Integer n, cons
       di << "Intersection type: " <<
         (aPInt.TransitionOfFirst().IsTangent() ? "TOUCH" : "INTERSECTION") << "\n";
     }
-    Handle(Draw_Marker2D) mark = new Draw_Marker2D(P, Draw_X, Draw_vert);
+    Handle(Draw_Marker2D) mark = new Draw_Marker2D( P, Draw_X, Draw_vert); 
     dout << mark;
   }
   dout.Flush();
 
-  Handle(Geom2d_Curve) S1, S2;
+  char aBuff[100];
+  Handle(Geom2d_Curve) S1,S2;
   Handle(DrawTrSurf_Curve2d) CD;
   Standard_Integer aNbSegments = Intersector.NbSegments();
   for (Standard_Integer i = 1; i <= aNbSegments; i++)
   {
     di << "Segment #" << i << " found.\n";
     Intersector.Segment(i,S1,S2);
+    Sprintf(aBuff, "ires1_%d", i);
+    di << aBuff;
+    DrawTrSurf::Set(aBuff, S1);
     CD = new DrawTrSurf_Curve2d(S1, Draw_bleu, 30);
     dout << CD;
+
+    Sprintf(aBuff, "ires2_%d", i);
+    di << " " << aBuff << "\n";
+    DrawTrSurf::Set(aBuff, S2);
     CD = new DrawTrSurf_Curve2d(S2, Draw_violet, 30);
     dout << CD;
   }
diff --git a/src/IntImpParGen/IntImpParGen.cxx b/src/IntImpParGen/IntImpParGen.cxx
index 4e2d0af..9003996 100644
--- a/src/IntImpParGen/IntImpParGen.cxx
+++ b/src/IntImpParGen/IntImpParGen.cxx
@@ -60,18 +60,22 @@ void IntImpParGen::DeterminePosition(IntRes2d_Position& Pos1,
     }
   }
    
-  if(TheDomain.HasLastPoint()) {
-    if(Pnt1.Distance(TheDomain.LastPoint()) 
-       <= TheDomain.LastTolerance()) {
-      if(Pos1==IntRes2d_Head) {
-	if(Abs(Param1-TheDomain.LastParameter())
-	   < Abs(Param1-TheDomain.FirstParameter()))
-	  Pos1=IntRes2d_End; 	
+  if (TheDomain.HasLastPoint())
+  {
+    if (Pnt1.Distance(TheDomain.LastPoint())
+        <= TheDomain.LastTolerance())
+    {
+      if (Pos1 == IntRes2d_Head)
+      {
+        if (Abs(Param1 - TheDomain.LastParameter()) <
+                              Abs(Param1 - TheDomain.FirstParameter()))
+          Pos1 = IntRes2d_End;
       }
-      else {
-	Pos1=IntRes2d_End; 
+      else
+      {
+        Pos1 = IntRes2d_End;
       }
-    } 
+    }
   }
 }   
 //----------------------------------------------------------------------
diff --git a/src/IntTools/IntTools_Context.cxx b/src/IntTools/IntTools_Context.cxx
index 64ad3b1..75c8c49 100644
--- a/src/IntTools/IntTools_Context.cxx
+++ b/src/IntTools/IntTools_Context.cxx
@@ -260,11 +260,10 @@ BRepTopAdaptor_FClass2d& IntTools_Context::FClass2d(const TopoDS_Face& aF)
   //
   if (!myFClass2dMap.IsBound(aF)) {
     const TopoDS_Face aFF = TopoDS::Face(aF.Oriented(TopAbs_FORWARD));
-    const Standard_Real aTolF=BRep_Tool::Tolerance(aFF);
     //
     pFClass2d = (BRepTopAdaptor_FClass2d*)myAllocator->
                         Allocate(sizeof(BRepTopAdaptor_FClass2d));
-    new (pFClass2d)BRepTopAdaptor_FClass2d(aFF, aTolF);
+    new (pFClass2d)BRepTopAdaptor_FClass2d(aFF);
 
     myFClass2dMap.Bind(aFF, (Standard_Address)pFClass2d);
   }
diff --git a/src/IntTools/IntTools_Tools.cxx b/src/IntTools/IntTools_Tools.cxx
index 7c8a6d4..a7d8236 100644
--- a/src/IntTools/IntTools_Tools.cxx
+++ b/src/IntTools/IntTools_Tools.cxx
@@ -429,13 +429,12 @@ static
 //function : ClassifyPointByFace
 //purpose  : 
 //=======================================================================
-  TopAbs_State IntTools_Tools::ClassifyPointByFace(const TopoDS_Face& aF,
-                                                   const gp_Pnt2d& aP2d)
+TopAbs_State IntTools_Tools::ClassifyPointByFace(const TopoDS_Face& aF,
+                                                 const gp_Pnt2d& aP2d)
 {
-  const Standard_Real aTolF=BRep_Tool::Tolerance(aF);
-  BRepTopAdaptor_FClass2d aClass2d(aF, aTolF);
-  const TopAbs_State aState=aClass2d.Perform(aP2d);
-  
+  BRepTopAdaptor_FClass2d aClass2d(aF);
+  const TopAbs_State aState = aClass2d.Perform(aP2d);
+
   return aState;
 }
 
diff --git a/src/LocOpe/LocOpe_SplitShape.cxx b/src/LocOpe/LocOpe_SplitShape.cxx
index 5749ed5..c03bc15 100644
--- a/src/LocOpe/LocOpe_SplitShape.cxx
+++ b/src/LocOpe/LocOpe_SplitShape.cxx
@@ -643,7 +643,7 @@ Standard_Boolean LocOpe_SplitShape::AddClosedWire(const TopoDS_Wire& W,
   //  GProp_GProps GP;
   //  BRepGProp::SurfaceProperties (newFace,GP);
   //  if (GP.Mass() < 0) {
-  BRepTopAdaptor_FClass2d classif(newFace, Precision::Confusion());
+  BRepTopAdaptor_FClass2d classif(newFace);
   if (classif.PerformInfinitePoint() == TopAbs_IN) {
     //le wire donne defini un trou
     aLocalFace = F.EmptyCopied();
@@ -1352,7 +1352,7 @@ static Standard_Boolean IsInside(const TopoDS_Face& F,
   //  GProp_GProps GP;
   //  BRepGProp::SurfaceProperties(newFace,GP);
   //  if (GP.Mass() < 0) {
-  BRepTopAdaptor_FClass2d classif(newFace,Precision::Confusion());
+  BRepTopAdaptor_FClass2d classif(newFace);
   Standard_Boolean Reversed = Standard_False;
   if (classif.PerformInfinitePoint() == TopAbs_IN) {
     //le wire donne defini un trou
@@ -1426,7 +1426,7 @@ static Standard_Boolean IsInside(const TopoDS_Face& F,
     gp_Pnt2d pt2d(C2d->Value(prm));
     //  BRepClass_FaceClassifier classif(F,pt2d,Precision::PConfusion());
     //  return (classif.State() != TopAbs_OUT);
-    BRepTopAdaptor_FClass2d classif(F,Precision::Confusion());
+    BRepTopAdaptor_FClass2d classif(F);
     TopAbs_State stat = classif.Perform(pt2d);
     //  return (classif.Perform(pt2d) != TopAbs_OUT);
     if(stat == TopAbs_OUT) return Standard_False;
diff --git a/src/LocOpe/LocOpe_WiresOnShape.cxx b/src/LocOpe/LocOpe_WiresOnShape.cxx
index e6ef814..8b136ba 100644
--- a/src/LocOpe/LocOpe_WiresOnShape.cxx
+++ b/src/LocOpe/LocOpe_WiresOnShape.cxx
@@ -1516,7 +1516,7 @@ Standard_Boolean LocOpe_WiresOnShape::Add(const TopTools_SequenceOfShape& theEdg
 
         if (aCheckStateTool.IsNull())
         {
-          aCheckStateTool = new BRepTopAdaptor_FClass2d(aCurF, Precision::Confusion());
+          aCheckStateTool = new BRepTopAdaptor_FClass2d(aCurF);
         }
         if (aCheckStateTool->Perform(gp_Pnt2d(aU, aV)) == TopAbs_IN)
         {
diff --git a/src/SWDRAW/SWDRAW_ShapeAnalysis.cxx b/src/SWDRAW/SWDRAW_ShapeAnalysis.cxx
index 078cee6..89a51b4 100644
--- a/src/SWDRAW/SWDRAW_ShapeAnalysis.cxx
+++ b/src/SWDRAW/SWDRAW_ShapeAnalysis.cxx
@@ -318,7 +318,6 @@ static Standard_Integer anaface
   }
   else { di<<"Analyse Wires, Ignore Faces\n"; }
 
-  const Standard_Real aTolF = BRep_Tool::Tolerance(Face);
   Standard_Boolean iasurf = !surface.IsNull();
 //:sw  if (!Face.IsNull()) STW.SetFace (Face);
 //:sw  else STW.SetPrecision (BRepBuilderAPI::Precision());
@@ -435,7 +434,7 @@ static Standard_Integer anaface
       if (G.Mass() > 0) di<<"GProps:Mass Out\n";
       else di<<"GProps:Mass In\n";
 ///  return (G.Mass() > 0);
-      BRepTopAdaptor_FClass2d fcl(Face, aTolF);
+      BRepTopAdaptor_FClass2d fcl(Face);
       if (fcl.PerformInfinitePoint () == TopAbs_OUT) di<<"Classifier Infinite : Out\n";
       else di<<"Classifier Infinite : In\n";
       gp_Pnt2d pcl;
diff --git a/src/SWDRAW/SWDRAW_ShapeFix.cxx b/src/SWDRAW/SWDRAW_ShapeFix.cxx
index 9ede795..4a966b6 100644
--- a/src/SWDRAW/SWDRAW_ShapeFix.cxx
+++ b/src/SWDRAW/SWDRAW_ShapeFix.cxx
@@ -748,7 +748,7 @@ static Standard_Integer checkfclass2d(Draw_Interpretor& di, Standard_Integer n,
   }
   TopoDS_Face aFace = TopoDS::Face(Sh1);
   gp_Pnt2d p2d(ucoord,vcoord);
-  BRepTopAdaptor_FClass2d f2d(aFace,Precision::Confusion());
+  BRepTopAdaptor_FClass2d f2d(aFace);
   TopAbs_State stat = f2d.Perform(p2d);
   if(stat == TopAbs_OUT)
     di<<"Point is OUT\n";
diff --git a/src/ShapeAnalysis/ShapeAnalysis.cxx b/src/ShapeAnalysis/ShapeAnalysis.cxx
index a4bef1e..343a06f 100644
--- a/src/ShapeAnalysis/ShapeAnalysis.cxx
+++ b/src/ShapeAnalysis/ShapeAnalysis.cxx
@@ -230,8 +230,7 @@ Standard_Boolean ShapeAnalysis::IsOuterBound(const TopoDS_Face& face)
     return (totcross >= 0);
   }
   else {
-    const Standard_Real aTol = BRep_Tool::Tolerance(F);
-    BRepTopAdaptor_FClass2d fcl(F, aTol);
+    BRepTopAdaptor_FClass2d fcl(F);
     Standard_Boolean rescl = (fcl.PerformInfinitePoint () == TopAbs_OUT);
     return rescl;
   }
diff --git a/src/ShapeFix/ShapeFix_ComposeShell.cxx b/src/ShapeFix/ShapeFix_ComposeShell.cxx
index e322048..1fd1266 100644
--- a/src/ShapeFix/ShapeFix_ComposeShell.cxx
+++ b/src/ShapeFix/ShapeFix_ComposeShell.cxx
@@ -2433,7 +2433,7 @@ void ShapeFix_ComposeShell::MakeFacesOnPatch (TopTools_SequenceOfShape &faces,
       TopoDS_Face fc;
       B.MakeFace ( fc, surf, myLoc, ::Precision::Confusion() );
       B.Add ( fc, awtmp );
-      BRepTopAdaptor_FClass2d clas ( fc, Precision::Confusion() );
+      BRepTopAdaptor_FClass2d clas(fc);
       TopAbs_State stPoint = clas.Perform (unp,Standard_False);
       if(stPoint == TopAbs_ON || stPoint == TopAbs_UNKNOWN) {
 
@@ -2486,7 +2486,7 @@ void ShapeFix_ComposeShell::MakeFacesOnPatch (TopTools_SequenceOfShape &faces,
     TopoDS_Face fc;
     B.MakeFace ( fc, surf, myLoc, ::Precision::Confusion() );
     B.Add ( fc, wire );
-    BRepTopAdaptor_FClass2d clas ( fc, Precision::Confusion() );
+    BRepTopAdaptor_FClass2d clas(fc);
     if ( clas.PerformInfinitePoint() == TopAbs_IN ) {
       reverse = Standard_True;
 #ifdef OCCT_DEBUG
diff --git a/src/ShapeFix/ShapeFix_Face.cxx b/src/ShapeFix/ShapeFix_Face.cxx
index 31020de..d8d9ac7 100644
--- a/src/ShapeFix/ShapeFix_Face.cxx
+++ b/src/ShapeFix/ShapeFix_Face.cxx
@@ -1196,7 +1196,7 @@ Standard_Boolean ShapeFix_Face::FixOrientation(TopTools_DataMapOfShapeListOfShap
       af.Orientation ( TopAbs_FORWARD );
       B.Add (af,aw);
       Standard_Boolean CheckShift = Standard_True;
-      BRepTopAdaptor_FClass2d clas (af, 0.0);
+      BRepTopAdaptor_FClass2d clas (af);
       TopAbs_State sta = TopAbs_OUT;
       TopAbs_State staout = clas.PerformInfinitePoint();
       TopTools_ListOfShape IntWires;
@@ -2434,12 +2434,12 @@ Standard_Boolean ShapeFix_Face::FixSplitFace(const TopTools_DataMapOfShapeListOf
         TopoDS_Face aFace = TopoDS::Face ( aShapeEmptyCopied);
         aFace.Orientation ( TopAbs_FORWARD );
         B.Add (aFace,liter.Value());
-        BRepTopAdaptor_FClass2d clas (aFace, 0.0);
+        BRepTopAdaptor_FClass2d clas (aFace);
         TopAbs_State staout = clas.PerformInfinitePoint();
         if (staout == TopAbs_IN) 
           B.Add(tmpFace,liter.Value());
         else
-          B.Add(tmpFace,liter.Value().Reversed());                
+          B.Add(tmpFace,liter.Value().Reversed());
         NbWiresNew++;
       }
       if(!myFwd) tmpFace.Orientation(TopAbs_REVERSED);
diff --git a/src/TNaming/TNaming.cxx b/src/TNaming/TNaming.cxx
index 5d5fd4a..e10cb3b 100644
--- a/src/TNaming/TNaming.cxx
+++ b/src/TNaming/TNaming.cxx
@@ -920,7 +920,6 @@ Standard_Boolean TNaming::OuterWire(const TopoDS_Face& theFace, TopoDS_Wire& the
   BRep_Builder aBB;
   BRepTopAdaptor_FClass2d aFC;
   Standard_Boolean bFlag(Standard_False);
-  Standard_Real aTolF = BRep_Tool::Tolerance(theFace);
 
   TopoDS_Iterator aIt(theFace);
   for (; aIt.More(); aIt.Next()) {
@@ -928,7 +927,7 @@ Standard_Boolean TNaming::OuterWire(const TopoDS_Face& theFace, TopoDS_Wire& the
     aFx = theFace;
     aFx.EmptyCopy();
     aBB.Add(aFx, aWx);
-    aFC.Init(aFx, aTolF);
+    aFC.Init(aFx);
     bFlag = aFC.IsHole();
     if (!bFlag) 
       break;
diff --git a/src/TopClass/TopClass_Classifier2d.gxx b/src/TopClass/TopClass_Classifier2d.gxx
index f690452..fab9520 100644
--- a/src/TopClass/TopClass_Classifier2d.gxx
+++ b/src/TopClass/TopClass_Classifier2d.gxx
@@ -82,12 +82,6 @@ void TopClass_Classifier2d::Compare(const TopClass_GeomEdge& theE,
   nbPoints = myIntersector.NbPoints();
   for (iPoint = 1; iPoint <= nbPoints;  iPoint++)  {
     const IntRes2d_IntersectionPoint& PInter = myIntersector.Point(iPoint);
-    // test for ON
-    if (PInter.TransitionOfFirst().PositionOnCurve() == IntRes2d_Head) {
-      myClosest = iPoint;
-      myState = TopAbs_ON;
-      return;
-    }
     Standard_Real paramfirst = PInter.ParamOnFirst();
     if (paramfirst <  dMin) {
       myClosest = iPoint;
@@ -99,14 +93,8 @@ void TopClass_Classifier2d::Compare(const TopClass_GeomEdge& theE,
   // for the segments we only test the first point
   nbSegments = myIntersector.NbSegments();
   for (iSegment = 1; iSegment <= nbSegments;  iSegment++)  {
-    const IntRes2d_IntersectionSegment& SegInter = 
-      myIntersector.Segment(iSegment);
+    const IntRes2d_IntersectionSegment& SegInter = myIntersector.Segment(iSegment);
     const IntRes2d_IntersectionPoint& PInter = SegInter.FirstPoint();
-    if (PInter.TransitionOfFirst().PositionOnCurve() == IntRes2d_Head) {
-      myClosest = nbPoints + iSegment+  iSegment - 1;
-      myState = TopAbs_ON;
-      return;
-    }
     Standard_Real paramfirst = PInter.ParamOnFirst();
     if (paramfirst <  dMin) {
       myClosest = nbPoints + iSegment+iSegment - 1;
@@ -118,9 +106,10 @@ void TopClass_Classifier2d::Compare(const TopClass_GeomEdge& theE,
   // if no point was found return
   if (myClosest == 0) return;
 
-  if ( ! myFirstCompare ) {
-    Standard_Boolean b = (dMin > myParam);
-    if (b) {
+  if (!myFirstCompare)
+  {
+    if (dMin > myParam)
+    {
       // dMin > myParam : le point le plus proche (dMin) trouve dans CETTE
       // intersection ligne,arete n'est pas le plus proche
       // de TOUS les points d'intersection avec les autres aretes (myParam).
@@ -131,19 +120,20 @@ void TopClass_Classifier2d::Compare(const TopClass_GeomEdge& theE,
   // process the closest point PClosest, found at dMin on line.
   myFirstCompare = Standard_False;
 
-  if(myParam > dMin) {  //-- lbr le 13 mai 96 
-    myFirstTrans = Standard_True; 
-  } 
-  
+  if (myParam > dMin)
+  {  //-- lbr le 13 mai 96 
+    myFirstTrans = Standard_True;
+  }
+
   myParam = dMin;
   const IntRes2d_Transition& T2 = PClosest->TransitionOfSecond();
-//  Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 Begin
-//   Standard_Boolean isHeadorEnd = (T2.PositionOnCurve() == IntRes2d_Head) ||
-//                                  (T2.PositionOnCurve() == IntRes2d_End);
+  //  Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 Begin
+  //   Standard_Boolean isHeadorEnd = (T2.PositionOnCurve() == IntRes2d_Head) ||
+  //                                  (T2.PositionOnCurve() == IntRes2d_End);
   myIsHeadOrEnd = (T2.PositionOnCurve() == IntRes2d_Head) ||
-                  (T2.PositionOnCurve() == IntRes2d_End);
-//  Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 End
-  
+    (T2.PositionOnCurve() == IntRes2d_End);
+  //  Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 End
+
   // transition on the segment
 
   TopAbs_Orientation SegTrans = TopAbs_FORWARD;
@@ -185,44 +175,48 @@ void TopClass_Classifier2d::Compare(const TopClass_GeomEdge& theE,
 
   // are we inside the Edge ?
   //  const IntRes2d_Transition& T2 = PClosest->TransitionOfSecond();
-  if ( ! myIsHeadOrEnd ) {
+  if (!myIsHeadOrEnd)
+  {
     // PClosest is inside the edge
-    switch (SegTrans) {
+    switch (SegTrans)
+    {
 
-    case TopAbs_FORWARD :
-    case TopAbs_EXTERNAL :
+    case TopAbs_FORWARD:
+    case TopAbs_EXTERNAL:
       myState = TopAbs_OUT;
       break;
 
-    case TopAbs_REVERSED :
-    case TopAbs_INTERNAL :
+    case TopAbs_REVERSED:
+    case TopAbs_INTERNAL:
       myState = TopAbs_IN;
       break;
     }
   }
-  else {
+  else
+  {
     // PClosest is Head or End of the edge : update the complex transition
-    gp_Dir2d Tang2d,Norm2d;
+    gp_Dir2d Tang2d, Norm2d;
     Standard_Real Curv;
     if(!GeomLib::LocalGeometry(theE.Get2DCurve().Curve(),
-                               PClosest->ParamOnSecond(),
+                                PClosest->ParamOnSecond(),
                                Tang2d, Norm2d, Curv))
     {
       return;
     }
 
-    gp_Dir Tang(Tang2d.X(),Tang2d.Y(),0.);
-    gp_Dir Norm(Norm2d.X(),Norm2d.Y(),0.);
-    if (myFirstTrans) {
-      gp_Dir D(myLin.Direction().X(),myLin.Direction().Y(),0.);
+    gp_Dir Tang(Tang2d.X(), Tang2d.Y(), 0.);
+    gp_Dir Norm(Norm2d.X(), Norm2d.Y(), 0.);
+    if (myFirstTrans)
+    {
+      gp_Dir D(myLin.Direction().X(), myLin.Direction().Y(), 0.);
       myTrans.Reset(D);
       myFirstTrans = Standard_False;
     }
-    
+
     TopAbs_Orientation Ort;
     if (T2.PositionOnCurve() == IntRes2d_Head) Ort = TopAbs_FORWARD;
     else                                       Ort = TopAbs_REVERSED;
-    myTrans.Compare(RealEpsilon(), Tang, Norm,  Curv, SegTrans, Ort);
+    myTrans.Compare(RealEpsilon(), Tang, Norm, Curv, SegTrans, Ort);
     myState = myTrans.StateBefore();
   }
 }
diff --git a/src/TopOpeBRep/TopOpeBRep_VPointInterClassifier.cxx b/src/TopOpeBRep/TopOpeBRep_VPointInterClassifier.cxx
index 087e8d5..f3361dd 100644
--- a/src/TopOpeBRep/TopOpeBRep_VPointInterClassifier.cxx
+++ b/src/TopOpeBRep/TopOpeBRep_VPointInterClassifier.cxx
@@ -109,7 +109,7 @@ TopAbs_State TopOpeBRep_VPointInterClassifier::VPointPosition
   // intersections est sur une frontiere de la face FF (ON)ou dans la face FF (IN)  
   Standard_Integer VPSI = VP.ShapeIndex();
   if (AssumeINON && FaceClassifyIndex == VPSI) {
-    mySlowFaceClassifier.Perform(FF, p2d, theTol3D);
+    mySlowFaceClassifier.Perform(FF, p2d);
     myState = mySlowFaceClassifier.State();
     if      (myState == TopAbs_ON) {
 //modified by NIZHNY-MKK  Mon Jun 19 11:45:36 2000.BEGIN
@@ -130,7 +130,7 @@ TopAbs_State TopOpeBRep_VPointInterClassifier::VPointPosition
 
   else if (!AssumeINON) {
     if (statefast == TopAbs_OUT || statefast == TopAbs_ON) {
-      mySlowFaceClassifier.Perform(FF, p2d, theTol3D);
+      mySlowFaceClassifier.Perform(FF, p2d);
       myState = mySlowFaceClassifier.State();
       if      (myState == TopAbs_ON) {
 //modified by NIZHNY-MKK  Mon Jun 19 11:45:36 2000.BEGIN
@@ -150,7 +150,7 @@ TopAbs_State TopOpeBRep_VPointInterClassifier::VPointPosition
     //modified by NIZNHY-PKV Mon Feb  5 19:04:01 2001 f
     if (statefast == TopAbs_ON || statefast == TopAbs_OUT) {
     //if (statefast == TopAbs_ON) {
-      mySlowFaceClassifier.Perform(FF, p2d, theTol3D);
+      mySlowFaceClassifier.Perform(FF, p2d);
       myState = mySlowFaceClassifier.State();
       
       if (myState == TopAbs_ON || myState == TopAbs_OUT) {
@@ -248,9 +248,7 @@ static TopAbs_State SlowClassifyOnBoundary(const gp_Pnt& thePointToClassify,
       if(!anEdgePCurve.IsNull()) {
 	gp_Pnt2d aPoint2dOnEdge = anEdgePCurve->Value(aParameterOnEdge);
 
-        // Must be 3D-tolerance. But we keep the current value.
-	Standard_Real aTol2d = thePoint2dToClassify.Distance(aPoint2dOnEdge) / 3;
-	theSlowClassifier.Perform(theFace, thePoint2dToClassify, aTol2d);
+	theSlowClassifier.Perform(theFace, thePoint2dToClassify);
 	if(theSlowClassifier.State() == TopAbs_IN)
 	  return TopAbs_IN;
 	else
diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1.cxx
index 5b06dc9..5629113 100644
--- a/src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1.cxx
+++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1.cxx
@@ -1953,7 +1953,7 @@ static TopAbs_State ClassifyEdgeToFaceByOnePoint(const TopoDS_Edge& E,
 
   C2D -> D0(par, aP2d);
 
-  BRepTopAdaptor_FClass2d FC(F, Precision::Confusion());
+  BRepTopAdaptor_FClass2d FC(F);
   TopAbs_State aState = FC.Perform(aP2d);
 
   return aState;
diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx
index 3b00d39..c2ba8c5 100644
--- a/src/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx
+++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx
@@ -802,7 +802,7 @@ TopOpeBRepBuild_CorrectFace2d::TopOpeBRepBuild_CorrectFace2d()
     BB.MakeFace(newFace, Surf, Loc, myFaceTolerance);
     BB.Add(newFace, aWire);
     
-    BRepTopAdaptor_FClass2d aClass2d(newFace, myFaceTolerance);
+    BRepTopAdaptor_FClass2d aClass2d(newFace);
     TopAbs_State aState=aClass2d.PerformInfinitePoint();
     if (aState==TopAbs_OUT) {
       anOuterWire=aWire;
diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.cxx
index 5c463f4..22396ef 100644
--- a/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.cxx
+++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.cxx
@@ -481,7 +481,7 @@ void TopOpeBRepBuild_Tools::GetNormalInNearestPoint(const TopoDS_Face& F,
 
   
   gp_Pnt2d aP2d(newU, newV);
-  BRepTopAdaptor_FClass2d FC(F, Precision::Confusion());
+  BRepTopAdaptor_FClass2d FC(F);
   TopAbs_State aState = FC.Perform(aP2d);
 
   //point out of face: try to go at another direction
diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_WireEdgeClassifier.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_WireEdgeClassifier.cxx
index e90a907..4ed0faa 100644
--- a/src/TopOpeBRepBuild/TopOpeBRepBuild_WireEdgeClassifier.cxx
+++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_WireEdgeClassifier.cxx
@@ -303,8 +303,7 @@ TopAbs_State  TopOpeBRepBuild_WireEdgeClassifier::CompareShapes
 //      TopoDS_Face F1 = TopoDS::Face(ftmp.EmptyCopied());
       BB.Add(F1,TopoDS::Wire(B1));
 
-      const Standard_Real tolF1 = BRep_Tool::Tolerance(F1);
-      BRepClass_FaceClassifier Fclass(F1, p2d, tolF1);
+      BRepClass_FaceClassifier Fclass(F1, p2d);
       state = Fclass.State();
       return state;
     } // ex2	
diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx
index 32e37d6..0d501bf 100644
--- a/src/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx
+++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx
@@ -96,8 +96,7 @@ static Standard_Integer FUN_getAncestorFsp(TopOpeBRepBuild_Builder& B,TopOpeBRep
       if (!ok) return 0;
       Standard_Real tolf = BRep_Tool::Tolerance(f)*1.e1;
       if (dd > tolf) return 0;
-      Standard_Real  TolClass  = 1e-8;
-      BRepTopAdaptor_FClass2d FClass2d(f,TolClass);
+      BRepTopAdaptor_FClass2d FClass2d(f);
       st = FClass2d.Perform(p2d);
     }
     if (st == TopAbs_IN) {
diff --git a/src/TopOpeBRepTool/TopOpeBRepTool_CLASSI.cxx b/src/TopOpeBRepTool/TopOpeBRepTool_CLASSI.cxx
index fa5977d..a1ee560 100644
--- a/src/TopOpeBRepTool/TopOpeBRepTool_CLASSI.cxx
+++ b/src/TopOpeBRepTool/TopOpeBRepTool_CLASSI.cxx
@@ -257,7 +257,7 @@ Standard_Integer TopOpeBRepTool_CLASSI::Classip2d(const TopoDS_Shape& S1, const
   // recall : ffi1 and ffi2 are built on same face 
   // => ffi1(u1,v1) = ffi2(u1,v1)
   // ----------------------------
-  BRepClass_FaceClassifier class2(ffi2,p2d1,BRep_Tool::Tolerance(ffi2));
+  BRepClass_FaceClassifier class2(ffi2,p2d1);
   TopAbs_State sta12 = class2.State();
   
   // staffi12 : only if !bnd2dUNK and stabnd2d12!=DIFF
@@ -295,7 +295,7 @@ Standard_Integer TopOpeBRepTool_CLASSI::Classip2d(const TopoDS_Shape& S1, const
     gp_Pnt2d p2d2(u2,v2);
 
     // sta21 : 
-    BRepClass_FaceClassifier class1(ffi1,p2d2,BRep_Tool::Tolerance(ffi1));
+    BRepClass_FaceClassifier class1(ffi1,p2d2);
     TopAbs_State sta21 = class1.State();
 
     if (bnd2dUNK) {
diff --git a/src/TopOpeBRepTool/TopOpeBRepTool_ShapeClassifier.cxx b/src/TopOpeBRepTool/TopOpeBRepTool_ShapeClassifier.cxx
index 5a997af..32d6196 100644
--- a/src/TopOpeBRepTool/TopOpeBRepTool_ShapeClassifier.cxx
+++ b/src/TopOpeBRepTool/TopOpeBRepTool_ShapeClassifier.cxx
@@ -570,8 +570,7 @@ void TopOpeBRepTool_ShapeClassifier::StateP2DReference
       myP2Ddef = Standard_True;
       TopoDS_Face F = TopoDS::Face(myRef);
       F.Orientation(TopAbs_FORWARD);
-      Standard_Real  TolClass  = 1e-8;
-      BRepTopAdaptor_FClass2d FClass2d(F,TolClass);
+      BRepTopAdaptor_FClass2d FClass2d(F);
       myState = FClass2d.Perform(P2D);
     }
   }
diff --git a/src/TopOpeBRepTool/TopOpeBRepTool_face.cxx b/src/TopOpeBRepTool/TopOpeBRepTool_face.cxx
index cf6ac64..1f84da4 100644
--- a/src/TopOpeBRepTool/TopOpeBRepTool_face.cxx
+++ b/src/TopOpeBRepTool/TopOpeBRepTool_face.cxx
@@ -70,7 +70,7 @@ Standard_Boolean TopOpeBRepTool_face::Init(const TopoDS_Wire& W, const TopoDS_Fa
   B.NaturalRestriction(fres,Standard_True);
 
   // <myfinite> :
-  BRepTopAdaptor_FClass2d FClass(fres, gp::Resolution());
+  BRepTopAdaptor_FClass2d FClass(fres);
   Standard_Boolean infinite = ( FClass.PerformInfinitePoint() == TopAbs_IN);
   myfinite = !infinite;
 
diff --git a/tests/bugs/modalg_6/bug27341_206 b/tests/bugs/modalg_6/bug27341_206
index dbad2ca..97a27a5 100644
--- a/tests/bugs/modalg_6/bug27341_206
+++ b/tests/bugs/modalg_6/bug27341_206
@@ -10,6 +10,38 @@ pload QAcommands
 
 restore [locate_data_file bug27341_hlrsave.brep] a
 
+explode a e;
+settolerance a_1 0.0000021000339414;
+settolerance a_9 0.0292972692933250;
+settolerance a_10 0.0000002916965956;
+settolerance a_12 0.0000077920795432;
+settolerance a_13 0.0009028909492925;
+settolerance a_14 0.0000008274847338;
+settolerance a_17 0.0000008447770235;
+settolerance a_19 0.0000044295408259;
+settolerance a_20 0.0000100105285272;
+settolerance a_22 0.0000159439495211;
+settolerance a_24 0.0004647375083553;
+settolerance a_25 0.0001235473526579;
+settolerance a_36 0.0000162166464122;
+settolerance a_38 0.0000024439908281;
+settolerance a_40 0.0000011938708148;
+settolerance a_42 0.0000147730124361;
+settolerance a_47 0.0000043348203081;
+settolerance a_49 0.0000015226955713;
+settolerance a_53 0.0000023619760706;
+settolerance a_55 0.0000008330183006;
+settolerance a_57 0.0000020829809516;
+settolerance a_59 0.0000018887181754;
+settolerance a_68 0.0000041414226306;
+settolerance a_71 0.0000016407524197;
+settolerance a_74 0.0010850265544331;
+settolerance a_75 0.0011543720476056;
+settolerance a_76 0.0000994972083569;
+settolerance a_77 0.0000017519416749;
+settolerance a_78 0.0000801275736206;
+
+
 set viewname "left"
 
 smallview
diff --git a/tests/lowalgos/classifier/bug23849_2 b/tests/lowalgos/classifier/bug23849_2
index 504542b..a48b539 100644
--- a/tests/lowalgos/classifier/bug23849_2
+++ b/tests/lowalgos/classifier/bug23849_2
@@ -9,15 +9,24 @@ puts ""
 set BugNumber OCC23849
 
 restore [locate_data_file bug23849_segment_1.brep] b1
+btolx b1
+checkshape b1
+
+puts [tolerance b1]
+
 explode b1 f
+copy b1_1 result
 
-point p2D 4.1882396063720497 50.643343428894831
+point pp 4.1882396063720497 50.643343428894831
 
-set info [b2dclassify b1_1 p2D]
-set check [regexp "IN" $info]
+if { ![regexp {ON} [ b2dclassifx result pp] ] } {
+    puts "Error : Wrong result of 2d classifier algorithm"
+} else {
+    puts "OK : Good result of 2d classifier algorithm"
+}
 
-if { ${check} == 1 } {
-    puts "OK ${BugNumber}"
+if { ![regexp {ON} [ b2dclassify result pp] ] } {
+    puts "Error : Wrong result of 2d classifier algorithm"
 } else {
-    puts "Faulty ${BugNumber}"
+    puts "OK : Good result of 2d classifier algorithm"
 }
diff --git a/tests/lowalgos/classifier/bug29203_1 b/tests/lowalgos/classifier/bug29203_1
index fc68faa..7d88dda 100644
--- a/tests/lowalgos/classifier/bug29203_1
+++ b/tests/lowalgos/classifier/bug29203_1
@@ -3,7 +3,7 @@ puts "OCC29203"
 puts "========"
 puts ""
 #################################################
-# Different Point-Face-classification algorithms return different results
+# Ambiguous behavior of Point-Face-classification algorithms: shall it return ON-status?
 #################################################
 
 # There is a dangerous to return ON-status by the reason
diff --git a/tests/lowalgos/classifier/bug29203_2 b/tests/lowalgos/classifier/bug29203_2
index 103e98d..f622ba9 100644
--- a/tests/lowalgos/classifier/bug29203_2
+++ b/tests/lowalgos/classifier/bug29203_2
@@ -3,7 +3,7 @@ puts "OCC29203"
 puts "========"
 puts ""
 #################################################
-# Different Point-Face-classification algorithms return different results
+# Ambiguous behavior of Point-Face-classification algorithms: shall it return ON-status?
 #################################################
 
 # 3D-representation of the source point is in the 
@@ -14,6 +14,7 @@ puts ""
 # ON-status in these cases.
 
 restore [locate_data_file bug29203_toron.brep] result
+fixshape result result
 checkshape result
 
 point pp 1.6881493482012555 3.9044196877163997
diff --git a/tests/lowalgos/classifier/bug538 b/tests/lowalgos/classifier/bug538
index 313371a..4da9857 100644
--- a/tests/lowalgos/classifier/bug538
+++ b/tests/lowalgos/classifier/bug538
@@ -3,7 +3,11 @@ puts "OCC538"
 puts "================"
 puts ""
 
+# The point is in the corespond
+# edge with tolerance criterium.
+
 restore [locate_data_file OCC538.brep] result 
+btolx result
 checkshape result
 
 puts [tolerance result]
@@ -22,13 +26,13 @@ if { ![regexp {ON} [ b2dclassify result pp] ] } {
     puts "OK : Good result of 2d classifier algorithm"
 }
 
-if { ![regexp {IN} [ b2dclassifx result pp -t 1.0e-7] ] } {
+if { ![regexp {ON} [ b2dclassifx result pp -t 1.0e-7] ] } {
     puts "Error : Wrong result of 2d classifier algorithm"
 } else {
     puts "OK : Good result of 2d classifier algorithm"
 }
 
-if { ![regexp {IN} [ b2dclassify result pp -t 1.0e-7] ] } {
+if { ![regexp {ON} [ b2dclassify result pp -t 1.0e-7] ] } {
     puts "Error : Wrong result of 2d classifier algorithm"
 } else {
     puts "OK : Good result of 2d classifier algorithm"
-- 
1.9.5.msysgit.0

