0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepBlend / BRepBlend_RstRstLineBuilder.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 604e574..32af8c8
@@ -1,22 +1,43 @@
-// File:       BRepBlend_RstRstLineBuilder.cxx
-// Created:    Fri Jan 24 10:39:44 1997
-// Author:     Jacques GOUSSARD
-// Author:     Laurent BOURESCHE
-//             <lbo@pomalox.paris1.matra-dtv.fr>
-
-#include <stdio.h>
-
-#include <BRepBlend_RstRstLineBuilder.ixx>
+// Created on: 1997-01-24
+// Created by: Laurent BOURESCHE
+// Copyright (c) 1997-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <Adaptor2d_HCurve2d.hxx>
+#include <Adaptor3d_HSurface.hxx>
+#include <Adaptor3d_HVertex.hxx>
+#include <Adaptor3d_TopolTool.hxx>
+#include <Blend_CurvPointFuncInv.hxx>
+#include <Blend_Point.hxx>
+#include <Blend_RstRstFunction.hxx>
+#include <Blend_SurfCurvFuncInv.hxx>
 #include <BRepBlend_BlendTool.hxx>
-#include <TopAbs.hxx>
-#include <IntSurf.hxx>
-#include <math_FunctionSetRoot.hxx>
-#include <gp_Pnt2d.hxx>
+#include <BRepBlend_Extremity.hxx>
+#include <BRepBlend_Line.hxx>
+#include <BRepBlend_RstRstLineBuilder.hxx>
 #include <gp_Pnt.hxx>
-#include <gp_Vec2d.hxx>
+#include <gp_Pnt2d.hxx>
 #include <gp_Vec.hxx>
+#include <gp_Vec2d.hxx>
+#include <IntSurf.hxx>
+#include <IntSurf_Transition.hxx>
+#include <math_FunctionSetRoot.hxx>
+#include <TopAbs.hxx>
 
-#ifdef DEB
+#include <stdio.h>
+#ifdef OCCT_DEBUG
 #include <TColStd_Array1OfInteger.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <TColgp_Array1OfPnt2d.hxx>
@@ -30,8 +51,9 @@
 static Standard_Integer IndexOfSection = 0;
 extern Standard_Boolean Blend_GettraceDRAWSECT(); 
 
+#ifdef OCCT_DEBUG_BBPP_N_TRDERIV
 //-----------------------------------------------------
