diff --git "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\BRepMesh\\BRepMesh_DiscretFactory.hxx" "b/D:\\dev-tools\\opencascade-7.3.0\\src\\BRepMesh\\BRepMesh_DiscretFactory.hxx"
index a5f47d3..63688c6 100644
--- "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\BRepMesh\\BRepMesh_DiscretFactory.hxx"
+++ "b/D:\\dev-tools\\opencascade-7.3.0\\src\\BRepMesh\\BRepMesh_DiscretFactory.hxx"
@@ -89,9 +89,11 @@ public:
   //! @param theShape shape to be meshed.
   //! @param theLinDeflection linear deflection to be used for meshing.
   //! @param theAngDeflection angular deflection to be used for meshing.
+  //! @param theTDOldBehavior tangential deflection behavior for default algorithm.
   Standard_EXPORT Handle(BRepMesh_DiscretRoot) Discret(const TopoDS_Shape& theShape,
                                                        const Standard_Real theLinDeflection,
-                                                       const Standard_Real theAngDeflection);
+                                                       const Standard_Real theAngDeflection,
+                                                       const Standard_Boolean theTDOldBehavior = Standard_True);
 
 protected:
diff --git "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\BRepMesh\\BRepMesh_DiscretFactory.cxx" "b/D:\\dev-tools\\opencascade-7.3.0\\src\\BRepMesh\\BRepMesh_DiscretFactory.cxx"
index 50e7d58..fb3cf58 100644
--- "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\BRepMesh\\BRepMesh_DiscretFactory.cxx"
+++ "b/D:\\dev-tools\\opencascade-7.3.0\\src\\BRepMesh\\BRepMesh_DiscretFactory.cxx"
@@ -171,7 +171,8 @@ Standard_Boolean BRepMesh_DiscretFactory::SetDefault(
 Handle(BRepMesh_DiscretRoot) BRepMesh_DiscretFactory::Discret(
   const TopoDS_Shape& theShape,
   const Standard_Real theDeflection,
-  const Standard_Real theAngle)
+  const Standard_Real theAngle,
+  const Standard_Boolean theTDOldBehavior)
 {
   Handle(BRepMesh_DiscretRoot) aDiscretRoot;
   BRepMesh_DiscretRoot* anInstancePtr = NULL;
@@ -192,7 +193,7 @@ Handle(BRepMesh_DiscretRoot) BRepMesh_DiscretFactory::Discret(
   {
     // use built-in
     BRepMesh_IncrementalMesh::Discret (theShape, 
-      theDeflection, theAngle, anInstancePtr);
+      theDeflection, theAngle, theTDOldBehavior, anInstancePtr);
   }
 
   // cover with handle
diff --git "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\BRepMesh\\BRepMesh_FastDiscret.hxx" "b/D:\\dev-tools\\opencascade-7.3.0\\src\\BRepMesh\\BRepMesh_FastDiscret.hxx"
index 3db6fee..55c4045 100644
--- "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\BRepMesh\\BRepMesh_FastDiscret.hxx"
+++ "b/D:\\dev-tools\\opencascade-7.3.0\\src\\BRepMesh\\BRepMesh_FastDiscret.hxx"
@@ -68,7 +68,8 @@ public:
      Relative(Standard_False),
      AdaptiveMin(Standard_False),
      InternalVerticesMode(Standard_True),
-     ControlSurfaceDeflection(Standard_True)
+     ControlSurfaceDeflection(Standard_True),
+     TDOldBehavior(Standard_True)
      {
      }
     
@@ -103,6 +104,10 @@ public:
     //! Prameter to check the deviation of triangulation and interior of
     //! the face
     Standard_Boolean                                 ControlSurfaceDeflection;
+
+    //! Prameter to set tangential deflection behavior
+    //! (old - for backward compatibility, may produce incorrect results in several cases)
+    Standard_Boolean                                 TDOldBehavior;
   };
 
 public:
