]> OCCT Git - occt-copy.git/commitdiff
# patch V6
authormsv <msv@opencascade.com>
Thu, 9 Aug 2018 16:11:24 +0000 (19:11 +0300)
committermsv <msv@opencascade.com>
Fri, 5 Oct 2018 17:04:36 +0000 (20:04 +0300)
src/GCPnts/GCPnts_TangentialDeflection.cxx
src/GCPnts/GCPnts_TangentialDeflection.pxx

index a68a6fc6a3e0e5da47a528e0779e9ed2353a5823..659719158fc118ff5de8d1270bd4c03f61bc244f 100644 (file)
@@ -67,7 +67,7 @@ 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())
   {
index d10dfc7c190f77d67894319a8c97d6ca6b1d31be..3b5fe2b0fe1e241a64e110dda134fa15a214e4b9 100644 (file)
@@ -293,13 +293,13 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
       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:
@@ -342,7 +342,7 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
             if(IsLine && IsSequential)
             {
                 gp_XYZ V3 = LastPoint.XYZ() - MiddlePoint.XYZ();
-                IsSequential = (V3.Dot(V2) > 0);
+                IsSequential = (V3.Dot(V2) >= 0.0);
             }
           }
         }
@@ -408,6 +408,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();
@@ -451,17 +452,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
@@ -604,10 +605,9 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
     }
   }
   //Additional check for intervals
-  Standard_Real MinLen2 = myMinLen * myMinLen;
   Standard_Integer MaxNbp = 10 * Nbp;
 
-  Standard_Real CosAngleMax = sqrt(1 - AngleMax * AngleMax);
+  Standard_Real CosAngleMax = Sqrt(1.0 - AngleMax * AngleMax);
 
   for(i = 1; i < Nbp; ++i)
   {