-// Pour debug : visualisation de la section
+// For debug : visualisation of the section
 static Standard_Boolean BBPP(const Standard_Real param,
                             Blend_RstRstFunction& Func,
                             const math_Vector& sol,
@@ -80,30 +102,30 @@ static void tracederiv(Blend_RstRstFunction& Func,
   Standard_Real scal = 1./ (param1 - param2);
 
   cout<<endl;
-  cout<<"controle des derivees au point : "<<param1<<endl;
+  cout<<"control of derivatives at point : "<<param1<<endl;
 
   for(i = 1; i <= hp; i++){
     cout<<endl;
     cout<<"point : "<<i<<endl;
-    cout<<"dx calcule : "<<TDP1(i).X()<<endl;
-    cout<<"dx estime  : "<<scal*(TP1(i).X()-TP2(i).X())<<endl;
-    cout<<"dy calcule : "<<TDP1(i).Y()<<endl;
-    cout<<"dy estime  : "<<scal*(TP1(i).Y()-TP2(i).Y())<<endl;
-    cout<<"dz calcule : "<<TDP1(i).Z()<<endl;
-    cout<<"dz estime  : "<<scal*(TP1(i).Z()-TP2(i).Z())<<endl;
-    cout<<"dw calcule : "<<TDW1(i)<<endl;
-    cout<<"dw estime  : "<<scal*(TW1(i)-TW2(i))<<endl;
+    cout<<"dx calculated : "<<TDP1(i).X()<<endl;
+    cout<<"dx estimated  : "<<scal*(TP1(i).X()-TP2(i).X())<<endl;
+    cout<<"dy calculated : "<<TDP1(i).Y()<<endl;
+    cout<<"dy estimated  : "<<scal*(TP1(i).Y()-TP2(i).Y())<<endl;
+    cout<<"dz calculated : "<<TDP1(i).Z()<<endl;
+    cout<<"dz estimated  : "<<scal*(TP1(i).Z()-TP2(i).Z())<<endl;
+    cout<<"dw calculated : "<<TDW1(i)<<endl;
+    cout<<"dw estimated  : "<<scal*(TW1(i)-TW2(i))<<endl;
   }
   for(i = 1; i <= hp2d; i++){
     cout<<endl;
     cout<<"point 2d : "<<i<<endl;
-    cout<<"dx calcule : "<<TDP2d1(i).X()<<endl;
-    cout<<"dx estime  : "<<scal*(TP2d1(i).X()-TP2d2(i).X())<<endl;
-    cout<<"dy calcule : "<<TDP2d1(i).Y()<<endl;
-    cout<<"dy estime  : "<<scal*(TP2d1(i).Y()-TP2d2(i).Y())<<endl;
+    cout<<"dx calculated : "<<TDP2d1(i).X()<<endl;
+    cout<<"dx estimated  : "<<scal*(TP2d1(i).X()-TP2d2(i).X())<<endl;
+    cout<<"dy calculated : "<<TDP2d1(i).Y()<<endl;
+    cout<<"dy estimated  : "<<scal*(TP2d1(i).Y()-TP2d2(i).Y())<<endl;
   }
 }
-
+#endif
 
 //-----------------------------------------------------
 static void Drawsect(const Standard_Real param,
@@ -159,7 +181,7 @@ BRepBlend_RstRstLineBuilder::BRepBlend_RstRstLineBuilder
 
 //=======================================================================
 //function : Perform
-//purpose  : lance le processus de cheminement
+//purpose  : launch the processing
 //=======================================================================
 
 void BRepBlend_RstRstLineBuilder::Perform(Blend_RstRstFunction&   Func,
@@ -224,12 +246,12 @@ void BRepBlend_RstRstLineBuilder::Perform(Blend_RstRstFunction&   Func,
   if (State != Blend_OK) {
     return;
   }
-#ifdef DEB
+#ifdef OCCT_DEBUG
   if (Blend_GettraceDRAWSECT()){
     Drawsect(param, Func);
   }
 #endif
-  // Mettre a jour la ligne.
+  // Update the line.
   line->Append(previousP);
   Standard_Real U, V;
   U = previousP.ParameterOnC1();
@@ -256,7 +278,7 @@ void BRepBlend_RstRstLineBuilder::Perform(Blend_RstRstFunction&   Func,
 
 //=======================================================================
 //function : PerformFirstSection
-//purpose  : Creation de la premiere section
+//purpose  : Creation of the first section
 //=======================================================================
 
 Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
@@ -294,13 +316,8 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
   
   Standard_Boolean recadp1, recadp2, recadrst1, recadrst2;
   Standard_Real wp1, wp2, wrst1, wrst2;
-#ifndef DEB
   Blend_Status State = Blend_OnRst12;
   Standard_Real trst11 = 0., trst12 = 0., trst21 = 0., trst22 = 0.;
-#else
-  Blend_Status State;
-  Standard_Real trst11, trst12, trst21, trst22;
-#endif
   math_Vector infbound(1, 2), supbound(1, 2), tolerance(1, 2);
   math_Vector solinvp1(1, 2), solinvp2(1, 2), solinvrst1(1, 3), solinvrst2(1, 3);
   Handle(Adaptor3d_HVertex) Vtxp1, Vtxp2, Vtxrst1, Vtxrst2, Vtxc;
@@ -340,9 +357,9 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
   if (!recadrst1 && !recadp1 && !recadrst2 && !recadp2) return Standard_False;
 
 
-  // on regarde si on a decroche ou sorti du domaine 1
+  // it is checked if the contact was lost or domain 1 was left
   if (recadp1 && recadrst1) {
-    if (sens * (wrst1 - wp1) > tolgui){ //on sort du domaine d abord
+    if (sens * (wrst1 - wp1) > tolgui){ //at first one leaves the domain
       wrst1     = wp1;
       trst12    = solinvp1(2);
       trst11    = BRepBlend_BlendTool::Parameter(Vtxp1, rst1);
@@ -350,7 +367,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
       Vtxrst2   = Vtxp1;
       recadrst1 = Standard_False;
     }
-    else { // on a decroche
+    else { // the contact is lost
       trst11  = solinvrst1(3);
       trst12  = solinvrst1(2);
       recadp1 = Standard_False;
@@ -368,9 +385,9 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
     trst12  = solinvrst1(2);
   }
 
-  // on regarde si on a decrocher ou sortie du domaine 2
+  // it is checked if the contact was lost or domain 2 was left
   if (recadp2 && recadrst2) {
-    if (sens * (wrst2 - wp2) > tolgui) { //on sort du domaine d abord
+    if (sens * (wrst2 - wp2) > tolgui) { //at first one leaves the domain
       wrst2     = wp2;
       trst21    = solinvp2(2);
       trst22    = BRepBlend_BlendTool::Parameter(Vtxp2, rst2);
@@ -396,7 +413,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
     trst21  = solinvrst2(2);
   }
 
-  // on regarde sur laquelle des courbes on decroche en premier
+  // it is checked on which curve the contact is lost earlier
   if (recadrst1 && recadrst2) {
     if (Abs(wrst1 - wrst2) < tolgui) {
       State    = Blend_OnRst12;
@@ -405,14 +422,14 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
       sol(2)   = trst22;
     }
     else if (sens * (wrst1 - wrst2) < 0) {
-      // on decroche sur Rst1
+      // contact lost on Rst1
       State   = Blend_OnRst1;
       param   = wrst1;
       sol(1)  = trst11;
       sol(2)  = trst12;
     }
     else {
-      // on decroche sur rst2
+      // contact lost on rst2
       State   = Blend_OnRst2;
       param   = wrst2;
       sol(1)  = trst21;
@@ -421,7 +438,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
   Func.Set(param);
   }
   else if (recadrst1) {
-    // sol sur rst1
+    // ground on rst1
     State   = Blend_OnRst1;
     param   = wrst1;
     sol(1)  = trst11;
@@ -429,14 +446,14 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
     Func.Set(param);
   }
   else if (recadrst2) {
-    // sol sur rst2
+    // ground on rst2
     State   = Blend_OnRst2;
     param   = wrst2;
     sol(1)  = trst21;
     sol(2)  = trst22;
     Func.Set(param);
   }
-  // on regarde sur laquelle des courbes on sort en premier
+  // it is checked on which curves one leaves first
   else if (recadp1 && recadp2) {
     if (Abs(wrst1 - wrst2) < tolgui) {
       State  = Blend_OnRst12;
@@ -445,14 +462,14 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
       sol(2) = trst22;
     }
     else if (sens * (wrst1 - wrst2) < 0) {
-      // sol sur Rst1
+      // sol on Rst1
       State  = Blend_OnRst1;
       param  = wrst1;
       sol(1) = trst11;
       sol(2) = trst12;
     }
     else {
-      // sol sur rst2
+      // ground on rst2
       State  = Blend_OnRst2;
       param  = wrst2;
       sol(1) = trst21;
@@ -461,7 +478,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
     Func.Set(param);
   }
   else if (recadp1) {
-    // sol sur rst1
+    // ground on rst1
     State  = Blend_OnRst1;
     param  = wrst1;
     sol(1) = trst11;
@@ -469,7 +486,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
     Func.Set(param);
   }
   else if (recadp2) {
-    // sol sur rst2
+    // ground on rst2
     State  = Blend_OnRst2;
     param  = wrst2;
     sol(1) = trst21;
@@ -515,7 +532,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Complete(Blend_RstRstFunction&   F
 
 //=======================================================================
 //function : InternalPerform
-//purpose  : algorithme de cheminement sauf aux extremites
+//purpose  : algorithm of processing without extremities
 //=======================================================================
 
 void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
@@ -527,7 +544,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
 {
   Standard_Real stepw  = pasmax;
   Standard_Integer nbp = line->NbPoints();
-  if(nbp >= 2){ //On reprend le dernier step s il n est pas trop petit.
+  if(nbp >= 2){ //The last step is redone if it is not too small.
     if(sens < 0.){
       stepw = (line->Point(2).Parameter() - line->Point(1).Parameter());
     }
@@ -540,15 +557,10 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
   if (sens* (parprec - Bound) >= -tolgui) {
     return;
   }
-#ifndef DEB
   Blend_Status State = Blend_OnRst12;
   Standard_Real trst11 = 0., trst12 = 0., trst21 = 0., trst22 = 0.;
-#else
-  Blend_Status State;
-  Standard_Real trst11, trst12, trst21, trst22;
-#endif
-  TopAbs_State situonc1, situonc2;
-  Blend_DecrochStatus decroch;
+  TopAbs_State situonc1 = TopAbs_UNKNOWN, situonc2 = TopAbs_UNKNOWN;
+  Blend_DecrochStatus decroch = Blend_NoDecroch;
   Standard_Boolean Arrive, recadp1, recadp2, recadrst1, recadrst2, echecrecad;
   Standard_Real wp1, wp2, wrst1, wrst2;
   math_Vector infbound(1, 2), supbound(1, 2);
@@ -575,7 +587,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
 
   while (!Arrive) {
     Standard_Boolean bonpoint = 1;
-#if 0
+#ifdef OCCT_DEBUG_BBPP_N_TRDERIV
     //debdebdebdebdebdeb
     Func.Set(param);
     rsnld.Perform(Func, parinit, infbound, supbound);
@@ -616,7 +628,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
       recadp1 = recadp2 = recadrst1 = recadrst2 = Standard_False;
       echecrecad = Standard_False;
       if (situonc1 != TopAbs_IN) {
-       // pb inverse rst/rst
+       // pb inversion rst/rst
        recadp1 = Recadre1(FinvP1, solinvp1, IsVtxp1, Vtxp1);
        if (recadp1) {
          wp1 = solinvp1(1);
@@ -627,7 +639,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
       }
 
       if (situonc2 != TopAbs_IN) {
-       // pb inverse point/surf
+       // pb inversion point/surf
        recadp2 = Recadre2(FinvP2, solinvp2, IsVtxp2, Vtxp2);
        if (recadp2) {
          wp2 = solinvp2(1);
@@ -638,7 +650,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
       }
 
       if (decroch == Blend_DecrochRst1 || decroch == Blend_DecrochBoth) {
-       // pb inverse rst1/surf1
+       // pb inversion rst1/surf1
        recadrst1 = Recadre1(Func, Finv1, solinvrst1, IsVtxrst1, Vtxrst1);
        if (recadrst1) {
          wrst1 = solinvrst1(1);
@@ -663,9 +675,9 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
       if (recadp1 || recadp2 || recadrst1 || recadrst2) echecrecad = Standard_False;
  
       if (!echecrecad) {
-        // on regarde si on a decroche ou sorti du domaine 1
+        // it is checked if the contact was lost or domain 1 was left
         if (recadp1 && recadrst1) {
-          if (sens * (wrst1 - wp1) > tolgui){ //on sort du domaine d abord
+          if (sens * (wrst1 - wp1) > tolgui){ //first one leaves the domain
             wrst1     = wp1;
            trst12    = solinvp1(2);
            trst11    = BRepBlend_BlendTool::Parameter(Vtxp1, rst1);
@@ -673,7 +685,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
            Vtxrst2   = Vtxp1;
             recadrst1 = Standard_False;
          }
-         else { // on a decroche
+         else { // contact is lost
            trst11  = solinvrst1(3);
            trst12  = solinvrst1(2);
             recadp1 = Standard_False;
@@ -691,9 +703,9 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
          trst12  = solinvrst1(2);
        }
 
-       // on regarde si on a decrocher ou sortie du domaine 2
+       // it is checked if the contact was lost or domain 2 was left
        if (recadp2 && recadrst2) {
-         if (sens * (wrst2 - wp2) > tolgui) { //on sort du domaine d abord
+         if (sens * (wrst2 - wp2) > tolgui) { //first one leaves the domain
            wrst2     = wp2;
            trst21    = solinvp2(2);
            trst22    = BRepBlend_BlendTool::Parameter(Vtxp2, rst2);
@@ -719,7 +731,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
          trst21  = solinvrst2(2);
        }
 
-        // on regarde sur laquelle des courbes on decroche en premier
+        // it is checked on which curve the contact is lost earlier
        if (recadrst1 && recadrst2) {
          if (Abs(wrst1 - wrst2) < tolgui) {
             State    = Blend_OnRst12;
@@ -729,7 +741,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
            sol(2)   = trst22;
          }
          else if (sens * (wrst1 - wrst2) < 0) {
-           // on decroche sur Rst1
+           // contact is lost on Rst1
             State   = Blend_OnRst1;
            decroch = Blend_DecrochRst1; 
            param   = wrst1;
@@ -737,7 +749,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
            sol(2)  = trst12;
          }
          else {
-           // on decroche sur rst2
+           // contact is lost on rst2
             State   = Blend_OnRst2;
            decroch = Blend_DecrochRst2;
            param   = wrst2;
@@ -747,7 +759,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
          Func.Set(param);
        }
        else if (recadrst1) {
-         // sol sur rst1
+         // ground on rst1
          State   = Blend_OnRst1;
           decroch = Blend_DecrochRst1;
          param   = wrst1;
@@ -756,7 +768,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
          Func.Set(param);
        }
        else if (recadrst2) {
-         // sol sur rst2
+         // ground on rst2
          State   = Blend_OnRst2;
           decroch = Blend_DecrochRst2;
          param   = wrst2;
@@ -764,7 +776,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
          sol(2)  = trst22;
          Func.Set(param);
        }
-       // on regarde sur laquelle des courbes on sort en premier
+       //  it is checked on which curve the contact is lost earlier
        else if (recadp1 && recadp2) {
          if (Abs(wrst1 - wrst2) < tolgui) {
            State  = Blend_OnRst12;
@@ -773,14 +785,14 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
            sol(2) = trst22;
          }
          else if (sens * (wrst1 - wrst2) < 0) {
-           // sol sur Rst1
+           // ground on Rst1
            State  = Blend_OnRst1;
            param  = wrst1;
            sol(1) = trst11;
            sol(2) = trst12;
          }
          else {
-           // sol sur rst2
+           // ground on rst2
            State  = Blend_OnRst2;
            param  = wrst2;
            sol(1) = trst21;
@@ -789,7 +801,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
          Func.Set(param);
        }
        else if (recadp1) {
-         // sol sur rst1
+         // ground on rst1
          State  = Blend_OnRst1;
          param  = wrst1;
          sol(1) = trst11;
@@ -797,7 +809,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
          Func.Set(param);
        }
        else if (recadp2) {
-         // sol sur rst2
+         // ground on rst2
          State  = Blend_OnRst2;
          param  = wrst2;
          sol(1) = trst21;
@@ -811,8 +823,10 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
        State = TestArret(Func, Standard_True, State);
       }
       else{
-       // echec recadrage. On sort avec PointsConfondus
-       cout<<"echec recadrage"<<endl;
+       // reframing failed. Leave with PointsConfondus
+#ifdef OCCT_DEBUG
+       cout<<"reframing failed"<<endl;
+#endif
        State = Blend_SamePoints;
       }
     }
@@ -820,12 +834,12 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
     switch (State) {
     case Blend_OK :
       {
-#ifdef DEB
+#ifdef OCCT_DEBUG
        if (Blend_GettraceDRAWSECT()){
          Drawsect(param, Func);
        }
 #endif
-       // Mettre a jour la ligne.
+       // Update the line.
        if (sens > 0.) {
          line->Append(previousP);
        }
@@ -841,7 +855,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
                           previousP.ParameterOnC1(),
                           previousP.Parameter(), tolesp);
          MakeExtremity(Extrst2, Standard_False, rst2, sol(2), IsVtxrst2, Vtxrst2);
-         // Indiquer que fin sur Bound.
+         // Show that end is on Bound.
        }
        else {
          param = param + sens * stepw;
@@ -863,25 +877,27 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
                           previousP.ParameterOnC2(),
                           previousP.Parameter(), tolesp);
          Arrive = Standard_True;
+#ifdef OCCT_DEBUG
          if (line->NbPoints()>=2) {
-           // Indiquer qu on s arrete en cours de cheminement
-           cout<<"On n avance plus dans le cheminement"<<endl;
+           // Show that there is a stop during processing 
+           cout<<"No more advancement in the processing"<<endl;
          }
+#endif
        }
        else {
-         param = parprec + sens * stepw;  // on ne risque pas de depasser Bound.
+         param = parprec + sens * stepw;  // there is no risk to exceed Bound.
        }
       }
       break;
       
     case Blend_StepTooSmall :
       {
-#ifdef DEB
+#ifdef OCCT_DEBUG
        if (Blend_GettraceDRAWSECT()){
          Drawsect(param,Func);
        }
 #endif
-       // Mettre a jour la ligne.
+       // Update the line.
        if (sens > 0.) {
          line->Append(previousP);
        }
@@ -898,7 +914,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
                           previousP.ParameterOnC1(),
                           previousP.Parameter(), tolesp);
          MakeExtremity(Extrst2, Standard_False, rst2, sol(2), IsVtxrst2, Vtxrst2);
-         // Indiquer que fin sur Bound.
+         // Indicate that end is on Bound.
        }
        else {
          param = param + sens * stepw;
@@ -911,7 +927,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
       
     case Blend_OnRst1  :
       {
-#ifdef DEB
+#ifdef OCCT_DEBUG
        if (Blend_GettraceDRAWSECT()){
          Drawsect(param, Func);
        }
@@ -930,7 +946,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
       
     case Blend_OnRst2  :
       {
-#ifdef DEB
+#ifdef OCCT_DEBUG
        if (Blend_GettraceDRAWSECT()){
          Drawsect(param, Func);
        }
@@ -950,7 +966,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
       
     case Blend_OnRst12  :
       {
-#ifdef DEB
+#ifdef OCCT_DEBUG
        if (Blend_GettraceDRAWSECT()){
          Drawsect(param, Func);
        }
@@ -970,8 +986,10 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
       
     case Blend_SamePoints :
       {
-       // On arrete
-       cout << " Points confondus dans le cheminement" << endl;
+       // Stop
+#ifdef OCCT_DEBUG
+       cout << " Mixed points in the processing" << endl;
+#endif
        Extrst1.SetValue(previousP.PointOnC1(),
                         previousP.ParameterOnC1(),
                         previousP.Parameter(), tolesp);
@@ -981,10 +999,8 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
        Arrive = Standard_True;
       }
       break;
-#ifndef DEB
     default:
       break;
-#endif
     }
     if (Arrive) {
       if (sens > 0.) {
@@ -1002,7 +1018,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction&   Func,
 
 //=======================================================================
 //function : Recadre1
-//purpose  : On a decroche en 1
+//purpose  : Contact lost on 1
 //=======================================================================
 
 Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_RstRstFunction&    Func,
@@ -1018,18 +1034,20 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_RstRstFunction&
   Solinv(2) = sol(2);
   Solinv(3) = sol(1);
  
-  // On recherche le point de non decrochement
+  // The point where contact is not lost is found
   math_FunctionSetRoot rsnld(Finv, toler, 30);
   rsnld.Perform(Finv, Solinv, infb, supb);
   if (!rsnld.IsDone()) {
+#ifdef OCCT_DEBUG
     cout << "RSNLD not done "<< endl << endl;
+#endif
     return Standard_False;
   }
 
   rsnld.Root(Solinv);
 
-  // On doit verifier la valeur de la fonction est bien
-  //  sur la seconde restriction
+  // It is necessary to check if the function value meets the
+  // second restriction
   if (Finv.IsSolution(Solinv, tolesp)) {
     Standard_Real w = Solinv(2);
     if(w < rst2->FirstParameter() - toler(2)||
@@ -1037,7 +1055,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_RstRstFunction&
       return Standard_False;
     }
  
-    // on regarde si on n est pas sur un Vertex
+    // it is checked if it is on a Vertex
     domain1->Initialize(rst1);
     domain1->InitVertexIterator();
     IsVtx = !domain1->MoreVertex();
@@ -1055,8 +1073,8 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_RstRstFunction&
     if (!domain1->MoreVertex()) {
       IsVtx = Standard_False;
     }
-    // On recalcule la section par resolution directe, sinon, on se recupere 
-    // des incoherences entre le parametre et sol dues au baillement.
+    // The section is recalculated by direct solution, otherwise return 
+    // incoherences between the parameter and the ground caused by yawn.
 
     math_Vector infbound(1, 2), supbound(1, 2);
     math_Vector parinit(1, 2), tolerance(1, 2);
@@ -1083,7 +1101,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_RstRstFunction&
 
 //=======================================================================
 //function : Recadre2
-//purpose  : On a decroche sur Rst2
+//purpose  : Contact lost on Rst2
 //=======================================================================
 
 Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre2(Blend_RstRstFunction&    Func,
@@ -1102,13 +1120,15 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre2(Blend_RstRstFunction&
   math_FunctionSetRoot rsnld(Finv, toler, 30);
   rsnld.Perform(Finv, Solinv, infb, supb);
   if (!rsnld.IsDone()) {
+#ifdef OCCT_DEBUG
     cout << "RSNLD not done "<< endl << endl;
+#endif
     return Standard_False;
   }
 
   rsnld.Root(Solinv);
 
-  // On doit verifier la valeur de la fonction
+  // It is necessary to check the value of the function
   if (Finv.IsSolution(Solinv, tolesp)) {
     Standard_Real w = Solinv(2);
     if(w < rst1->FirstParameter() - toler(2)||
@@ -1133,9 +1153,9 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre2(Blend_RstRstFunction&
     if (!domain2->MoreVertex()) {
       IsVtx = Standard_False;
     }
-    // On recalcule la section par resolution directe, sinon, on se recupere 
-    // des incoherences entre le parametre et sol dues au baillement.
-
+    // The section is recalculated by direct solution, otherwise return 
+    // incoherences between the parameter and the ground caused by yawn.
+   
     math_Vector infbound(1, 2), supbound(1, 2);
     math_Vector parinit(1,2), tolerance(1,2);
     Func.GetTolerance(tolerance, tolesp);
@@ -1157,7 +1177,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre2(Blend_RstRstFunction&
 
 //=======================================================================
 //function : Recadre
-//purpose  : On est en fin de la courbe rst1
+//purpose  : This is the end of curve rst1
 //=======================================================================
 
 Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_CurvPointFuncInv&  FinvP,
@@ -1165,8 +1185,8 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_CurvPointFuncInv&
                                                       Standard_Boolean&        IsVtx,
                                                       Handle(Adaptor3d_HVertex)& Vtx) 
 {
-  // On se place sur le dernier ou le premier point, suivant le
-  // sens de cheminement.
+  // One is located on the last or the first point, following the
+  // direction of processing.
   gp_Pnt2d p2drst1;
   Standard_Real firstrst1 = rst1->FirstParameter();
   Standard_Real lastrst1  = rst1->LastParameter();
@@ -1186,7 +1206,9 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_CurvPointFuncInv&
   math_FunctionSetRoot rsnld(FinvP, toler, 30);
   rsnld.Perform(FinvP, Solinv, infb, supb);
   if (!rsnld.IsDone()) {
+#ifdef OCCT_DEBUG
     cout << "RSNLD not done "<< endl << endl;
+#endif
     return Standard_False;
   }
   rsnld.Root(Solinv);
@@ -1223,7 +1245,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_CurvPointFuncInv&
 
 //=======================================================================
 //function : Recadre2
-//purpose  : On est en fin de la courbe rst2
+//purpose  : This is the end of curve rst2
 //=======================================================================
 
 Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre2(Blend_CurvPointFuncInv&  FinvP,
@@ -1231,8 +1253,8 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre2(Blend_CurvPointFuncInv&
                                                       Standard_Boolean&        IsVtx,
                                                       Handle(Adaptor3d_HVertex)& Vtx) 
 {
-  // On se place sur le dernier ou le premier point, suivant le
-  // sens de cheminement.
+  // One is located on the last or the first point, following the 
+  // direction of processing.
   gp_Pnt2d p2drst2;
   Standard_Real firstrst2 = rst2->FirstParameter();
   Standard_Real lastrst2  = rst2->LastParameter();
@@ -1252,7 +1274,9 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre2(Blend_CurvPointFuncInv&
   math_FunctionSetRoot rsnld(FinvP, toler, 30);
   rsnld.Perform(FinvP, Solinv, infb, supb);
   if (!rsnld.IsDone()) {
+#ifdef OCCT_DEBUG
     cout << "RSNLD not done "<< endl << endl;
+#endif
     return Standard_False;
   }
   rsnld.Root(Solinv);
@@ -1337,7 +1361,7 @@ void BRepBlend_RstRstLineBuilder::Transition(const Standard_Boolean          OnF
 
 //=======================================================================
 //function : MakeExtremity
-//purpose  : fabrique l extremite d une courbe
+//purpose  : produce the extremity of a curve
 //=======================================================================
 
 void BRepBlend_RstRstLineBuilder::MakeExtremity(BRepBlend_Extremity&            Extrem,
@@ -1375,11 +1399,7 @@ void BRepBlend_RstRstLineBuilder::MakeExtremity(BRepBlend_Extremity&
   else {
     Extrem.SetVertex(Vtx);
     while (Iter->More()) {
-//#ifndef DEB
       Handle(Adaptor2d_HCurve2d) arc = Iter->Value();
-//#else
-//      Handle(Adaptor2d_HCurve2d)& arc = Iter->Value();
-//#endif
      if (arc != Arc) {
        Iter->Initialize(arc);
        Iter->InitVertexIterator();
@@ -1408,9 +1428,9 @@ void BRepBlend_RstRstLineBuilder::MakeExtremity(BRepBlend_Extremity&
 
 Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst1(const Blend_Point& CurPoint)
 {
-  //Controles 3d du Blend_CSWalking.
+  //Controls 3d of Blend_CSWalking.
 
-  // regle par tests dans U4 correspond a 11.478 d
+  // rule by tests in U4 corresponds to 11.478 
   const Standard_Real CosRef3D = 0.98;
   Standard_Real Cosi, Cosi2;
   Standard_Boolean curpointistangent  = CurPoint.IsTangencyPoint();
@@ -1426,19 +1446,14 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst1(const Blend_Poin
   if(!prevpointistangent){
     prevTg = previousP.TangentOnC1();
   }
-  Standard_Real Norme, curNorme;
-#ifndef DEB
+  Standard_Real Norme;
   Standard_Real prevNorme = 0.;
-#else
-  Standard_Real prevNorme;
-#endif
   gp_Vec Corde(prevP, Psurf);
   Norme = Corde.SquareMagnitude();
-  if (!curpointistangent) curNorme = Tgsurf.SquareMagnitude();
   if (!prevpointistangent) prevNorme = prevTg.SquareMagnitude();
 
   if (Norme <= tolesp * tolesp) {
-    // il faudra peut etre  forcer meme point
+    // it can be necessary to force the same point
     return Blend_SamePoints;
   }
   if(!prevpointistangent){
@@ -1446,7 +1461,7 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst1(const Blend_Poin
       return Blend_SamePoints;
     }
     Cosi = sens * Corde * prevTg;
-    if (Cosi < 0.) { // angle 3d>pi/2. --> retour arriere
+    if (Cosi < 0.) { // angle 3d>pi/2. --> return back
       return Blend_Backward;
     }
     
@@ -1457,7 +1472,7 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst1(const Blend_Poin
   }
   
   if(!curpointistangent){
-    // Voir s il faut faire le controle sur le signe de prevtg*Tgsurf
+    // Check if it is necessary to control the sign of prevtg*Tgsurf
     Cosi = sens * Corde * Tgsurf;
     Cosi2 = Cosi * Cosi / Tgsurf.SquareMagnitude() / Norme;
     if (Cosi2 < CosRef3D || Cosi < 0.) { 
@@ -1466,7 +1481,7 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst1(const Blend_Poin
   }  
 
   if (!curpointistangent && !prevpointistangent) {
-    // Estimation de la fleche courante
+    // Estimation of the current arrow
     Standard_Real FlecheCourante = 
       (prevTg.Normalized().XYZ() - Tgsurf.Normalized().XYZ()).SquareModulus() * Norme / 64.;
     
@@ -1474,7 +1489,7 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst1(const Blend_Poin
       return Blend_StepTooSmall;
     }
     if (FlecheCourante > fleche * fleche) {
-      // pas trop grand : commentaire interessant
+      // not too great
       return Blend_StepTooLarge;
     }
   }
@@ -1489,9 +1504,9 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst1(const Blend_Poin
 
 Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst2(const Blend_Point& CurPoint)
 {
-  //Controles 3d du Blend_CSWalking.
+  //3D Controls of Blend_CSWalking.
 
-  // regle par tests dans U4 correspond a 11.478 d
+  // rule by tests in U4 corresponding to 11.478 d
   const Standard_Real CosRef3D = 0.98;
   Standard_Real Cosi, Cosi2;
   Standard_Boolean curpointistangent  = CurPoint.IsTangencyPoint();
@@ -1508,19 +1523,14 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst2(const Blend_Poin
   if (!prevpointistangent) {
     prevTg = previousP.TangentOnC2();
   }
-  Standard_Real Norme, curNorme;
-#ifndef DEB
+  Standard_Real Norme;
   Standard_Real prevNorme = 0.;
-#else
-  Standard_Real prevNorme;
-#endif
   gp_Vec Corde(prevP, Psurf);
   Norme = Corde.SquareMagnitude();
-  if (!curpointistangent) curNorme   = Tgsurf.SquareMagnitude();
   if (!prevpointistangent) prevNorme = prevTg.SquareMagnitude();
 
   if (Norme <= tolesp * tolesp){
-    // il faudra peut etre  forcer meme point
+    // it can be necessary to force the same point
     return Blend_SamePoints;
   }
   if (!prevpointistangent) {
@@ -1528,7 +1538,7 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst2(const Blend_Poin
       return Blend_SamePoints;
     }
     Cosi = sens * Corde * prevTg;
-    if (Cosi < 0.) { // angle 3d>pi/2. --> retour arriere
+    if (Cosi < 0.) { // angle 3d>pi/2. --> return back
       return Blend_Backward;
     }
     
@@ -1539,7 +1549,7 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst2(const Blend_Poin
   }
   
   if (!curpointistangent) {
-    // Voir s il faut faire le controle sur le signe de prevtg*Tgsurf
+    // Check if it is necessary to control the sign of prevtg*Tgsurf
     Cosi  = sens * Corde * Tgsurf;
     Cosi2 = Cosi * Cosi / Tgsurf.SquareMagnitude() / Norme;
     if (Cosi2 < CosRef3D || Cosi < 0.) { 
@@ -1548,7 +1558,7 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst2(const Blend_Poin
   }  
 
   if(!curpointistangent && !prevpointistangent){
-    // Estimation de la fleche courante
+    // Estimation of the current arrow
     Standard_Real FlecheCourante = 
       (prevTg.Normalized().XYZ() - Tgsurf.Normalized().XYZ()).SquareModulus() * Norme/64.;
     
@@ -1556,7 +1566,7 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst2(const Blend_Poin
       return Blend_StepTooSmall;
     }
     if (FlecheCourante > fleche * fleche) {
-      // pas trop grand : commentaire interessant
+      // not too great
       return Blend_StepTooLarge;
     }
   }
@@ -1583,11 +1593,7 @@ Blend_Status BRepBlend_RstRstLineBuilder::TestArret(Blend_RstRstFunction& Func,
   gp_Vec tgrst1, tgrst2;
   gp_Vec2d tg2drst1, tg2drst2;
   Blend_Status StateRst1, StateRst2;
-#ifndef DEB
   IntSurf_TypeTrans trarst1 = IntSurf_Undecided, trarst2 = IntSurf_Undecided;
-#else
-  IntSurf_TypeTrans trarst1, trarst2;
-#endif
   Blend_Point curpoint;
 
   if (Func.IsSolution(sol, tolesp)) {
@@ -1700,7 +1706,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::CheckInside(Blend_RstRstFunction&
   math_Vector tolerance(1, 2);
   Func.GetTolerance(tolerance, tolesp);
 
-  //cote pcurve 1.
+  //face pcurve 1.
   Standard_Real v = sol(1);
   if(v < rst1->FirstParameter() - tolerance(2)||
      v > rst1->LastParameter() + tolerance(2)){
@@ -1712,7 +1718,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::CheckInside(Blend_RstRstFunction&
   }
   else SituOnC1 = TopAbs_ON;
 
-  //cote pcurve 2.
+  //face pcurve 2.
   v = sol(2);
   if(v < rst2->FirstParameter() - tolerance(2)||
      v > rst2->LastParameter() + tolerance(2)){
@@ -1725,7 +1731,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::CheckInside(Blend_RstRstFunction&
   else SituOnC2 = TopAbs_ON;
 
 
-  //decrochage
+  //lost contact
   gp_Vec tgrst1, norst1, tgrst2, norst2;
   Decroch = Func.Decroch(sol,tgrst1, norst1, tgrst2, norst2);