diff --git "a/D:\\dev-tools\\opencascade-7.3.0-original\\BRepMesh\\BRepMesh_IncrementalMesh.cxx" "b/D:\\dev-tools\\opencascade-7.3.0\\src\\BRepMesh\\BRepMesh_IncrementalMesh.cxx"
index 70278be..07095ad 100644
--- "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\BRepMesh\\BRepMesh_IncrementalMesh.cxx"
+++ "b/D:\\dev-tools\\opencascade-7.3.0\\src\\BRepMesh\\BRepMesh_IncrementalMesh.cxx"
@@ -84,7 +84,8 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh( const TopoDS_Shape&    theSh
                                                     const Standard_Boolean isRelative,
                                                     const Standard_Real    theAngDeflection,
                                                     const Standard_Boolean isInParallel,
-                                                    const Standard_Boolean adaptiveMin)
+                                                    const Standard_Boolean adaptiveMin,
+                                                    const Standard_Boolean theTdOldBehavior)
 : myMaxShapeSize(0.),
   myModified(Standard_False),
   myStatus(0)
@@ -94,6 +95,7 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh( const TopoDS_Shape&    theSh
   myParameters.Angle = theAngDeflection;
   myParameters.InParallel = isInParallel;
   myParameters.AdaptiveMin = adaptiveMin;
+  myParameters.TDOldBehavior = theTdOldBehavior;
 
   myShape = theShape;
   Perform();
@@ -262,7 +264,7 @@ void BRepMesh_IncrementalMesh::discretizeFreeEdges()
     BRepAdaptor_Curve aCurve(aEdge);
     GCPnts_TangentialDeflection aDiscret(aCurve, aCurve.FirstParameter(),
       aCurve.LastParameter(), myParameters.Angle, aEdgeDeflection, 2,
-      Precision::PConfusion(), myParameters.MinSize);
+      Precision::PConfusion(), myParameters.MinSize, myParameters.TDOldBehavior);
 
     Standard_Integer aNodesNb = aDiscret.NbPoints();
     TColgp_Array1OfPnt   aNodes  (1, aNodesNb);
@@ -572,6 +574,23 @@ Standard_Integer BRepMesh_IncrementalMesh::Discret(
   return 0; // no error
 }
 
+Standard_Integer BRepMesh_IncrementalMesh::Discret(
+  const TopoDS_Shape&    theShape,
+  const Standard_Real    theDeflection,
+  const Standard_Real    theAngle,
+  const Standard_Boolean theTdOldBehavior,
+  BRepMesh_DiscretRoot* &theAlgo)
+{
+    BRepMesh_IncrementalMesh* anAlgo = new BRepMesh_IncrementalMesh();
+    anAlgo->ChangeParameters().Deflection = theDeflection;
+    anAlgo->ChangeParameters().Angle = theAngle;
+    anAlgo->ChangeParameters().InParallel = IS_IN_PARALLEL;
+    anAlgo->ChangeParameters().TDOldBehavior = theTdOldBehavior;
+    anAlgo->SetShape(theShape);
+    theAlgo = anAlgo;
+    return 0; // no error
+}
+
 //=======================================================================
 //function : IsParallelDefault
 //purpose  :
diff --git "a/D:\\dev-tools\\opencascade-7.3.0-original\\BRepMesh\\BRepMesh_IncrementalMesh.hxx" "b/D:\\dev-tools\\opencascade-7.3.0\\src\\BRepMesh\\BRepMesh_IncrementalMesh.hxx"
index 5e7d4f3..d0a132c 100644
--- "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\BRepMesh\\BRepMesh_IncrementalMesh.hxx"
+++ "b/D:\\dev-tools\\opencascade-7.3.0\\src\\BRepMesh\\BRepMesh_IncrementalMesh.hxx"
@@ -57,7 +57,8 @@ public: //! @name mesher API
     const Standard_Boolean isRelative = Standard_False,
     const Standard_Real    theAngDeflection = 0.5,
     const Standard_Boolean isInParallel = Standard_False,
-    const Standard_Boolean adaptiveMin = Standard_False);  
+    const Standard_Boolean adaptiveMin = Standard_False,
+    const Standard_Boolean theTdOldBehavior = Standard_True);
 
   //! Constructor.
   //! Automatically calls method Perform.
@@ -108,6 +109,19 @@ public: //! @name plugin API
                                                   const Standard_Real    theLinDeflection,
                                                   const Standard_Real    theAngDeflection,
                                                   BRepMesh_DiscretRoot* &theAlgo);
