]> OCCT Git - occt-copy.git/commitdiff
# generate number of points according to the specified minimum value
authoroan <oan@opencascade.com>
Sat, 19 Oct 2019 16:07:14 +0000 (19:07 +0300)
committeroan <oan@opencascade.com>
Mon, 28 Oct 2019 10:47:16 +0000 (13:47 +0300)
src/GCPnts/GCPnts_TangentialDeflection.pxx

index c32e4a08083c97cec0a2b3aa4fc76a2cd7791c87..f6476bab5e421f6d6b9101fb704c0528c5bb09b3 100644 (file)
@@ -196,10 +196,12 @@ void GCPnts_TangentialDeflection::PerformLinear (const TheCurve& C) {
   D0 (C, firstu, P);
   parameters.Append (firstu);
   points    .Append (P);
-  if (minNbPnts > 2) {
+  if (minNbPnts > 2)
+  {
     Standard_Real Du = (lastu - firstu) / minNbPnts;
     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);
@@ -226,7 +228,7 @@ void GCPnts_TangentialDeflection::PerformCircular (const TheCurve& C)
   const Standard_Real aDiff = lastu - firstu;
   // Round up number of points to satisfy curvatureDeflection more precisely
   Standard_Integer NbPoints = (Standard_Integer)Min(Ceiling(aDiff / Du), 1.0e+6);
-  NbPoints = Max(NbPoints, minNbPnts - 1);
+  NbPoints = Max(NbPoints, minNbPnts) - 1;
   Du       = aDiff / NbPoints;
 
   gp_Pnt P;
@@ -571,14 +573,14 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
   //-- On rajoute des points aux milieux des segments si le nombre
   //-- mini de points n'est pas atteint
   //--
-  Standard_Integer Nbp =  points.Length();
-  Standard_Integer MinNb= (9*minNbPnts)/10;
-  //if(MinNb<4) MinNb=4;
-
-  //-- if(Nbp <  MinNb) { cout<<"\n*"; } else {  cout<<"\n."; } 
-  while(Nbp < MinNb) 
-    //-- cout<<" \nGCPnts TangentialDeflection : Ajout de Points ("<<Nbp<<" "<<minNbPnts<<" )"<<endl;
-    for (i = 2; i <= Nbp; i += 2) {
+  Standard_Integer Nbp = points.Length();
+
+  //std::cout << "GCPnts_TangentialDeflection: Number of Points (" << Nbp << " " << minNbPnts << " )" << std::endl;
+
+  while(Nbp < minNbPnts)
+  { 
+    for (i = 2; i <= Nbp; i += 2)
+    {
       MiddleU = (parameters.Value(i-1)+parameters.Value(i))*0.5;
       D0 (C, MiddleU, MiddlePoint); 
       parameters.InsertBefore(i,MiddleU);