+
+  //! Plugin interface for the Mesh Factories.
+  //! Initializes meshing algorithm with the given parameters.
+  //! @param theShape shape to be meshed.
+  //! @param theLinDeflection linear deflection.
+  //! @param theAngDeflection angular deflection.
+  //! @param theTdOldBehavior angle comparison mode for tangential deflection
+  //! @param[out] theAlgo pointer to initialized algorithm.
+  Standard_EXPORT static Standard_Integer Discret(const TopoDS_Shape&    theShape,
+                                                  const Standard_Real    theLinDeflection,
+                                                  const Standard_Real    theAngDeflection,
+                                                  const Standard_Boolean theTdOldBehavior,
+                                                  BRepMesh_DiscretRoot* &theAlgo);
   
   //! Returns multi-threading usage flag set by default in 
   //! Discret() static method (thus applied only to Mesh Factories).
diff --git "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\GCPnts\\GCPnts_TangentialDeflection.cxx" "b/D:\\dev-tools\\opencascade-7.3.0\\src\\GCPnts\\GCPnts_TangentialDeflection.cxx"
index 7019e58..261da50 100644
--- "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\GCPnts\\GCPnts_TangentialDeflection.cxx"
+++ "b/D:\\dev-tools\\opencascade-7.3.0\\src\\GCPnts\\GCPnts_TangentialDeflection.cxx"
@@ -67,11 +67,11 @@ static void D2 (const Adaptor2d_Curve2d& C, const Standard_Real U,
 static Standard_Real EstimAngl(const gp_Pnt& P1, const gp_Pnt& Pm, const gp_Pnt& P2)
 {
   gp_Vec V1(P1, Pm), V2(Pm, P2);
-  Standard_Real L = V1.Magnitude() * V2.Magnitude();
+  Standard_Real L = Sqrt(V1.SquareMagnitude() * V2.SquareMagnitude());
   //
   if(L > gp::Resolution())
   {
-    return V1.CrossMagnitude(V2)/L;
+    return V1.Dot(V2) / L;
   }
   else
   {
@@ -79,6 +79,21 @@ static Standard_Real EstimAngl(const gp_Pnt& P1, const gp_Pnt& Pm, const gp_Pnt&
   }
 }
 
+static Standard_Real EstimAnglOld(const gp_Pnt& P1, const gp_Pnt& Pm, const gp_Pnt& P2)
+{
+    gp_Vec V1(P1, Pm), V2(Pm, P2);
+    Standard_Real L = Sqrt(V1.SquareMagnitude() * V2.SquareMagnitude());
+    //
+    if(L > gp::Resolution())
+    {
+        return V1.CrossMagnitude(V2) / L;
+    }
+    else
+    {
+        return 0.;
+    }
+}
+
 
 // Return number of interval of continuity on which theParam is located.
 // Last parameter is used to increase search speed.
diff --git "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\GCPnts\\GCPnts_TangentialDeflection.hxx" "b/D:\\dev-tools\\opencascade-7.3.0\\src\\GCPnts\\GCPnts_TangentialDeflection.hxx"
index 0e66213..2d97520 100644
--- "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\GCPnts\\GCPnts_TangentialDeflection.hxx"
+++ "b/D:\\dev-tools\\opencascade-7.3.0\\src\\GCPnts\\GCPnts_TangentialDeflection.hxx"
@@ -75,21 +75,21 @@ public:
   
   Standard_EXPORT GCPnts_TangentialDeflection();
   
-  Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor3d_Curve& C, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
+  Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor3d_Curve& C, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7, const Standard_Boolean ACompOldBehavior = Standard_False);
   
-  Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor3d_Curve& C, const Standard_Real FirstParameter, const Standard_Real LastParameter, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
+  Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor3d_Curve& C, const Standard_Real FirstParameter, const Standard_Real LastParameter, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7, const Standard_Boolean ACompOldBehavior = Standard_False);
   
-  Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor2d_Curve2d& C, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
+  Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor2d_Curve2d& C, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7, const Standard_Boolean ACompOldBehavior = Standard_False);
   
-  Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor2d_Curve2d& C, const Standard_Real FirstParameter, const Standard_Real LastParameter, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
+  Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor2d_Curve2d& C, const Standard_Real FirstParameter, const Standard_Real LastParameter, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7, const Standard_Boolean ACompOldBehavior = Standard_False);
   
-  Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
+  Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7, const Standard_Boolean ACompOldBehavior = Standard_False);
   
-  Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real FirstParameter, const Standard_Real LastParameter, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
+  Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real FirstParameter, const Standard_Real LastParameter, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7, const Standard_Boolean ACompOldBehavior = Standard_False);
   
-  Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
+  Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7, const Standard_Boolean ACompOldBehavior = Standard_False);
   
-  Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real FirstParameter, const Standard_Real LastParameter, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
+  Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real FirstParameter, const Standard_Real LastParameter, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7, const Standard_Boolean ACompOldBehavior = Standard_False);
   
   //! Add point to already calculated points (or replace existing)
   //! Returns index of new added point
@@ -110,6 +110,12 @@ public:
   {
     return points.Value (I);
   }
+
+  //! Returns if the old behavior for angle comparison (based on sin) or the new one (based on cos) should be used.
+  Standard_Boolean ACompOldBehavior()
+  {
+      return aCompOldBehavior;
+  }
   
   //! Computes angular step for the arc using the given parameters.
   Standard_EXPORT static Standard_Real ArcAngularStep (const Standard_Real theRadius, const Standard_Real theLinearDeflection, const Standard_Real theAngularDeflection, const Standard_Real theMinLength);
@@ -148,6 +154,7 @@ private:
   Standard_Real firstu;
   TColgp_SequenceOfPnt points;
   TColStd_SequenceOfReal parameters;
+  Standard_Boolean aCompOldBehavior;
 };
 
 #endif // _GCPnts_TangentialDeflection_HeaderFile
diff --git "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\GCPnts\\GCPnts_TangentialDeflection.pxx" "b/D:\\dev-tools\\opencascade-7.3.0\\src\\GCPnts\\GCPnts_TangentialDeflection.pxx"
index b4838d3..420ecef 100644
--- "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\GCPnts\\GCPnts_TangentialDeflection.pxx"
+++ "b/D:\\dev-tools\\opencascade-7.3.0\\src\\GCPnts\\GCPnts_TangentialDeflection.pxx"
@@ -42,7 +42,7 @@ void GCPnts_TangentialDeflection::EvaluateDu (
     Standard_Real Lc = N.CrossMagnitude (T);
     Standard_Real Ln = Lc/Lt;
     if (Ln > LTol) {
-      Du = sqrt (8.0 * Max(curvatureDeflection, myMinLen) / Ln);
+      Du = Sqrt (8.0 * Max(curvatureDeflection, myMinLen) / Ln);
       NotDone = Standard_False;
     }
   }
@@ -60,10 +60,11 @@ GCPnts_TangentialDeflection::GCPnts_TangentialDeflection (
  const Standard_Real    CurvatureDeflection,
  const Standard_Integer MinimumOfPoints,
  const Standard_Real    UTol,
- const Standard_Real    theMinLen)
+ const Standard_Real    theMinLen, 
+ const Standard_Boolean ACompOldBehavior)
 
 { 
-  Initialize (C,AngularDeflection,CurvatureDeflection,MinimumOfPoints,UTol,theMinLen); 
+  Initialize (C,AngularDeflection,CurvatureDeflection,MinimumOfPoints,UTol,theMinLen, ACompOldBehavior);
 }
 
 
@@ -80,7 +81,8 @@ GCPnts_TangentialDeflection::GCPnts_TangentialDeflection (
  const Standard_Real    CurvatureDeflection,
  const Standard_Integer MinimumOfPoints,
  const Standard_Real    UTol,
- const Standard_Real    theMinLen)
+ const Standard_Real    theMinLen,
+ const Standard_Boolean ACompOldBehavior)
 
 { 
   Initialize (C, 
@@ -89,7 +91,8 @@ GCPnts_TangentialDeflection::GCPnts_TangentialDeflection (
         AngularDeflection, 
         CurvatureDeflection, 
         MinimumOfPoints,
-        UTol, theMinLen);
+        UTol, theMinLen,
+        ACompOldBehavior);
 }
 
 
@@ -105,7 +108,8 @@ void GCPnts_TangentialDeflection::Initialize (
  const Standard_Real    CurvatureDeflection,
  const Standard_Integer MinimumOfPoints,
  const Standard_Real    UTol,
- const Standard_Real    theMinLen)
+ const Standard_Real    theMinLen,
+ const Standard_Boolean ACompOldBehavior)
 
 {
   Initialize (C, 
@@ -114,7 +118,8 @@ void GCPnts_TangentialDeflection::Initialize (
               AngularDeflection, 
               CurvatureDeflection,
               MinimumOfPoints,
-              UTol, theMinLen);
+              UTol, theMinLen,
+              ACompOldBehavior);
 }
 
 
@@ -131,12 +136,14 @@ void GCPnts_TangentialDeflection::Initialize (
  const Standard_Real    CurvatureDeflection,
  const Standard_Integer MinimumOfPoints,
  const Standard_Real    UTol,
- const Standard_Real    theMinLen)
+ const Standard_Real    theMinLen,
+ const Standard_Boolean ACompOldBehavior)
 
 {
   
   Standard_ConstructionError_Raise_if (CurvatureDeflection <= Precision::Confusion () || AngularDeflection   <= Precision::Angular (), "GCPnts_TangentialDeflection::Initialize - Zero Deflection")
 
+ aCompOldBehavior = ACompOldBehavior;
  parameters.Clear ();
  points    .Clear ();
  if (FirstParameter < LastParameter) {
@@ -195,9 +202,9 @@ void GCPnts_TangentialDeflection::PerformLinear (const TheCurve& C) {
   parameters.Append (firstu);
   points    .Append (P);
   if (minNbPnts > 2) {
-    Standard_Real Du = (lastu - firstu) / minNbPnts;
+    Standard_Real Du = (lastu - firstu) / (minNbPnts - 1);
     Standard_Real U = firstu + Du;
-    for (Standard_Integer i = 2; i <= minNbPnts; i++) {
+    for (Standard_Integer i = 2; i < minNbPnts; i++) {
       D0 (C, U, P);
       parameters.Append (U);
       points    .Append (P);
@@ -287,18 +294,19 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
     {
       //Si c'est une droite on verifie en calculant minNbPoints :
       Standard_Boolean IsLine   = Standard_True;
+      Standard_Boolean IsSequential = Standard_True;
       Standard_Integer NbPoints = (minNbPnts > 3) ? minNbPnts : 3;
       switch (C.GetType()) {
       case GeomAbs_BSplineCurve:
         {
           Handle_TheBSplineCurve BS = C.BSpline() ;
-          NbPoints = Max(BS->Degree() + 1, NbPoints);
+          NbPoints = Max(BS->NbPoles(), Max(BS->Degree() + 1, NbPoints));
           break;
         }
       case GeomAbs_BezierCurve:
         {
           Handle_TheBezierCurve  BZ = C.Bezier();
-          NbPoints = Max(BZ->Degree() + 1, NbPoints);
+          NbPoints = Max(BZ->NbPoles(), Max(BZ->Degree() + 1, NbPoints));
           break;
         }
       default:
@@ -325,8 +333,9 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
           Intervs(i + 1) = lastu;
         }
 
-        Standard_Real delta = (Intervs(i+1) - Intervs(i))/NbPoints;
-        for (j = 1; j <= NbPoints && IsLine; ++j)
+        Standard_Real delta = (Intervs(i+1) - Intervs(i))/(NbPoints-1);
+
+        for (j = 1; j < NbPoints && IsLine; ++j)
         {
           param = Intervs(i) + j*delta;
           D0 (C, param, MiddlePoint);
@@ -336,6 +345,12 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
           {
             const Standard_Real aAngle = V2.CrossMagnitude(V1)/(L1*L2);
             IsLine = (aAngle < ATol);
+
+            if(IsLine && IsSequential)
+            {
+                gp_XYZ V3 = LastPoint.XYZ() - MiddlePoint.XYZ();
+                IsSequential = (V3.Dot(V2) >= 0.0);
+            }
           }
         }
       }
@@ -345,7 +360,18 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
         parameters.Clear();
         points    .Clear();
 
+        const Standard_Integer oldMinNbPoints = minNbPnts;
+        if(!IsSequential)
+        {
+            minNbPnts = NbPoints;
+        }
+
         PerformLinear(C);
+
+        if(!IsSequential)
+        {
+            minNbPnts = oldMinNbPoints;
+        }
         return;
       }
       else
@@ -389,6 +415,7 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
   Standard_Boolean MorePoints = Standard_True;
   Standard_Real U2            = firstu;   
   Standard_Real AngleMax      = angularDeflection * 0.5;  //car on prend le point milieu
+  Standard_Real MinLen2       = myMinLen * myMinLen;
   Standard_Integer aIdx[2] = {Intervs.Lower(), Intervs.Lower()}; // Indexes of intervals of U1 and U2, used to handle non-uniform case.
   Standard_Boolean isNeedToCheck = Standard_False;
   gp_Pnt aPrevPoint = points.Last();
@@ -432,17 +459,17 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
 
       V1 = (CurrentPoint.XYZ() - aPrevPoint.XYZ()); //Critere de fleche
       V2 = (MiddlePoint.XYZ()  - aPrevPoint.XYZ());
-      L1 = V1.Modulus ();
+      L1 = V1.SquareModulus ();
 
-      FCoef = (L1 > myMinLen) ? 
-        V1.CrossMagnitude(V2)/(L1*curvatureDeflection) : 0.0;
+      FCoef = (L1 > MinLen2) ?
+        V1.CrossMagnitude(V2)/(Sqrt(L1)*curvatureDeflection) : 0.0;
 
       V1 = (CurrentPoint.XYZ() - MiddlePoint.XYZ()); //Critere d'angle
-      L1 = V1.Modulus ();
-      L2 = V2.Modulus ();
-      if (L1 > myMinLen && L2 > myMinLen)
+      L1 = V1.SquareModulus ();
+      L2 = V2.SquareModulus ();
+      if (L1 > MinLen2 && L2 > MinLen2)
       {
-        Standard_Real angg = V1.CrossMagnitude(V2) / (L1 * L2);
+        Standard_Real angg = V1.CrossMagnitude(V2) / Sqrt(L1 * L2);
         ACoef = angg / AngleMax;
       }
       else
@@ -585,8 +612,10 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
     }
   }
   //Additional check for intervals
-  Standard_Real MinLen2 = myMinLen * myMinLen;
   Standard_Integer MaxNbp = 10 * Nbp;
+
+  const Standard_Real AngleMaxFixed = aCompOldBehavior ? AngleMax : Sqrt(1.0 - AngleMax * AngleMax);
+
   for(i = 1; i < Nbp; ++i)
   {
     U1 = parameters(i);
@@ -594,13 +623,14 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
     // Check maximal deflection on interval;
     Standard_Real dmax = 0.;
     Standard_Real umax = 0.;
-    Standard_Real amax = 0.;
     EstimDefl(C, U1, U2, dmax, umax);
     const gp_Pnt& P1 = points(i);
     const gp_Pnt& P2 = points(i+1);
     D0(C, umax, MiddlePoint);
-    amax = EstimAngl(P1, MiddlePoint, P2);
-    if(dmax > curvatureDeflection || amax > AngleMax)
+
+    Standard_Real amax = aCompOldBehavior ? EstimAnglOld(P1, MiddlePoint, P2) : EstimAngl(P1, MiddlePoint, P2);
+
+    if(dmax > curvatureDeflection || AngleMaxFixed - amax > ATol)
     {
       if(umax - U1 > uTol && U2 - umax > uTol)
       {
@@ -638,7 +668,7 @@ void GCPnts_TangentialDeflection::EstimDefl (const TheCurve& C,
   Standard_Real reltol = Max(1.e-3, 2.*uTol/((Abs(U1) + Abs(U2))));
   //
   math_BrentMinimum anOptLoc(reltol, aNbIter, uTol);
-  anOptLoc.Perform(aFunc, U1, (U1+U2)/2., U2);
+  anOptLoc.Perform(aFunc, U1, (U1+U2)*0.5, U2);
   if(anOptLoc.IsDone())
   {
     MaxDefl = Sqrt(-anOptLoc.Minimum());
diff --git "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\IVtkOCC\\IVtkOCC_ShapeMesher.cxx" "b/D:\\dev-tools\\opencascade-7.3.0\\src\\IVtkOCC\\IVtkOCC_ShapeMesher.cxx"
index fb9afad..66a309f 100644
--- "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\IVtkOCC\\IVtkOCC_ShapeMesher.cxx"
+++ "b/D:\\dev-tools\\opencascade-7.3.0\\src\\IVtkOCC\\IVtkOCC_ShapeMesher.cxx"
@@ -128,7 +128,8 @@ void IVtkOCC_ShapeMesher::meshShape()
     Handle(BRepMesh_DiscretRoot) anAlgo;
     anAlgo = BRepMesh_DiscretFactory::Get().Discret (anOcctShape,
                                                      aDeflection,
-                                                     GetDeviationAngle());
+                                                     GetDeviationAngle(),
+                                                     GetTDOldBehavior());
     if (!anAlgo.IsNull())
     {
       anAlgo->Perform();
@@ -455,12 +456,13 @@ static void FindLimits (const Adaptor3d_Curve& theCurve,
 //! @param [in] theU2 maximal curve parameter value
 //! @param [out] thePoints the container for generated polyline
 //================================================================
-static void DrawCurve (Adaptor3d_Curve&    theCurve,
-                       const Standard_Real theDeflection,
-                       const Standard_Real theAngle,
-                       const Standard_Real theU1,
-                       const Standard_Real theU2,
-                       IVtk_Polyline&      thePoints)
+static void DrawCurve (Adaptor3d_Curve&       theCurve,
+                       const Standard_Real    theDeflection,
+                       const Standard_Real    theAngle,
+                       const Standard_Boolean theTDOldBehavior,
+                       const Standard_Real    theU1,
+                       const Standard_Real    theU2,
+                       IVtk_Polyline&         thePoints)
 {
   switch (theCurve.GetType())
   {
@@ -493,7 +495,7 @@ static void DrawCurve (Adaptor3d_Curve&    theCurve,
           anU1 = Max(anU1, anU1);
           anU2 = Min(anU2, anU2);
 
-          GCPnts_TangentialDeflection anAlgo (theCurve, anU1, anU2, theAngle, theDeflection);
+          GCPnts_TangentialDeflection anAlgo (theCurve, anU1, anU2, theAngle, theDeflection, theTDOldBehavior);
           NumberOfPoints = anAlgo.NbPoints();
 
           if (NumberOfPoints > 0)
@@ -766,7 +768,7 @@ void IVtkOCC_ShapeMesher::buildIsoLines (const Handle(BRepAdaptor_HSurface)& the
         if (aB2 - aB1 > Precision::Confusion())
         {
           IVtk_Polyline aPoints;
-          DrawCurve (aGeomCurve, aDeflection, anAngle, aB1, aB2, aPoints);
+          DrawCurve (aGeomCurve, aDeflection, anAngle, GetTDOldBehavior(), aB1, aB2, aPoints);
           thePolylines.Append (aPoints);
         }
       }
@@ -784,7 +786,7 @@ void IVtkOCC_ShapeMesher::buildIsoLines (const Handle(BRepAdaptor_HSurface)& the
         if (aB2 - aB1>Precision::Confusion())
         {
           IVtk_Polyline aPoints;
-          DrawCurve (anIso, aDeflection, anAngle, aB1, aB2, aPoints);
+          DrawCurve (anIso, aDeflection, anAngle, GetTDOldBehavior(), aB1, aB2, aPoints);
           thePolylines.Append (aPoints);
         }
       }
diff --git "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\IVtkOCC\\IVtkOCC_ShapeMesher.hxx" "b/D:\\dev-tools\\opencascade-7.3.0\\src\\IVtkOCC\\IVtkOCC_ShapeMesher.hxx"
index 00fe88d..5d05cfe 100644
--- "a/D:\\dev-tools\\opencascade-7.3.0-original\\src\\IVtkOCC\\IVtkOCC_ShapeMesher.hxx"
+++ "b/D:\\dev-tools\\opencascade-7.3.0\\src\\IVtkOCC\\IVtkOCC_ShapeMesher.hxx"
@@ -50,9 +50,11 @@ public:
   IVtkOCC_ShapeMesher (const Standard_Real& theDevCoeff = 0.0001,
                        const Standard_Real& theDevAngle = 12.0 * M_PI / 180.0,
                        const Standard_Integer theNbUIsos = 1,
-                       const Standard_Integer theNbVIsos = 1)
+                       const Standard_Integer theNbVIsos = 1,
+                       const Standard_Boolean theTDOldBehavior = Standard_True)
  : myDevCoeff (theDevCoeff),
    myDevAngle (theDevAngle),
+   myTDOldBehavior(theTDOldBehavior),
    myDeflection (0.0)
   {
     myNbIsos[0] = theNbUIsos;
@@ -85,6 +87,13 @@ public:
     return myDevAngle;
   }
 
+  //! Returns tangential deflection behavior used in the algorithm
+  //! @return tangential deflection behavior
+  Standard_Boolean GetTDOldBehavior() const
+  {
+      return myTDOldBehavior;
+  }
+
 protected:
   //! Executes the mesh generation algorithms. To be defined in implementation class.
   Standard_EXPORT virtual void internalBuild() Standard_OVERRIDE;
@@ -186,6 +195,7 @@ private:
   Standard_Real         myDevAngle;
   mutable Standard_Real myDeflection;
   Standard_Integer      myNbIsos[2];
+  Standard_Boolean      myTDOldBehavior;
 };
 
 #endif //  __IVTKOCC_SHAPEMESHER_H__


