]> OCCT Git - occt.git/commitdiff
Coding - Add clang-format configuration #246
authordpasukhi <dpasukhi@opencascade.com>
Mon, 6 Jan 2025 12:35:56 +0000 (12:35 +0000)
committerdpasukhi <dpasukhi@opencascade.com>
Tue, 14 Jan 2025 23:07:40 +0000 (23:07 +0000)
New clang-format configuration added to determinate code style.
The default version is 16.
Extend CMake to copy config file to build root.
Method/function separator deprecation:
  In case if function/method has declaration in header,
    definition must not have related comment.
    Only //==== [100 chars] ==== is allowed as a not connected
    separator.
  In case if function/method has  NOT declaration in header,
    definition must have related comment in doxygen style:
    // Descriptions
    // @param
    // @return
    Or just function/method separator:
    //==== [100 chars] ====
  All old separators with no description must be replaced to
    //==== [100 chars] ====

49 files changed:
.clang-format [new file with mode: 0644]
CMakeLists.txt
src/Approx/Approx_Array1OfAdHSurface.hxx
src/Approx/Approx_Array1OfGTrsf2d.hxx
src/Approx/Approx_Curve2d.cxx
src/Approx/Approx_Curve2d.hxx
src/Approx/Approx_Curve3d.cxx
src/Approx/Approx_Curve3d.hxx
src/Approx/Approx_CurveOnSurface.cxx
src/Approx/Approx_CurveOnSurface.hxx
src/Approx/Approx_CurvilinearParameter.cxx
src/Approx/Approx_CurvilinearParameter.hxx
src/Approx/Approx_CurvlinFunc.cxx
src/Approx/Approx_CurvlinFunc.hxx
src/Approx/Approx_FitAndDivide.hxx
src/Approx/Approx_FitAndDivide2d.hxx
src/Approx/Approx_FitAndDivide2d_0.cxx
src/Approx/Approx_FitAndDivide_0.cxx
src/Approx/Approx_HArray1OfAdHSurface.hxx
src/Approx/Approx_HArray1OfGTrsf2d.hxx
src/Approx/Approx_MCurvesToBSpCurve.cxx
src/Approx/Approx_MCurvesToBSpCurve.hxx
src/Approx/Approx_ParametrizationType.hxx
src/Approx/Approx_SameParameter.cxx
src/Approx/Approx_SameParameter.hxx
src/Approx/Approx_SequenceOfHArray1OfReal.hxx
src/Approx/Approx_Status.hxx
src/Approx/Approx_SweepApproximation.cxx
src/Approx/Approx_SweepApproximation.hxx
src/Approx/Approx_SweepApproximation.lxx
src/Approx/Approx_SweepFunction.cxx
src/Approx/Approx_SweepFunction.hxx
src/ApproxInt/ApproxInt_Approx.gxx
src/ApproxInt/ApproxInt_ImpPrmSvSurfaces.gxx
src/ApproxInt/ApproxInt_KnotTools.cxx
src/ApproxInt/ApproxInt_KnotTools.hxx
src/ApproxInt/ApproxInt_MultiLineTool.lxx
src/ApproxInt/ApproxInt_SvSurfaces.cxx
src/ApproxInt/ApproxInt_SvSurfaces.hxx
src/DE/DE_ConfigurationContext.cxx
src/DE/DE_ConfigurationContext.hxx
src/DE/DE_ConfigurationNode.cxx
src/DE/DE_ConfigurationNode.hxx
src/DE/DE_Provider.cxx
src/DE/DE_Provider.hxx
src/DE/DE_ShapeFixConfigurationNode.cxx
src/DE/DE_ShapeFixConfigurationNode.hxx
src/DE/DE_Wrapper.cxx
src/DE/DE_Wrapper.hxx

diff --git a/.clang-format b/.clang-format
new file mode 100644 (file)
index 0000000..fe3f24f
--- /dev/null
@@ -0,0 +1,40 @@
+# clang-format configuration file trying to apply OCCT coding style
+#
+# Clang formatting rules: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+# The clang-format npm package (https://github.com/angular/clang-format) uses
+# a pre-built clang-format.exe from http://llvm.org/builds/
+#
+# We use defaults from the Microsoft style
+BasedOnStyle: Microsoft
+#
+# Style options
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowAllArgumentsOnNextLine: false
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: Consecutive
+AlignConsecutiveDeclarations: Consecutive
+AlignTrailingComments: true
+AllowShortFunctionsOnASingleLine: Inline
+AlwaysBreakTemplateDeclarations: Yes
+BinPackArguments: false
+BinPackParameters: false
+BreakBeforeBinaryOperators: NonAssignment
+BreakBeforeTernaryOperators: true
+ColumnLimit: 100
+ContinuationIndentWidth: 2
+IndentCaseLabels: true
+IndentPPDirectives: BeforeHash
+IndentWidth: 2
+IndentWrappedFunctionNames: true
+PackConstructorInitializers: Never
+PointerAlignment: Left
+ReferenceAlignment: Left
+SeparateDefinitionBlocks: Always
+SortIncludes: true
+UseTab: Never
+#
+# OCCT specific settings
+StatementMacros:
+  - Standard_FALLTHROUGH
+TypenameMacros:
+  - Handle
index 96c228520bfd55ab5a6d9d3d1434ff0723da4746..766356f3f9f79865abf983372ee0a2a10f5ac4b6 100644 (file)
@@ -723,6 +723,9 @@ endif()
 # the name of the project
 project (OCCT)
 
+# copying clang-format file to the root of the project
+file(COPY ${CMAKE_SOURCE_DIR}/.clang-format DESTINATION ${CMAKE_SOURCE_DIR})
+
 # Get all used variables: OS_WITH_BIT, COMPILER
 OCCT_MAKE_OS_WITH_BITNESS()
 OCCT_MAKE_COMPILER_SHORT_NAME()
index ba7d26d1a658d20d437872728847c91ea3daff8c..5c5ea5a3763dae82613b219ff7aad34e65e74f5c 100644 (file)
@@ -22,5 +22,4 @@
 
 typedef NCollection_Array1<Handle(Adaptor3d_Surface)> Approx_Array1OfAdHSurface;
 
-
 #endif
index df098802aeb967a44a11f9dca7738a23f81efe71..5b90de5b9277cd1529ef9e15ce711bf9e4f97167 100644 (file)
 #ifndef Approx_Array1OfGTrsf2d_HeaderFile
 #define Approx_Array1OfGTrsf2d_HeaderFile
 
-#include <gp_GTrsf2d.hxx>
 #include <NCollection_Array1.hxx>
+#include <gp_GTrsf2d.hxx>
 
 typedef NCollection_Array1<gp_GTrsf2d> Approx_Array1OfGTrsf2d;
 
-
 #endif
index be3c9def4cacb05ec0d6136c6bbf318f2359d95e..9e307cc789d612e33f4fd034a571fbbc1deda96c 100644 (file)
@@ -14,7 +14,6 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-
 #include <Adaptor2d_Curve2d.hxx>
 #include <AdvApprox_ApproxAFunction.hxx>
 #include <AdvApprox_PrefAndRec.hxx>
 #include <Precision.hxx>
 #include <TColgp_Array1OfPnt2d.hxx>
 
-//=======================================================================
-//class : Approx_Curve2d_Eval
-//purpose: evaluator class for approximation
-//=======================================================================
+//=================================================================================================
+
 class Approx_Curve2d_Eval : public AdvApprox_EvaluatorFunction
 {
- public:
-  Approx_Curve2d_Eval (const Handle(Adaptor2d_Curve2d)& theFunc, 
-                       Standard_Real First, Standard_Real Last)
-    : fonct(theFunc) { StartEndSav[0] = First; StartEndSav[1] = Last; }
-  
-  virtual void Evaluate (Standard_Integer *Dimension,
-                        Standard_Real     StartEnd[2],
-                         Standard_Real    *Parameter,
-                         Standard_Integer *DerivativeRequest,
-                         Standard_Real    *Result, // [Dimension]
-                         Standard_Integer *ErrorCode);
-  
- private:
+public:
+  Approx_Curve2d_Eval(const Handle(Adaptor2d_Curve2d)& theFunc,
+                      Standard_Real                    First,
+                      Standard_Real                    Last)
+      : fonct(theFunc)
+  {
+    StartEndSav[0] = First;
+    StartEndSav[1] = Last;
+  }
+
+  virtual void Evaluate(Standard_Integer* Dimension,
+                        Standard_Real     StartEnd[2],
+                        Standard_Real*    Parameter,
+                        Standard_Integer* DerivativeRequest,
+                        Standard_Real*    Result, // [Dimension]
+                        Standard_Integer* ErrorCode);
+
+private:
   Handle(Adaptor2d_Curve2d) fonct;
-  Standard_Real StartEndSav[2];
+  Standard_Real             StartEndSav[2];
 };
 
-void Approx_Curve2d_Eval::Evaluate (Standard_Integer *Dimension,
-                                    Standard_Real     StartEnd[2],
-                                    Standard_Real    *Param, // Parameter at which evaluation
-                                    Standard_Integer *Order, // Derivative Request
-                                    Standard_Real    *Result,// [Dimension]
-                                    Standard_Integer *ErrorCode)
+void Approx_Curve2d_Eval::Evaluate(Standard_Integer* Dimension,
+                                   Standard_Real     StartEnd[2],
+                                   Standard_Real*    Param,  // Parameter at which evaluation
+                                   Standard_Integer* Order,  // Derivative Request
+                                   Standard_Real*    Result, // [Dimension]
+                                   Standard_Integer* ErrorCode)
 {
-  *ErrorCode = 0;
+  *ErrorCode        = 0;
   Standard_Real par = *Param;
 
-// Dimension is incorrect
-  if (*Dimension!=2) {
+  // Dimension is incorrect
+  if (*Dimension != 2)
+  {
     *ErrorCode = 1;
   }
-// Parameter is incorrect
-  if ( par < StartEnd[0] || par > StartEnd[1] ) {
+  // Parameter is incorrect
+  if (par < StartEnd[0] || par > StartEnd[1])
+  {
     *ErrorCode = 2;
   }
-  if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1]) 
-    {
-      fonct = fonct->Trim(StartEnd[0],StartEnd[1],Precision::PConfusion());
-      StartEndSav[0]=StartEnd[0];
-      StartEndSav[1]=StartEnd[1];
-    }
+  if (StartEnd[0] != StartEndSav[0] || StartEnd[1] != StartEndSav[1])
+  {
+    fonct          = fonct->Trim(StartEnd[0], StartEnd[1], Precision::PConfusion());
+    StartEndSav[0] = StartEnd[0];
+    StartEndSav[1] = StartEnd[1];
+  }
   gp_Pnt2d pnt;
   gp_Vec2d v1, v2;
 
-  switch (*Order) {
-  case 0:
-    pnt = fonct->Value(par);
-    Result[0] = pnt.X();
-    Result[1] = pnt.Y();
-    break;
-  case 1:
-    fonct->D1(par, pnt, v1);
-    Result[0] = v1.X();
-    Result[1] = v1.Y();
-    break;
-  case 2:
-    fonct->D2(par, pnt, v1, v2);
-    Result[0] = v2.X();
-    Result[1] = v2.Y();
-    break;
-  default:
-    Result[0] = Result[1] = 0.;
-    *ErrorCode = 3;
-    break;
+  switch (*Order)
+  {
+    case 0:
+      pnt       = fonct->Value(par);
+      Result[0] = pnt.X();
+      Result[1] = pnt.Y();
+      break;
+    case 1:
+      fonct->D1(par, pnt, v1);
+      Result[0] = v1.X();
+      Result[1] = v1.Y();
+      break;
+    case 2:
+      fonct->D2(par, pnt, v1, v2);
+      Result[0] = v2.X();
+      Result[1] = v2.Y();
+      break;
+    default:
+      Result[0] = Result[1] = 0.;
+      *ErrorCode            = 3;
+      break;
   }
 }
 
- Approx_Curve2d::Approx_Curve2d(const Handle(Adaptor2d_Curve2d)& C2D,const Standard_Real First,const Standard_Real Last,const Standard_Real TolU,const Standard_Real TolV,const GeomAbs_Shape Continuity,const Standard_Integer MaxDegree,const Standard_Integer MaxSegments)
+Approx_Curve2d::Approx_Curve2d(const Handle(Adaptor2d_Curve2d)& C2D,
+                               const Standard_Real              First,
+                               const Standard_Real              Last,
+                               const Standard_Real              TolU,
+                               const Standard_Real              TolV,
+                               const GeomAbs_Shape              Continuity,
+                               const Standard_Integer           MaxDegree,
+                               const Standard_Integer           MaxSegments)
 {
-  C2D->Trim(First,Last,Precision::PConfusion());
-
-  Standard_Integer Num1DSS=2, Num2DSS=0, Num3DSS=0;
-  Handle(TColStd_HArray1OfReal) TwoDTolNul, ThreeDTolNul; 
-  Handle(TColStd_HArray1OfReal) OneDTol  = new TColStd_HArray1OfReal(1,Num1DSS);
-  OneDTol->ChangeValue(1) = TolU;
-  OneDTol->ChangeValue(2) = TolV;
-  
-  Standard_Integer NbInterv_C2 = C2D->NbIntervals(GeomAbs_C2);
-  TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2+1);
+  C2D->Trim(First, Last, Precision::PConfusion());
+
+  Standard_Integer              Num1DSS = 2, Num2DSS = 0, Num3DSS = 0;
+  Handle(TColStd_HArray1OfReal) TwoDTolNul, ThreeDTolNul;
+  Handle(TColStd_HArray1OfReal) OneDTol = new TColStd_HArray1OfReal(1, Num1DSS);
+  OneDTol->ChangeValue(1)               = TolU;
+  OneDTol->ChangeValue(2)               = TolV;
+
+  Standard_Integer     NbInterv_C2 = C2D->NbIntervals(GeomAbs_C2);
+  TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
   C2D->Intervals(CutPnts_C2, GeomAbs_C2);
-  Standard_Integer NbInterv_C3 = C2D->NbIntervals(GeomAbs_C3);
-  TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3+1);
+  Standard_Integer     NbInterv_C3 = C2D->NbIntervals(GeomAbs_C3);
+  TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3 + 1);
   C2D->Intervals(CutPnts_C3, GeomAbs_C3);
 
-  AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
+  AdvApprox_PrefAndRec CutTool(CutPnts_C2, CutPnts_C3);
 
   myMaxError2dU = 0;
   myMaxError2dV = 0;
 
-  Approx_Curve2d_Eval ev (C2D, First, Last);
-  AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS, 
-                                    OneDTol, TwoDTolNul, ThreeDTolNul,
-                                    First, Last, Continuity,
-                                    MaxDegree, MaxSegments,
-                                    ev, CutTool);
-
-  myIsDone = aApprox.IsDone();
+  Approx_Curve2d_Eval       ev(C2D, First, Last);
+  AdvApprox_ApproxAFunction aApprox(Num1DSS,
+                                    Num2DSS,
+                                    Num3DSS,
+                                    OneDTol,
+                                    TwoDTolNul,
+                                    ThreeDTolNul,
+                                    First,
+                                    Last,
+                                    Continuity,
+                                    MaxDegree,
+                                    MaxSegments,
+                                    ev,
+                                    CutTool);
+
+  myIsDone    = aApprox.IsDone();
   myHasResult = aApprox.HasResult();
-  
-  if (myHasResult) {
-    TColgp_Array1OfPnt2d Poles2d(1,aApprox.NbPoles());
-    TColStd_Array1OfReal Poles1dU(1,aApprox.NbPoles());
+
+  if (myHasResult)
+  {
+    TColgp_Array1OfPnt2d Poles2d(1, aApprox.NbPoles());
+    TColStd_Array1OfReal Poles1dU(1, aApprox.NbPoles());
     aApprox.Poles1d(1, Poles1dU);
-    TColStd_Array1OfReal Poles1dV(1,aApprox.NbPoles());
+    TColStd_Array1OfReal Poles1dV(1, aApprox.NbPoles());
     aApprox.Poles1d(2, Poles1dV);
-    for(Standard_Integer i = 1; i <= aApprox.NbPoles(); i++)
+    for (Standard_Integer i = 1; i <= aApprox.NbPoles(); i++)
       Poles2d.SetValue(i, gp_Pnt2d(Poles1dU.Value(i), Poles1dV.Value(i)));
 
-    Handle(TColStd_HArray1OfReal)    Knots = aApprox.Knots();
-    Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
-    Standard_Integer Degree = aApprox.Degree();
-    myCurve = new Geom2d_BSplineCurve(Poles2d, Knots->Array1(), Mults->Array1(), Degree);
+    Handle(TColStd_HArray1OfReal)    Knots  = aApprox.Knots();
+    Handle(TColStd_HArray1OfInteger) Mults  = aApprox.Multiplicities();
+    Standard_Integer                 Degree = aApprox.Degree();
+    myCurve       = new Geom2d_BSplineCurve(Poles2d, Knots->Array1(), Mults->Array1(), Degree);
     myMaxError2dU = aApprox.MaxError(1, 1);
     myMaxError2dV = aApprox.MaxError(1, 2);
-  } 
+  }
 }
 
- Standard_Boolean Approx_Curve2d::IsDone() const
+Standard_Boolean Approx_Curve2d::IsDone() const
 {
   return myIsDone;
 }
 
- Standard_Boolean Approx_Curve2d::HasResult() const
+Standard_Boolean Approx_Curve2d::HasResult() const
 {
   return myHasResult;
 }
 
- Handle(Geom2d_BSplineCurve) Approx_Curve2d::Curve() const
+Handle(Geom2d_BSplineCurve) Approx_Curve2d::Curve() const
 {
   return myCurve;
 }
 
- Standard_Real Approx_Curve2d::MaxError2dU() const
+Standard_Real Approx_Curve2d::MaxError2dU() const
 {
   return myMaxError2dU;
 }
 
- Standard_Real Approx_Curve2d::MaxError2dV() const
+Standard_Real Approx_Curve2d::MaxError2dV() const
 {
   return myMaxError2dV;
 }
index 9fcf2f6e5b5bd6ac4854d65049d8eb347a001050..7fcef70ae056982760b47d095ba33329f9a2f00e 100644 (file)
 #define _Approx_Curve2d_HeaderFile
 
 #include <Adaptor2d_Curve2d.hxx>
-#include <GeomAbs_Shape.hxx>
 #include <Geom2d_BSplineCurve.hxx>
+#include <GeomAbs_Shape.hxx>
 
 //! Makes  an  approximation  for  HCurve2d  from  Adaptor3d
-class Approx_Curve2d 
+class Approx_Curve2d
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
-  
-  Standard_EXPORT Approx_Curve2d(const Handle(Adaptor2d_Curve2d)& C2D, const Standard_Real First, const Standard_Real Last, const Standard_Real TolU, const Standard_Real TolV, const GeomAbs_Shape Continuity, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments);
-  
+  Standard_EXPORT Approx_Curve2d(const Handle(Adaptor2d_Curve2d)& C2D,
+                                 const Standard_Real              First,
+                                 const Standard_Real              Last,
+                                 const Standard_Real              TolU,
+                                 const Standard_Real              TolV,
+                                 const GeomAbs_Shape              Continuity,
+                                 const Standard_Integer           MaxDegree,
+                                 const Standard_Integer           MaxSegments);
+
   Standard_EXPORT Standard_Boolean IsDone() const;
-  
+
   Standard_EXPORT Standard_Boolean HasResult() const;
-  
+
   Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve() const;
-  
+
   Standard_EXPORT Standard_Real MaxError2dU() const;
-  
+
   Standard_EXPORT Standard_Real MaxError2dV() const;
 
 private:
-
   Handle(Geom2d_BSplineCurve) myCurve;
-  Standard_Boolean myIsDone;
-  Standard_Boolean myHasResult;
-  Standard_Real myMaxError2dU;
-  Standard_Real myMaxError2dV;
-
+  Standard_Boolean            myIsDone;
+  Standard_Boolean            myHasResult;
+  Standard_Real               myMaxError2dU;
+  Standard_Real               myMaxError2dV;
 };
 
 #endif // _Approx_Curve2d_HeaderFile
index ccbab07868e2c477c3d5750768e748de06f3ae79..7b228b41c348e448256e692e4a3ef50647bb9f6b 100644 (file)
 #include <Adaptor3d_Curve.hxx>
 #include <AdvApprox_ApproxAFunction.hxx>
 #include <AdvApprox_PrefAndRec.hxx>
-#include <Geom_BSplineCurve.hxx>
 #include <GeomAdaptor_Curve.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Vec.hxx>
+#include <Geom_BSplineCurve.hxx>
 #include <Precision.hxx>
-#include <TColgp_Array1OfPnt.hxx>
 #include <TColStd_HArray1OfReal.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+
+//=================================================================================================
 
-//=======================================================================
-//class : Approx_Curve3d_Eval
-//purpose: evaluator class for approximation
-//=======================================================================
 class Approx_Curve3d_Eval : public AdvApprox_EvaluatorFunction
 {
- public:
-  Approx_Curve3d_Eval (const Handle(Adaptor3d_Curve)& theFunc, 
-                       Standard_Real First, Standard_Real Last)
-    : fonct(theFunc) { StartEndSav[0] = First; StartEndSav[1] = Last; }
-  
-  virtual void Evaluate (Standard_Integer *Dimension,
-                        Standard_Real     StartEnd[2],
-                         Standard_Real    *Parameter,
-                         Standard_Integer *DerivativeRequest,
-                         Standard_Real    *Result, // [Dimension]
-                         Standard_Integer *ErrorCode);
-  
- private:
+public:
+  Approx_Curve3d_Eval(const Handle(Adaptor3d_Curve)& theFunc,
+                      Standard_Real                  First,
+                      Standard_Real                  Last)
+      : fonct(theFunc)
+  {
+    StartEndSav[0] = First;
+    StartEndSav[1] = Last;
+  }
+
+  virtual void Evaluate(Standard_Integer* Dimension,
+                        Standard_Real     StartEnd[2],
+                        Standard_Real*    Parameter,
+                        Standard_Integer* DerivativeRequest,
+                        Standard_Real*    Result, // [Dimension]
+                        Standard_Integer* ErrorCode);
+
+private:
   Handle(Adaptor3d_Curve) fonct;
-  Standard_Real StartEndSav[2];
+  Standard_Real           StartEndSav[2];
 };
 
-void Approx_Curve3d_Eval::Evaluate (Standard_Integer *Dimension,
-                                    Standard_Real     StartEnd[2],
-                                    Standard_Real    *Param, // Parameter at which evaluation
-                                    Standard_Integer *Order, // Derivative Request
-                                    Standard_Real    *Result,// [Dimension]
-                                    Standard_Integer *ErrorCode)
+void Approx_Curve3d_Eval::Evaluate(Standard_Integer* Dimension,
+                                   Standard_Real     StartEnd[2],
+                                   Standard_Real*    Param,  // Parameter at which evaluation
+                                   Standard_Integer* Order,  // Derivative Request
+                                   Standard_Real*    Result, // [Dimension]
+                                   Standard_Integer* ErrorCode)
 {
-  *ErrorCode = 0;
+  *ErrorCode        = 0;
   Standard_Real par = *Param;
 
-// Dimension is incorrect
-  if (*Dimension!=3) {
+  // Dimension is incorrect
+  if (*Dimension != 3)
+  {
     *ErrorCode = 1;
   }
 
-  if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1]) 
-    {
-      fonct = fonct->Trim(StartEnd[0],StartEnd[1],Precision::PConfusion());
-      StartEndSav[0]=StartEnd[0];
-      StartEndSav[1]=StartEnd[1];
-    }
+  if (StartEnd[0] != StartEndSav[0] || StartEnd[1] != StartEndSav[1])
+  {
+    fonct          = fonct->Trim(StartEnd[0], StartEnd[1], Precision::PConfusion());
+    StartEndSav[0] = StartEnd[0];
+    StartEndSav[1] = StartEnd[1];
+  }
 
   gp_Pnt pnt;
   gp_Vec v1, v2;
 
-  switch (*Order) {
-  case 0:
-    pnt = fonct->Value(par);
-    Result[0] = pnt.X();
-    Result[1] = pnt.Y();
-    Result[2] = pnt.Z();
-    break;
-  case 1:
-    fonct->D1(par, pnt, v1);
-    Result[0] = v1.X();
-    Result[1] = v1.Y();
-    Result[2] = v1.Z();
-    break;
-  case 2:
-    fonct->D2(par, pnt, v1, v2);
-    Result[0] = v2.X();
-    Result[1] = v2.Y();
-    Result[2] = v2.Z();
-    break;
-  default:
-    Result[0] = Result[1] = Result[2] = 0.;
-    *ErrorCode = 3;
-    break;
+  switch (*Order)
+  {
+    case 0:
+      pnt       = fonct->Value(par);
+      Result[0] = pnt.X();
+      Result[1] = pnt.Y();
+      Result[2] = pnt.Z();
+      break;
+    case 1:
+      fonct->D1(par, pnt, v1);
+      Result[0] = v1.X();
+      Result[1] = v1.Y();
+      Result[2] = v1.Z();
+      break;
+    case 2:
+      fonct->D2(par, pnt, v1, v2);
+      Result[0] = v2.X();
+      Result[1] = v2.Y();
+      Result[2] = v2.Z();
+      break;
+    default:
+      Result[0] = Result[1] = Result[2] = 0.;
+      *ErrorCode                        = 3;
+      break;
   }
 }
 
 Approx_Curve3d::Approx_Curve3d(const Handle(Adaptor3d_Curve)& Curve,
-                                                const Standard_Real Tol3d,
-                                                const GeomAbs_Shape Order,
-                                                const Standard_Integer MaxSegments,
-                                                const Standard_Integer MaxDegree)
+                               const Standard_Real            Tol3d,
+                               const GeomAbs_Shape            Order,
+                               const Standard_Integer         MaxSegments,
+                               const Standard_Integer         MaxDegree)
 {
   // Initialisation of input parameters of AdvApprox
 
-  Standard_Integer Num1DSS=0, Num2DSS=0, Num3DSS=1;
-  Handle(TColStd_HArray1OfReal) OneDTolNul, TwoDTolNul; 
-  Handle(TColStd_HArray1OfReal) ThreeDTol  = 
-    new TColStd_HArray1OfReal(1,Num3DSS);
-  ThreeDTol->Init(Tol3d); 
+  Standard_Integer              Num1DSS = 0, Num2DSS = 0, Num3DSS = 1;
+  Handle(TColStd_HArray1OfReal) OneDTolNul, TwoDTolNul;
+  Handle(TColStd_HArray1OfReal) ThreeDTol = new TColStd_HArray1OfReal(1, Num3DSS);
+  ThreeDTol->Init(Tol3d);
 
   Standard_Real First = Curve->FirstParameter();
   Standard_Real Last  = Curve->LastParameter();
 
-  Standard_Integer NbInterv_C2 = Curve->NbIntervals(GeomAbs_C2);
-  TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2+1);
-  Curve->Intervals(CutPnts_C2,GeomAbs_C2);
-  Standard_Integer NbInterv_C3 = Curve->NbIntervals(GeomAbs_C3);
-  TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3+1);
-  Curve->Intervals(CutPnts_C3,GeomAbs_C3);
-  AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
+  Standard_Integer     NbInterv_C2 = Curve->NbIntervals(GeomAbs_C2);
+  TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
+  Curve->Intervals(CutPnts_C2, GeomAbs_C2);
+  Standard_Integer     NbInterv_C3 = Curve->NbIntervals(GeomAbs_C3);
+  TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3 + 1);
+  Curve->Intervals(CutPnts_C3, GeomAbs_C3);
 
-  myMaxError = 0;
+  AdvApprox_PrefAndRec CutTool(CutPnts_C2, CutPnts_C3);
 
-  Approx_Curve3d_Eval ev (Curve, First, Last);
-  AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS, 
-                                    OneDTolNul, TwoDTolNul, ThreeDTol,
-                                    First, Last, Order,
-                                    MaxDegree, MaxSegments,
-                                    ev, CutTool);
+  myMaxError = 0;
 
-  myIsDone = aApprox.IsDone();
+  Approx_Curve3d_Eval       ev(Curve, First, Last);
+  AdvApprox_ApproxAFunction aApprox(Num1DSS,
+                                    Num2DSS,
+                                    Num3DSS,
+                                    OneDTolNul,
+                                    TwoDTolNul,
+                                    ThreeDTol,
+                                    First,
+                                    Last,
+                                    Order,
+                                    MaxDegree,
+                                    MaxSegments,
+                                    ev,
+                                    CutTool);
+
+  myIsDone    = aApprox.IsDone();
   myHasResult = aApprox.HasResult();
 
-  if (myHasResult) {
-    TColgp_Array1OfPnt Poles(1,aApprox.NbPoles());
-    aApprox.Poles(1,Poles);
-    Handle(TColStd_HArray1OfReal)    Knots = aApprox.Knots();
-    Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
-    Standard_Integer Degree = aApprox.Degree();
+  if (myHasResult)
+  {
+    TColgp_Array1OfPnt Poles(1, aApprox.NbPoles());
+    aApprox.Poles(1, Poles);
+    Handle(TColStd_HArray1OfReal)    Knots  = aApprox.Knots();
+    Handle(TColStd_HArray1OfInteger) Mults  = aApprox.Multiplicities();
+    Standard_Integer                 Degree = aApprox.Degree();
     myBSplCurve = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
-    myMaxError = aApprox.MaxError(3, 1);
-  } 
+    myMaxError  = aApprox.MaxError(3, 1);
+  }
 }
 
- Handle(Geom_BSplineCurve) Approx_Curve3d::Curve() const
+Handle(Geom_BSplineCurve) Approx_Curve3d::Curve() const
 {
   return myBSplCurve;
 }
 
- Standard_Boolean Approx_Curve3d::IsDone() const
+Standard_Boolean Approx_Curve3d::IsDone() const
 {
-  return myIsDone; 
+  return myIsDone;
 }
 
- Standard_Boolean Approx_Curve3d::HasResult() const
+Standard_Boolean Approx_Curve3d::HasResult() const
 {
-  return myHasResult; 
+  return myHasResult;
 }
 
- Standard_Real Approx_Curve3d::MaxError() const
+Standard_Real Approx_Curve3d::MaxError() const
 {
   return myMaxError;
 }
 
- void Approx_Curve3d::Dump(Standard_OStream& o) const
+void Approx_Curve3d::Dump(Standard_OStream& o) const
 {
   o << "******* Dump of ApproxCurve *******" << std::endl;
   o << "*******Degree     " << Curve()->Degree() << std::endl;
index 97ab07a95ddf811b2406518fe810494abeef85ab..453f379b7ea677c0d4e8b8f7855e31574f8cd3b7 100644 (file)
 #include <GeomAbs_Shape.hxx>
 #include <Geom_BSplineCurve.hxx>
 
-class Approx_Curve3d 
+class Approx_Curve3d
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
-  
   //! Approximation  of  a  curve  with respect of the
   //! required tolerance Tol3D.
-  Standard_EXPORT Approx_Curve3d(const Handle(Adaptor3d_Curve)& Curve, const Standard_Real Tol3d, const GeomAbs_Shape Order, const Standard_Integer MaxSegments, const Standard_Integer MaxDegree);
-  
+  Standard_EXPORT Approx_Curve3d(const Handle(Adaptor3d_Curve)& Curve,
+                                 const Standard_Real            Tol3d,
+                                 const GeomAbs_Shape            Order,
+                                 const Standard_Integer         MaxSegments,
+                                 const Standard_Integer         MaxDegree);
+
   Standard_EXPORT Handle(Geom_BSplineCurve) Curve() const;
-  
+
   //! returns  Standard_True  if  the  approximation  has
   //! been  done  within  required tolerance
   Standard_EXPORT Standard_Boolean IsDone() const;
-  
+
   //! returns  Standard_True if the approximation did come out
   //! with a result that  is not NECESSARELY within the required
   //! tolerance
   Standard_EXPORT Standard_Boolean HasResult() const;
-  
+
   //! returns  the  Maximum  Error  (>0 when an approximation
   //! has  been  done, 0  if  no  approximation)
   Standard_EXPORT Standard_Real MaxError() const;
-  
+
   //! Print on the stream  o  information about the object
-  Standard_EXPORT void Dump (Standard_OStream& o) const;
+  Standard_EXPORT void Dump(Standard_OStream& o) const;
 
 private:
-
-  Standard_Boolean myIsDone;
-  Standard_Boolean myHasResult;
+  Standard_Boolean          myIsDone;
+  Standard_Boolean          myHasResult;
   Handle(Geom_BSplineCurve) myBSplCurve;
-  Standard_Real myMaxError;
-
+  Standard_Real             myMaxError;
 };
 
 #endif // _Approx_Curve3d_HeaderFile
index 4a616a2a1e5193253f1eaa29e2dddd3b2cccc1ba..a15089e783429a5c989263b4cf13352744cadf76 100644 (file)
 #include <AdvApprox_ApproxAFunction.hxx>
 #include <AdvApprox_DichoCutting.hxx>
 #include <AdvApprox_PrefAndRec.hxx>
-#include <Geom2d_BezierCurve.hxx>
-#include <Geom2d_BSplineCurve.hxx>
 #include <Geom2dAdaptor_Curve.hxx>
-#include <Geom_RectangularTrimmedSurface.hxx>
-#include <Geom_TrimmedCurve.hxx>
+#include <Geom2d_BSplineCurve.hxx>
+#include <Geom2d_BezierCurve.hxx>
 #include <GeomAdaptor_Curve.hxx>
 #include <GeomAdaptor_Surface.hxx>
 #include <GeomConvert.hxx>
-#include <gp_Lin2d.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Vec.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+#include <Geom_TrimmedCurve.hxx>
 #include <Precision.hxx>
 #include <Standard_ConstructionError.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <TColgp_Array1OfPnt2d.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <TColStd_HArray1OfReal.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <gp_Lin2d.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+
+//=================================================================================================
 
-//=======================================================================
-//class : Approx_CurveOnSurface_Eval
-//purpose: evaluator class for approximation of both 2d and 3d curves
-//=======================================================================
 class Approx_CurveOnSurface_Eval : public AdvApprox_EvaluatorFunction
 {
- public:
-  Approx_CurveOnSurface_Eval (const Handle(Adaptor3d_Curve)& theFunc, 
-                              const Handle(Adaptor2d_Curve2d)& theFunc2d, 
-                              Standard_Real First, Standard_Real Last)
-    : fonct(theFunc), fonct2d(theFunc2d) 
-      { StartEndSav[0] = First; StartEndSav[1] = Last; }
-  
-  virtual void Evaluate (Standard_Integer *Dimension,
-                        Standard_Real     StartEnd[2],
-                         Standard_Real    *Parameter,
-                         Standard_Integer *DerivativeRequest,
-                         Standard_Real    *Result, // [Dimension]
-                         Standard_Integer *ErrorCode);
-  
- private:
-  Handle(Adaptor3d_Curve) fonct;
+public:
+  Approx_CurveOnSurface_Eval(const Handle(Adaptor3d_Curve)&   theFunc,
+                             const Handle(Adaptor2d_Curve2d)& theFunc2d,
+                             Standard_Real                    First,
+                             Standard_Real                    Last)
+      : fonct(theFunc),
+        fonct2d(theFunc2d)
+  {
+    StartEndSav[0] = First;
+    StartEndSav[1] = Last;
+  }
+
+  virtual void Evaluate(Standard_Integer* Dimension,
+                        Standard_Real     StartEnd[2],
+                        Standard_Real*    Parameter,
+                        Standard_Integer* DerivativeRequest,
+                        Standard_Real*    Result, // [Dimension]
+                        Standard_Integer* ErrorCode);
+
+private:
+  Handle(Adaptor3d_Curve)   fonct;
   Handle(Adaptor2d_Curve2d) fonct2d;
-  Standard_Real StartEndSav[2];
+  Standard_Real             StartEndSav[2];
 };
 
-void Approx_CurveOnSurface_Eval::Evaluate (Standard_Integer *Dimension,
-                                           Standard_Real     StartEnd[2],
-                                           Standard_Real    *Param, // Parameter at which evaluation
-                                           Standard_Integer *Order, // Derivative Request
-                                           Standard_Real    *Result,// [Dimension]
-                                           Standard_Integer *ErrorCode)
+void Approx_CurveOnSurface_Eval::Evaluate(Standard_Integer* Dimension,
+                                          Standard_Real     StartEnd[2],
+                                          Standard_Real*    Param,  // Parameter at which evaluation
+                                          Standard_Integer* Order,  // Derivative Request
+                                          Standard_Real*    Result, // [Dimension]
+                                          Standard_Integer* ErrorCode)
 {
-  *ErrorCode = 0;
+  *ErrorCode        = 0;
   Standard_Real par = *Param;
 
-// Dimension is incorrect
-  if (*Dimension != 5) {
+  // Dimension is incorrect
+  if (*Dimension != 5)
+  {
     *ErrorCode = 1;
   }
 
-// Parameter is incorrect
-  if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1]) 
-    {
-      fonct = fonct->Trim(StartEnd[0],StartEnd[1],Precision::PConfusion());
-      fonct2d = fonct2d->Trim(StartEnd[0],StartEnd[1],
-                               Precision::PConfusion());
-      StartEndSav[0]=StartEnd[0];
-      StartEndSav[1]=StartEnd[1];
-    }
+  // Parameter is incorrect
+  if (StartEnd[0] != StartEndSav[0] || StartEnd[1] != StartEndSav[1])
+  {
+    fonct          = fonct->Trim(StartEnd[0], StartEnd[1], Precision::PConfusion());
+    fonct2d        = fonct2d->Trim(StartEnd[0], StartEnd[1], Precision::PConfusion());
+    StartEndSav[0] = StartEnd[0];
+    StartEndSav[1] = StartEnd[1];
+  }
   gp_Pnt pnt;
 
-
   gp_Pnt2d pnt2d;
 
-  switch (*Order) {
-  case 0: 
-    {
+  switch (*Order)
+  {
+    case 0: {
       fonct2d->D0(par, pnt2d);
       fonct->D0(par, pnt);
       Result[0] = pnt2d.X();
@@ -109,25 +111,23 @@ void Approx_CurveOnSurface_Eval::Evaluate (Standard_Integer *Dimension,
       Result[4] = pnt.Z();
       break;
     }
-  case 1:
-    {
-      gp_Vec v1;
+    case 1: {
+      gp_Vec   v1;
       gp_Vec2d v21;
       fonct2d->D1(par, pnt2d, v21);
-      fonct->D1(par,pnt, v1);
+      fonct->D1(par, pnt, v1);
       Result[0] = v21.X();
       Result[1] = v21.Y();
       Result[2] = v1.X();
       Result[3] = v1.Y();
       Result[4] = v1.Z();
       break;
-  }
-  case 2:
-    {
-      gp_Vec v1, v2;
-      gp_Vec2d v21, v22;    
+    }
+    case 2: {
+      gp_Vec   v1, v2;
+      gp_Vec2d v21, v22;
       fonct2d->D2(par, pnt2d, v21, v22);
-      fonct->D2(par, pnt, v1, v2);         
+      fonct->D2(par, pnt, v1, v2);
       Result[0] = v22.X();
       Result[1] = v22.Y();
       Result[2] = v2.X();
@@ -135,71 +135,74 @@ void Approx_CurveOnSurface_Eval::Evaluate (Standard_Integer *Dimension,
       Result[4] = v2.Z();
       break;
     }
-  default:
-    Result[0] = Result[1] = Result[2] = Result[3] = Result[4] = 0.;
-    *ErrorCode = 3;
-    break;
+    default:
+      Result[0] = Result[1] = Result[2] = Result[3] = Result[4] = 0.;
+      *ErrorCode                                                = 3;
+      break;
   }
 }
 
-//=======================================================================
-//class : Approx_CurveOnSurface_Eval3d
-//purpose: evaluator class for approximation of 3d curve
-//=======================================================================
+//=================================================================================================
 
 class Approx_CurveOnSurface_Eval3d : public AdvApprox_EvaluatorFunction
 {
- public:
-  Approx_CurveOnSurface_Eval3d (const Handle(Adaptor3d_Curve)& theFunc, 
-                                Standard_Real First, Standard_Real Last)
-    : fonct(theFunc) { StartEndSav[0] = First; StartEndSav[1] = Last; }
-  
-  virtual void Evaluate (Standard_Integer *Dimension,
-                        Standard_Real     StartEnd[2],
-                         Standard_Real    *Parameter,
-                         Standard_Integer *DerivativeRequest,
-                         Standard_Real    *Result, // [Dimension]
-                         Standard_Integer *ErrorCode);
-  
- private:
+public:
+  Approx_CurveOnSurface_Eval3d(const Handle(Adaptor3d_Curve)& theFunc,
+                               Standard_Real                  First,
+                               Standard_Real                  Last)
+      : fonct(theFunc)
+  {
+    StartEndSav[0] = First;
+    StartEndSav[1] = Last;
+  }
+
+  virtual void Evaluate(Standard_Integer* Dimension,
+                        Standard_Real     StartEnd[2],
+                        Standard_Real*    Parameter,
+                        Standard_Integer* DerivativeRequest,
+                        Standard_Real*    Result, // [Dimension]
+                        Standard_Integer* ErrorCode);
+
+private:
   Handle(Adaptor3d_Curve) fonct;
-  Standard_Real StartEndSav[2];
+  Standard_Real           StartEndSav[2];
 };
 
-void Approx_CurveOnSurface_Eval3d::Evaluate (Standard_Integer *Dimension,
-                                             Standard_Real     StartEnd[2],
-                                             Standard_Real    *Param, // Parameter at which evaluation
-                                             Standard_Integer *Order, // Derivative Request
-                                             Standard_Real    *Result,// [Dimension]
-                                             Standard_Integer *ErrorCode)
+void Approx_CurveOnSurface_Eval3d::Evaluate(Standard_Integer* Dimension,
+                                            Standard_Real     StartEnd[2],
+                                            Standard_Real* Param, // Parameter at which evaluation
+                                            Standard_Integer* Order,  // Derivative Request
+                                            Standard_Real*    Result, // [Dimension]
+                                            Standard_Integer* ErrorCode)
 {
-  *ErrorCode = 0;
+  *ErrorCode        = 0;
   Standard_Real par = *Param;
 
-// Dimension is incorrect
-  if (*Dimension != 3) {
+  // Dimension is incorrect
+  if (*Dimension != 3)
+  {
     *ErrorCode = 1;
   }
 
-// Parameter is incorrect
-  if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1]) 
-    {
-      fonct = fonct->Trim(StartEnd[0],StartEnd[1],Precision::PConfusion());
-      StartEndSav[0]=StartEnd[0];
-      StartEndSav[1]=StartEnd[1];
-    }
+  // Parameter is incorrect
+  if (StartEnd[0] != StartEndSav[0] || StartEnd[1] != StartEndSav[1])
+  {
+    fonct          = fonct->Trim(StartEnd[0], StartEnd[1], Precision::PConfusion());
+    StartEndSav[0] = StartEnd[0];
+    StartEndSav[1] = StartEnd[1];
+  }
 
   gp_Pnt pnt;
 
-  switch (*Order) {
-  case 0:
-    pnt = fonct->Value(par);
-    Result[0] = pnt.X();
-    Result[1] = pnt.Y();
-    Result[2] = pnt.Z();
-    break;
-  case 1:
-    {
+  switch (*Order)
+  {
+    case 0:
+      pnt       = fonct->Value(par);
+      Result[0] = pnt.X();
+      Result[1] = pnt.Y();
+      Result[2] = pnt.Z();
+      break;
+    case 1: {
       gp_Vec v1;
       fonct->D1(par, pnt, v1);
       Result[0] = v1.X();
@@ -207,8 +210,7 @@ void Approx_CurveOnSurface_Eval3d::Evaluate (Standard_Integer *Dimension,
       Result[2] = v1.Z();
       break;
     }
-  case 2:
-    {
+    case 2: {
       gp_Vec v1, v2;
       fonct->D2(par, pnt, v1, v2);
       Result[0] = v2.X();
@@ -216,160 +218,156 @@ void Approx_CurveOnSurface_Eval3d::Evaluate (Standard_Integer *Dimension,
       Result[2] = v2.Z();
       break;
     }
-  default:
-    Result[0] = Result[1] = Result[2] = 0.;
-    *ErrorCode = 3;
-    break;
+    default:
+      Result[0] = Result[1] = Result[2] = 0.;
+      *ErrorCode                        = 3;
+      break;
   }
 }
 
-//=======================================================================
-//class : Approx_CurveOnSurface_Eval2d
-//purpose: evaluator class for approximation of 2d curve
-//=======================================================================
+//=================================================================================================
 
 class Approx_CurveOnSurface_Eval2d : public AdvApprox_EvaluatorFunction
 {
- public:
-  Approx_CurveOnSurface_Eval2d (const Handle(Adaptor2d_Curve2d)& theFunc2d, 
-                                Standard_Real First, Standard_Real Last)
-    : fonct2d(theFunc2d) { StartEndSav[0] = First; StartEndSav[1] = Last; }
-  
-  virtual void Evaluate (Standard_Integer *Dimension,
-                        Standard_Real     StartEnd[2],
-                         Standard_Real    *Parameter,
-                         Standard_Integer *DerivativeRequest,
-                         Standard_Real    *Result, // [Dimension]
-                         Standard_Integer *ErrorCode);
-  
- private:
+public:
+  Approx_CurveOnSurface_Eval2d(const Handle(Adaptor2d_Curve2d)& theFunc2d,
+                               Standard_Real                    First,
+                               Standard_Real                    Last)
+      : fonct2d(theFunc2d)
+  {
+    StartEndSav[0] = First;
+    StartEndSav[1] = Last;
+  }
+
+  virtual void Evaluate(Standard_Integer* Dimension,
+                        Standard_Real     StartEnd[2],
+                        Standard_Real*    Parameter,
+                        Standard_Integer* DerivativeRequest,
+                        Standard_Real*    Result, // [Dimension]
+                        Standard_Integer* ErrorCode);
+
+private:
   Handle(Adaptor2d_Curve2d) fonct2d;
-  Standard_Real StartEndSav[2];
+  Standard_Real             StartEndSav[2];
 };
 
-void Approx_CurveOnSurface_Eval2d::Evaluate (Standard_Integer *Dimension,
-                                             Standard_Real     StartEnd[2],
-                                             Standard_Real    *Param, // Parameter at which evaluation
-                                             Standard_Integer *Order, // Derivative Request
-                                             Standard_Real    *Result,// [Dimension]
-                                             Standard_Integer *ErrorCode)
+void Approx_CurveOnSurface_Eval2d::Evaluate(Standard_Integer* Dimension,
+                                            Standard_Real     StartEnd[2],
+                                            Standard_Real* Param, // Parameter at which evaluation
+                                            Standard_Integer* Order,  // Derivative Request
+                                            Standard_Real*    Result, // [Dimension]
+                                            Standard_Integer* ErrorCode)
 {
-  *ErrorCode = 0;
+  *ErrorCode        = 0;
   Standard_Real par = *Param;
 
-// Dimension is incorrect
-  if (*Dimension != 2) {
+  // Dimension is incorrect
+  if (*Dimension != 2)
+  {
     *ErrorCode = 1;
   }
 
-// Parameter is incorrect
-  if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1]) 
-    {
-      fonct2d = fonct2d->Trim(StartEnd[0],StartEnd[1],Precision::PConfusion());
-      StartEndSav[0]=StartEnd[0];
-      StartEndSav[1]=StartEnd[1];
-    }
+  // Parameter is incorrect
+  if (StartEnd[0] != StartEndSav[0] || StartEnd[1] != StartEndSav[1])
+  {
+    fonct2d        = fonct2d->Trim(StartEnd[0], StartEnd[1], Precision::PConfusion());
+    StartEndSav[0] = StartEnd[0];
+    StartEndSav[1] = StartEnd[1];
+  }
+
   gp_Pnt2d pnt;
 
-  switch (*Order) {
-  case 0:
-    {
-      pnt = fonct2d->Value(par);
+  switch (*Order)
+  {
+    case 0: {
+      pnt       = fonct2d->Value(par);
       Result[0] = pnt.X();
       Result[1] = pnt.Y();
       break;
     }
-  case 1:
-    {
+    case 1: {
       gp_Vec2d v1;
       fonct2d->D1(par, pnt, v1);
       Result[0] = v1.X();
       Result[1] = v1.Y();
       break;
     }
-  case 2:
-    {
+    case 2: {
       gp_Vec2d v1, v2;
       fonct2d->D2(par, pnt, v1, v2);
       Result[0] = v2.X();
       Result[1] = v2.Y();
       break;
     }
-  default:
-    Result[0] = Result[1] = 0.;
-    *ErrorCode = 3;
-    break;
+    default:
+      Result[0] = Result[1] = 0.;
+      *ErrorCode            = 3;
+      break;
   }
 }
 
-//=============================================================================
-//function : Approx_CurveOnSurface
-//purpose  : Constructor
-//=============================================================================
- Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C2D,
-                                             const Handle(Adaptor3d_Surface)& Surf,
-                                             const Standard_Real First,
-                                             const Standard_Real Last,
-                                             const Standard_Real Tol,
-                                             const GeomAbs_Shape S,
-                                             const Standard_Integer MaxDegree,
-                                             const Standard_Integer MaxSegments, 
-                                             const Standard_Boolean only3d, 
-                                             const Standard_Boolean only2d)
-: myC2D(C2D),
-  mySurf(Surf),
-  myFirst(First),
-  myLast(Last),
-  myTol(Tol),
-  myIsDone(Standard_False),
-  myHasResult(Standard_False),
-  myError3d(0.0),
-  myError2dU(0.0),
-  myError2dV(0.0)
- {
-   Perform(MaxSegments, MaxDegree, S, only3d, only2d);
- }
-
-//=============================================================================
-//function : Approx_CurveOnSurface
-//purpose  : Constructor
-//=============================================================================
- Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& theC2D,
-                                              const Handle(Adaptor3d_Surface)& theSurf,
-                                              const Standard_Real               theFirst,
-                                              const Standard_Real               theLast,
-                                              const Standard_Real               theTol)
-: myC2D(theC2D),
-  mySurf(theSurf),
-  myFirst(theFirst),
-  myLast(theLast),
-  myTol(theTol),
-  myIsDone(Standard_False),
-  myHasResult(Standard_False),
-  myError3d(0.0),
-  myError2dU(0.0),
-  myError2dV(0.0)
+//=================================================================================================
+
+Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C2D,
+                                             const Handle(Adaptor3d_Surface)& Surf,
+                                             const Standard_Real              First,
+                                             const Standard_Real              Last,
+                                             const Standard_Real              Tol,
+                                             const GeomAbs_Shape              S,
+                                             const Standard_Integer           MaxDegree,
+                                             const Standard_Integer           MaxSegments,
+                                             const Standard_Boolean           only3d,
+                                             const Standard_Boolean           only2d)
+    : myC2D(C2D),
+      mySurf(Surf),
+      myFirst(First),
+      myLast(Last),
+      myTol(Tol),
+      myIsDone(Standard_False),
+      myHasResult(Standard_False),
+      myError3d(0.0),
+      myError2dU(0.0),
+      myError2dV(0.0)
 {
+  Perform(MaxSegments, MaxDegree, S, only3d, only2d);
 }
 
-//=============================================================================
-//function : Perform
-//purpose  :
-//=============================================================================
+//=================================================================================================
+
+Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& theC2D,
+                                             const Handle(Adaptor3d_Surface)& theSurf,
+                                             const Standard_Real              theFirst,
+                                             const Standard_Real              theLast,
+                                             const Standard_Real              theTol)
+    : myC2D(theC2D),
+      mySurf(theSurf),
+      myFirst(theFirst),
+      myLast(theLast),
+      myTol(theTol),
+      myIsDone(Standard_False),
+      myHasResult(Standard_False),
+      myError3d(0.0),
+      myError2dU(0.0),
+      myError2dV(0.0)
+{
+}
+
+//=================================================================================================
+
 void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
                                     const Standard_Integer theMaxDegree,
                                     const GeomAbs_Shape    theContinuity,
                                     const Standard_Boolean theOnly3d,
                                     const Standard_Boolean theOnly2d)
 {
-  myIsDone = Standard_False;
+  myIsDone    = Standard_False;
   myHasResult = Standard_False;
-  myError2dU = 0.0;
-  myError2dV = 0.0;
-  myError3d = 0.0;
+  myError2dU  = 0.0;
+  myError2dV  = 0.0;
+  myError3d   = 0.0;
 
-  if(theOnly3d && theOnly2d) throw Standard_ConstructionError();
+  if (theOnly3d && theOnly2d)
+    throw Standard_ConstructionError();
 
   GeomAbs_Shape aContinuity = theContinuity;
   if (aContinuity == GeomAbs_G1)
@@ -377,42 +375,46 @@ void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
   else if (aContinuity == GeomAbs_G2)
     aContinuity = GeomAbs_C2;
   else if (aContinuity > GeomAbs_C2)
-    aContinuity = GeomAbs_C2; //Restriction of AdvApprox_ApproxAFunction
+    aContinuity = GeomAbs_C2; // Restriction of AdvApprox_ApproxAFunction
 
-  Handle( Adaptor2d_Curve2d ) TrimmedC2D = myC2D->Trim( myFirst, myLast, Precision::PConfusion() );
+  Handle(Adaptor2d_Curve2d) TrimmedC2D = myC2D->Trim(myFirst, myLast, Precision::PConfusion());
 
   Standard_Boolean isU, isForward;
-  Standard_Real aParam;
+  Standard_Real    aParam;
   if (theOnly3d && isIsoLine(TrimmedC2D, isU, aParam, isForward))
   {
     if (buildC3dOnIsoLine(TrimmedC2D, isU, aParam, isForward))
     {
-      myIsDone = Standard_True;
+      myIsDone    = Standard_True;
       myHasResult = Standard_True;
       return;
     }
   }
 
-  Handle(Adaptor3d_CurveOnSurface) HCOnS = new Adaptor3d_CurveOnSurface (TrimmedC2D, mySurf);
+  Handle(Adaptor3d_CurveOnSurface) HCOnS = new Adaptor3d_CurveOnSurface(TrimmedC2D, mySurf);
 
-  Standard_Integer Num1DSS = 0, Num2DSS=0, Num3DSS=0;
+  Standard_Integer              Num1DSS = 0, Num2DSS = 0, Num3DSS = 0;
   Handle(TColStd_HArray1OfReal) OneDTol;
   Handle(TColStd_HArray1OfReal) TwoDTolNul;
   Handle(TColStd_HArray1OfReal) ThreeDTol;
 
   // create evaluators and choose appropriate one
-  Approx_CurveOnSurface_Eval3d Eval3dCvOnSurf (HCOnS,             myFirst, myLast);
-  Approx_CurveOnSurface_Eval2d Eval2dCvOnSurf (       TrimmedC2D, myFirst, myLast);
-  Approx_CurveOnSurface_Eval   EvalCvOnSurf   (HCOnS, TrimmedC2D, myFirst, myLast);
+  Approx_CurveOnSurface_Eval3d Eval3dCvOnSurf(HCOnS, myFirst, myLast);
+  Approx_CurveOnSurface_Eval2d Eval2dCvOnSurf(TrimmedC2D, myFirst, myLast);
+  Approx_CurveOnSurface_Eval   EvalCvOnSurf(HCOnS, TrimmedC2D, myFirst, myLast);
   AdvApprox_EvaluatorFunction* EvalPtr;
-  if ( theOnly3d ) EvalPtr = &Eval3dCvOnSurf;
-  else if ( theOnly2d ) EvalPtr = &Eval2dCvOnSurf;
-  else EvalPtr = &EvalCvOnSurf;
+  if (theOnly3d)
+    EvalPtr = &Eval3dCvOnSurf;
+  else if (theOnly2d)
+    EvalPtr = &Eval2dCvOnSurf;
+  else
+    EvalPtr = &EvalCvOnSurf;
 
   // Initialization for 2d approximation
-  if(!theOnly3d) {
+  if (!theOnly3d)
+  {
     Num1DSS = 2;
-    OneDTol = new TColStd_HArray1OfReal(1,Num1DSS);
+    OneDTol = new TColStd_HArray1OfReal(1, Num1DSS);
 
     Standard_Real TolU, TolV;
 
@@ -435,144 +437,150 @@ void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
         TolV = Min(1.e-3, 1.e2 * TolV);
     }
 
-    OneDTol->SetValue(1,TolU);
-    OneDTol->SetValue(2,TolV);
+    OneDTol->SetValue(1, TolU);
+    OneDTol->SetValue(2, TolV);
   }
-  
-  if(!theOnly2d) {
-    Num3DSS=1;
-    ThreeDTol = new TColStd_HArray1OfReal(1,Num3DSS);
-    ThreeDTol->Init(myTol/2);
+
+  if (!theOnly2d)
+  {
+    Num3DSS   = 1;
+    ThreeDTol = new TColStd_HArray1OfReal(1, Num3DSS);
+    ThreeDTol->Init(myTol / 2);
   }
 
   AdvApprox_Cutting* CutTool;
 
-  if (aContinuity <= myC2D->Continuity() &&
-      aContinuity <= mySurf->UContinuity() &&
-      aContinuity <= mySurf->VContinuity())
+  if (aContinuity <= myC2D->Continuity() && aContinuity <= mySurf->UContinuity()
+      && aContinuity <= mySurf->VContinuity())
   {
     CutTool = new AdvApprox_DichoCutting();
   }
   else if (aContinuity == GeomAbs_C1)
   {
-    Standard_Integer NbInterv_C1 = HCOnS->NbIntervals(GeomAbs_C1);
+    Standard_Integer     NbInterv_C1 = HCOnS->NbIntervals(GeomAbs_C1);
     TColStd_Array1OfReal CutPnts_C1(1, NbInterv_C1 + 1);
     HCOnS->Intervals(CutPnts_C1, GeomAbs_C1);
-    Standard_Integer NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
+    Standard_Integer     NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
     TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
     HCOnS->Intervals(CutPnts_C2, GeomAbs_C2);
-    
-    CutTool = new AdvApprox_PrefAndRec (CutPnts_C1, CutPnts_C2);
+
+    CutTool = new AdvApprox_PrefAndRec(CutPnts_C1, CutPnts_C2);
   }
   else
   {
-    Standard_Integer NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
+    Standard_Integer     NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
     TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
     HCOnS->Intervals(CutPnts_C2, GeomAbs_C2);
-    Standard_Integer NbInterv_C3 = HCOnS->NbIntervals(GeomAbs_C3);
+    Standard_Integer     NbInterv_C3 = HCOnS->NbIntervals(GeomAbs_C3);
     TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3 + 1);
     HCOnS->Intervals(CutPnts_C3, GeomAbs_C3);
-    
-    CutTool = new AdvApprox_PrefAndRec (CutPnts_C2, CutPnts_C3);
+
+    CutTool = new AdvApprox_PrefAndRec(CutPnts_C2, CutPnts_C3);
   }
 
-  AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS, 
-                                    OneDTol, TwoDTolNul, ThreeDTol,
-                                    myFirst, myLast, aContinuity,
-                                    theMaxDegree, theMaxSegments,
-                                    *EvalPtr, *CutTool);
+  AdvApprox_ApproxAFunction aApprox(Num1DSS,
+                                    Num2DSS,
+                                    Num3DSS,
+                                    OneDTol,
+                                    TwoDTolNul,
+                                    ThreeDTol,
+                                    myFirst,
+                                    myLast,
+                                    aContinuity,
+                                    theMaxDegree,
+                                    theMaxSegments,
+                                    *EvalPtr,
+                                    *CutTool);
 
   delete CutTool;
 
-  myIsDone = aApprox.IsDone();
+  myIsDone    = aApprox.IsDone();
   myHasResult = aApprox.HasResult();
-  
-  if (myHasResult) {
-    Handle(TColStd_HArray1OfReal)    Knots = aApprox.Knots();
-    Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
-    Standard_Integer Degree = aApprox.Degree();
 
-    if(!theOnly2d) 
-      {
-       TColgp_Array1OfPnt Poles(1,aApprox.NbPoles());
-       aApprox.Poles(1,Poles);
-       myCurve3d = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
-       myError3d = aApprox.MaxError(3, 1);
-      }
-    if(!theOnly3d) 
-      {
-       TColgp_Array1OfPnt2d Poles2d(1,aApprox.NbPoles());
-       TColStd_Array1OfReal Poles1dU(1,aApprox.NbPoles());
-       aApprox.Poles1d(1, Poles1dU);
-       TColStd_Array1OfReal Poles1dV(1,aApprox.NbPoles());
-       aApprox.Poles1d(2, Poles1dV);
-       for(Standard_Integer i = 1; i <= aApprox.NbPoles(); i++)
-         Poles2d.SetValue(i, gp_Pnt2d(Poles1dU.Value(i), Poles1dV.Value(i)));
-       myCurve2d = new Geom2d_BSplineCurve(Poles2d, Knots->Array1(), Mults->Array1(), Degree);
-       
-       myError2dU = aApprox.MaxError(1, 1);
-       myError2dV = aApprox.MaxError(1, 2);
-      }
+  if (myHasResult)
+  {
+    Handle(TColStd_HArray1OfReal)    Knots  = aApprox.Knots();
+    Handle(TColStd_HArray1OfInteger) Mults  = aApprox.Multiplicities();
+    Standard_Integer                 Degree = aApprox.Degree();
+
+    if (!theOnly2d)
+    {
+      TColgp_Array1OfPnt Poles(1, aApprox.NbPoles());
+      aApprox.Poles(1, Poles);
+      myCurve3d = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
+      myError3d = aApprox.MaxError(3, 1);
+    }
+    if (!theOnly3d)
+    {
+      TColgp_Array1OfPnt2d Poles2d(1, aApprox.NbPoles());
+      TColStd_Array1OfReal Poles1dU(1, aApprox.NbPoles());
+      aApprox.Poles1d(1, Poles1dU);
+      TColStd_Array1OfReal Poles1dV(1, aApprox.NbPoles());
+      aApprox.Poles1d(2, Poles1dV);
+      for (Standard_Integer i = 1; i <= aApprox.NbPoles(); i++)
+        Poles2d.SetValue(i, gp_Pnt2d(Poles1dU.Value(i), Poles1dV.Value(i)));
+      myCurve2d = new Geom2d_BSplineCurve(Poles2d, Knots->Array1(), Mults->Array1(), Degree);
+
+      myError2dU = aApprox.MaxError(1, 1);
+      myError2dV = aApprox.MaxError(1, 2);
+    }
   }
-  
 }
 
- Standard_Boolean Approx_CurveOnSurface::IsDone() const
+Standard_Boolean Approx_CurveOnSurface::IsDone() const
 {
   return myIsDone;
 }
 
- Standard_Boolean Approx_CurveOnSurface::HasResult() const
+Standard_Boolean Approx_CurveOnSurface::HasResult() const
 {
   return myHasResult;
 }
 
- Handle(Geom_BSplineCurve) Approx_CurveOnSurface::Curve3d() const
+Handle(Geom_BSplineCurve) Approx_CurveOnSurface::Curve3d() const
 {
   return myCurve3d;
 }
 
- Handle(Geom2d_BSplineCurve) Approx_CurveOnSurface::Curve2d() const
+Handle(Geom2d_BSplineCurve) Approx_CurveOnSurface::Curve2d() const
 {
   return myCurve2d;
 }
 
- Standard_Real Approx_CurveOnSurface::MaxError3d() const
+Standard_Real Approx_CurveOnSurface::MaxError3d() const
 {
   return myError3d;
 }
 
- Standard_Real Approx_CurveOnSurface::MaxError2dU() const
+Standard_Real Approx_CurveOnSurface::MaxError2dU() const
 {
   return myError2dU;
 }
 
- Standard_Real Approx_CurveOnSurface::MaxError2dV() const
+Standard_Real Approx_CurveOnSurface::MaxError2dV() const
 {
   return myError2dV;
 }
 
-//=============================================================================
-//function : isIsoLine
-//purpose  :
-//=============================================================================
+//=================================================================================================
+
 Standard_Boolean Approx_CurveOnSurface::isIsoLine(const Handle(Adaptor2d_Curve2d)& theC2D,
                                                   Standard_Boolean&                theIsU,
                                                   Standard_Real&                   theParam,
-                                                  Standard_Boolean&                theIsForward) const
+                                                  Standard_Boolean& theIsForward) const
 {
   // These variables are used to check line state (vertical or horizontal).
   Standard_Boolean isAppropriateType = Standard_False;
-  gp_Pnt2d aLoc2d;
-  gp_Dir2d aDir2d;
+  gp_Pnt2d         aLoc2d;
+  gp_Dir2d         aDir2d;
 
   // Test type.
   const GeomAbs_CurveType aType = theC2D->GetType();
   if (aType == GeomAbs_Line)
   {
-    gp_Lin2d aLin2d = theC2D->Line();
-    aLoc2d = aLin2d.Location();
-    aDir2d = aLin2d.Direction();
+    gp_Lin2d aLin2d   = theC2D->Line();
+    aLoc2d            = aLin2d.Location();
+    aDir2d            = aLin2d.Direction();
     isAppropriateType = Standard_True;
   }
   else if (aType == GeomAbs_BSplineCurve)
@@ -615,16 +623,16 @@ Standard_Boolean Approx_CurveOnSurface::isIsoLine(const Handle(Adaptor2d_Curve2d
   if (aDir2d.IsParallel(gp::DX2d(), Precision::Angular()))
   {
     // Horizontal line. V = const.
-    theIsU = Standard_False;
-    theParam = aLoc2d.Y();
+    theIsU       = Standard_False;
+    theParam     = aLoc2d.Y();
     theIsForward = aDir2d.Dot(gp::DX2d()) > 0.0;
     return Standard_True;
   }
   else if (aDir2d.IsParallel(gp::DY2d(), Precision::Angular()))
   {
     // Vertical line. U = const.
-    theIsU = Standard_True;
-    theParam = aLoc2d.X();
+    theIsU       = Standard_True;
+    theParam     = aLoc2d.X();
     theIsForward = aDir2d.Dot(gp::DY2d()) > 0.0;
     return Standard_True;
   }
@@ -634,14 +642,12 @@ Standard_Boolean Approx_CurveOnSurface::isIsoLine(const Handle(Adaptor2d_Curve2d
 
 #include <GeomLib.hxx>
 
-//=============================================================================
-//function : buildC3dOnIsoLine
-//purpose  :
-//=============================================================================
+//=================================================================================================
+
 Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d_Curve2d)& theC2D,
                                                           const Standard_Boolean           theIsU,
                                                           const Standard_Real              theParam,
-                                                          const Standard_Boolean           theIsForward)
+                                                          const Standard_Boolean theIsForward)
 {
   // Convert adapter to the appropriate type.
   Handle(GeomAdaptor_Surface) aGeomAdapter = Handle(GeomAdaptor_Surface)::DownCast(mySurf);
@@ -653,13 +659,13 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
 
   // Extract isoline
   Handle(Geom_Surface) aSurf = aGeomAdapter->Surface();
-  Handle(Geom_Curve) aC3d;
+  Handle(Geom_Curve)   aC3d;
 
   gp_Pnt2d aF2d = theC2D->Value(theC2D->FirstParameter());
   gp_Pnt2d aL2d = theC2D->Value(theC2D->LastParameter());
 
   Standard_Boolean isToTrim = Standard_True;
-  Standard_Real U1, U2, V1, V2;
+  Standard_Real    U1, U2, V1, V2;
   aSurf->Bounds(U1, U2, V1, V2);
 
   if (theIsU)
@@ -676,7 +682,7 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
       {
         return Standard_False;
       }
-      aSurf = new Geom_RectangularTrimmedSurface(aSurf, U1, U2, aV1Param, aV2Param);
+      aSurf    = new Geom_RectangularTrimmedSurface(aSurf, U1, U2, aV1Param, aV2Param);
       isToTrim = Standard_False;
     }
     else
@@ -706,7 +712,7 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
       {
         return Standard_False;
       }
-      aSurf = new Geom_RectangularTrimmedSurface(aSurf, aU1Param, aU2Param, V1, V2);
+      aSurf    = new Geom_RectangularTrimmedSurface(aSurf, aU1Param, aU2Param, V1, V2);
       isToTrim = Standard_False;
     }
     else
@@ -729,7 +735,7 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
     myCurve3d->Reverse();
 
   // Rebuild parameterization for the 3d curve to have the same parameterization with
-  // a two-dimensional curve. 
+  // a two-dimensional curve.
   TColStd_Array1OfReal aKnots = myCurve3d->Knots();
   BSplCLib::Reparametrize(theC2D->FirstParameter(), theC2D->LastParameter(), aKnots);
   myCurve3d->SetKnots(aKnots);
@@ -737,10 +743,10 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
   // Evaluate error.
   myError3d = 0.0;
 
-  const Standard_Real aParF = myFirst;
-  const Standard_Real aParL = myLast;
+  const Standard_Real    aParF  = myFirst;
+  const Standard_Real    aParL  = myLast;
   const Standard_Integer aNbPnt = 23;
-  for(Standard_Integer anIdx = 0; anIdx <= aNbPnt; ++anIdx)
+  for (Standard_Integer anIdx = 0; anIdx <= aNbPnt; ++anIdx)
   {
     const Standard_Real aPar = aParF + ((aParL - aParF) * anIdx) / aNbPnt;
 
@@ -750,7 +756,7 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
     const gp_Pnt aPntC2D = mySurf->Value(aPnt2d.X(), aPnt2d.Y());
 
     const Standard_Real aSqDeviation = aPntC3D.SquareDistance(aPntC2D);
-    myError3d = Max(aSqDeviation, myError3d);
+    myError3d                        = Max(aSqDeviation, myError3d);
   }
 
   myError3d = Sqrt(myError3d);
@@ -758,7 +764,7 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
   // Target tolerance is not obtained. This situation happens for isolines on the sphere.
   // OCCT is unable to convert it keeping original parameterization, while the geometric
   // form of the result is entirely identical. In that case, it is better to utilize
-  // a general-purpose approach. 
+  // a general-purpose approach.
   if (myError3d > myTol)
     return Standard_False;
 
index c3541e357dda049bcfa69226b8ba3ef54b58def9..7761363746ba5cd4ceb5bcb946df8e091463fe6a 100644 (file)
@@ -25,15 +25,24 @@ class Geom_BSplineCurve;
 class Geom2d_BSplineCurve;
 
 //! Approximation of   curve on surface
-class Approx_CurveOnSurface 
+class Approx_CurveOnSurface
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
   //! This constructor calls perform method. This constructor is deprecated.
-  Standard_DEPRECATED("This constructor is deprecated. Use other constructor and perform method instead.")
-  Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C2D, const Handle(Adaptor3d_Surface)& Surf, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol, const GeomAbs_Shape Continuity, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments, const Standard_Boolean Only3d = Standard_False, const Standard_Boolean Only2d = Standard_False);
+  Standard_DEPRECATED(
+    "This constructor is deprecated. Use other constructor and perform method instead.")
+    Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C2D,
+                                          const Handle(Adaptor3d_Surface)& Surf,
+                                          const Standard_Real              First,
+                                          const Standard_Real              Last,
+                                          const Standard_Real              Tol,
+                                          const GeomAbs_Shape              Continuity,
+                                          const Standard_Integer           MaxDegree,
+                                          const Standard_Integer           MaxSegments,
+                                          const Standard_Boolean           Only3d = Standard_False,
+                                          const Standard_Boolean           Only2d = Standard_False);
 
   //! This constructor does not call perform method.
   //! @param theC2D   2D Curve to be approximated in 3D.
@@ -43,22 +52,22 @@ public:
   //! @param theTol   Computation tolerance.
   Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& theC2D,
                                         const Handle(Adaptor3d_Surface)& theSurf,
-                                        const Standard_Real               theFirst,
-                                        const Standard_Real               theLast,
-                                        const Standard_Real               theTol);
+                                        const Standard_Real              theFirst,
+                                        const Standard_Real              theLast,
+                                        const Standard_Real              theTol);
 
   Standard_EXPORT Standard_Boolean IsDone() const;
-  
+
   Standard_EXPORT Standard_Boolean HasResult() const;
-  
+
   Standard_EXPORT Handle(Geom_BSplineCurve) Curve3d() const;
-  
+
   Standard_EXPORT Standard_Real MaxError3d() const;
-  
+
   Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d() const;
-  
+
   Standard_EXPORT Standard_Real MaxError2dU() const;
-  
+
   //! returns the maximum errors relatively to the  U component or the V component of the
   //! 2d Curve
   Standard_EXPORT Standard_Real MaxError2dV() const;
@@ -70,14 +79,13 @@ public:
   //! @param theContinuity  Resulting continuity.
   //! @param theOnly3d      Determines building only 3D curve.
   //! @param theOnly2d      Determines building only 2D curve.
-  Standard_EXPORT void Perform(const Standard_Integer theMaxSegments, 
-                               const Standard_Integer theMaxDegree, 
+  Standard_EXPORT void Perform(const Standard_Integer theMaxSegments,
+                               const Standard_Integer theMaxDegree,
                                const GeomAbs_Shape    theContinuity,
                                const Standard_Boolean theOnly3d = Standard_False,
                                const Standard_Boolean theOnly2d = Standard_False);
 
 protected:
-
   //! Checks whether the 2d curve is a isoline. It can be represented by b-spline, bezier,
   //! or geometric line. This line should have natural parameterization.
   //! @param theC2D       Trimmed curve to be checked.
@@ -103,10 +111,9 @@ protected:
                                      const Standard_Boolean           theIsForward);
 
 private:
-  Approx_CurveOnSurface& operator= (const Approx_CurveOnSurface&);
+  Approx_CurveOnSurface& operator=(const Approx_CurveOnSurface&);
 
 private:
-
   //! Input curve.
   const Handle(Adaptor2d_Curve2d) myC2D;
 
@@ -123,13 +130,12 @@ private:
   Standard_Real myTol;
 
   Handle(Geom2d_BSplineCurve) myCurve2d;
-  Handle(Geom_BSplineCurve) myCurve3d;
-  Standard_Boolean myIsDone;
-  Standard_Boolean myHasResult;
-  Standard_Real myError3d;
-  Standard_Real myError2dU;
-  Standard_Real myError2dV;
-
+  Handle(Geom_BSplineCurve)   myCurve3d;
+  Standard_Boolean            myIsDone;
+  Standard_Boolean            myHasResult;
+  Standard_Real               myError3d;
+  Standard_Real               myError2dU;
+  Standard_Real               myError2dV;
 };
 
 #endif // _Approx_CurveOnSurface_HeaderFile
index 175441cab036f87a72346b49c2db8657c6c3a3bb..6f63ae4807bec8cdc31f317ee81aaaff60d447ac 100644 (file)
 #include <AdvApprox_PrefAndRec.hxx>
 #include <Approx_CurvlinFunc.hxx>
 #include <Geom2d_BSplineCurve.hxx>
-#include <Geom_BSplineCurve.hxx>
 #include <GeomAbs_Shape.hxx>
 #include <GeomAdaptor_Curve.hxx>
 #include <GeomAdaptor_Surface.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Pnt2d.hxx>
-#include <gp_Vec.hxx>
-#include <math_Vector.hxx>
+#include <Geom_BSplineCurve.hxx>
 #include <Precision.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <TColgp_Array1OfPnt2d.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <TColStd_HArray1OfInteger.hxx>
 #include <TColStd_HArray1OfReal.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Vec.hxx>
+#include <math_Vector.hxx>
 
 #ifdef OCCT_DEBUG_CHRONO
-#include <OSD_Timer.hxx>
+  #include <OSD_Timer.hxx>
 static OSD_Chronometer chr_total, chr_init, chr_approx;
 
 Standard_Real t_total, t_init, t_approx;
+
 void InitChron(OSD_Chronometer& ch)
-{ 
-    ch.Reset();
-    ch.Start();
+{
+  ch.Reset();
+  ch.Start();
 }
 
-void ResultChron( OSD_Chronometer & ch, Standard_Real & time) 
+void ResultChron(OSD_Chronometer& ch, Standard_Real& time)
 {
-    Standard_Real tch ;
-    ch.Stop();
-    ch.Show(tch);
-    time=time +tch;
+  Standard_Real tch;
+  ch.Stop();
+  ch.Show(tch);
+  time = time + tch;
 }
 
 Standard_IMPORT Standard_Integer uparam_count;
-Standard_IMPORT Standard_Real t_uparam;
+Standard_IMPORT Standard_Real    t_uparam;
 #endif
 
-//=======================================================================
-//class : Approx_CurvilinearParameter_EvalCurv
-//purpose  : case of a free 3D curve
-//=======================================================================
+//=================================================================================================
 
 class Approx_CurvilinearParameter_EvalCurv : public AdvApprox_EvaluatorFunction
 {
- public:
-  Approx_CurvilinearParameter_EvalCurv (const Handle(Approx_CurvlinFunc)& theFunc, 
-                                        Standard_Real First, Standard_Real Last)
-    : fonct(theFunc) { StartEndSav[0] = First; StartEndSav[1] = Last; }
-  
-  virtual void Evaluate (Standard_Integer *Dimension,
-                        Standard_Real     StartEnd[2],
-                         Standard_Real    *Parameter,
-                         Standard_Integer *DerivativeRequest,
-                         Standard_Real    *Result, // [Dimension]
-                         Standard_Integer *ErrorCode);
-  
- private:
+public:
+  Approx_CurvilinearParameter_EvalCurv(const Handle(Approx_CurvlinFunc)& theFunc,
+                                       Standard_Real                     First,
+                                       Standard_Real                     Last)
+      : fonct(theFunc)
+  {
+    StartEndSav[0] = First;
+    StartEndSav[1] = Last;
+  }
+
+  virtual void Evaluate(Standard_Integer* Dimension,
+                        Standard_Real     StartEnd[2],
+                        Standard_Real*    Parameter,
+                        Standard_Integer* DerivativeRequest,
+                        Standard_Real*    Result, // [Dimension]
+                        Standard_Integer* ErrorCode);
+
+private:
   Handle(Approx_CurvlinFunc) fonct;
-  Standard_Real StartEndSav[2];
+  Standard_Real              StartEndSav[2];
 };
 
-void Approx_CurvilinearParameter_EvalCurv::Evaluate (Standard_Integer * Dimension,
-                                                     Standard_Real    * StartEnd,
-                                                     Standard_Real    * Param,
-                                                     Standard_Integer * Order,
-                                                     Standard_Real    * Result,
-                                                     Standard_Integer * ErrorCode)
+void Approx_CurvilinearParameter_EvalCurv::Evaluate(Standard_Integer* Dimension,
+                                                    Standard_Real*    StartEnd,
+                                                    Standard_Real*    Param,
+                                                    Standard_Integer* Order,
+                                                    Standard_Real*    Result,
+                                                    Standard_Integer* ErrorCode)
 {
-  *ErrorCode = 0;
-  Standard_Real S = *Param;
+  *ErrorCode             = 0;
+  Standard_Real        S = *Param;
   TColStd_Array1OfReal Res(0, 2);
-  Standard_Integer i;
-  
-// Dimension is incorrect
-  if (*Dimension != 3) {
+  Standard_Integer     i;
+
+  // Dimension is incorrect
+  if (*Dimension != 3)
+  {
     *ErrorCode = 1;
   }
-// Parameter is incorrect
-  if ( S < StartEnd[0] || S > StartEnd[1] ) {
+  // Parameter is incorrect
+  if (S < StartEnd[0] || S > StartEnd[1])
+  {
     *ErrorCode = 2;
   }
 
-  if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1]) 
-    {
-      fonct->Trim(StartEnd[0],StartEnd[1], Precision::Confusion());
-      StartEndSav[0]=StartEnd[0];
-      StartEndSav[1]=StartEnd[1];
-    }
+  if (StartEnd[0] != StartEndSav[0] || StartEnd[1] != StartEndSav[1])
+  {
+    fonct->Trim(StartEnd[0], StartEnd[1], Precision::Confusion());
+    StartEndSav[0] = StartEnd[0];
+    StartEndSav[1] = StartEnd[1];
+  }
 
-  if(!fonct->EvalCase1(S, *Order, Res)) {
+  if (!fonct->EvalCase1(S, *Order, Res))
+  {
     *ErrorCode = 3;
   }
 
-  for(i = 0; i <= 2; i++)
-    Result[i] = Res(i);  
+  for (i = 0; i <= 2; i++)
+    Result[i] = Res(i);
 }
 
 Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor3d_Curve)& C3D,
-                                                        const Standard_Real Tol,
-                                                        const GeomAbs_Shape Order,
-                                                        const Standard_Integer MaxDegree,
-                                                        const Standard_Integer MaxSegments)
-: myMaxError2d1(0.0),
-  myMaxError2d2(0.0)
+                                                         const Standard_Real            Tol,
+                                                         const GeomAbs_Shape            Order,
+                                                         const Standard_Integer         MaxDegree,
+                                                         const Standard_Integer         MaxSegments)
+    : myMaxError2d1(0.0),
+      myMaxError2d2(0.0)
 {
 #ifdef OCCT_DEBUG_CHRONO
   t_total = t_init = t_approx = t_uparam = 0;
-  uparam_count = 0;
+  uparam_count                           = 0;
   InitChron(chr_total);
 #endif
   myCase = 1;
-// Initialisation of input parameters of AdvApprox
+  // Initialisation of input parameters of AdvApprox
 
-  Standard_Integer Num1DSS=0, Num2DSS=0, Num3DSS=1;
-  Handle(TColStd_HArray1OfReal) OneDTolNul, TwoDTolNul; 
-  Handle(TColStd_HArray1OfReal) ThreeDTol  = new TColStd_HArray1OfReal(1,Num3DSS);
-  ThreeDTol->Init(Tol); 
+  Standard_Integer              Num1DSS = 0, Num2DSS = 0, Num3DSS = 1;
+  Handle(TColStd_HArray1OfReal) OneDTolNul, TwoDTolNul;
+  Handle(TColStd_HArray1OfReal) ThreeDTol = new TColStd_HArray1OfReal(1, Num3DSS);
+  ThreeDTol->Init(Tol);
 
 #ifdef OCCT_DEBUG_CHRONO
   InitChron(chr_init);
 #endif
-  Handle(Approx_CurvlinFunc) fonct = new Approx_CurvlinFunc(C3D, Tol/10);
+  Handle(Approx_CurvlinFunc) fonct = new Approx_CurvlinFunc(C3D, Tol / 10);
 #ifdef OCCT_DEBUG_CHRONO
   ResultChron(chr_init, t_init);
 #endif
 
   Standard_Real FirstS = fonct->FirstParameter();
-  Standard_Real  LastS = fonct->LastParameter();
+  Standard_Real LastS  = fonct->LastParameter();
 
-  Standard_Integer NbInterv_C2 = fonct->NbIntervals(GeomAbs_C2);
-  TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2+1);
-  fonct->Intervals(CutPnts_C2,GeomAbs_C2);
-  Standard_Integer NbInterv_C3 = fonct->NbIntervals(GeomAbs_C3);
-  TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3+1);
-  fonct->Intervals(CutPnts_C3,GeomAbs_C3);
-  AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
+  Standard_Integer     NbInterv_C2 = fonct->NbIntervals(GeomAbs_C2);
+  TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
+  fonct->Intervals(CutPnts_C2, GeomAbs_C2);
+  Standard_Integer     NbInterv_C3 = fonct->NbIntervals(GeomAbs_C3);
+  TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3 + 1);
+  fonct->Intervals(CutPnts_C3, GeomAbs_C3);
+  AdvApprox_PrefAndRec CutTool(CutPnts_C2, CutPnts_C3);
 
 #ifdef OCCT_DEBUG_CHRONO
   InitChron(chr_approx);
 #endif
 
-  Approx_CurvilinearParameter_EvalCurv evC (fonct, FirstS, LastS);
-  AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS, 
-                                    OneDTolNul, TwoDTolNul, ThreeDTol,
-                                    FirstS, LastS, Order,
-                                    MaxDegree, MaxSegments,
-                                    evC, CutTool);
+  Approx_CurvilinearParameter_EvalCurv evC(fonct, FirstS, LastS);
+  AdvApprox_ApproxAFunction            aApprox(Num1DSS,
+                                    Num2DSS,
+                                    Num3DSS,
+                                    OneDTolNul,
+                                    TwoDTolNul,
+                                    ThreeDTol,
+                                    FirstS,
+                                    LastS,
+                                    Order,
+                                    MaxDegree,
+                                    MaxSegments,
+                                    evC,
+                                    CutTool);
 
 #ifdef OCCT_DEBUG_CHRONO
   ResultChron(chr_approx, t_approx);
@@ -179,148 +193,162 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor3d_
   myDone      = aApprox.IsDone();
   myHasResult = aApprox.HasResult();
 
-  if (myHasResult) {
-    TColgp_Array1OfPnt Poles(1,aApprox.NbPoles());
-    aApprox.Poles(1,Poles);
-    Handle(TColStd_HArray1OfReal)    Knots = aApprox.Knots();
-    Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
-    Standard_Integer Degree = aApprox.Degree();
+  if (myHasResult)
+  {
+    TColgp_Array1OfPnt Poles(1, aApprox.NbPoles());
+    aApprox.Poles(1, Poles);
+    Handle(TColStd_HArray1OfReal)    Knots  = aApprox.Knots();
+    Handle(TColStd_HArray1OfInteger) Mults  = aApprox.Multiplicities();
+    Standard_Integer                 Degree = aApprox.Degree();
     myCurve3d = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
   }
-  myMaxError3d = aApprox.MaxError(3,1);
+  myMaxError3d = aApprox.MaxError(3, 1);
 
 #ifdef OCCT_DEBUG_CHRONO
   ResultChron(chr_total, t_total);
 
-  std::cout<<" total reparametrization time = "<<t_total<<std::endl;
-  std::cout<<"initialization time = "<<t_init<<std::endl;
-  std::cout<<"approximation time = "<<t_approx<<std::endl;
-  std::cout<<"total time for uparam computation = "<<t_uparam<<std::endl;
-  std::cout<<"number uparam calls = "<<uparam_count<<std::endl;
+  std::cout << " total reparametrization time = " << t_total << std::endl;
+  std::cout << "initialization time = " << t_init << std::endl;
+  std::cout << "approximation time = " << t_approx << std::endl;
+  std::cout << "total time for uparam computation = " << t_uparam << std::endl;
+  std::cout << "number uparam calls = " << uparam_count << std::endl;
 #endif
 }
 
-//=======================================================================
-//class : Approx_CurvilinearParameter_EvalCurvOnSurf
-//purpose  : case of a curve on one surface
-//=======================================================================
+//=================================================================================================
 
 class Approx_CurvilinearParameter_EvalCurvOnSurf : public AdvApprox_EvaluatorFunction
 {
- public:
-  Approx_CurvilinearParameter_EvalCurvOnSurf (const Handle(Approx_CurvlinFunc)& theFunc, 
-                                              Standard_Real First, Standard_Real Last)
-    : fonct(theFunc) { StartEndSav[0] = First; StartEndSav[1] = Last; }
-  
-  virtual void Evaluate (Standard_Integer *Dimension,
-                        Standard_Real     StartEnd[2],
-                         Standard_Real    *Parameter,
-                         Standard_Integer *DerivativeRequest,
-                         Standard_Real    *Result, // [Dimension]
-                         Standard_Integer *ErrorCode);
-  
- private:
+public:
+  Approx_CurvilinearParameter_EvalCurvOnSurf(const Handle(Approx_CurvlinFunc)& theFunc,
+                                             Standard_Real                     First,
+                                             Standard_Real                     Last)
+      : fonct(theFunc)
+  {
+    StartEndSav[0] = First;
+    StartEndSav[1] = Last;
+  }
+
+  virtual void Evaluate(Standard_Integer* Dimension,
+                        Standard_Real     StartEnd[2],
+                        Standard_Real*    Parameter,
+                        Standard_Integer* DerivativeRequest,
+                        Standard_Real*    Result, // [Dimension]
+                        Standard_Integer* ErrorCode);
+
+private:
   Handle(Approx_CurvlinFunc) fonct;
-  Standard_Real StartEndSav[2];
+  Standard_Real              StartEndSav[2];
 };
 
-void Approx_CurvilinearParameter_EvalCurvOnSurf::Evaluate (Standard_Integer * Dimension,
-                                                           Standard_Real    * StartEnd,
-                                                           Standard_Real    * Param,
-                                                           Standard_Integer * Order,
-                                                           Standard_Real    * Result,
-                                                           Standard_Integer * ErrorCode)
+void Approx_CurvilinearParameter_EvalCurvOnSurf::Evaluate(Standard_Integer* Dimension,
+                                                          Standard_Real*    StartEnd,
+                                                          Standard_Real*    Param,
+                                                          Standard_Integer* Order,
+                                                          Standard_Real*    Result,
+                                                          Standard_Integer* ErrorCode)
 {
-  *ErrorCode = 0;
-  Standard_Real S = *Param;
+  *ErrorCode             = 0;
+  Standard_Real        S = *Param;
   TColStd_Array1OfReal Res(0, 4);
-  Standard_Integer i;
+  Standard_Integer     i;
 
-// Dimension is incorrect
-  if (*Dimension != 5) {
+  // Dimension is incorrect
+  if (*Dimension != 5)
+  {
     *ErrorCode = 1;
   }
-// Parameter is incorrect
-  if ( S < StartEnd[0] || S > StartEnd[1] ) {
+  // Parameter is incorrect
+  if (S < StartEnd[0] || S > StartEnd[1])
+  {
     *ErrorCode = 2;
   }
 
-  if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1]) 
-    {
-      fonct->Trim(StartEnd[0],StartEnd[1], Precision::Confusion());
-      StartEndSav[0]=StartEnd[0];
-      StartEndSav[1]=StartEnd[1];
-    }
+  if (StartEnd[0] != StartEndSav[0] || StartEnd[1] != StartEndSav[1])
+  {
+    fonct->Trim(StartEnd[0], StartEnd[1], Precision::Confusion());
+    StartEndSav[0] = StartEnd[0];
+    StartEndSav[1] = StartEnd[1];
+  }
 
-  if(!fonct->EvalCase2(S, *Order, Res)) {
+  if (!fonct->EvalCase2(S, *Order, Res))
+  {
     *ErrorCode = 3;
   }
 
-  for(i = 0; i <= 4; i++)
-    Result[i] = Res(i);  
+  for (i = 0; i <= 4; i++)
+    Result[i] = Res(i);
 }
 
 Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_Curve2d)& C2D,
-                                                        const Handle(Adaptor3d_Surface)& Surf,
-                                                        const Standard_Real Tol,
-                                                        const GeomAbs_Shape Order,
-                                                        const Standard_Integer MaxDegree,
-                                                        const Standard_Integer MaxSegments)
+                                                         const Handle(Adaptor3d_Surface)& Surf,
+                                                         const Standard_Real              Tol,
+                                                         const GeomAbs_Shape              Order,
+                                                         const Standard_Integer           MaxDegree,
+                                                         const Standard_Integer MaxSegments)
 {
 #ifdef OCCT_DEBUG_CHRONO
   t_total = t_init = t_approx = t_uparam = 0;
-  uparam_count = 0;
+  uparam_count                           = 0;
   InitChron(chr_total);
 #endif
   myCase = 2;
 
   // Initialisation of input parameters of AdvApprox
 
-  Standard_Integer Num1DSS=2, Num2DSS=0, Num3DSS=1, i;
+  Standard_Integer Num1DSS = 2, Num2DSS = 0, Num3DSS = 1, i;
 
-  Handle(TColStd_HArray1OfReal) OneDTol = new TColStd_HArray1OfReal(1,Num1DSS);
-  Standard_Real TolV,TolW;
+  Handle(TColStd_HArray1OfReal) OneDTol = new TColStd_HArray1OfReal(1, Num1DSS);
+  Standard_Real                 TolV, TolW;
 
-  ToleranceComputation(C2D,Surf,10,Tol,TolV,TolW);
-  OneDTol->SetValue(1,TolV);
-  OneDTol->SetValue(2,TolW);
+  ToleranceComputation(C2D, Surf, 10, Tol, TolV, TolW);
+  OneDTol->SetValue(1, TolV);
+  OneDTol->SetValue(2, TolW);
 
-  OneDTol->SetValue(1,Tol);
-  OneDTol->SetValue(2,Tol);
+  OneDTol->SetValue(1, Tol);
+  OneDTol->SetValue(2, Tol);
 
-  Handle(TColStd_HArray1OfReal) TwoDTolNul; 
-  Handle(TColStd_HArray1OfReal) ThreeDTol = new TColStd_HArray1OfReal(1,Num3DSS);
-  ThreeDTol->Init(Tol/2.); 
+  Handle(TColStd_HArray1OfReal) TwoDTolNul;
+  Handle(TColStd_HArray1OfReal) ThreeDTol = new TColStd_HArray1OfReal(1, Num3DSS);
+  ThreeDTol->Init(Tol / 2.);
 
 #ifdef OCCT_DEBUG_CHRONO
   InitChron(chr_init);
 #endif
-  Handle(Approx_CurvlinFunc) fonct = new Approx_CurvlinFunc(C2D, Surf, Tol/20);
+  Handle(Approx_CurvlinFunc) fonct = new Approx_CurvlinFunc(C2D, Surf, Tol / 20);
 #ifdef OCCT_DEBUG_CHRONO
   ResultChron(chr_init, t_init);
 #endif
 
   Standard_Real FirstS = fonct->FirstParameter();
-  Standard_Real  LastS = fonct->LastParameter();
+  Standard_Real LastS  = fonct->LastParameter();
 
-  Standard_Integer NbInterv_C2 = fonct->NbIntervals(GeomAbs_C2);
-  TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2+1);
-  fonct->Intervals(CutPnts_C2,GeomAbs_C2);
-  Standard_Integer NbInterv_C3 = fonct->NbIntervals(GeomAbs_C3);
-  TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3+1);
-  fonct->Intervals(CutPnts_C3,GeomAbs_C3);
-  AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
+  Standard_Integer     NbInterv_C2 = fonct->NbIntervals(GeomAbs_C2);
+  TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
+  fonct->Intervals(CutPnts_C2, GeomAbs_C2);
+  Standard_Integer     NbInterv_C3 = fonct->NbIntervals(GeomAbs_C3);
+  TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3 + 1);
+  fonct->Intervals(CutPnts_C3, GeomAbs_C3);
+  AdvApprox_PrefAndRec CutTool(CutPnts_C2, CutPnts_C3);
 
 #ifdef OCCT_DEBUG_CHRONO
   InitChron(chr_approx);
 #endif
 
-  Approx_CurvilinearParameter_EvalCurvOnSurf evCOnS (fonct, FirstS, LastS);
-  AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS, 
-                                    OneDTol, TwoDTolNul, ThreeDTol,
-                                    FirstS, LastS, Order,
-                                    MaxDegree, MaxSegments,
-                                    evCOnS, CutTool);
+  Approx_CurvilinearParameter_EvalCurvOnSurf evCOnS(fonct, FirstS, LastS);
+  AdvApprox_ApproxAFunction                  aApprox(Num1DSS,
+                                    Num2DSS,
+                                    Num3DSS,
+                                    OneDTol,
+                                    TwoDTolNul,
+                                    ThreeDTol,
+                                    FirstS,
+                                    LastS,
+                                    Order,
+                                    MaxDegree,
+                                    MaxSegments,
+                                    evCOnS,
+                                    CutTool);
 
 #ifdef OCCT_DEBUG_CHRONO
   ResultChron(chr_approx, t_approx);
@@ -329,163 +357,177 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_
   myDone      = aApprox.IsDone();
   myHasResult = aApprox.HasResult();
 
-  if (myHasResult) {
-    Standard_Integer NbPoles = aApprox.NbPoles();
-    TColgp_Array1OfPnt   Poles  (1,NbPoles);
-    TColgp_Array1OfPnt2d Poles2d(1,NbPoles);
-    TColStd_Array1OfReal Poles1d(1,NbPoles);
-    aApprox.Poles(1,Poles);
-    aApprox.Poles1d(1,Poles1d);
-    for (i=1; i<=NbPoles; i++) 
+  if (myHasResult)
+  {
+    Standard_Integer     NbPoles = aApprox.NbPoles();
+    TColgp_Array1OfPnt   Poles(1, NbPoles);
+    TColgp_Array1OfPnt2d Poles2d(1, NbPoles);
+    TColStd_Array1OfReal Poles1d(1, NbPoles);
+    aApprox.Poles(1, Poles);
+    aApprox.Poles1d(1, Poles1d);
+    for (i = 1; i <= NbPoles; i++)
       Poles2d(i).SetX(Poles1d(i));
-    aApprox.Poles1d(2,Poles1d);
-    for (i=1; i<=NbPoles; i++) 
+    aApprox.Poles1d(2, Poles1d);
+    for (i = 1; i <= NbPoles; i++)
       Poles2d(i).SetY(Poles1d(i));
-    Handle(TColStd_HArray1OfReal)    Knots = aApprox.Knots();
-    Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
-    Standard_Integer Degree = aApprox.Degree();
-    myCurve3d = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
+    Handle(TColStd_HArray1OfReal)    Knots  = aApprox.Knots();
+    Handle(TColStd_HArray1OfInteger) Mults  = aApprox.Multiplicities();
+    Standard_Integer                 Degree = aApprox.Degree();
+    myCurve3d  = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
     myCurve2d1 = new Geom2d_BSplineCurve(Poles2d, Knots->Array1(), Mults->Array1(), Degree);
   }
-  myMaxError2d1 = Max (aApprox.MaxError(1,1),aApprox.MaxError(1,2));
-  myMaxError3d  = aApprox.MaxError(3,1);
+  myMaxError2d1 = Max(aApprox.MaxError(1, 1), aApprox.MaxError(1, 2));
+  myMaxError3d  = aApprox.MaxError(3, 1);
 
 #ifdef OCCT_DEBUG_CHRONO
   ResultChron(chr_total, t_total);
 
-  std::cout<<" total reparametrization time = "<<t_total<<std::endl;
-  std::cout<<"initialization time = "<<t_init<<std::endl;
-  std::cout<<"approximation time = "<<t_approx<<std::endl;
-  std::cout<<"total time for uparam computation = "<<t_uparam<<std::endl;
-  std::cout<<"number uparam calls = "<<uparam_count<<std::endl;
+  std::cout << " total reparametrization time = " << t_total << std::endl;
+  std::cout << "initialization time = " << t_init << std::endl;
+  std::cout << "approximation time = " << t_approx << std::endl;
+  std::cout << "total time for uparam computation = " << t_uparam << std::endl;
+  std::cout << "number uparam calls = " << uparam_count << std::endl;
 #endif
 }
 
-//=======================================================================
-//function : Approx_CurvilinearParameter_EvalCurvOn2Surf
-//purpose  : case of a curve on two surfaces
-//=======================================================================
+//=================================================================================================
 
 class Approx_CurvilinearParameter_EvalCurvOn2Surf : public AdvApprox_EvaluatorFunction
 {
- public:
-  Approx_CurvilinearParameter_EvalCurvOn2Surf (const Handle(Approx_CurvlinFunc)& theFunc, 
-                                               Standard_Real First, Standard_Real Last)
-    : fonct(theFunc) { StartEndSav[0] = First; StartEndSav[1] = Last; }
-  
-  virtual void Evaluate (Standard_Integer *Dimension,
-                        Standard_Real     StartEnd[2],
-                         Standard_Real    *Parameter,
-                         Standard_Integer *DerivativeRequest,
-                         Standard_Real    *Result, // [Dimension]
-                         Standard_Integer *ErrorCode);
-  
- private:
+public:
+  Approx_CurvilinearParameter_EvalCurvOn2Surf(const Handle(Approx_CurvlinFunc)& theFunc,
+                                              Standard_Real                     First,
+                                              Standard_Real                     Last)
+      : fonct(theFunc)
+  {
+    StartEndSav[0] = First;
+    StartEndSav[1] = Last;
+  }
+
+  virtual void Evaluate(Standard_Integer* Dimension,
+                        Standard_Real     StartEnd[2],
+                        Standard_Real*    Parameter,
+                        Standard_Integer* DerivativeRequest,
+                        Standard_Real*    Result, // [Dimension]
+                        Standard_Integer* ErrorCode);
+
+private:
   Handle(Approx_CurvlinFunc) fonct;
-  Standard_Real StartEndSav[2];
+  Standard_Real              StartEndSav[2];
 };
 
-void Approx_CurvilinearParameter_EvalCurvOn2Surf::Evaluate (Standard_Integer * Dimension,
-                                                            Standard_Real    * StartEnd,
-                                                            Standard_Real    * Param,
-                                                            Standard_Integer * Order,
-                                                            Standard_Real    * Result,
-                                                            Standard_Integer * ErrorCode)
+void Approx_CurvilinearParameter_EvalCurvOn2Surf::Evaluate(Standard_Integer* Dimension,
+                                                           Standard_Real*    StartEnd,
+                                                           Standard_Real*    Param,
+                                                           Standard_Integer* Order,
+                                                           Standard_Real*    Result,
+                                                           Standard_Integer* ErrorCode)
 {
-  *ErrorCode = 0;
-  Standard_Real S = *Param;
+  *ErrorCode             = 0;
+  Standard_Real        S = *Param;
   TColStd_Array1OfReal Res(0, 6);
-  Standard_Integer i;
+  Standard_Integer     i;
 
-// Dimension is incorrect
-  if (*Dimension != 7) {
+  // Dimension is incorrect
+  if (*Dimension != 7)
+  {
     *ErrorCode = 1;
   }
-// Parameter is incorrect
-  if ( S < StartEnd[0] || S > StartEnd[1] ) {
+  // Parameter is incorrect
+  if (S < StartEnd[0] || S > StartEnd[1])
+  {
     *ErrorCode = 2;
   }
 
-/*  if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1]) 
-    {
-      fonct->Trim(StartEnd[0],StartEnd[1], Precision::Confusion());
-      StartEndSav[0]=StartEnd[0];
-      StartEndSav[1]=StartEnd[1];
-    }
-*/
-  if(!fonct->EvalCase3(S, *Order, Res)) {
+  /*  if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1])
+      {
+        fonct->Trim(StartEnd[0],StartEnd[1], Precision::Confusion());
+        StartEndSav[0]=StartEnd[0];
+        StartEndSav[1]=StartEnd[1];
+      }
+  */
+  if (!fonct->EvalCase3(S, *Order, Res))
+  {
     *ErrorCode = 3;
   }
 
-  for(i = 0; i <= 6; i++)
-    Result[i] = Res(i);  
+  for (i = 0; i <= 6; i++)
+    Result[i] = Res(i);
 }
 
 Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_Curve2d)& C2D1,
-                                                        const Handle(Adaptor3d_Surface)& Surf1,
-                                                        const Handle(Adaptor2d_Curve2d)& C2D2,
-                                                        const Handle(Adaptor3d_Surface)& Surf2,
-                                                        const Standard_Real Tol,
-                                                        const GeomAbs_Shape Order,
-                                                        const Standard_Integer MaxDegree,
-                                                        const Standard_Integer MaxSegments)
+                                                         const Handle(Adaptor3d_Surface)& Surf1,
+                                                         const Handle(Adaptor2d_Curve2d)& C2D2,
+                                                         const Handle(Adaptor3d_Surface)& Surf2,
+                                                         const Standard_Real              Tol,
+                                                         const GeomAbs_Shape              Order,
+                                                         const Standard_Integer           MaxDegree,
+                                                         const Standard_Integer MaxSegments)
 {
   Standard_Integer i;
 
 #ifdef OCCT_DEBUG_CHRONO
   t_total = t_init = t_approx = t_uparam = 0;
-  uparam_count = 0;
+  uparam_count                           = 0;
   InitChron(chr_total);
 #endif
   myCase = 3;
 
   // Initialisation of input parameters of AdvApprox
 
-  Standard_Integer Num1DSS=4, Num2DSS=0, Num3DSS=1;
-  Handle(TColStd_HArray1OfReal) OneDTol = new TColStd_HArray1OfReal(1,Num1DSS); 
+  Standard_Integer              Num1DSS = 4, Num2DSS = 0, Num3DSS = 1;
+  Handle(TColStd_HArray1OfReal) OneDTol = new TColStd_HArray1OfReal(1, Num1DSS);
 
-  Standard_Real TolV,TolW;
-  ToleranceComputation(C2D1,Surf1,10,Tol,TolV,TolW);
-  OneDTol->SetValue(1,TolV); 
-  OneDTol->SetValue(2,TolW); 
-  
-  ToleranceComputation(C2D2,Surf2,10,Tol,TolV,TolW);
-  OneDTol->SetValue(3,TolV); 
-  OneDTol->SetValue(4,TolW); 
+  Standard_Real TolV, TolW;
+  ToleranceComputation(C2D1, Surf1, 10, Tol, TolV, TolW);
+  OneDTol->SetValue(1, TolV);
+  OneDTol->SetValue(2, TolW);
 
-  Handle(TColStd_HArray1OfReal) TwoDTolNul; 
-  Handle(TColStd_HArray1OfReal) ThreeDTol = new TColStd_HArray1OfReal(1,Num3DSS);
-  ThreeDTol->Init(Tol/2); 
+  ToleranceComputation(C2D2, Surf2, 10, Tol, TolV, TolW);
+  OneDTol->SetValue(3, TolV);
+  OneDTol->SetValue(4, TolW);
+
+  Handle(TColStd_HArray1OfReal) TwoDTolNul;
+  Handle(TColStd_HArray1OfReal) ThreeDTol = new TColStd_HArray1OfReal(1, Num3DSS);
+  ThreeDTol->Init(Tol / 2);
 
 #ifdef OCCT_DEBUG_CHRONO
   InitChron(chr_init);
 #endif
-  Handle(Approx_CurvlinFunc) fonct = new Approx_CurvlinFunc(C2D1, C2D2, Surf1, Surf2, Tol/20);
+  Handle(Approx_CurvlinFunc) fonct = new Approx_CurvlinFunc(C2D1, C2D2, Surf1, Surf2, Tol / 20);
 #ifdef OCCT_DEBUG_CHRONO
   ResultChron(chr_init, t_init);
 #endif
 
   Standard_Real FirstS = fonct->FirstParameter();
-  Standard_Real  LastS = fonct->LastParameter();
+  Standard_Real LastS  = fonct->LastParameter();
 
-  Standard_Integer NbInterv_C2 = fonct->NbIntervals(GeomAbs_C2);
-  TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2+1);
-  fonct->Intervals(CutPnts_C2,GeomAbs_C2);
-  Standard_Integer NbInterv_C3 = fonct->NbIntervals(GeomAbs_C3);
-  TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3+1);
-  fonct->Intervals(CutPnts_C3,GeomAbs_C3);
-  AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);  
+  Standard_Integer     NbInterv_C2 = fonct->NbIntervals(GeomAbs_C2);
+  TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
+  fonct->Intervals(CutPnts_C2, GeomAbs_C2);
+  Standard_Integer     NbInterv_C3 = fonct->NbIntervals(GeomAbs_C3);
+  TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3 + 1);
+  fonct->Intervals(CutPnts_C3, GeomAbs_C3);
+  AdvApprox_PrefAndRec CutTool(CutPnts_C2, CutPnts_C3);
 
 #ifdef OCCT_DEBUG_CHRONO
   InitChron(chr_approx);
 #endif
 
-  Approx_CurvilinearParameter_EvalCurvOn2Surf evCOn2S (fonct, FirstS, LastS);
-  AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS, 
-                                    OneDTol, TwoDTolNul, ThreeDTol,
-                                    FirstS, LastS, Order,
-                                    MaxDegree, MaxSegments,
-                                    evCOn2S, CutTool);
+  Approx_CurvilinearParameter_EvalCurvOn2Surf evCOn2S(fonct, FirstS, LastS);
+  AdvApprox_ApproxAFunction                   aApprox(Num1DSS,
+                                    Num2DSS,
+                                    Num3DSS,
+                                    OneDTol,
+                                    TwoDTolNul,
+                                    ThreeDTol,
+                                    FirstS,
+                                    LastS,
+                                    Order,
+                                    MaxDegree,
+                                    MaxSegments,
+                                    evCOn2S,
+                                    CutTool);
 
 #ifdef OCCT_DEBUG_CHRONO
   ResultChron(chr_approx, t_approx);
@@ -494,170 +536,151 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_
   myDone      = aApprox.IsDone();
   myHasResult = aApprox.HasResult();
 
-  if (myHasResult) {
-    Standard_Integer NbPoles = aApprox.NbPoles();
-    TColgp_Array1OfPnt   Poles  (1,NbPoles);
-    TColgp_Array1OfPnt2d Poles2d(1,NbPoles);
-    TColStd_Array1OfReal Poles1d(1,NbPoles);
-    aApprox.Poles(1,Poles);
-    aApprox.Poles1d(1,Poles1d);
-    for (i=1; i<=NbPoles; i++) 
+  if (myHasResult)
+  {
+    Standard_Integer     NbPoles = aApprox.NbPoles();
+    TColgp_Array1OfPnt   Poles(1, NbPoles);
+    TColgp_Array1OfPnt2d Poles2d(1, NbPoles);
+    TColStd_Array1OfReal Poles1d(1, NbPoles);
+    aApprox.Poles(1, Poles);
+    aApprox.Poles1d(1, Poles1d);
+    for (i = 1; i <= NbPoles; i++)
       Poles2d(i).SetX(Poles1d(i));
-    aApprox.Poles1d(2,Poles1d);
-    for (i=1; i<=NbPoles; i++) 
+    aApprox.Poles1d(2, Poles1d);
+    for (i = 1; i <= NbPoles; i++)
       Poles2d(i).SetY(Poles1d(i));
-    Handle(TColStd_HArray1OfReal)    Knots = aApprox.Knots();
-    Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
-    Standard_Integer Degree = aApprox.Degree();
-    myCurve3d = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
+    Handle(TColStd_HArray1OfReal)    Knots  = aApprox.Knots();
+    Handle(TColStd_HArray1OfInteger) Mults  = aApprox.Multiplicities();
+    Standard_Integer                 Degree = aApprox.Degree();
+    myCurve3d  = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
     myCurve2d1 = new Geom2d_BSplineCurve(Poles2d, Knots->Array1(), Mults->Array1(), Degree);
-    aApprox.Poles1d(3,Poles1d);
-    for (i=1; i<=NbPoles; i++) 
+    aApprox.Poles1d(3, Poles1d);
+    for (i = 1; i <= NbPoles; i++)
       Poles2d(i).SetX(Poles1d(i));
-    aApprox.Poles1d(4,Poles1d);
-    for (i=1; i<=NbPoles; i++) 
+    aApprox.Poles1d(4, Poles1d);
+    for (i = 1; i <= NbPoles; i++)
       Poles2d(i).SetY(Poles1d(i));
     myCurve2d2 = new Geom2d_BSplineCurve(Poles2d, Knots->Array1(), Mults->Array1(), Degree);
   }
-  myMaxError2d1 = Max (aApprox.MaxError(1,1),aApprox.MaxError(1,2));
-  myMaxError2d2 = Max (aApprox.MaxError(1,3),aApprox.MaxError(1,4));
-  myMaxError3d  = aApprox.MaxError(3,1);
+  myMaxError2d1 = Max(aApprox.MaxError(1, 1), aApprox.MaxError(1, 2));
+  myMaxError2d2 = Max(aApprox.MaxError(1, 3), aApprox.MaxError(1, 4));
+  myMaxError3d  = aApprox.MaxError(3, 1);
 
 #ifdef OCCT_DEBUG_CHRONO
   ResultChron(chr_total, t_total);
 
-  std::cout<<" total reparametrization time = "<<t_total<<std::endl;
-  std::cout<<"initialization time = "<<t_init<<std::endl;
-  std::cout<<"approximation time = "<<t_approx<<std::endl;
-  std::cout<<"total time for uparam computation = "<<t_uparam<<std::endl;
-  std::cout<<"number uparam calls = "<<uparam_count<<std::endl;
+  std::cout << " total reparametrization time = " << t_total << std::endl;
+  std::cout << "initialization time = " << t_init << std::endl;
+  std::cout << "approximation time = " << t_approx << std::endl;
+  std::cout << "total time for uparam computation = " << t_uparam << std::endl;
+  std::cout << "number uparam calls = " << uparam_count << std::endl;
 #endif
 }
 
-//=======================================================================
-//function : IsDone
-//purpose  : 
-//=======================================================================
+//=================================================================================================
 
- Standard_Boolean Approx_CurvilinearParameter::IsDone() const
+Standard_Boolean Approx_CurvilinearParameter::IsDone() const
 {
   return myDone;
 }
 
-//=======================================================================
-//function : HasResult
-//purpose  : 
-//=======================================================================
+//=================================================================================================
 
- Standard_Boolean Approx_CurvilinearParameter::HasResult() const
+Standard_Boolean Approx_CurvilinearParameter::HasResult() const
 {
   return myHasResult;
 }
 
-//=======================================================================
-//function : Curve3d
-//purpose  : returns the Bspline curve corresponding to the reparametrized 3D curve 
-//=======================================================================
+//=================================================================================================
 
- Handle(Geom_BSplineCurve) Approx_CurvilinearParameter::Curve3d() const
+Handle(Geom_BSplineCurve) Approx_CurvilinearParameter::Curve3d() const
 {
   return myCurve3d;
 }
 
-//=======================================================================
-//function : MaxError3d
-//purpose  : returns the maximum error on the reparametrized 3D curve
-//=======================================================================
+//=================================================================================================
 
- Standard_Real Approx_CurvilinearParameter::MaxError3d() const
+Standard_Real Approx_CurvilinearParameter::MaxError3d() const
 {
   return myMaxError3d;
 }
 
-//=======================================================================
-//function : Curve2d1
-//purpose  : returns the BsplineCurve representing the reparametrized 2D curve on the
+//=================================================================================================
+// function : Curve2d1
+// purpose  : returns the BsplineCurve representing the reparametrized 2D curve on the
 //           first surface (case of a curve on one or two surfaces)
-//=======================================================================
+//=================================================================================================
 
- Handle(Geom2d_BSplineCurve) Approx_CurvilinearParameter::Curve2d1() const
+Handle(Geom2d_BSplineCurve) Approx_CurvilinearParameter::Curve2d1() const
 {
   return myCurve2d1;
 }
 
-//=======================================================================
-//function : MaxError2d1
-//purpose  : returns the maximum error on the first reparametrized 2D curve
-//=======================================================================
+//=================================================================================================
 
- Standard_Real Approx_CurvilinearParameter::MaxError2d1() const
+Standard_Real Approx_CurvilinearParameter::MaxError2d1() const
 {
   return myMaxError2d1;
 }
 
-//=======================================================================
-//function : Curve2d2
-//purpose  : returns the BsplineCurve representing the reparametrized 2D curve on the
+//=================================================================================================
+// function : Curve2d2
+// purpose  : returns the BsplineCurve representing the reparametrized 2D curve on the
 //           second surface (case of a curve on two surfaces)
-//=======================================================================
+//=================================================================================================
 
- Handle(Geom2d_BSplineCurve) Approx_CurvilinearParameter::Curve2d2() const
+Handle(Geom2d_BSplineCurve) Approx_CurvilinearParameter::Curve2d2() const
 {
   return myCurve2d2;
 }
 
-//=======================================================================
-//function : MaxError2d2
-//purpose  : returns the maximum error on the second reparametrized 2D curve 
-//=======================================================================
+//=================================================================================================
 
- Standard_Real Approx_CurvilinearParameter::MaxError2d2() const
+Standard_Real Approx_CurvilinearParameter::MaxError2d2() const
 {
   return myMaxError2d2;
 }
 
-//=======================================================================
-//function : Dump
-//purpose  : print the maximum errors(s)
-//=======================================================================
+//=================================================================================================
+// function : Dump
+// purpose  : print the maximum errors(s)
+//=================================================================================================
 
 void Approx_CurvilinearParameter::Dump(Standard_OStream& o) const
 {
   o << "Dump of Approx_CurvilinearParameter" << std::endl;
-  if (myCase==2 || myCase==3) 
+  if (myCase == 2 || myCase == 3)
     o << "myMaxError2d1 = " << myMaxError2d1 << std::endl;
-  if (myCase==3) 
+  if (myCase == 3)
     o << "myMaxError2d2 = " << myMaxError2d2 << std::endl;
   o << "myMaxError3d = " << myMaxError3d << std::endl;
 }
 
-//=======================================================================
-//function : ToleranceComputation
-//purpose  : 
-//=======================================================================
+//=================================================================================================
 
-void Approx_CurvilinearParameter::ToleranceComputation(const Handle(Adaptor2d_Curve2d) &C2D,
-                                                      const Handle(Adaptor3d_Surface) &S, 
-                                                      const Standard_Integer MaxNumber, 
-                                                      const Standard_Real Tol,
-                                                      Standard_Real &TolV, Standard_Real &TolW)
+void Approx_CurvilinearParameter::ToleranceComputation(const Handle(Adaptor2d_Curve2d)& C2D,
+                                                       const Handle(Adaptor3d_Surface)& S,
+                                                       const Standard_Integer           MaxNumber,
+                                                       const Standard_Real              Tol,
+                                                       Standard_Real&                   TolV,
+                                                       Standard_Real&                   TolW)
 {
-  Standard_Real FirstU = C2D->FirstParameter(),
-                LastU  = C2D->LastParameter();
-//  Standard_Real parU, Max_dS_dv=1.,Max_dS_dw=1.;
-  Standard_Real Max_dS_dv=1.,Max_dS_dw=1.;
-  gp_Pnt P;
-  gp_Pnt2d pntVW;
-  gp_Vec dS_dv,dS_dw;
-
-  for (Standard_Integer i=1; i<=MaxNumber; i++) {
-    pntVW = C2D->Value(FirstU + (i-1)*(LastU-FirstU)/(MaxNumber-1));
-    S->D1(pntVW.X(),pntVW.Y(),P,dS_dv,dS_dw);
-    Max_dS_dv = Max (Max_dS_dv, dS_dv.Magnitude());
-    Max_dS_dw = Max (Max_dS_dw, dS_dw.Magnitude());
+  Standard_Real FirstU = C2D->FirstParameter(), LastU = C2D->LastParameter();
+  //  Standard_Real parU, Max_dS_dv=1.,Max_dS_dw=1.;
+  Standard_Real Max_dS_dv = 1., Max_dS_dw = 1.;
+  gp_Pnt        P;
+  gp_Pnt2d      pntVW;
+  gp_Vec        dS_dv, dS_dw;
+
+  for (Standard_Integer i = 1; i <= MaxNumber; i++)
+  {
+    pntVW = C2D->Value(FirstU + (i - 1) * (LastU - FirstU) / (MaxNumber - 1));
+    S->D1(pntVW.X(), pntVW.Y(), P, dS_dv, dS_dw);
+    Max_dS_dv = Max(Max_dS_dv, dS_dv.Magnitude());
+    Max_dS_dw = Max(Max_dS_dw, dS_dw.Magnitude());
   }
-  TolV = Tol / (4.*Max_dS_dv);
-  TolW = Tol / (4.*Max_dS_dw);
+  TolV = Tol / (4. * Max_dS_dv);
+  TolW = Tol / (4. * Max_dS_dw);
 
 #ifdef OCCT_DEBUG
   std::cout << "TolV = " << TolV << std::endl;
index bf014252db4668b3748a4d71cb2008a77bf8e1f8..5405c0f0ff3490296d73420d6361a0cdccf213e0 100644 (file)
 //! @code
 //!   1/2(S1(C2D1(u) + S2(C2D2(u)))
 //! @endcode
-class Approx_CurvilinearParameter 
+class Approx_CurvilinearParameter
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
-  
   //! case of a free 3D curve
-  Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor3d_Curve)& C3D, const Standard_Real Tol, const GeomAbs_Shape Order, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments);
-  
+  Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor3d_Curve)& C3D,
+                                              const Standard_Real            Tol,
+                                              const GeomAbs_Shape            Order,
+                                              const Standard_Integer         MaxDegree,
+                                              const Standard_Integer         MaxSegments);
+
   //! case of a curve on one surface
-  Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor2d_Curve2d)& C2D, const Handle(Adaptor3d_Surface)& Surf, const Standard_Real Tol, const GeomAbs_Shape Order, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments);
-  
+  Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor2d_Curve2d)& C2D,
+                                              const Handle(Adaptor3d_Surface)& Surf,
+                                              const Standard_Real              Tol,
+                                              const GeomAbs_Shape              Order,
+                                              const Standard_Integer           MaxDegree,
+                                              const Standard_Integer           MaxSegments);
+
   //! case of a curve on two surfaces
-  Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor2d_Curve2d)& C2D1, const Handle(Adaptor3d_Surface)& Surf1, const Handle(Adaptor2d_Curve2d)& C2D2, const Handle(Adaptor3d_Surface)& Surf2, const Standard_Real Tol, const GeomAbs_Shape Order, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments);
-  
+  Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor2d_Curve2d)& C2D1,
+                                              const Handle(Adaptor3d_Surface)& Surf1,
+                                              const Handle(Adaptor2d_Curve2d)& C2D2,
+                                              const Handle(Adaptor3d_Surface)& Surf2,
+                                              const Standard_Real              Tol,
+                                              const GeomAbs_Shape              Order,
+                                              const Standard_Integer           MaxDegree,
+                                              const Standard_Integer           MaxSegments);
+
   Standard_EXPORT Standard_Boolean IsDone() const;
-  
+
   Standard_EXPORT Standard_Boolean HasResult() const;
-  
+
   //! returns the Bspline curve corresponding to the reparametrized 3D curve
   Standard_EXPORT Handle(Geom_BSplineCurve) Curve3d() const;
-  
+
   //! returns the maximum error on the reparametrized 3D curve
   Standard_EXPORT Standard_Real MaxError3d() const;
-  
+
   //! returns the BsplineCurve representing the reparametrized 2D curve on the
   //! first surface (case of a curve on one or two surfaces)
   Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d1() const;
-  
+
   //! returns the maximum error on the first reparametrized 2D curve
   Standard_EXPORT Standard_Real MaxError2d1() const;
-  
+
   //! returns the BsplineCurve representing the reparametrized 2D curve on the
   //! second surface (case of a curve on two surfaces)
   Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d2() const;
-  
+
   //! returns the maximum error on the second reparametrized 2D curve
   Standard_EXPORT Standard_Real MaxError2d2() const;
-  
+
   //! print the maximum errors(s)
-  Standard_EXPORT void Dump (Standard_OStream& o) const;
+  Standard_EXPORT void Dump(Standard_OStream& o) const;
 
 private:
-
-  Standard_EXPORT static void ToleranceComputation (const Handle(Adaptor2d_Curve2d)& C2D, const Handle(Adaptor3d_Surface)& S, const Standard_Integer MaxNumber, const Standard_Real Tol, Standard_Real& TolV, Standard_Real& TolW);
+  Standard_EXPORT static void ToleranceComputation(const Handle(Adaptor2d_Curve2d)& C2D,
+                                                   const Handle(Adaptor3d_Surface)& S,
+                                                   const Standard_Integer           MaxNumber,
+                                                   const Standard_Real              Tol,
+                                                   Standard_Real&                   TolV,
+                                                   Standard_Real&                   TolW);
 
 private:
-
-  Standard_Integer myCase;
-  Standard_Boolean myDone;
-  Standard_Boolean myHasResult;
-  Handle(Geom_BSplineCurve) myCurve3d;
-  Standard_Real myMaxError3d;
+  Standard_Integer            myCase;
+  Standard_Boolean            myDone;
+  Standard_Boolean            myHasResult;
+  Handle(Geom_BSplineCurve)   myCurve3d;
+  Standard_Real               myMaxError3d;
   Handle(Geom2d_BSplineCurve) myCurve2d1;
-  Standard_Real myMaxError2d1;
+  Standard_Real               myMaxError2d1;
   Handle(Geom2d_BSplineCurve) myCurve2d2;
-  Standard_Real myMaxError2d2;
-
+  Standard_Real               myMaxError2d2;
 };
 
 #endif // _Approx_CurvilinearParameter_HeaderFile
index ba82388e953145ba59b9ed3ef710936340f380bb..91bacd442c3406a92a90eeb7dca53ae3982e6c59 100644 (file)
 #include <Standard_Type.hxx>
 #include <TColStd_SequenceOfReal.hxx>
 
-IMPLEMENT_STANDARD_RTTIEXT(Approx_CurvlinFunc,Standard_Transient)
+IMPLEMENT_STANDARD_RTTIEXT(Approx_CurvlinFunc, Standard_Transient)
 
 #ifdef OCCT_DEBUG_CHRONO
-#include <OSD_Timer.hxx>
-static OSD_Chronometer chr_uparam;
+  #include <OSD_Timer.hxx>
+static OSD_Chronometer           chr_uparam;
 Standard_EXPORT Standard_Integer uparam_count;
-Standard_EXPORT Standard_Real t_uparam;
+Standard_EXPORT Standard_Real    t_uparam;
 
-//Standard_IMPORT extern void InitChron(OSD_Chronometer& ch);
+// Standard_IMPORT extern void InitChron(OSD_Chronometer& ch);
 Standard_IMPORT void InitChron(OSD_Chronometer& ch);
-//Standard_IMPORT extern void ResultChron( OSD_Chronometer & ch, Standard_Real & time);
-Standard_IMPORT void ResultChron( OSD_Chronometer & ch, Standard_Real & time);
+// Standard_IMPORT extern void ResultChron( OSD_Chronometer & ch, Standard_Real & time);
+Standard_IMPORT void ResultChron(OSD_Chronometer& ch, Standard_Real& time);
 #endif
 
-static Standard_Real cubic(const Standard_Real X, const Standard_Real *Xi, const Standard_Real *Yi)
+static Standard_Real cubic(const Standard_Real X, const Standard_Real* Xi, const Standard_Real* Yi)
 {
   Standard_Real I1, I2, I3, I21, I22, I31, Result;
 
-  I1 = (Yi[0] - Yi[1])/(Xi[0] - Xi[1]);
-  I2 = (Yi[1] - Yi[2])/(Xi[1] - Xi[2]);
-  I3 = (Yi[2] - Yi[3])/(Xi[2] - Xi[3]);
+  I1 = (Yi[0] - Yi[1]) / (Xi[0] - Xi[1]);
+  I2 = (Yi[1] - Yi[2]) / (Xi[1] - Xi[2]);
+  I3 = (Yi[2] - Yi[3]) / (Xi[2] - Xi[3]);
 
-  I21 = (I1 - I2)/(Xi[0] - Xi[2]);
-  I22 = (I2 - I3)/(Xi[1] - Xi[3]);
-  
-  I31 = (I21 - I22)/(Xi[0] - Xi[3]);  
+  I21 = (I1 - I2) / (Xi[0] - Xi[2]);
+  I22 = (I2 - I3) / (Xi[1] - Xi[3]);
 
-  Result = Yi[0] + (X - Xi[0])*(I1 + (X - Xi[1])*(I21 + (X - Xi[2])*I31));
+  I31 = (I21 - I22) / (Xi[0] - Xi[3]);
+
+  Result = Yi[0] + (X - Xi[0]) * (I1 + (X - Xi[1]) * (I21 + (X - Xi[2]) * I31));
 
   return Result;
 }
 
-//static void findfourpoints(const Standard_Real S, 
-static void findfourpoints(const Standard_Real , 
-                          Standard_Integer NInterval, 
-                          const Handle(TColStd_HArray1OfReal)& Si, 
-                          Handle(TColStd_HArray1OfReal)& Ui, 
-                          const Standard_Real prevS, 
-                          const Standard_Real prevU, Standard_Real *Xi, 
-                          Standard_Real *Yi)
+// static void findfourpoints(const Standard_Real S,
+static void findfourpoints(const Standard_Real,
+                           Standard_Integer                     NInterval,
+                           const Handle(TColStd_HArray1OfReal)& Si,
+                           Handle(TColStd_HArray1OfReal)&       Ui,
+                           const Standard_Real                  prevS,
+                           const Standard_Real                  prevU,
+                           Standard_Real*                       Xi,
+                           Standard_Real*                       Yi)
 {
   Standard_Integer i, j;
   Standard_Integer NbInt = Si->Length() - 1;
-  if (NbInt < 3) throw Standard_ConstructionError("Approx_CurvlinFunc::GetUParameter");
+  if (NbInt < 3)
+    throw Standard_ConstructionError("Approx_CurvlinFunc::GetUParameter");
 
-  if(NInterval < 1) NInterval = 1;
-  else if(NInterval > NbInt - 2) NInterval = NbInt - 2;
+  if (NInterval < 1)
+    NInterval = 1;
+  else if (NInterval > NbInt - 2)
+    NInterval = NbInt - 2;
 
-  for(i = 0; i < 4; i++) {
+  for (i = 0; i < 4; i++)
+  {
     Xi[i] = Si->Value(NInterval - 1 + i);
     Yi[i] = Ui->Value(NInterval - 1 + i);
   }
-// try to insert (S, U)  
-  for(i = 0; i < 3; i++) {
-    if(Xi[i] < prevS && prevS < Xi[i+1]) {
-      for(j = 0; j < i; j++) {
-       Xi[j] = Xi[j+1];
-       Yi[j] = Yi[j+1];
+  // try to insert (S, U)
+  for (i = 0; i < 3; i++)
+  {
+    if (Xi[i] < prevS && prevS < Xi[i + 1])
+    {
+      for (j = 0; j < i; j++)
+      {
+        Xi[j] = Xi[j + 1];
+        Yi[j] = Yi[j + 1];
       }
       Xi[i] = prevS;
       Yi[i] = prevU;
@@ -110,122 +118,135 @@ static void findfourpoints(const Standard_Real ,
 }
 */
 
-Approx_CurvlinFunc::Approx_CurvlinFunc(const Handle(Adaptor3d_Curve)& C, const Standard_Real Tol) : myC3D(C), 
-                    myCase(1), 
-                    myFirstS(0), 
-                    myLastS(1), 
-                    myTolLen(Tol),
-                    myPrevS (0.0),
-                    myPrevU (0.0)
+Approx_CurvlinFunc::Approx_CurvlinFunc(const Handle(Adaptor3d_Curve)& C, const Standard_Real Tol)
+    : myC3D(C),
+      myCase(1),
+      myFirstS(0),
+      myLastS(1),
+      myTolLen(Tol),
+      myPrevS(0.0),
+      myPrevU(0.0)
 {
   Init();
 }
 
-Approx_CurvlinFunc::Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D, const Handle(Adaptor3d_Surface)& S, const Standard_Real Tol) : 
-                    myC2D1(C2D), 
-                    mySurf1(S), 
-                    myCase(2), 
-                    myFirstS(0), 
-                    myLastS(1), 
-                    myTolLen(Tol),
-                    myPrevS (0.0),
-                    myPrevU (0.0)
-{  
+Approx_CurvlinFunc::Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D,
+                                       const Handle(Adaptor3d_Surface)& S,
+                                       const Standard_Real              Tol)
+    : myC2D1(C2D),
+      mySurf1(S),
+      myCase(2),
+      myFirstS(0),
+      myLastS(1),
+      myTolLen(Tol),
+      myPrevS(0.0),
+      myPrevU(0.0)
+{
   Init();
 }
 
-Approx_CurvlinFunc::Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D1, const Handle(Adaptor2d_Curve2d)& C2D2, const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_Surface)& S2, const Standard_Real Tol) : 
-                    myC2D1(C2D1), 
-                    myC2D2(C2D2), 
-                    mySurf1(S1), 
-                    mySurf2(S2), 
-                    myCase(3), 
-                    myFirstS(0), 
-                    myLastS(1), 
-                    myTolLen(Tol),
-                    myPrevS (0.0),
-                    myPrevU (0.0)
-{  
+Approx_CurvlinFunc::Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D1,
+                                       const Handle(Adaptor2d_Curve2d)& C2D2,
+                                       const Handle(Adaptor3d_Surface)& S1,
+                                       const Handle(Adaptor3d_Surface)& S2,
+                                       const Standard_Real              Tol)
+    : myC2D1(C2D1),
+      myC2D2(C2D2),
+      mySurf1(S1),
+      mySurf2(S2),
+      myCase(3),
+      myFirstS(0),
+      myLastS(1),
+      myTolLen(Tol),
+      myPrevS(0.0),
+      myPrevU(0.0)
+{
   Init();
 }
 
 void Approx_CurvlinFunc::Init()
 {
   Adaptor3d_CurveOnSurface CurOnSur;
-  
-  switch(myCase) {
-  case 1:
-    Init (*myC3D, mySi_1, myUi_1);
-    myFirstU1 = myC3D->FirstParameter();
-    myLastU1 = myC3D->LastParameter();
-    myFirstU2 = myLastU2 = 0;
-    break;
-  case 2:
-    CurOnSur.Load(myC2D1);
-    CurOnSur.Load(mySurf1);
-    Init(CurOnSur, mySi_1, myUi_1);
-    myFirstU1 = CurOnSur.FirstParameter();
-    myLastU1 = CurOnSur.LastParameter();
-    myFirstU2 = myLastU2 = 0;
-    break;
-  case 3:
-    CurOnSur.Load(myC2D1);
-    CurOnSur.Load(mySurf1);
-    Init(CurOnSur, mySi_1, myUi_1);
-    myFirstU1 = CurOnSur.FirstParameter();
-    myLastU1 = CurOnSur.LastParameter();
-    CurOnSur.Load(myC2D2);
-    CurOnSur.Load(mySurf2);
-    Init(CurOnSur, mySi_2, myUi_2);
-    myFirstU2 = CurOnSur.FirstParameter();
-    myLastU2 = CurOnSur.LastParameter();
+
+  switch (myCase)
+  {
+    case 1:
+      Init(*myC3D, mySi_1, myUi_1);
+      myFirstU1 = myC3D->FirstParameter();
+      myLastU1  = myC3D->LastParameter();
+      myFirstU2 = myLastU2 = 0;
+      break;
+    case 2:
+      CurOnSur.Load(myC2D1);
+      CurOnSur.Load(mySurf1);
+      Init(CurOnSur, mySi_1, myUi_1);
+      myFirstU1 = CurOnSur.FirstParameter();
+      myLastU1  = CurOnSur.LastParameter();
+      myFirstU2 = myLastU2 = 0;
+      break;
+    case 3:
+      CurOnSur.Load(myC2D1);
+      CurOnSur.Load(mySurf1);
+      Init(CurOnSur, mySi_1, myUi_1);
+      myFirstU1 = CurOnSur.FirstParameter();
+      myLastU1  = CurOnSur.LastParameter();
+      CurOnSur.Load(myC2D2);
+      CurOnSur.Load(mySurf2);
+      Init(CurOnSur, mySi_2, myUi_2);
+      myFirstU2 = CurOnSur.FirstParameter();
+      myLastU2  = CurOnSur.LastParameter();
   }
 
   Length();
 }
 
+//=================================================================================================
+// function : Init
+// purpose  : Init the values
+// history  : 23/10/1998 PMN : Cut at curve's discontinuities
+//=================================================================================================
 
-//=======================================================================
-//function : Init
-//purpose  : Init the values
-//history  : 23/10/1998 PMN : Cut at curve's discontinuities
-//=======================================================================
-void Approx_CurvlinFunc::Init(Adaptor3d_Curve& C, Handle(TColStd_HArray1OfReal)& Si, 
-                             Handle(TColStd_HArray1OfReal)& Ui) const
+void Approx_CurvlinFunc::Init(Adaptor3d_Curve&               C,
+                              Handle(TColStd_HArray1OfReal)& Si,
+                              Handle(TColStd_HArray1OfReal)& Ui) const
 {
-  Standard_Real Step, FirstU, LastU;
+  Standard_Real    Step, FirstU, LastU;
   Standard_Integer i, j, k, NbInt, NbIntC3;
   FirstU = C.FirstParameter();
   LastU  = C.LastParameter();
 
-  NbInt = 10;
+  NbInt   = 10;
   NbIntC3 = C.NbIntervals(GeomAbs_C3);
-  TColStd_Array1OfReal Disc(1, NbIntC3+1);
+  TColStd_Array1OfReal Disc(1, NbIntC3 + 1);
 
-  if (NbIntC3 >1) {
-     C.Intervals(Disc, GeomAbs_C3);
+  if (NbIntC3 > 1)
+  {
+    C.Intervals(Disc, GeomAbs_C3);
   }
-  else {
+  else
+  {
     Disc(1) = FirstU;
     Disc(2) = LastU;
   }
 
-  Ui = new TColStd_HArray1OfReal (0,NbIntC3*NbInt);
-  Si = new TColStd_HArray1OfReal (0,NbIntC3*NbInt);
+  Ui = new TColStd_HArray1OfReal(0, NbIntC3 * NbInt);
+  Si = new TColStd_HArray1OfReal(0, NbIntC3 * NbInt);
 
   Ui->SetValue(0, FirstU);
   Si->SetValue(0, 0);
 
-  for(j = 1, i=1; j<=NbIntC3; j++) {
-    Step = (Disc(j+1) - Disc(j))/NbInt;
-    for(k = 1; k <= NbInt; k++, i++) {
-      Ui->ChangeValue(i) = Ui->Value(i-1) + Step;
-      Si->ChangeValue(i) = Si->Value(i-1) + Length(C, Ui->Value(i-1), Ui->Value(i));
+  for (j = 1, i = 1; j <= NbIntC3; j++)
+  {
+    Step = (Disc(j + 1) - Disc(j)) / NbInt;
+    for (k = 1; k <= NbInt; k++, i++)
+    {
+      Ui->ChangeValue(i) = Ui->Value(i - 1) + Step;
+      Si->ChangeValue(i) = Si->Value(i - 1) + Length(C, Ui->Value(i - 1), Ui->Value(i));
     }
   }
 
   Standard_Real Len = Si->Value(Si->Upper());
-  for(i = Si->Lower(); i<= Si->Upper(); i++)
+  for (i = Si->Lower(); i <= Si->Upper(); i++)
     Si->ChangeValue(i) /= Len;
 
   // TODO - fields should be mutable
@@ -233,7 +254,7 @@ void Approx_CurvlinFunc::Init(Adaptor3d_Curve& C, Handle(TColStd_HArray1OfReal)&
   const_cast<Approx_CurvlinFunc*>(this)->myPrevU = FirstU;
 }
 
-void  Approx_CurvlinFunc::SetTol(const Standard_Real Tol)
+void Approx_CurvlinFunc::SetTol(const Standard_Real Tol)
 {
   myTolLen = Tol;
 }
@@ -252,161 +273,172 @@ Standard_Integer Approx_CurvlinFunc::NbIntervals(const GeomAbs_Shape S) const
 {
   Adaptor3d_CurveOnSurface CurOnSur;
 
-  switch(myCase) {
-  case 1:
-    return myC3D->NbIntervals(S);
-  case 2:
-    CurOnSur.Load(myC2D1);
-    CurOnSur.Load(mySurf1);
-    return CurOnSur.NbIntervals(S);
-  case 3:
-    Standard_Integer NbInt;
-    CurOnSur.Load(myC2D1);
-    CurOnSur.Load(mySurf1);
-    NbInt = CurOnSur.NbIntervals(S);
-    TColStd_Array1OfReal T1(1, NbInt+1);
-    CurOnSur.Intervals(T1, S);
-    CurOnSur.Load(myC2D2);
-    CurOnSur.Load(mySurf2);
-    NbInt = CurOnSur.NbIntervals(S);
-    TColStd_Array1OfReal T2(1, NbInt+1);
-    CurOnSur.Intervals(T2, S);
-
-    TColStd_SequenceOfReal Fusion;
-    GeomLib::FuseIntervals(T1, T2, Fusion);
-    return Fusion.Length() - 1;
+  switch (myCase)
+  {
+    case 1:
+      return myC3D->NbIntervals(S);
+    case 2:
+      CurOnSur.Load(myC2D1);
+      CurOnSur.Load(mySurf1);
+      return CurOnSur.NbIntervals(S);
+    case 3:
+      Standard_Integer NbInt;
+      CurOnSur.Load(myC2D1);
+      CurOnSur.Load(mySurf1);
+      NbInt = CurOnSur.NbIntervals(S);
+      TColStd_Array1OfReal T1(1, NbInt + 1);
+      CurOnSur.Intervals(T1, S);
+      CurOnSur.Load(myC2D2);
+      CurOnSur.Load(mySurf2);
+      NbInt = CurOnSur.NbIntervals(S);
+      TColStd_Array1OfReal T2(1, NbInt + 1);
+      CurOnSur.Intervals(T2, S);
+
+      TColStd_SequenceOfReal Fusion;
+      GeomLib::FuseIntervals(T1, T2, Fusion);
+      return Fusion.Length() - 1;
   }
 
-  //POP pour WNT
+  // POP pour WNT
   return 1;
 }
 
 void Approx_CurvlinFunc::Intervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
 {
   Adaptor3d_CurveOnSurface CurOnSur;
-  Standard_Integer i;
-    
-  switch(myCase) {
-  case 1:
-    myC3D->Intervals(T, S);
-    break;
-  case 2:
-    CurOnSur.Load(myC2D1);
-    CurOnSur.Load(mySurf1);
-    CurOnSur.Intervals(T, S);
-    break;
-  case 3:
-    Standard_Integer NbInt;
-    CurOnSur.Load(myC2D1);
-    CurOnSur.Load(mySurf1);
-    NbInt = CurOnSur.NbIntervals(S);
-    TColStd_Array1OfReal T1(1, NbInt+1);
-    CurOnSur.Intervals(T1, S);
-    CurOnSur.Load(myC2D2);
-    CurOnSur.Load(mySurf2);
-    NbInt = CurOnSur.NbIntervals(S);
-    TColStd_Array1OfReal T2(1, NbInt+1);
-    CurOnSur.Intervals(T2, S);
-
-    TColStd_SequenceOfReal Fusion;
-    GeomLib::FuseIntervals(T1, T2, Fusion);
-
-    for (i = 1; i <= Fusion.Length(); i++)
-      T.ChangeValue(i) = Fusion.Value(i);
+  Standard_Integer         i;
+
+  switch (myCase)
+  {
+    case 1:
+      myC3D->Intervals(T, S);
+      break;
+    case 2:
+      CurOnSur.Load(myC2D1);
+      CurOnSur.Load(mySurf1);
+      CurOnSur.Intervals(T, S);
+      break;
+    case 3:
+      Standard_Integer NbInt;
+      CurOnSur.Load(myC2D1);
+      CurOnSur.Load(mySurf1);
+      NbInt = CurOnSur.NbIntervals(S);
+      TColStd_Array1OfReal T1(1, NbInt + 1);
+      CurOnSur.Intervals(T1, S);
+      CurOnSur.Load(myC2D2);
+      CurOnSur.Load(mySurf2);
+      NbInt = CurOnSur.NbIntervals(S);
+      TColStd_Array1OfReal T2(1, NbInt + 1);
+      CurOnSur.Intervals(T2, S);
+
+      TColStd_SequenceOfReal Fusion;
+      GeomLib::FuseIntervals(T1, T2, Fusion);
+
+      for (i = 1; i <= Fusion.Length(); i++)
+        T.ChangeValue(i) = Fusion.Value(i);
   }
 
-  for(i = 1; i <= T.Length(); i++)
+  for (i = 1; i <= T.Length(); i++)
     T.ChangeValue(i) = GetSParameter(T.Value(i));
 }
 
-void Approx_CurvlinFunc::Trim(const Standard_Real First, const Standard_Real Last, const Standard_Real Tol)
+void Approx_CurvlinFunc::Trim(const Standard_Real First,
+                              const Standard_Real Last,
+                              const Standard_Real Tol)
 {
-  if (First < 0 || Last >1) throw Standard_OutOfRange("Approx_CurvlinFunc::Trim");
-  if ((Last - First) < Tol) return;
+  if (First < 0 || Last > 1)
+    throw Standard_OutOfRange("Approx_CurvlinFunc::Trim");
+  if ((Last - First) < Tol)
+    return;
 
-  Standard_Real FirstU, LastU;
-  Adaptor3d_CurveOnSurface CurOnSur;
+  Standard_Real                    FirstU, LastU;
+  Adaptor3d_CurveOnSurface         CurOnSur;
   Handle(Adaptor3d_CurveOnSurface) HCurOnSur;
 
-  switch(myCase) {
-  case 1:
-    myC3D = myC3D->Trim(myFirstU1, myLastU1, Tol);
-    FirstU = GetUParameter(*myC3D, First, 1);
-    LastU = GetUParameter (*myC3D, Last, 1);
-    myC3D = myC3D->Trim(FirstU, LastU, Tol);
-    break;
-  case 3:
-    CurOnSur.Load(myC2D2);
-    CurOnSur.Load(mySurf2);
-    HCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast (CurOnSur.Trim(myFirstU2, myLastU2, Tol));
-    myC2D2 = HCurOnSur->GetCurve();
-    mySurf2 = HCurOnSur->GetSurface();
-    CurOnSur.Load(myC2D2);
-    CurOnSur.Load(mySurf2);
-
-    FirstU = GetUParameter(CurOnSur, First, 1);
-    LastU = GetUParameter(CurOnSur, Last, 1);
-    HCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast (CurOnSur.Trim(FirstU, LastU, Tol));
-    myC2D2 = HCurOnSur->GetCurve();
-    mySurf2 = HCurOnSur->GetSurface();
-
-    Standard_FALLTHROUGH
-  case 2:
-    CurOnSur.Load(myC2D1);
-    CurOnSur.Load(mySurf1);
-    HCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast (CurOnSur.Trim(myFirstU1, myLastU1, Tol));
-    myC2D1 = HCurOnSur->GetCurve();
-    mySurf1 = HCurOnSur->GetSurface();
-    CurOnSur.Load(myC2D1);
-    CurOnSur.Load(mySurf1);
-
-    FirstU = GetUParameter(CurOnSur, First, 1);
-    LastU = GetUParameter(CurOnSur, Last, 1);
-    HCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast (CurOnSur.Trim(FirstU, LastU, Tol));
-    myC2D1 = HCurOnSur->GetCurve();
-    mySurf1 = HCurOnSur->GetSurface();
+  switch (myCase)
+  {
+    case 1:
+      myC3D  = myC3D->Trim(myFirstU1, myLastU1, Tol);
+      FirstU = GetUParameter(*myC3D, First, 1);
+      LastU  = GetUParameter(*myC3D, Last, 1);
+      myC3D  = myC3D->Trim(FirstU, LastU, Tol);
+      break;
+    case 3:
+      CurOnSur.Load(myC2D2);
+      CurOnSur.Load(mySurf2);
+      HCurOnSur =
+        Handle(Adaptor3d_CurveOnSurface)::DownCast(CurOnSur.Trim(myFirstU2, myLastU2, Tol));
+      myC2D2  = HCurOnSur->GetCurve();
+      mySurf2 = HCurOnSur->GetSurface();
+      CurOnSur.Load(myC2D2);
+      CurOnSur.Load(mySurf2);
+
+      FirstU    = GetUParameter(CurOnSur, First, 1);
+      LastU     = GetUParameter(CurOnSur, Last, 1);
+      HCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast(CurOnSur.Trim(FirstU, LastU, Tol));
+      myC2D2    = HCurOnSur->GetCurve();
+      mySurf2   = HCurOnSur->GetSurface();
+
+      Standard_FALLTHROUGH
+    case 2:
+      CurOnSur.Load(myC2D1);
+      CurOnSur.Load(mySurf1);
+      HCurOnSur =
+        Handle(Adaptor3d_CurveOnSurface)::DownCast(CurOnSur.Trim(myFirstU1, myLastU1, Tol));
+      myC2D1  = HCurOnSur->GetCurve();
+      mySurf1 = HCurOnSur->GetSurface();
+      CurOnSur.Load(myC2D1);
+      CurOnSur.Load(mySurf1);
+
+      FirstU    = GetUParameter(CurOnSur, First, 1);
+      LastU     = GetUParameter(CurOnSur, Last, 1);
+      HCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast(CurOnSur.Trim(FirstU, LastU, Tol));
+      myC2D1    = HCurOnSur->GetCurve();
+      mySurf1   = HCurOnSur->GetSurface();
   }
   myFirstS = First;
-  myLastS = Last;  
+  myLastS  = Last;
 }
 
 void Approx_CurvlinFunc::Length()
 {
   Adaptor3d_CurveOnSurface CurOnSur;
-  Standard_Real FirstU, LastU;
-
-  switch(myCase){
-  case 1:
-    FirstU = myC3D->FirstParameter();
-    LastU = myC3D->LastParameter();
-    myLength = Length (*myC3D, FirstU, LastU);    
-    myLength1 = myLength2 = 0;    
-    break;
-  case 2:
-    CurOnSur.Load(myC2D1);
-    CurOnSur.Load(mySurf1);
-    FirstU = CurOnSur.FirstParameter();
-    LastU = CurOnSur.LastParameter();
-    myLength = Length(CurOnSur, FirstU, LastU);
-    myLength1 = myLength2 = 0;    
-    break;
-  case 3:
-    CurOnSur.Load(myC2D1);
-    CurOnSur.Load(mySurf1);
-    FirstU = CurOnSur.FirstParameter();
-    LastU = CurOnSur.LastParameter();
-    myLength1 = Length(CurOnSur, FirstU, LastU);
-    CurOnSur.Load(myC2D2);
-    CurOnSur.Load(mySurf2);
-    FirstU = CurOnSur.FirstParameter();
-    LastU = CurOnSur.LastParameter();
-    myLength2 = Length(CurOnSur, FirstU, LastU);
-    myLength = (myLength1 + myLength2)/2;
+  Standard_Real            FirstU, LastU;
+
+  switch (myCase)
+  {
+    case 1:
+      FirstU    = myC3D->FirstParameter();
+      LastU     = myC3D->LastParameter();
+      myLength  = Length(*myC3D, FirstU, LastU);
+      myLength1 = myLength2 = 0;
+      break;
+    case 2:
+      CurOnSur.Load(myC2D1);
+      CurOnSur.Load(mySurf1);
+      FirstU    = CurOnSur.FirstParameter();
+      LastU     = CurOnSur.LastParameter();
+      myLength  = Length(CurOnSur, FirstU, LastU);
+      myLength1 = myLength2 = 0;
+      break;
+    case 3:
+      CurOnSur.Load(myC2D1);
+      CurOnSur.Load(mySurf1);
+      FirstU    = CurOnSur.FirstParameter();
+      LastU     = CurOnSur.LastParameter();
+      myLength1 = Length(CurOnSur, FirstU, LastU);
+      CurOnSur.Load(myC2D2);
+      CurOnSur.Load(mySurf2);
+      FirstU    = CurOnSur.FirstParameter();
+      LastU     = CurOnSur.LastParameter();
+      myLength2 = Length(CurOnSur, FirstU, LastU);
+      myLength  = (myLength1 + myLength2) / 2;
   }
 }
 
-
-Standard_Real Approx_CurvlinFunc::Length(Adaptor3d_Curve& C, const Standard_Real FirstU, const Standard_Real LastU) const
+Standard_Real Approx_CurvlinFunc::Length(Adaptor3d_Curve&    C,
+                                         const Standard_Real FirstU,
+                                         const Standard_Real LastU) const
 {
   Standard_Real Length;
 
@@ -414,7 +446,6 @@ Standard_Real Approx_CurvlinFunc::Length(Adaptor3d_Curve& C, const Standard_Real
   return Length;
 }
 
-
 Standard_Real Approx_CurvlinFunc::GetLength() const
 {
   return myLength;
@@ -422,82 +453,89 @@ Standard_Real Approx_CurvlinFunc::GetLength() const
 
 Standard_Real Approx_CurvlinFunc::GetSParameter(const Standard_Real U) const
 {
-  Standard_Real S=0, S1, S2;
+  Standard_Real            S = 0, S1, S2;
   Adaptor3d_CurveOnSurface CurOnSur;
 
-  switch (myCase) {
-  case 1:
-    S = GetSParameter (*myC3D, U, myLength);
-    break;
-  case 2:
-    CurOnSur.Load(myC2D1);
-    CurOnSur.Load(mySurf1);
-    S = GetSParameter(CurOnSur, U, myLength);
-    break;
-  case 3:
-    CurOnSur.Load(myC2D1);
-    CurOnSur.Load(mySurf1);
-    S1 = GetSParameter(CurOnSur, U, myLength1);    
-    CurOnSur.Load(myC2D2);
-    CurOnSur.Load(mySurf2);
-    S2 = GetSParameter(CurOnSur, U, myLength2);    
-    S = (S1 + S2)/2;
+  switch (myCase)
+  {
+    case 1:
+      S = GetSParameter(*myC3D, U, myLength);
+      break;
+    case 2:
+      CurOnSur.Load(myC2D1);
+      CurOnSur.Load(mySurf1);
+      S = GetSParameter(CurOnSur, U, myLength);
+      break;
+    case 3:
+      CurOnSur.Load(myC2D1);
+      CurOnSur.Load(mySurf1);
+      S1 = GetSParameter(CurOnSur, U, myLength1);
+      CurOnSur.Load(myC2D2);
+      CurOnSur.Load(mySurf2);
+      S2 = GetSParameter(CurOnSur, U, myLength2);
+      S  = (S1 + S2) / 2;
   }
   return S;
 }
 
-
-
-Standard_Real Approx_CurvlinFunc::GetUParameter(Adaptor3d_Curve& C, 
-                                               const Standard_Real S, 
-                                               const Standard_Integer NumberOfCurve) const
+Standard_Real Approx_CurvlinFunc::GetUParameter(Adaptor3d_Curve&       C,
+                                                const Standard_Real    S,
+                                                const Standard_Integer NumberOfCurve) const
 {
-  Standard_Real deltaS, base, U, Length;
-  Standard_Integer NbInt, NInterval, i;
+  Standard_Real                 deltaS, base, U, Length;
+  Standard_Integer              NbInt, NInterval, i;
   Handle(TColStd_HArray1OfReal) InitUArray, InitSArray;
 #ifdef OCCT_DEBUG_CHRONO
   InitChron(chr_uparam);
 #endif
-  if(S < 0 || S > 1) throw Standard_ConstructionError("Approx_CurvlinFunc::GetUParameter");
+  if (S < 0 || S > 1)
+    throw Standard_ConstructionError("Approx_CurvlinFunc::GetUParameter");
 
-  if(NumberOfCurve == 1) {
+  if (NumberOfCurve == 1)
+  {
     InitUArray = myUi_1;
     InitSArray = mySi_1;
-    if(myCase == 3)
+    if (myCase == 3)
       Length = myLength1;
-    else 
+    else
       Length = myLength;
   }
-  else {
+  else
+  {
     InitUArray = myUi_2;
     InitSArray = mySi_2;
-    Length = myLength2;
+    Length     = myLength2;
   }
 
   NbInt = InitUArray->Length() - 1;
 
-  if(S == 1) NInterval = NbInt - 1;
-  else {
-    for(i = 0; i < NbInt; i++) {
-      if((InitSArray->Value(i) <= S && S < InitSArray->Value(i+1)))
-       break;
+  if (S == 1)
+    NInterval = NbInt - 1;
+  else
+  {
+    for (i = 0; i < NbInt; i++)
+    {
+      if ((InitSArray->Value(i) <= S && S < InitSArray->Value(i + 1)))
+        break;
     }
     NInterval = i;
   }
-  if(S==InitSArray->Value(NInterval)) {
+  if (S == InitSArray->Value(NInterval))
+  {
     return InitUArray->Value(NInterval);
   }
-  if(S==InitSArray->Value(NInterval+1)) {
-    return InitUArray->Value(NInterval+1);
-  } 
+  if (S == InitSArray->Value(NInterval + 1))
+  {
+    return InitUArray->Value(NInterval + 1);
+  }
 
-  base = InitUArray->Value(NInterval);
-  deltaS = (S - InitSArray->Value(NInterval))*Length;
+  base   = InitUArray->Value(NInterval);
+  deltaS = (S - InitSArray->Value(NInterval)) * Length;
 
-// to find an initial point
+  // to find an initial point
   Standard_Real Xi[4], Yi[4], UGuess;
   findfourpoints(S, NInterval, InitSArray, InitUArray, myPrevS, myPrevU, Xi, Yi);
-  UGuess = cubic(S , Xi, Yi);
+  UGuess = cubic(S, Xi, Yi);
 
   U = GCPnts_AbscissaPoint(C, deltaS, base, UGuess, myTolLen).Parameter();
 
@@ -513,67 +551,77 @@ Standard_Real Approx_CurvlinFunc::GetUParameter(Adaptor3d_Curve& C,
   return U;
 }
 
-Standard_Real Approx_CurvlinFunc::GetSParameter(Adaptor3d_Curve& C, const Standard_Real U, const Standard_Real Len) const
+Standard_Real Approx_CurvlinFunc::GetSParameter(Adaptor3d_Curve&    C,
+                                                const Standard_Real U,
+                                                const Standard_Real Len) const
 {
   Standard_Real S, Origin;
 
   Origin = C.FirstParameter();
-  S = myFirstS + Length(C, Origin, U)/Len;    
+  S      = myFirstS + Length(C, Origin, U) / Len;
   return S;
 }
 
-Standard_Boolean Approx_CurvlinFunc::EvalCase1(const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result) const
+Standard_Boolean Approx_CurvlinFunc::EvalCase1(const Standard_Real    S,
+                                               const Standard_Integer Order,
+                                               TColStd_Array1OfReal&  Result) const
 {
-  if(myCase != 1) throw Standard_ConstructionError("Approx_CurvlinFunc::EvalCase1");
+  if (myCase != 1)
+    throw Standard_ConstructionError("Approx_CurvlinFunc::EvalCase1");
 
-  gp_Pnt C;
-  gp_Vec dC_dU, dC_dS, d2C_dU2, d2C_dS2;
+  gp_Pnt        C;
+  gp_Vec        dC_dU, dC_dS, d2C_dU2, d2C_dS2;
   Standard_Real U, Mag, dU_dS, d2U_dS2;
-  
-  U = GetUParameter (*myC3D, S, 1);
-
-  switch(Order) {
-
-  case 0: 
-    myC3D->D0(U, C);
-
-    Result(0) = C.X();
-    Result(1) = C.Y();
-    Result(2) = C.Z();
-    break;
-    
-  case 1:
-    myC3D->D1(U, C, dC_dU);
-    Mag = dC_dU.Magnitude();
-    dU_dS = myLength/Mag;
-    dC_dS = dC_dU*dU_dS;
-
-    Result(0) = dC_dS.X();
-    Result(1) = dC_dS.Y();
-    Result(2) = dC_dS.Z();
-    break;
-
-  case 2:
-    myC3D->D2(U, C, dC_dU, d2C_dU2);
-    Mag = dC_dU.Magnitude();
-    dU_dS = myLength/Mag;
-    d2U_dS2 = -myLength*dC_dU.Dot(d2C_dU2)*dU_dS/(Mag*Mag*Mag);
-    d2C_dS2 = d2C_dU2*dU_dS*dU_dS + dC_dU*d2U_dS2;
-
-    Result(0) = d2C_dS2.X();
-    Result(1) = d2C_dS2.Y();
-    Result(2) = d2C_dS2.Z();
-    break;
-
-  default: Result(0) = Result(1) = Result(2) = 0;
-    return Standard_False;
+
+  U = GetUParameter(*myC3D, S, 1);
+
+  switch (Order)
+  {
+
+    case 0:
+      myC3D->D0(U, C);
+
+      Result(0) = C.X();
+      Result(1) = C.Y();
+      Result(2) = C.Z();
+      break;
+
+    case 1:
+      myC3D->D1(U, C, dC_dU);
+      Mag   = dC_dU.Magnitude();
+      dU_dS = myLength / Mag;
+      dC_dS = dC_dU * dU_dS;
+
+      Result(0) = dC_dS.X();
+      Result(1) = dC_dS.Y();
+      Result(2) = dC_dS.Z();
+      break;
+
+    case 2:
+      myC3D->D2(U, C, dC_dU, d2C_dU2);
+      Mag     = dC_dU.Magnitude();
+      dU_dS   = myLength / Mag;
+      d2U_dS2 = -myLength * dC_dU.Dot(d2C_dU2) * dU_dS / (Mag * Mag * Mag);
+      d2C_dS2 = d2C_dU2 * dU_dS * dU_dS + dC_dU * d2U_dS2;
+
+      Result(0) = d2C_dS2.X();
+      Result(1) = d2C_dS2.Y();
+      Result(2) = d2C_dS2.Z();
+      break;
+
+    default:
+      Result(0) = Result(1) = Result(2) = 0;
+      return Standard_False;
   }
   return Standard_True;
 }
 
-Standard_Boolean Approx_CurvlinFunc::EvalCase2(const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result) const
+Standard_Boolean Approx_CurvlinFunc::EvalCase2(const Standard_Real    S,
+                                               const Standard_Integer Order,
+                                               TColStd_Array1OfReal&  Result) const
 {
-  if(myCase != 2) throw Standard_ConstructionError("Approx_CurvlinFunc::EvalCase2");
+  if (myCase != 2)
+    throw Standard_ConstructionError("Approx_CurvlinFunc::EvalCase2");
 
   Standard_Boolean Done;
 
@@ -582,12 +630,15 @@ Standard_Boolean Approx_CurvlinFunc::EvalCase2(const Standard_Real S, const Stan
   return Done;
 }
 
-Standard_Boolean Approx_CurvlinFunc::EvalCase3(const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result)
+Standard_Boolean Approx_CurvlinFunc::EvalCase3(const Standard_Real    S,
+                                               const Standard_Integer Order,
+                                               TColStd_Array1OfReal&  Result)
 {
-  if(myCase != 3) throw Standard_ConstructionError("Approx_CurvlinFunc::EvalCase3");
-  
+  if (myCase != 3)
+    throw Standard_ConstructionError("Approx_CurvlinFunc::EvalCase3");
+
   TColStd_Array1OfReal tmpRes1(0, 4), tmpRes2(0, 4);
-  Standard_Boolean Done;
+  Standard_Boolean     Done;
 
   Done = EvalCurOnSur(S, Order, tmpRes1, 1);
 
@@ -597,107 +648,116 @@ Standard_Boolean Approx_CurvlinFunc::EvalCase3(const Standard_Real S, const Stan
   Result(1) = tmpRes1(1);
   Result(2) = tmpRes2(0);
   Result(3) = tmpRes2(1);
-  Result(4) = 0.5*(tmpRes1(2) + tmpRes2(2));
-  Result(5) = 0.5*(tmpRes1(3) + tmpRes2(3));
-  Result(6) = 0.5*(tmpRes1(4) + tmpRes2(4));
+  Result(4) = 0.5 * (tmpRes1(2) + tmpRes2(2));
+  Result(5) = 0.5 * (tmpRes1(3) + tmpRes2(3));
+  Result(6) = 0.5 * (tmpRes1(4) + tmpRes2(4));
 
   return Done;
 }
 
-Standard_Boolean Approx_CurvlinFunc::EvalCurOnSur(const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result, const  Standard_Integer NumberOfCurve) const
+Standard_Boolean Approx_CurvlinFunc::EvalCurOnSur(const Standard_Real    S,
+                                                  const Standard_Integer Order,
+                                                  TColStd_Array1OfReal&  Result,
+                                                  const Standard_Integer NumberOfCurve) const
 {
   Handle(Adaptor2d_Curve2d) Cur2D;
   Handle(Adaptor3d_Surface) Surf;
-  Standard_Real U=0, Length=0;
+  Standard_Real             U = 0, Length = 0;
 
-  if (NumberOfCurve == 1) {
+  if (NumberOfCurve == 1)
+  {
     Cur2D = myC2D1;
-    Surf = mySurf1;    
+    Surf  = mySurf1;
     Adaptor3d_CurveOnSurface CurOnSur(myC2D1, mySurf1);
     U = GetUParameter(CurOnSur, S, 1);
-    if(myCase == 3) Length = myLength1;
-    else Length = myLength;
+    if (myCase == 3)
+      Length = myLength1;
+    else
+      Length = myLength;
   }
-  else if (NumberOfCurve == 2) {
+  else if (NumberOfCurve == 2)
+  {
     Cur2D = myC2D2;
-    Surf = mySurf2;    
+    Surf  = mySurf2;
     Adaptor3d_CurveOnSurface CurOnSur(myC2D2, mySurf2);
-    U = GetUParameter(CurOnSur, S, 2);
+    U      = GetUParameter(CurOnSur, S, 2);
     Length = myLength2;
   }
-  else 
+  else
     throw Standard_ConstructionError("Approx_CurvlinFunc::EvalCurOnSur");
 
   Standard_Real Mag, dU_dS, d2U_dS2, dV_dU, dW_dU, dV_dS, dW_dS, d2V_dS2, d2W_dS2, d2V_dU2, d2W_dU2;
-  gp_Pnt2d C2D;
-  gp_Pnt C;
-  gp_Vec2d dC2D_dU, d2C2D_dU2;
-  gp_Vec dC_dU, d2C_dU2, dC_dS, d2C_dS2, dS_dV, dS_dW, d2S_dV2, d2S_dW2, d2S_dVdW;
-
-  switch(Order) {
-  case 0:
-    Cur2D->D0(U, C2D);
-    Surf->D0(C2D.X(), C2D.Y(), C);
-    
-    Result(0) = C2D.X();
-    Result(1) = C2D.Y();
-    Result(2) = C.X();
-    Result(3) = C.Y();
-    Result(4) = C.Z();
-    break;
-
-  case 1:
-    Cur2D->D1(U, C2D, dC2D_dU);
-    dV_dU = dC2D_dU.X();
-    dW_dU = dC2D_dU.Y();
-    Surf->D1(C2D.X(), C2D.Y(), C, dS_dV, dS_dW);
-    dC_dU = dS_dV*dV_dU + dS_dW*dW_dU;
-    Mag = dC_dU.Magnitude();
-    dU_dS = Length/Mag;
-
-    dV_dS = dV_dU*dU_dS;
-    dW_dS = dW_dU*dU_dS;
-    dC_dS = dC_dU*dU_dS;
-
-    Result(0) = dV_dS;
-    Result(1) = dW_dS;
-    Result(2) = dC_dS.X();
-    Result(3) = dC_dS.Y();
-    Result(4) = dC_dS.Z();    
-    break;
-
-  case 2:
-    Cur2D->D2(U, C2D, dC2D_dU, d2C2D_dU2);
-    dV_dU = dC2D_dU.X();
-    dW_dU = dC2D_dU.Y();
-    d2V_dU2 = d2C2D_dU2.X();
-    d2W_dU2 = d2C2D_dU2.Y();
-    Surf->D2(C2D.X(), C2D.Y(), C, dS_dV, dS_dW, d2S_dV2, d2S_dW2, d2S_dVdW);
-    dC_dU = dS_dV*dV_dU + dS_dW*dW_dU;
-    d2C_dU2 = (d2S_dV2*dV_dU + d2S_dVdW*dW_dU)*dV_dU + dS_dV*d2V_dU2 + 
-              (d2S_dVdW*dV_dU + d2S_dW2*dW_dU)*dW_dU + dS_dW*d2W_dU2;
-    Mag = dC_dU.Magnitude();
-    dU_dS = Length/Mag;
-    d2U_dS2 = -Length*dC_dU.Dot(d2C_dU2)*dU_dS/(Mag*Mag*Mag);
-    
-    dV_dS = dV_dU * dU_dS;
-    dW_dS = dW_dU * dU_dS;
-    d2V_dS2 = d2V_dU2*dU_dS*dU_dS + dV_dU*d2U_dS2;
-    d2W_dS2 = d2W_dU2*dU_dS*dU_dS + dW_dU*d2U_dS2;
-    
-    d2U_dS2 = -dC_dU.Dot(d2C_dU2)*dU_dS/(Mag*Mag);
-    d2C_dS2 = (d2S_dV2 * dV_dS + d2S_dVdW * dW_dS) * dV_dS + dS_dV * d2V_dS2 +
-              (d2S_dW2 * dW_dS + d2S_dVdW * dV_dS) * dW_dS + dS_dW * d2W_dS2;
-    
-    Result(0) = d2V_dS2;
-    Result(1) = d2W_dS2;
-    Result(2) = d2C_dS2.X();
-    Result(3) = d2C_dS2.Y();
-    Result(4) = d2C_dS2.Z();      
-    break;
-
-  default: Result(0) = Result(1) = Result(2) = Result(3) = Result(4) = 0;
-    return Standard_False;
+  gp_Pnt2d      C2D;
+  gp_Pnt        C;
+  gp_Vec2d      dC2D_dU, d2C2D_dU2;
+  gp_Vec        dC_dU, d2C_dU2, dC_dS, d2C_dS2, dS_dV, dS_dW, d2S_dV2, d2S_dW2, d2S_dVdW;
+
+  switch (Order)
+  {
+    case 0:
+      Cur2D->D0(U, C2D);
+      Surf->D0(C2D.X(), C2D.Y(), C);
+
+      Result(0) = C2D.X();
+      Result(1) = C2D.Y();
+      Result(2) = C.X();
+      Result(3) = C.Y();
+      Result(4) = C.Z();
+      break;
+
+    case 1:
+      Cur2D->D1(U, C2D, dC2D_dU);
+      dV_dU = dC2D_dU.X();
+      dW_dU = dC2D_dU.Y();
+      Surf->D1(C2D.X(), C2D.Y(), C, dS_dV, dS_dW);
+      dC_dU = dS_dV * dV_dU + dS_dW * dW_dU;
+      Mag   = dC_dU.Magnitude();
+      dU_dS = Length / Mag;
+
+      dV_dS = dV_dU * dU_dS;
+      dW_dS = dW_dU * dU_dS;
+      dC_dS = dC_dU * dU_dS;
+
+      Result(0) = dV_dS;
+      Result(1) = dW_dS;
+      Result(2) = dC_dS.X();
+      Result(3) = dC_dS.Y();
+      Result(4) = dC_dS.Z();
+      break;
+
+    case 2:
+      Cur2D->D2(U, C2D, dC2D_dU, d2C2D_dU2);
+      dV_dU   = dC2D_dU.X();
+      dW_dU   = dC2D_dU.Y();
+      d2V_dU2 = d2C2D_dU2.X();
+      d2W_dU2 = d2C2D_dU2.Y();
+      Surf->D2(C2D.X(), C2D.Y(), C, dS_dV, dS_dW, d2S_dV2, d2S_dW2, d2S_dVdW);
+      dC_dU   = dS_dV * dV_dU + dS_dW * dW_dU;
+      d2C_dU2 = (d2S_dV2 * dV_dU + d2S_dVdW * dW_dU) * dV_dU + dS_dV * d2V_dU2
+                + (d2S_dVdW * dV_dU + d2S_dW2 * dW_dU) * dW_dU + dS_dW * d2W_dU2;
+      Mag     = dC_dU.Magnitude();
+      dU_dS   = Length / Mag;
+      d2U_dS2 = -Length * dC_dU.Dot(d2C_dU2) * dU_dS / (Mag * Mag * Mag);
+
+      dV_dS   = dV_dU * dU_dS;
+      dW_dS   = dW_dU * dU_dS;
+      d2V_dS2 = d2V_dU2 * dU_dS * dU_dS + dV_dU * d2U_dS2;
+      d2W_dS2 = d2W_dU2 * dU_dS * dU_dS + dW_dU * d2U_dS2;
+
+      d2U_dS2 = -dC_dU.Dot(d2C_dU2) * dU_dS / (Mag * Mag);
+      d2C_dS2 = (d2S_dV2 * dV_dS + d2S_dVdW * dW_dS) * dV_dS + dS_dV * d2V_dS2
+                + (d2S_dW2 * dW_dS + d2S_dVdW * dV_dS) * dW_dS + dS_dW * d2W_dS2;
+
+      Result(0) = d2V_dS2;
+      Result(1) = d2W_dS2;
+      Result(2) = d2C_dS2.X();
+      Result(3) = d2C_dS2.Y();
+      Result(4) = d2C_dS2.Z();
+      break;
+
+    default:
+      Result(0) = Result(1) = Result(2) = Result(3) = Result(4) = 0;
+      return Standard_False;
   }
   return Standard_True;
 }
index c97e46146b4bc2f8949e0a97edd7c42986fdcf6c..fb236ce3321fe7d0cba749aaaf49023936ec3ece 100644 (file)
@@ -31,112 +31,118 @@ class Approx_CurvlinFunc : public Standard_Transient
 {
 
 public:
-
-  
   Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor3d_Curve)& C, const Standard_Real Tol);
-  
-  Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D, const Handle(Adaptor3d_Surface)& S, const Standard_Real Tol);
-  
-  Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D1, const Handle(Adaptor2d_Curve2d)& C2D2, const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_Surface)& S2, const Standard_Real Tol);
-  
+
+  Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D,
+                                     const Handle(Adaptor3d_Surface)& S,
+                                     const Standard_Real              Tol);
+
+  Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D1,
+                                     const Handle(Adaptor2d_Curve2d)& C2D2,
+                                     const Handle(Adaptor3d_Surface)& S1,
+                                     const Handle(Adaptor3d_Surface)& S2,
+                                     const Standard_Real              Tol);
+
   //! ---Purpose Update the tolerance to used
-  Standard_EXPORT void SetTol (const Standard_Real Tol);
-  
+  Standard_EXPORT void SetTol(const Standard_Real Tol);
+
   Standard_EXPORT Standard_Real FirstParameter() const;
-  
+
   Standard_EXPORT Standard_Real LastParameter() const;
-  
+
   //! Returns  the number  of  intervals for  continuity
   //! <S>. May be one if Continuity(me) >= <S>
-  Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const;
-  
+  Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const;
+
   //! Stores in <T> the  parameters bounding the intervals
   //! of continuity <S>.
   //!
   //! The array must provide  enough room to  accommodate
   //! for the parameters. i.e. T.Length() > NbIntervals()
-  Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
-  
+  Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
+
   //! if First < 0 or Last > 1
-  Standard_EXPORT void Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol);
-  
+  Standard_EXPORT void Trim(const Standard_Real First,
+                            const Standard_Real Last,
+                            const Standard_Real Tol);
+
   //! Computes length of the curve.
   Standard_EXPORT void Length();
-  
+
   //! Computes length of the curve segment.
-  Standard_EXPORT Standard_Real Length (Adaptor3d_Curve& C, const Standard_Real FirstU, const Standard_Real LasrU) const;
-  
+  Standard_EXPORT Standard_Real Length(Adaptor3d_Curve&    C,
+                                       const Standard_Real FirstU,
+                                       const Standard_Real LasrU) const;
+
   Standard_EXPORT Standard_Real GetLength() const;
-  
+
   //! returns  original parameter corresponding S.  if
   //! Case == 1 computation is performed on myC2D1 and mySurf1,
   //! otherwise it is done on myC2D2 and mySurf2.
-  Standard_EXPORT Standard_Real GetUParameter (Adaptor3d_Curve& C, const Standard_Real S, const Standard_Integer NumberOfCurve) const;
-  
+  Standard_EXPORT Standard_Real GetUParameter(Adaptor3d_Curve&       C,
+                                              const Standard_Real    S,
+                                              const Standard_Integer NumberOfCurve) const;
+
   //! returns original parameter corresponding S.
-  Standard_EXPORT Standard_Real GetSParameter (const Standard_Real U) const;
-  
-  //! if myCase != 1
-  Standard_EXPORT Standard_Boolean EvalCase1 (const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result) const;
-  
-  //! if myCase != 2
-  Standard_EXPORT Standard_Boolean EvalCase2 (const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result) const;
-  
-  //! if myCase != 3
-  Standard_EXPORT Standard_Boolean EvalCase3 (const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result);
+  Standard_EXPORT Standard_Real GetSParameter(const Standard_Real U) const;
 
+  //! if myCase != 1
+  Standard_EXPORT Standard_Boolean EvalCase1(const Standard_Real    S,
+                                             const Standard_Integer Order,
+                                             TColStd_Array1OfReal&  Result) const;
 
+  //! if myCase != 2
+  Standard_EXPORT Standard_Boolean EvalCase2(const Standard_Real    S,
+                                             const Standard_Integer Order,
+                                             TColStd_Array1OfReal&  Result) const;
 
+  //! if myCase != 3
+  Standard_EXPORT Standard_Boolean EvalCase3(const Standard_Real    S,
+                                             const Standard_Integer Order,
+                                             TColStd_Array1OfReal&  Result);
 
-  DEFINE_STANDARD_RTTIEXT(Approx_CurvlinFunc,Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(Approx_CurvlinFunc, Standard_Transient)
 
 protected:
-
-
-
-
 private:
-
-  
   Standard_EXPORT void Init();
-  
-  Standard_EXPORT void Init (Adaptor3d_Curve& C, Handle(TColStd_HArray1OfReal)& Si, Handle(TColStd_HArray1OfReal)& Ui) const;
-  
+
+  Standard_EXPORT void Init(Adaptor3d_Curve&               C,
+                            Handle(TColStd_HArray1OfReal)& Si,
+                            Handle(TColStd_HArray1OfReal)& Ui) const;
+
   //! returns curvilinear parameter corresponding U.
-  Standard_EXPORT Standard_Real GetSParameter (Adaptor3d_Curve& C, const Standard_Real U, const Standard_Real Length) const;
-  
-  Standard_EXPORT Standard_Boolean EvalCurOnSur (const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result, const Standard_Integer NumberOfCurve) const;
-
-  Handle(Adaptor3d_Curve) myC3D;
-  Handle(Adaptor2d_Curve2d) myC2D1;
-  Handle(Adaptor2d_Curve2d) myC2D2;
-  Handle(Adaptor3d_Surface) mySurf1;
-  Handle(Adaptor3d_Surface) mySurf2;
-  Standard_Integer myCase;
-  Standard_Real myFirstS;
-  Standard_Real myLastS;
-  Standard_Real myFirstU1;
-  Standard_Real myLastU1;
-  Standard_Real myFirstU2;
-  Standard_Real myLastU2;
-  Standard_Real myLength;
-  Standard_Real myLength1;
-  Standard_Real myLength2;
-  Standard_Real myTolLen;
-  Standard_Real myPrevS;
-  Standard_Real myPrevU;
+  Standard_EXPORT Standard_Real GetSParameter(Adaptor3d_Curve&    C,
+                                              const Standard_Real U,
+                                              const Standard_Real Length) const;
+
+  Standard_EXPORT Standard_Boolean EvalCurOnSur(const Standard_Real    S,
+                                                const Standard_Integer Order,
+                                                TColStd_Array1OfReal&  Result,
+                                                const Standard_Integer NumberOfCurve) const;
+
+  Handle(Adaptor3d_Curve)       myC3D;
+  Handle(Adaptor2d_Curve2d)     myC2D1;
+  Handle(Adaptor2d_Curve2d)     myC2D2;
+  Handle(Adaptor3d_Surface)     mySurf1;
+  Handle(Adaptor3d_Surface)     mySurf2;
+  Standard_Integer              myCase;
+  Standard_Real                 myFirstS;
+  Standard_Real                 myLastS;
+  Standard_Real                 myFirstU1;
+  Standard_Real                 myLastU1;
+  Standard_Real                 myFirstU2;
+  Standard_Real                 myLastU2;
+  Standard_Real                 myLength;
+  Standard_Real                 myLength1;
+  Standard_Real                 myLength2;
+  Standard_Real                 myTolLen;
+  Standard_Real                 myPrevS;
+  Standard_Real                 myPrevU;
   Handle(TColStd_HArray1OfReal) myUi_1;
   Handle(TColStd_HArray1OfReal) mySi_1;
   Handle(TColStd_HArray1OfReal) myUi_2;
   Handle(TColStd_HArray1OfReal) mySi_2;
-
-
 };
 
-
-
-
-
-
-
 #endif // _Approx_CurvlinFunc_HeaderFile
index f5a4b24f81578b375f3c57324b25e3f3718203f7..761c53ead14fe78ffb64ccba242d37a2725387e4 100644 (file)
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 
-#include <AppParCurves_SequenceOfMultiCurve.hxx>
-#include <TColStd_SequenceOfReal.hxx>
+#include <AppCont_Function.hxx>
+#include <AppParCurves_Constraint.hxx>
 #include <AppParCurves_MultiCurve.hxx>
+#include <AppParCurves_SequenceOfMultiCurve.hxx>
 #include <Standard_Integer.hxx>
-#include <AppParCurves_Constraint.hxx>
-#include <AppCont_Function.hxx>
+#include <TColStd_SequenceOfReal.hxx>
 class AppParCurves_MultiCurve;
 
-
-
-class Approx_FitAndDivide 
+class Approx_FitAndDivide
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
-  
   //! The MultiLine <Line> will be approximated until tolerances
   //! will be reached.
   //! The approximation will be done from degreemin to degreemax
   //! with a cutting if the corresponding boolean is True.
-  Standard_EXPORT Approx_FitAndDivide(const AppCont_Function& Line, const Standard_Integer degreemin = 3, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-5, const Standard_Real Tolerance2d = 1.0e-5, const Standard_Boolean cutting = Standard_False, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
-  
+  Standard_EXPORT Approx_FitAndDivide(
+    const AppCont_Function&       Line,
+    const Standard_Integer        degreemin   = 3,
+    const Standard_Integer        degreemax   = 8,
+    const Standard_Real           Tolerance3d = 1.0e-5,
+    const Standard_Real           Tolerance2d = 1.0e-5,
+    const Standard_Boolean        cutting     = Standard_False,
+    const AppParCurves_Constraint FirstC      = AppParCurves_TangencyPoint,
+    const AppParCurves_Constraint LastC       = AppParCurves_TangencyPoint);
+
   //! Initializes the fields of the algorithm.
-  Standard_EXPORT Approx_FitAndDivide(const Standard_Integer degreemin = 3, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-05, const Standard_Real Tolerance2d = 1.0e-05, const Standard_Boolean cutting = Standard_False, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
-  
+  Standard_EXPORT Approx_FitAndDivide(
+    const Standard_Integer        degreemin   = 3,
+    const Standard_Integer        degreemax   = 8,
+    const Standard_Real           Tolerance3d = 1.0e-05,
+    const Standard_Real           Tolerance2d = 1.0e-05,
+    const Standard_Boolean        cutting     = Standard_False,
+    const AppParCurves_Constraint FirstC      = AppParCurves_TangencyPoint,
+    const AppParCurves_Constraint LastC       = AppParCurves_TangencyPoint);
+
   //! runs the algorithm after having initialized the fields.
-  Standard_EXPORT void Perform (const AppCont_Function& Line);
-  
+  Standard_EXPORT void Perform(const AppCont_Function& Line);
+
   //! changes the degrees of the approximation.
-  Standard_EXPORT void SetDegrees (const Standard_Integer degreemin, const Standard_Integer degreemax);
-  
+  Standard_EXPORT void SetDegrees(const Standard_Integer degreemin,
+                                  const Standard_Integer degreemax);
+
   //! Changes the tolerances of the approximation.
-  Standard_EXPORT void SetTolerances (const Standard_Real Tolerance3d, const Standard_Real Tolerance2d);
-  
+  Standard_EXPORT void SetTolerances(const Standard_Real Tolerance3d,
+                                     const Standard_Real Tolerance2d);
+
   //! Changes the constraints of the approximation.
-  Standard_EXPORT void SetConstraints (const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC);
+  Standard_EXPORT void SetConstraints(const AppParCurves_Constraint FirstC,
+                                      const AppParCurves_Constraint LastC);
 
   //! Changes the max number of segments, which is allowed for cutting.
-  Standard_EXPORT void SetMaxSegments (const Standard_Integer theMaxSegments);
-  
+  Standard_EXPORT void SetMaxSegments(const Standard_Integer theMaxSegments);
+
   //! Set inverse order of degree selection:
   //! if theInvOrdr = true, current degree is chosen by inverse order -
   //! from maxdegree to mindegree.
@@ -77,66 +91,55 @@ public:
   //! the status NoApproximation has been sent by the user
   //! when more points were needed.
   Standard_EXPORT Standard_Boolean IsAllApproximated() const;
-  
+
   //! returns False if the status NoPointsAdded has been sent.
   Standard_EXPORT Standard_Boolean IsToleranceReached() const;
-  
+
   //! returns the tolerances 2d and 3d of the <Index> MultiCurve.
-  Standard_EXPORT void Error (const Standard_Integer Index, Standard_Real& tol3d, Standard_Real& tol2d) const;
-  
+  Standard_EXPORT void Error(const Standard_Integer Index,
+                             Standard_Real&         tol3d,
+                             Standard_Real&         tol2d) const;
+
   //! Returns the number of MultiCurve doing the approximation
   //! of the MultiLine.
   Standard_EXPORT Standard_Integer NbMultiCurves() const;
-  
-  //! returns the approximation MultiCurve of range <Index>.
-  Standard_EXPORT AppParCurves_MultiCurve Value (const Standard_Integer Index = 1) const;
-  
-  Standard_EXPORT void Parameters (const Standard_Integer Index, Standard_Real& firstp, Standard_Real& lastp) const;
-
 
+  //! returns the approximation MultiCurve of range <Index>.
+  Standard_EXPORT AppParCurves_MultiCurve Value(const Standard_Integer Index = 1) const;
 
+  Standard_EXPORT void Parameters(const Standard_Integer Index,
+                                  Standard_Real&         firstp,
+                                  Standard_Real&         lastp) const;
 
 protected:
-
-
-
-
-
 private:
-
-  
   //! is internally used by the algorithms.
-  Standard_EXPORT Standard_Boolean Compute (const AppCont_Function& Line, const Standard_Real Ufirst, const Standard_Real Ulast, Standard_Real& TheTol3d, Standard_Real& TheTol2d);
-
+  Standard_EXPORT Standard_Boolean Compute(const AppCont_Function& Line,
+                                           const Standard_Real     Ufirst,
+                                           const Standard_Real     Ulast,
+                                           Standard_Real&          TheTol3d,
+                                           Standard_Real&          TheTol2d);
 
   AppParCurves_SequenceOfMultiCurve myMultiCurves;
-  TColStd_SequenceOfReal myfirstparam;
-  TColStd_SequenceOfReal mylastparam;
-  AppParCurves_MultiCurve TheMultiCurve;
-  Standard_Boolean alldone;
-  Standard_Boolean tolreached;
-  TColStd_SequenceOfReal Tolers3d;
-  TColStd_SequenceOfReal Tolers2d;
-  Standard_Integer mydegremin;
-  Standard_Integer mydegremax;
-  Standard_Real mytol3d;
-  Standard_Real mytol2d;
-  Standard_Real currenttol3d;
-  Standard_Real currenttol2d;
-  Standard_Boolean mycut;
-  AppParCurves_Constraint myfirstC;
-  AppParCurves_Constraint mylastC;
-  Standard_Integer myMaxSegments;
-  Standard_Boolean myInvOrder;
-  Standard_Boolean myHangChecking;
-
-
+  TColStd_SequenceOfReal            myfirstparam;
+  TColStd_SequenceOfReal            mylastparam;
+  AppParCurves_MultiCurve           TheMultiCurve;
+  Standard_Boolean                  alldone;
+  Standard_Boolean                  tolreached;
+  TColStd_SequenceOfReal            Tolers3d;
+  TColStd_SequenceOfReal            Tolers2d;
+  Standard_Integer                  mydegremin;
+  Standard_Integer                  mydegremax;
+  Standard_Real                     mytol3d;
+  Standard_Real                     mytol2d;
+  Standard_Real                     currenttol3d;
+  Standard_Real                     currenttol2d;
+  Standard_Boolean                  mycut;
+  AppParCurves_Constraint           myfirstC;
+  AppParCurves_Constraint           mylastC;
+  Standard_Integer                  myMaxSegments;
+  Standard_Boolean                  myInvOrder;
+  Standard_Boolean                  myHangChecking;
 };
 
-
-
-
-
-
-
 #endif // _Approx_FitAndDivide_HeaderFile
index e98a013e5d14f62f0f6b2c1dc69a4d65078e516b..da98a33fb2f1ce45c79fae7bb7427535e52c7c92 100644 (file)
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 
-#include <AppParCurves_SequenceOfMultiCurve.hxx>
-#include <TColStd_SequenceOfReal.hxx>
+#include <AppCont_Function.hxx>
+#include <AppParCurves_Constraint.hxx>
 #include <AppParCurves_MultiCurve.hxx>
+#include <AppParCurves_SequenceOfMultiCurve.hxx>
 #include <Standard_Integer.hxx>
-#include <AppParCurves_Constraint.hxx>
-#include <AppCont_Function.hxx>
+#include <TColStd_SequenceOfReal.hxx>
 class AppParCurves_MultiCurve;
 
-
-
-class Approx_FitAndDivide2d 
+class Approx_FitAndDivide2d
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
-  
   //! The MultiLine <Line> will be approximated until tolerances
   //! will be reached.
   //! The approximation will be done from degreemin to degreemax
   //! with a cutting if the corresponding boolean is True.
-  Standard_EXPORT Approx_FitAndDivide2d(const AppCont_Function& Line, const Standard_Integer degreemin = 3, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-5, const Standard_Real Tolerance2d = 1.0e-5, const Standard_Boolean cutting = Standard_False, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
-  
+  Standard_EXPORT Approx_FitAndDivide2d(
+    const AppCont_Function&       Line,
+    const Standard_Integer        degreemin   = 3,
+    const Standard_Integer        degreemax   = 8,
+    const Standard_Real           Tolerance3d = 1.0e-5,
+    const Standard_Real           Tolerance2d = 1.0e-5,
+    const Standard_Boolean        cutting     = Standard_False,
+    const AppParCurves_Constraint FirstC      = AppParCurves_TangencyPoint,
+    const AppParCurves_Constraint LastC       = AppParCurves_TangencyPoint);
+
   //! Initializes the fields of the algorithm.
-  Standard_EXPORT Approx_FitAndDivide2d(const Standard_Integer degreemin = 3, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-05, const Standard_Real Tolerance2d = 1.0e-05, const Standard_Boolean cutting = Standard_False, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
-  
+  Standard_EXPORT Approx_FitAndDivide2d(
+    const Standard_Integer        degreemin   = 3,
+    const Standard_Integer        degreemax   = 8,
+    const Standard_Real           Tolerance3d = 1.0e-05,
+    const Standard_Real           Tolerance2d = 1.0e-05,
+    const Standard_Boolean        cutting     = Standard_False,
+    const AppParCurves_Constraint FirstC      = AppParCurves_TangencyPoint,
+    const AppParCurves_Constraint LastC       = AppParCurves_TangencyPoint);
+
   //! runs the algorithm after having initialized the fields.
-  Standard_EXPORT void Perform (const AppCont_Function& Line);
-  
+  Standard_EXPORT void Perform(const AppCont_Function& Line);
+
   //! changes the degrees of the approximation.
-  Standard_EXPORT void SetDegrees (const Standard_Integer degreemin, const Standard_Integer degreemax);
-  
+  Standard_EXPORT void SetDegrees(const Standard_Integer degreemin,
+                                  const Standard_Integer degreemax);
+
   //! Changes the tolerances of the approximation.
-  Standard_EXPORT void SetTolerances (const Standard_Real Tolerance3d, const Standard_Real Tolerance2d);
-  
+  Standard_EXPORT void SetTolerances(const Standard_Real Tolerance3d,
+                                     const Standard_Real Tolerance2d);
+
   //! Changes the constraints of the approximation.
-  Standard_EXPORT void SetConstraints (const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC);
+  Standard_EXPORT void SetConstraints(const AppParCurves_Constraint FirstC,
+                                      const AppParCurves_Constraint LastC);
 
   //! Changes the max number of segments, which is allowed for cutting.
-  Standard_EXPORT void SetMaxSegments (const Standard_Integer theMaxSegments);
-  
+  Standard_EXPORT void SetMaxSegments(const Standard_Integer theMaxSegments);
+
   //! Set inverse order of degree selection:
   //! if theInvOrdr = true, current degree is chosen by inverse order -
   //! from maxdegree to mindegree.
@@ -72,70 +86,60 @@ public:
   //! and algorithm is forced to stop.
   //! By default hang checking is used.
   Standard_EXPORT void SetHangChecking(const Standard_Boolean theHangChecking);
-  
+
   //! returns False if at a moment of the approximation,
   //! the status NoApproximation has been sent by the user
   //! when more points were needed.
   Standard_EXPORT Standard_Boolean IsAllApproximated() const;
-  
+
   //! returns False if the status NoPointsAdded has been sent.
   Standard_EXPORT Standard_Boolean IsToleranceReached() const;
-  
+
   //! returns the tolerances 2d and 3d of the <Index> MultiCurve.
-  Standard_EXPORT void Error (const Standard_Integer Index, Standard_Real& tol3d, Standard_Real& tol2d) const;
-  
+  Standard_EXPORT void Error(const Standard_Integer Index,
+                             Standard_Real&         tol3d,
+                             Standard_Real&         tol2d) const;
+
   //! Returns the number of MultiCurve doing the approximation
   //! of the MultiLine.
   Standard_EXPORT Standard_Integer NbMultiCurves() const;
-  
-  //! returns the approximation MultiCurve of range <Index>.
-  Standard_EXPORT AppParCurves_MultiCurve Value (const Standard_Integer Index = 1) const;
-  
-  Standard_EXPORT void Parameters (const Standard_Integer Index, Standard_Real& firstp, Standard_Real& lastp) const;
-
 
+  //! returns the approximation MultiCurve of range <Index>.
+  Standard_EXPORT AppParCurves_MultiCurve Value(const Standard_Integer Index = 1) const;
 
+  Standard_EXPORT void Parameters(const Standard_Integer Index,
+                                  Standard_Real&         firstp,
+                                  Standard_Real&         lastp) const;
 
 protected:
-
-
-
-
-
 private:
-
-  
   //! is internally used by the algorithms.
-  Standard_EXPORT Standard_Boolean Compute (const AppCont_Function& Line, const Standard_Real Ufirst, const Standard_Real Ulast, Standard_Real& TheTol3d, Standard_Real& TheTol2d);
-
+  Standard_EXPORT Standard_Boolean Compute(const AppCont_Function& Line,
+                                           const Standard_Real     Ufirst,
+                                           const Standard_Real     Ulast,
+                                           Standard_Real&          TheTol3d,
+                                           Standard_Real&          TheTol2d);
 
   AppParCurves_SequenceOfMultiCurve myMultiCurves;
-  TColStd_SequenceOfReal myfirstparam;
-  TColStd_SequenceOfReal mylastparam;
-  AppParCurves_MultiCurve TheMultiCurve;
-  Standard_Boolean alldone;
-  Standard_Boolean tolreached;
-  TColStd_SequenceOfReal Tolers3d;
-  TColStd_SequenceOfReal Tolers2d;
-  Standard_Integer mydegremin;
-  Standard_Integer mydegremax;
-  Standard_Real mytol3d;
-  Standard_Real mytol2d;
-  Standard_Real currenttol3d;
-  Standard_Real currenttol2d;
-  Standard_Boolean mycut;
-  AppParCurves_Constraint myfirstC;
-  AppParCurves_Constraint mylastC;
-  Standard_Integer myMaxSegments;
-  Standard_Boolean myInvOrder;
-  Standard_Boolean myHangChecking;
-
+  TColStd_SequenceOfReal            myfirstparam;
+  TColStd_SequenceOfReal            mylastparam;
+  AppParCurves_MultiCurve           TheMultiCurve;
+  Standard_Boolean                  alldone;
+  Standard_Boolean                  tolreached;
+  TColStd_SequenceOfReal            Tolers3d;
+  TColStd_SequenceOfReal            Tolers2d;
+  Standard_Integer                  mydegremin;
+  Standard_Integer                  mydegremax;
+  Standard_Real                     mytol3d;
+  Standard_Real                     mytol2d;
+  Standard_Real                     currenttol3d;
+  Standard_Real                     currenttol2d;
+  Standard_Boolean                  mycut;
+  AppParCurves_Constraint           myfirstC;
+  AppParCurves_Constraint           mylastC;
+  Standard_Integer                  myMaxSegments;
+  Standard_Boolean                  myInvOrder;
+  Standard_Boolean                  myHangChecking;
 };
 
-
-
-
-
-
-
 #endif // _Approx_FitAndDivide2d_HeaderFile
index bb6cd9bef66cd76a74d6186a7ea365f4cc6918fd..85d3a34fc0d283f8e8a9437f367dd504d9bb222f 100644 (file)
 #include <Approx_FitAndDivide2d.hxx>
 
 #include <AppParCurves_MultiCurve.hxx>
 
 #define MultiLine AppCont_Function
 #define MultiLine_hxx <AppCont_Function.hxx>
 #define Approx_ComputeCLine Approx_FitAndDivide2d
 #define Approx_ComputeCLine_hxx <Approx_FitAndDivide2d.hxx>
 #include "../Approx/Approx_ComputeCLine.gxx"
-
index a22b577dca615bb441e02a5992d89c9b2980fa63..786dc26240c488d46569f9d905980e72dca126b0 100644 (file)
 #include <Approx_FitAndDivide.hxx>
 
 #include <AppParCurves_MultiCurve.hxx>
 
 #define MultiLine AppCont_Function
 #define MultiLine_hxx <AppCont_Function.hxx>
 #define Approx_ComputeCLine Approx_FitAndDivide
 #define Approx_ComputeCLine_hxx <Approx_FitAndDivide.hxx>
 #include "../Approx/Approx_ComputeCLine.gxx"
-
index c4f37f6c0f96cb38cc628b8d7434cd58cfbd234f..6f557ea622ae404e47430b02984390e17f4883b3 100644 (file)
@@ -23,5 +23,4 @@
 
 DEFINE_HARRAY1(Approx_HArray1OfAdHSurface, Approx_Array1OfAdHSurface)
 
-
 #endif
index 1938e310c28ad25084d254a4c54b4fdb82f24749..b058153157a1f7c16140378438b898170356dfb0 100644 (file)
@@ -22,5 +22,4 @@
 
 DEFINE_HARRAY1(Approx_HArray1OfGTrsf2d, Approx_Array1OfGTrsf2d)
 
-
 #endif
index f929166f90c04d6d559bdbb832a5cc448c44ec44..6ffc2a607ddfda87241ccf53ae1140489f501422 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-
 #include <AppParCurves_MultiPoint.hxx>
 #include <Approx_MCurvesToBSpCurve.hxx>
 #include <BSplCLib.hxx>
 #include <Convert_CompBezierCurves2dToBSplineCurve2d.hxx>
 #include <Convert_CompBezierCurvesToBSplineCurve.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <TColgp_Array1OfPnt2d.hxx>
 #include <TColStd_Array1OfInteger.hxx>
 #include <TColStd_Array1OfReal.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
 
 #ifdef OCCT_DEBUG
-static void DEBUG(const AppParCurves_MultiCurve& MC) {
-  Standard_Integer i, j;
-  Standard_Integer nbcu = MC.NbCurves();
-  Standard_Integer nbpoles = MC.NbPoles();
-  TColgp_Array1OfPnt Poles(1, nbpoles);
+static void DEBUG(const AppParCurves_MultiCurve& MC)
+{
+  Standard_Integer     i, j;
+  Standard_Integer     nbcu    = MC.NbCurves();
+  Standard_Integer     nbpoles = MC.NbPoles();
+  TColgp_Array1OfPnt   Poles(1, nbpoles);
   TColgp_Array1OfPnt2d Poles2d(1, nbpoles);
 
-  for (i = 1; i <= nbcu; i++) {
+  for (i = 1; i <= nbcu; i++)
+  {
     std::cout << " Curve No. " << i << std::endl;
-    if (MC.Dimension(i) == 3) {
+    if (MC.Dimension(i) == 3)
+    {
       MC.Curve(i, Poles);
-      for (j = 1; j <= nbpoles; j++) {
-       std::cout<< " Pole = " << Poles(j).X() <<" "<<Poles(j).Y()<<" "<<Poles(j).Z()<< std::endl;
+      for (j = 1; j <= nbpoles; j++)
+      {
+        std::cout << " Pole = " << Poles(j).X() << " " << Poles(j).Y() << " " << Poles(j).Z()
+                  << std::endl;
       }
     }
-    else {
+    else
+    {
       MC.Curve(i, Poles2d);
-      for (j = 1; j <= nbpoles; j++) {
-       std::cout<< " Pole = " << Poles2d(j).X() <<" "<<Poles2d(j).Y()<< std::endl;
+      for (j = 1; j <= nbpoles; j++)
+      {
+        std::cout << " Pole = " << Poles2d(j).X() << " " << Poles2d(j).Y() << std::endl;
       }
     }
   }
-
 }
 #endif
 
-
-
 Approx_MCurvesToBSpCurve::Approx_MCurvesToBSpCurve()
 {
   myDone = Standard_False;
@@ -68,181 +71,210 @@ void Approx_MCurvesToBSpCurve::Append(const AppParCurves_MultiCurve& MC)
   myCurves.Append(MC);
 }
 
-
 void Approx_MCurvesToBSpCurve::Perform()
 {
   Perform(myCurves);
 }
 
-void Approx_MCurvesToBSpCurve::Perform
-  (const AppParCurves_SequenceOfMultiCurve& TheSeq)
+void Approx_MCurvesToBSpCurve::Perform(const AppParCurves_SequenceOfMultiCurve& TheSeq)
 {
 
-  Standard_Integer i, j, deg=0;
-  Standard_Integer nbcu = TheSeq.Length();
+  Standard_Integer        i, j, deg = 0;
+  Standard_Integer        nbcu = TheSeq.Length();
   AppParCurves_MultiCurve CU;
-  Standard_Integer nbpolesspl=0, nbknots=0;
+  Standard_Integer        nbpolesspl = 0, nbknots = 0;
 #ifdef OCCT_DEBUG
   Standard_Boolean debug = Standard_False;
-#endif  
+#endif
 
-  if (nbcu == 1) {
-    CU = TheSeq.Value(1);
+  if (nbcu == 1)
+  {
+    CU  = TheSeq.Value(1);
     deg = CU.Degree();
-    TColStd_Array1OfReal Knots(1, 2);
+    TColStd_Array1OfReal    Knots(1, 2);
     TColStd_Array1OfInteger Mults(1, 2);
     Knots(1) = 0.0;
     Knots(2) = 1.0;
-    Mults(1) = Mults(2) = deg+1;
-    mySpline = AppParCurves_MultiBSpCurve (CU, Knots, Mults);
+    Mults(1) = Mults(2) = deg + 1;
+    mySpline            = AppParCurves_MultiBSpCurve(CU, Knots, Mults);
   }
-  else {
+  else
+  {
 
-    AppParCurves_MultiPoint P = TheSeq.Value(nbcu).Value(1);
-    Standard_Integer nb3d = P.NbPoints();
-    Standard_Integer nb2d = P.NbPoints2d();
+    AppParCurves_MultiPoint P    = TheSeq.Value(nbcu).Value(1);
+    Standard_Integer        nb3d = P.NbPoints();
+    Standard_Integer        nb2d = P.NbPoints2d();
 
-    Convert_CompBezierCurvesToBSplineCurve conv;
+    Convert_CompBezierCurvesToBSplineCurve     conv;
     Convert_CompBezierCurves2dToBSplineCurve2d conv2d;
 
-    if (nb3d != 0) {
-      for (i = 1; i <= nbcu; i++) {
-       CU = TheSeq.Value(i);
-       TColgp_Array1OfPnt ThePoles3d(1, CU.NbPoles());
-       CU.Curve(1, ThePoles3d);
-       conv.AddCurve(ThePoles3d);
+    if (nb3d != 0)
+    {
+      for (i = 1; i <= nbcu; i++)
+      {
+        CU = TheSeq.Value(i);
+        TColgp_Array1OfPnt ThePoles3d(1, CU.NbPoles());
+        CU.Curve(1, ThePoles3d);
+        conv.AddCurve(ThePoles3d);
       }
       conv.Perform();
     }
 
-    
-    else if (nb2d != 0) {
-      for (i = 1; i <= nbcu; i++) {
-       CU = TheSeq.Value(i);
-       TColgp_Array1OfPnt2d ThePoles2d(1, CU.NbPoles());
-       CU.Curve(1+nb3d, ThePoles2d);
-       conv2d.AddCurve(ThePoles2d);
+    else if (nb2d != 0)
+    {
+      for (i = 1; i <= nbcu; i++)
+      {
+        CU = TheSeq.Value(i);
+        TColgp_Array1OfPnt2d ThePoles2d(1, CU.NbPoles());
+        CU.Curve(1 + nb3d, ThePoles2d);
+        conv2d.AddCurve(ThePoles2d);
       }
       conv2d.Perform();
     }
-    
-    
+
     // Recuperation:
-    if (nb3d != 0) {
+    if (nb3d != 0)
+    {
       nbpolesspl = conv.NbPoles();
-      nbknots = conv.NbKnots();
+      nbknots    = conv.NbKnots();
     }
-    else if (nb2d != 0) {
+    else if (nb2d != 0)
+    {
       nbpolesspl = conv2d.NbPoles();
-      nbknots = conv2d.NbKnots();
-    }    
-    
+      nbknots    = conv2d.NbKnots();
+    }
+
     AppParCurves_Array1OfMultiPoint tabMU(1, nbpolesspl);
-    TColgp_Array1OfPnt PolesSpl(1, nbpolesspl);
-    TColgp_Array1OfPnt2d PolesSpl2d(1, nbpolesspl);
-    TColStd_Array1OfInteger TheMults(1, nbknots);
-    TColStd_Array1OfReal TheKnots(1, nbknots);
-    
-    if (nb3d != 0) {
+    TColgp_Array1OfPnt              PolesSpl(1, nbpolesspl);
+    TColgp_Array1OfPnt2d            PolesSpl2d(1, nbpolesspl);
+    TColStd_Array1OfInteger         TheMults(1, nbknots);
+    TColStd_Array1OfReal            TheKnots(1, nbknots);
+
+    if (nb3d != 0)
+    {
       conv.KnotsAndMults(TheKnots, TheMults);
       conv.Poles(PolesSpl);
       deg = conv.Degree();
     }
-    else if (nb2d != 0) {
+    else if (nb2d != 0)
+    {
       conv2d.KnotsAndMults(TheKnots, TheMults);
       conv2d.Poles(PolesSpl2d);
       deg = conv2d.Degree();
     }
 
-
-    for (j = 1; j <= nbpolesspl; j++) {
+    for (j = 1; j <= nbpolesspl; j++)
+    {
       AppParCurves_MultiPoint MP(nb3d, nb2d);
-      if (nb3d!=0) {
-       MP.SetPoint(1, PolesSpl(j));
+      if (nb3d != 0)
+      {
+        MP.SetPoint(1, PolesSpl(j));
       }
-      else if (nb2d!=0) {
-       MP.SetPoint2d(1+nb3d, PolesSpl2d(j));
+      else if (nb2d != 0)
+      {
+        MP.SetPoint2d(1 + nb3d, PolesSpl2d(j));
       }
       tabMU.SetValue(j, MP);
     }
 
-    Standard_Integer kpol = 1, kpoles3d=1, kpoles2d=1;
+    Standard_Integer kpol = 1, kpoles3d = 1, kpoles2d = 1;
     Standard_Integer mydegre, k;
     Standard_Integer first, last, Inc, thefirst;
-    if (nb3d != 0) thefirst = 1;
-    else thefirst = 2;
-
-    for (i = 1; i <= nbcu; i++) {
-      CU = TheSeq.Value(i);
+    if (nb3d != 0)
+      thefirst = 1;
+    else
+      thefirst = 2;
+
+    for (i = 1; i <= nbcu; i++)
+    {
+      CU      = TheSeq.Value(i);
       mydegre = CU.Degree();
-      if (TheMults(i+1) == deg) last = deg+1;      // Continuite C0
-      else last = deg;                             // Continuite C1
-      if (i==nbcu) {last = deg+1;}
+      if (TheMults(i + 1) == deg)
+        last = deg + 1; // Continuite C0
+      else
+        last = deg; // Continuite C1
+      if (i == nbcu)
+      {
+        last = deg + 1;
+      }
       first = 1;
-      if (i==1) first = 1;
-      else if ((TheMults(i)== deg-1) || (TheMults(i)==deg)) first = 2;
-
-      for (j = 2; j <= nb3d; j++) {
-       kpol = kpoles3d;
-       TColgp_Array1OfPnt ThePoles(1, CU.NbPoles());
-       CU.Curve(j, ThePoles);
-
-       Inc = deg-mydegre;
-       TColgp_Array1OfPnt Points(1, deg+1);
-       if (Inc > 0) {
-         BSplCLib::IncreaseDegree(deg, ThePoles, BSplCLib::NoWeights(),
-                                  Points, BSplCLib::NoWeights());
-       }
-       else {
-         Points = ThePoles;
-       }
-
-       for (k = first; k <= last; k++) {
-         tabMU.ChangeValue(kpol++).SetPoint(j, Points(k));
-       }
+      if (i == 1)
+        first = 1;
+      else if ((TheMults(i) == deg - 1) || (TheMults(i) == deg))
+        first = 2;
+
+      for (j = 2; j <= nb3d; j++)
+      {
+        kpol = kpoles3d;
+        TColgp_Array1OfPnt ThePoles(1, CU.NbPoles());
+        CU.Curve(j, ThePoles);
+
+        Inc = deg - mydegre;
+        TColgp_Array1OfPnt Points(1, deg + 1);
+        if (Inc > 0)
+        {
+          BSplCLib::IncreaseDegree(deg,
+                                   ThePoles,
+                                   BSplCLib::NoWeights(),
+                                   Points,
+                                   BSplCLib::NoWeights());
+        }
+        else
+        {
+          Points = ThePoles;
+        }
+
+        for (k = first; k <= last; k++)
+        {
+          tabMU.ChangeValue(kpol++).SetPoint(j, Points(k));
+        }
       }
       kpoles3d = kpol;
 
-      for (j = thefirst; j <= nb2d; j++) {
-       kpol = kpoles2d;
-       TColgp_Array1OfPnt2d ThePoles2d(1, CU.NbPoles());
-       CU.Curve(j+nb3d, ThePoles2d);
-       
-       Inc = deg-mydegre;
-       TColgp_Array1OfPnt2d Points2d(1, deg+1);
-       if (Inc > 0) {
-         BSplCLib::IncreaseDegree(deg, ThePoles2d, BSplCLib::NoWeights(),
-                                  Points2d, BSplCLib::NoWeights());
-       }
-       else {
-         Points2d = ThePoles2d;
-       }
-       for (k = first; k <= last; k++) {
-         tabMU.ChangeValue(kpol++).SetPoint2d(j+nb3d, Points2d(k));
-       }
+      for (j = thefirst; j <= nb2d; j++)
+      {
+        kpol = kpoles2d;
+        TColgp_Array1OfPnt2d ThePoles2d(1, CU.NbPoles());
+        CU.Curve(j + nb3d, ThePoles2d);
+
+        Inc = deg - mydegre;
+        TColgp_Array1OfPnt2d Points2d(1, deg + 1);
+        if (Inc > 0)
+        {
+          BSplCLib::IncreaseDegree(deg,
+                                   ThePoles2d,
+                                   BSplCLib::NoWeights(),
+                                   Points2d,
+                                   BSplCLib::NoWeights());
+        }
+        else
+        {
+          Points2d = ThePoles2d;
+        }
+        for (k = first; k <= last; k++)
+        {
+          tabMU.ChangeValue(kpol++).SetPoint2d(j + nb3d, Points2d(k));
+        }
       }
       kpoles2d = kpol;
     }
-    
+
     mySpline = AppParCurves_MultiBSpCurve(tabMU, TheKnots, TheMults);
   }
 #ifdef OCCT_DEBUG
-if(debug) DEBUG(mySpline);
+  if (debug)
+    DEBUG(mySpline);
 #endif
 
   myDone = Standard_True;
 }
 
-
 const AppParCurves_MultiBSpCurve& Approx_MCurvesToBSpCurve::Value() const
 {
   return mySpline;
 }
 
-
 const AppParCurves_MultiBSpCurve& Approx_MCurvesToBSpCurve::ChangeValue()
 {
   return mySpline;
 }
-
-
index 294e4bf607f2da2131c04a80d28851223c774714..9e6ec1989107eaf14a290d7899aa553a0453fca6 100644 (file)
 #include <AppParCurves_SequenceOfMultiCurve.hxx>
 class AppParCurves_MultiCurve;
 
-
-
-class Approx_MCurvesToBSpCurve 
+class Approx_MCurvesToBSpCurve
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
-  
   Standard_EXPORT Approx_MCurvesToBSpCurve();
-  
+
   Standard_EXPORT void Reset();
-  
-  Standard_EXPORT void Append (const AppParCurves_MultiCurve& MC);
-  
+
+  Standard_EXPORT void Append(const AppParCurves_MultiCurve& MC);
+
   Standard_EXPORT void Perform();
-  
-  Standard_EXPORT void Perform (const AppParCurves_SequenceOfMultiCurve& TheSeq);
-  
+
+  Standard_EXPORT void Perform(const AppParCurves_SequenceOfMultiCurve& TheSeq);
+
   //! return the composite MultiCurves as a MultiBSpCurve.
   Standard_EXPORT const AppParCurves_MultiBSpCurve& Value() const;
-  
+
   //! return the composite MultiCurves as a MultiBSpCurve.
   Standard_EXPORT const AppParCurves_MultiBSpCurve& ChangeValue();
 
-
-
-
 protected:
-
-
-
-
-
 private:
-
-
-
-  AppParCurves_MultiBSpCurve mySpline;
-  Standard_Boolean myDone;
+  AppParCurves_MultiBSpCurve        mySpline;
+  Standard_Boolean                  myDone;
   AppParCurves_SequenceOfMultiCurve myCurves;
-
-
 };
 
-
-
-
-
-
-
 #endif // _Approx_MCurvesToBSpCurve_HeaderFile
index 0a19d2864933758fe7ec8302895f57b17cc0085f..2d98081fa2392ec14cef475f4f08f700965876ed 100644 (file)
 #ifndef _Approx_ParametrizationType_HeaderFile
 #define _Approx_ParametrizationType_HeaderFile
 
-
 enum Approx_ParametrizationType
 {
-  Approx_ChordLength, //!< parameters of points are proportionate to distances between them
-  Approx_Centripetal, //!< parameters of points are proportionate to square roots of distances between them
+  Approx_ChordLength,  //!< parameters of points are proportionate to distances between them
+  Approx_Centripetal,  //!< parameters of points are proportionate to square roots of distances
+                       //!< between them
   Approx_IsoParametric //!< parameters of points are distributed uniformly
 };
 
index 9bb7b22e24fbb21ceadd8856e2ec132995bb07fb..cd2dae333991bdf8a34e2f72091883b65afccf62 100644 (file)
 #include <Approx_SameParameter.hxx>
 
 #include <Adaptor2d_Curve2d.hxx>
-#include <Adaptor3d_CurveOnSurface.hxx>
 #include <Adaptor3d_Curve.hxx>
+#include <Adaptor3d_CurveOnSurface.hxx>
 #include <Adaptor3d_Surface.hxx>
 #include <Extrema_ExtPC.hxx>
 #include <Extrema_LocateExtPC.hxx>
+#include <Geom2dAdaptor.hxx>
+#include <Geom2dAdaptor_Curve.hxx>
 #include <Geom2d_BSplineCurve.hxx>
 #include <Geom2d_Curve.hxx>
-#include <Geom2dAdaptor_Curve.hxx>
 #include <GeomAdaptor_Curve.hxx>
 #include <GeomAdaptor_Surface.hxx>
 #include <GeomLib_MakeCurvefromApprox.hxx>
 #include <Precision.hxx>
 #include <TColStd_Array1OfReal.hxx>
-#include <Geom2dAdaptor.hxx>
 
-//=======================================================================
-//class    : Approx_SameParameter_Evaluator
-//purpose  : Used in same parameterization curve approximation.
-//=======================================================================
+//=================================================================================================
+
 class Approx_SameParameter_Evaluator : public AdvApprox_EvaluatorFunction
 {
 public:
-  Approx_SameParameter_Evaluator (const TColStd_Array1OfReal& theFlatKnots,
-                                  const TColStd_Array1OfReal& thePoles,
-                                  const Handle(Adaptor2d_Curve2d)& theHCurve2d)
-    : FlatKnots(theFlatKnots),
-      Poles(thePoles),
-      HCurve2d(theHCurve2d) {}
-
-  virtual void Evaluate (Standard_Integer *Dimension,
-                         Standard_Real     StartEnd[2],
-                         Standard_Real    *Parameter,
-                         Standard_Integer *DerivativeRequest,
-                         Standard_Real    *Result, // [Dimension]
-                         Standard_Integer *ErrorCode);
+  Approx_SameParameter_Evaluator(const TColStd_Array1OfReal&      theFlatKnots,
+                                 const TColStd_Array1OfReal&      thePoles,
+                                 const Handle(Adaptor2d_Curve2d)& theHCurve2d)
+      : FlatKnots(theFlatKnots),
+        Poles(thePoles),
+        HCurve2d(theHCurve2d)
+  {
+  }
+
+  virtual void Evaluate(Standard_Integer* Dimension,
+                        Standard_Real     StartEnd[2],
+                        Standard_Real*    Parameter,
+                        Standard_Integer* DerivativeRequest,
+                        Standard_Real*    Result, // [Dimension]
+                        Standard_Integer* ErrorCode);
 
 private:
   const TColStd_Array1OfReal& FlatKnots;
   const TColStd_Array1OfReal& Poles;
-  Handle(Adaptor2d_Curve2d) HCurve2d;
+  Handle(Adaptor2d_Curve2d)   HCurve2d;
 };
 
-//=======================================================================
-//function : Evaluate
-//purpose  : 
-//=======================================================================
-void Approx_SameParameter_Evaluator::Evaluate (Standard_Integer *,/*Dimension*/
-                                               Standard_Real    /*StartEnd*/[2],
-                                               Standard_Real    *Parameter,
-                                               Standard_Integer *DerivativeRequest,
-                                               Standard_Real    *Result,
-                                               Standard_Integer *ReturnCode) 
+//=================================================================================================
+
+void Approx_SameParameter_Evaluator::Evaluate(Standard_Integer*, /*Dimension*/
+                                              Standard_Real /*StartEnd*/[2],
+                                              Standard_Real*    Parameter,
+                                              Standard_Integer* DerivativeRequest,
+                                              Standard_Real*    Result,
+                                              Standard_Integer* ReturnCode)
 {
-  const Standard_Integer aDegree = 3;
-  Standard_Integer extrap_mode[2] = {aDegree, aDegree};
-  Standard_Real eval_result[2];
-  Standard_Real *PolesArray = (Standard_Real *) &Poles(Poles.Lower()) ;
+  const Standard_Integer aDegree        = 3;
+  Standard_Integer       extrap_mode[2] = {aDegree, aDegree};
+  Standard_Real          eval_result[2];
+  Standard_Real*         PolesArray = (Standard_Real*)&Poles(Poles.Lower());
 
   // Evaluate the 1D B-Spline that represents the change in parameterization.
   BSplCLib::Eval(*Parameter,
@@ -91,48 +89,45 @@ void Approx_SameParameter_Evaluator::Evaluate (Standard_Integer *,/*Dimension*/
   if (*DerivativeRequest == 0)
   {
     HCurve2d->D0(eval_result[0], aPoint);
-    aPoint.Coord(Result[0],Result[1]);
+    aPoint.Coord(Result[0], Result[1]);
   }
   else if (*DerivativeRequest == 1)
   {
     HCurve2d->D1(eval_result[0], aPoint, aVector);
     aVector.Multiply(eval_result[1]);
-    aVector.Coord(Result[0],Result[1]);
+    aVector.Coord(Result[0], Result[1]);
   }
 
   ReturnCode[0] = 0;
 }
 
-//=======================================================================
-//function : ProjectPointOnCurve
-//purpose  : 
-//=======================================================================
-static void ProjectPointOnCurve(const Standard_Real      InitValue,
-                                const gp_Pnt&            APoint,
-                                const Standard_Real      Tolerance,
-                                const Standard_Integer   NumIteration,
-                                const Adaptor3d_Curve&   Curve,
-                                Standard_Boolean&        Status,
-                                Standard_Real&           Result)
+//=================================================================================================
+
+static void ProjectPointOnCurve(const Standard_Real    InitValue,
+                                const gp_Pnt&          APoint,
+                                const Standard_Real    Tolerance,
+                                const Standard_Integer NumIteration,
+                                const Adaptor3d_Curve& Curve,
+                                Standard_Boolean&      Status,
+                                Standard_Real&         Result)
 {
   Standard_Integer num_iter = 0, not_done = 1;
 
-  gp_Pnt a_point;
-  gp_Vec vector, d1, d2;
-  Standard_Real func, func_derivative,
-                param = InitValue;
+  gp_Pnt        a_point;
+  gp_Vec        vector, d1, d2;
+  Standard_Real func, func_derivative, param = InitValue;
   Status = Standard_False;
   do
   {
     num_iter++;
     Curve.D2(param, a_point, d1, d2);
-    vector = gp_Vec(a_point,APoint);
+    vector = gp_Vec(a_point, APoint);
 
     func = vector.Dot(d1);
-    if ( Abs(func) < Tolerance * d1.Magnitude())
+    if (Abs(func) < Tolerance * d1.Magnitude())
     {
       not_done = 0;
-      Status = Standard_True;
+      Status   = Standard_True;
     }
     else
     {
@@ -140,36 +135,34 @@ static void ProjectPointOnCurve(const Standard_Real      InitValue,
 
       // Avoid division by zero.
       const Standard_Real Toler = 1.0e-12;
-      if( Abs(func_derivative) > Toler )
+      if (Abs(func_derivative) > Toler)
         param -= func / func_derivative;
 
-      param = Max(param,Curve.FirstParameter());
-      param = Min(param,Curve.LastParameter());
+      param = Max(param, Curve.FirstParameter());
+      param = Min(param, Curve.LastParameter());
     }
   } while (not_done && num_iter <= NumIteration);
 
   Result = param;
 }
 
-//=======================================================================
-//function : ComputeTolReached
-//purpose  :
-//=======================================================================
-static Standard_Real ComputeTolReached(const Handle(Adaptor3d_Curve)& c3d,
+//=================================================================================================
+
+static Standard_Real ComputeTolReached(const Handle(Adaptor3d_Curve)&  c3d,
                                        const Adaptor3d_CurveOnSurface& cons,
-                                       const Standard_Integer        nbp)
+                                       const Standard_Integer          nbp)
 {
-  Standard_Real d2 = 0.0; // Square max discrete deviation.
+  Standard_Real       d2    = 0.0; // Square max discrete deviation.
   const Standard_Real first = c3d->FirstParameter();
   const Standard_Real last  = c3d->LastParameter();
-  for(Standard_Integer i = 0; i <= nbp; i++)
+  for (Standard_Integer i = 0; i <= nbp; i++)
   {
     Standard_Real t = IntToReal(i) / IntToReal(nbp);
     Standard_Real u = first * (1.0 - t) + last * t;
-    gp_Pnt Pc3d, Pcons;
+    gp_Pnt        Pc3d, Pcons;
     try
     {
-      Pc3d = c3d->Value(u);
+      Pc3d  = c3d->Value(u);
       Pcons = cons.Value(u);
     }
     catch (Standard_Failure const&)
@@ -177,45 +170,42 @@ static Standard_Real ComputeTolReached(const Handle(Adaptor3d_Curve)& c3d,
       d2 = Precision::Infinite();
       break;
     }
-    if (Precision::IsInfinite(Pcons.X()) ||
-        Precision::IsInfinite(Pcons.Y()) ||
-        Precision::IsInfinite(Pcons.Z()))
+    if (Precision::IsInfinite(Pcons.X()) || Precision::IsInfinite(Pcons.Y())
+        || Precision::IsInfinite(Pcons.Z()))
     {
-        d2=Precision::Infinite();
-        break;
+      d2 = Precision::Infinite();
+      break;
     }
     d2 = Max(d2, Pc3d.SquareDistance(Pcons));
   }
 
-  const Standard_Real aMult = 1. + 0.05; // 
-  Standard_Real aDeviation = aMult * sqrt(d2);
+  const Standard_Real aMult      = 1. + 0.05; //
+  Standard_Real       aDeviation = aMult * sqrt(d2);
   aDeviation = Max(aDeviation, Precision::Confusion()); // Tolerance in modeling space.
   return aDeviation;
 }
 
-//=======================================================================
-//function : Check
-//purpose  : Check current interpolation for validity.
-//=======================================================================
-static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
-                              const TColStd_Array1OfReal& Poles,
-                              const Standard_Integer nbp,
-                              const Standard_Real *pc3d,
-                              const Handle(Adaptor3d_Curve)& c3d,
+//=================================================================================================
+
+static Standard_Boolean Check(const TColStd_Array1OfReal&     FlatKnots,
+                              const TColStd_Array1OfReal&     Poles,
+                              const Standard_Integer          nbp,
+                              const Standard_Real*            pc3d,
+                              const Handle(Adaptor3d_Curve)&  c3d,
                               const Adaptor3d_CurveOnSurface& cons,
-                              Standard_Real& tol,
-                              const Standard_Real oldtol)
+                              Standard_Real&                  tol,
+                              const Standard_Real             oldtol)
 {
-  const Standard_Integer aDegree = 3;
-  Standard_Integer extrap_mode[2] = {aDegree, aDegree};
+  const Standard_Integer aDegree        = 3;
+  Standard_Integer       extrap_mode[2] = {aDegree, aDegree};
 
   // Correction of the interval of valid values. This condition has no sensible
   // grounds. But it is better then the old one (which is commented out) because
   // it fixes the bug OCC5898. To develop more or less sensible criterion it is
   // necessary to deeply investigate this problem which is not possible in frames
   // of debugging.
-  Standard_Real aParamFirst = 3.0 * pc3d[0]   - 2.0 * pc3d[nbp - 1];
-  Standard_Real aParamLast = 3.0 * pc3d[nbp - 1] - 2.0 * pc3d[0];
+  Standard_Real aParamFirst = 3.0 * pc3d[0] - 2.0 * pc3d[nbp - 1];
+  Standard_Real aParamLast  = 3.0 * pc3d[nbp - 1] - 2.0 * pc3d[0];
 
   Standard_Real FirstPar = cons.FirstParameter();
   Standard_Real LastPar  = cons.LastParameter();
@@ -224,37 +214,44 @@ static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
   if (aParamLast > LastPar)
     aParamLast = LastPar;
 
-  Standard_Real d2 = 0.0; // Maximum square deviation on the samples.
-  const Standard_Real d = tol;
-  const Standard_Integer nn = 2 * nbp;
-  const Standard_Real unsurnn = 1.0 / nn;
-  Standard_Real tprev = aParamFirst;
-  for(Standard_Integer i = 0; i <= nn; i++)
+  Standard_Real          d2      = 0.0; // Maximum square deviation on the samples.
+  const Standard_Real    d       = tol;
+  const Standard_Integer nn      = 2 * nbp;
+  const Standard_Real    unsurnn = 1.0 / nn;
+  Standard_Real          tprev   = aParamFirst;
+  for (Standard_Integer i = 0; i <= nn; i++)
   {
     // Compute corresponding parameter on 2d curve.
     // It should be inside of 3d curve parameter space.
-    Standard_Real t = unsurnn*i;
-    Standard_Real tc3d = pc3d[0]*(1.0 - t) + pc3d[nbp - 1] * t; // weight function.
-    gp_Pnt Pc3d = c3d->Value(tc3d);
+    Standard_Real t    = unsurnn * i;
+    Standard_Real tc3d = pc3d[0] * (1.0 - t) + pc3d[nbp - 1] * t; // weight function.
+    gp_Pnt        Pc3d = c3d->Value(tc3d);
     Standard_Real tcons;
-    BSplCLib::Eval(tc3d, Standard_False, 0, extrap_mode[0],
-                   aDegree, FlatKnots, 1, (Standard_Real&)Poles(1), tcons);
-
-    if (tcons < tprev ||
-        tcons > aParamLast)
+    BSplCLib::Eval(tc3d,
+                   Standard_False,
+                   0,
+                   extrap_mode[0],
+                   aDegree,
+                   FlatKnots,
+                   1,
+                   (Standard_Real&)Poles(1),
+                   tcons);
+
+    if (tcons < tprev || tcons > aParamLast)
     {
       tol = Precision::Infinite();
       return Standard_False;
     }
-    tprev = tcons;
-    gp_Pnt Pcons = cons.Value(tcons);
-    Standard_Real temp = Pc3d.SquareDistance(Pcons);
-    if(temp > d2) d2 = temp;
+    tprev               = tcons;
+    gp_Pnt        Pcons = cons.Value(tcons);
+    Standard_Real temp  = Pc3d.SquareDistance(Pcons);
+    if (temp > d2)
+      d2 = temp;
   }
   tol = sqrt(d2);
 
   // Check poles parameters to be ordered.
-  for(Standard_Integer i = Poles.Lower() + 1; i <= Poles.Upper(); ++i)
+  for (Standard_Integer i = Poles.Lower() + 1; i <= Poles.Upper(); ++i)
   {
     const Standard_Real aPreviousParam = Poles(i - 1);
     const Standard_Real aCurrentParam  = Poles(i);
@@ -266,17 +263,15 @@ static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
   return (tol <= d || tol > 0.8 * oldtol);
 }
 
-//=======================================================================
-//function : Approx_SameParameter
-//purpose  : 
-//=======================================================================
+//=================================================================================================
+
 Approx_SameParameter::Approx_SameParameter(const Handle(Geom_Curve)&   C3D,
                                            const Handle(Geom2d_Curve)& C2D,
                                            const Handle(Geom_Surface)& S,
                                            const Standard_Real         Tol)
-: myDeltaMin(Precision::PConfusion()),
-  mySameParameter(Standard_True),
-  myDone(Standard_False)
+    : myDeltaMin(Precision::PConfusion()),
+      mySameParameter(Standard_True),
+      myDone(Standard_False)
 {
   myHCurve2d = new Geom2dAdaptor_Curve(C2D);
   myC3d      = new GeomAdaptor_Curve(C3D);
@@ -284,46 +279,40 @@ Approx_SameParameter::Approx_SameParameter(const Handle(Geom_Curve)&   C3D,
   Build(Tol);
 }
 
-//=======================================================================
-//function : Approx_SameParameter
-//purpose  : 
-//=======================================================================
+//=================================================================================================
+
 Approx_SameParameter::Approx_SameParameter(const Handle(Adaptor3d_Curve)&   C3D,
-                                           const Handle(Geom2d_Curve)&       C2D,
+                                           const Handle(Geom2d_Curve)&      C2D,
                                            const Handle(Adaptor3d_Surface)& S,
-                                           const Standard_Real               Tol)
-: myDeltaMin(Precision::PConfusion()),
-  mySameParameter(Standard_True),
-  myDone(Standard_False)
+                                           const Standard_Real              Tol)
+    : myDeltaMin(Precision::PConfusion()),
+      mySameParameter(Standard_True),
+      myDone(Standard_False)
 {
-  myC3d = C3D;
-  mySurf = S;
+  myC3d      = C3D;
+  mySurf     = S;
   myHCurve2d = new Geom2dAdaptor_Curve(C2D);
   Build(Tol);
 }
 
-//=======================================================================
-//function : Approx_SameParameter
-//purpose  : 
-//=======================================================================
+//=================================================================================================
+
 Approx_SameParameter::Approx_SameParameter(const Handle(Adaptor3d_Curve)&   C3D,
                                            const Handle(Adaptor2d_Curve2d)& C2D,
                                            const Handle(Adaptor3d_Surface)& S,
-                                           const Standard_Real               Tol)
-: myDeltaMin(Precision::PConfusion()),
-  mySameParameter(Standard_True),
-  myDone(Standard_False)
+                                           const Standard_Real              Tol)
+    : myDeltaMin(Precision::PConfusion()),
+      mySameParameter(Standard_True),
+      myDone(Standard_False)
 {
-  myC3d = C3D;
-  mySurf = S;
+  myC3d      = C3D;
+  mySurf     = S;
   myHCurve2d = C2D;
   Build(Tol);
 }
 
-//=======================================================================
-//function : Build
-//purpose  : 
-//=======================================================================
+//=================================================================================================
+
 void Approx_SameParameter::Build(const Standard_Real Tolerance)
 {
   // Algorithm:
@@ -332,52 +321,52 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
   // 2.2) Compute parameters in 2d space if not same parameter.
   // 3) Loop over poles number and try to interpolate 2d curve.
   // 4) If loop is failed build 2d curve forcibly or use original pcurve.
-  Standard_Real qpcons[myMaxArraySize], qnewpcons[myMaxArraySize],
-                 qpc3d[myMaxArraySize], qnewpc3d[myMaxArraySize];
+  Standard_Real qpcons[myMaxArraySize], qnewpcons[myMaxArraySize], qpc3d[myMaxArraySize],
+    qnewpc3d[myMaxArraySize];
 
   // Create and fill data structure.
   Approx_SameParameter_Data aData;
-  aData.myCOnS = Adaptor3d_CurveOnSurface(myHCurve2d,mySurf);
-  aData.myC2dPF = aData.myCOnS.FirstParameter();
-  aData.myC2dPL = aData.myCOnS.LastParameter();
-  aData.myC3dPF = myC3d->FirstParameter();
-  aData.myC3dPL = myC3d->LastParameter();
-  aData.myNbPnt = 0; // No points initially.
-  aData.myPC2d = qpcons;
-  aData.myPC3d = qpc3d;
+  aData.myCOnS    = Adaptor3d_CurveOnSurface(myHCurve2d, mySurf);
+  aData.myC2dPF   = aData.myCOnS.FirstParameter();
+  aData.myC2dPL   = aData.myCOnS.LastParameter();
+  aData.myC3dPF   = myC3d->FirstParameter();
+  aData.myC3dPL   = myC3d->LastParameter();
+  aData.myNbPnt   = 0; // No points initially.
+  aData.myPC2d    = qpcons;
+  aData.myPC3d    = qpc3d;
   aData.myNewPC2d = qnewpcons;
   aData.myNewPC3d = qnewpc3d;
-  aData.myTol = Tolerance;
+  aData.myTol     = Tolerance;
 
   // Build initial distribution.
   if (!BuildInitialDistribution(aData))
   {
     mySameParameter = Standard_False;
-    myDone = Standard_False;
+    myDone          = Standard_False;
     return;
   }
 
   // Check same parameter state on distribution.
-  Standard_Real aMaxSqDeviation = 0.0;
+  Standard_Real       aMaxSqDeviation   = 0.0;
   const Standard_Real aPercentOfBadProj = 0.3;
-  Standard_Integer aNbPnt = aData.myNbPnt - RealToInt(aPercentOfBadProj * aData.myNbPnt);
-  mySameParameter = CheckSameParameter(aData, aMaxSqDeviation);
-  if(mySameParameter)
+  Standard_Integer    aNbPnt = aData.myNbPnt - RealToInt(aPercentOfBadProj * aData.myNbPnt);
+  mySameParameter            = CheckSameParameter(aData, aMaxSqDeviation);
+  if (mySameParameter)
   {
     myTolReached = ComputeTolReached(myC3d, aData.myCOnS, 2 * myNbSamples);
-    myDone = Standard_True;
+    myDone       = Standard_True;
     return;
   }
   else
   {
     // Control number of sample points after checking sameparameter
-    // If number of points is less then initial one, it means that there are 
+    // If number of points is less then initial one, it means that there are
     // problems with projection
-    if(aData.myNbPnt < aNbPnt )
+    if (aData.myNbPnt < aNbPnt)
     {
-      myTolReached = ComputeTolReached(myC3d,aData.myCOnS, 2 * myNbSamples);
-      myCurve2d = Geom2dAdaptor::MakeCurve (*myHCurve2d);
-      myDone = Standard_False;
+      myTolReached = ComputeTolReached(myC3d, aData.myCOnS, 2 * myNbSamples);
+      myCurve2d    = Geom2dAdaptor::MakeCurve(*myHCurve2d);
+      myDone       = Standard_False;
       return;
     }
   }
@@ -385,13 +374,13 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
   // Control tangents at the extremities to know if the
   // reparametring is possible and calculate the tangents
   // at the extremities of the function of change of variable.
-  Standard_Real tangent[2] = { 0.0, 0.0 };
-  if(!ComputeTangents(aData.myCOnS, tangent[0], tangent[1]))
+  Standard_Real tangent[2] = {0.0, 0.0};
+  if (!ComputeTangents(aData.myCOnS, tangent[0], tangent[1]))
   {
     // Cannot compute tangents.
     mySameParameter = Standard_False;
-    myDone = Standard_False;
-    myTolReached = ComputeTolReached(myC3d, aData.myCOnS, 2 * myNbSamples);
+    myDone          = Standard_False;
+    myTolReached    = ComputeTolReached(myC3d, aData.myCOnS, 2 * myNbSamples);
     return;
   }
 
@@ -399,69 +388,78 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
   // Try to build B-spline approximation curve using interpolation with degree 3.
   // The loop is organized over number of poles.
   GeomAbs_Shape aContinuity = myHCurve2d->Continuity();
-  if(aContinuity > GeomAbs_C1) aContinuity = GeomAbs_C1;
+  if (aContinuity > GeomAbs_C1)
+    aContinuity = GeomAbs_C1;
 
-  Standard_Real besttol2 = aData.myTol * aData.myTol,
-                tolsov = Precision::Infinite();
-  Standard_Boolean interpolok = Standard_False,
-                   hasCountChanged = Standard_False;
+  Standard_Real    besttol2 = aData.myTol * aData.myTol, tolsov = Precision::Infinite();
+  Standard_Boolean interpolok = Standard_False, hasCountChanged = Standard_False;
   do
   {
     // Interpolation data.
-    Standard_Integer num_knots = aData.myNbPnt + 7;
-    Standard_Integer num_poles = aData.myNbPnt + 3;
-    TColStd_Array1OfReal    Poles(1, num_poles);
-    TColStd_Array1OfReal    FlatKnots(1 ,num_knots);
+    Standard_Integer     num_knots = aData.myNbPnt + 7;
+    Standard_Integer     num_poles = aData.myNbPnt + 3;
+    TColStd_Array1OfReal Poles(1, num_poles);
+    TColStd_Array1OfReal FlatKnots(1, num_knots);
 
     if (!Interpolate(aData, tangent[0], tangent[1], Poles, FlatKnots))
     {
       // Interpolation fails.
       mySameParameter = Standard_False;
-      myDone = Standard_False;
-      myTolReached = ComputeTolReached(myC3d, aData.myCOnS, 2 * myNbSamples);
+      myDone          = Standard_False;
+      myTolReached    = ComputeTolReached(myC3d, aData.myCOnS, 2 * myNbSamples);
       return;
     }
 
     Standard_Real algtol = sqrt(besttol2);
-    interpolok = Check (FlatKnots, Poles, aData.myNbPnt+1, aData.myPC3d,
-                        myC3d, aData.myCOnS, algtol, tolsov);
+    interpolok =
+      Check(FlatKnots, Poles, aData.myNbPnt + 1, aData.myPC3d, myC3d, aData.myCOnS, algtol, tolsov);
     tolsov = algtol;
 
     // Try to build 2d curve and check it for validity.
-    if(interpolok)
+    if (interpolok)
     {
       Standard_Real besttol = sqrt(besttol2);
 
-      Handle(TColStd_HArray1OfReal) tol1d,tol2d,tol3d;
-      tol1d = new TColStd_HArray1OfReal(1,2);
+      Handle(TColStd_HArray1OfReal) tol1d, tol2d, tol3d;
+      tol1d = new TColStd_HArray1OfReal(1, 2);
       tol1d->SetValue(1, mySurf->UResolution(besttol));
       tol1d->SetValue(2, mySurf->VResolution(besttol));
 
-      Approx_SameParameter_Evaluator ev (FlatKnots, Poles, myHCurve2d);
-      Standard_Integer aMaxDeg = 11, aMaxSeg = 1000;
-      AdvApprox_ApproxAFunction  anApproximator(2,0,0,tol1d,tol2d,tol3d,aData.myC3dPF,aData.myC3dPL,
-                                                aContinuity,aMaxDeg,aMaxSeg,ev);
+      Approx_SameParameter_Evaluator ev(FlatKnots, Poles, myHCurve2d);
+      Standard_Integer               aMaxDeg = 11, aMaxSeg = 1000;
+      AdvApprox_ApproxAFunction      anApproximator(2,
+                                               0,
+                                               0,
+                                               tol1d,
+                                               tol2d,
+                                               tol3d,
+                                               aData.myC3dPF,
+                                               aData.myC3dPL,
+                                               aContinuity,
+                                               aMaxDeg,
+                                               aMaxSeg,
+                                               ev);
 
       if (anApproximator.IsDone() || anApproximator.HasResult())
       {
-        Adaptor3d_CurveOnSurface ACS = aData.myCOnS;
-        GeomLib_MakeCurvefromApprox  aCurveBuilder(anApproximator);
-        Handle(Geom2d_BSplineCurve) aC2d = aCurveBuilder.Curve2dFromTwo1d(1,2);
-        Handle(Adaptor2d_Curve2d) aHCurve2d = new Geom2dAdaptor_Curve(aC2d);
+        Adaptor3d_CurveOnSurface    ACS = aData.myCOnS;
+        GeomLib_MakeCurvefromApprox aCurveBuilder(anApproximator);
+        Handle(Geom2d_BSplineCurve) aC2d      = aCurveBuilder.Curve2dFromTwo1d(1, 2);
+        Handle(Adaptor2d_Curve2d)   aHCurve2d = new Geom2dAdaptor_Curve(aC2d);
         aData.myCOnS.Load(aHCurve2d);
-        myTolReached = ComputeTolReached(myC3d,aData.myCOnS, 2 * myNbSamples);
+        myTolReached = ComputeTolReached(myC3d, aData.myCOnS, 2 * myNbSamples);
 
         const Standard_Real aMult = 250.0; // To be tolerant with discrete tolerance.
-        if (myTolReached < aMult * besttol ) 
+        if (myTolReached < aMult * besttol)
         {
-          myCurve2d = aC2d;
+          myCurve2d  = aC2d;
           myHCurve2d = aHCurve2d;
-          myDone = Standard_True;
+          myDone     = Standard_True;
           break;
         }
-        else if(aData.myNbPnt < myMaxArraySize - 1)
+        else if (aData.myNbPnt < myMaxArraySize - 1)
         {
-          interpolok = Standard_False;
+          interpolok   = Standard_False;
           aData.myCOnS = ACS;
         }
         else
@@ -473,68 +471,78 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
 
     if (!interpolok)
       hasCountChanged = IncreaseNbPoles(Poles, FlatKnots, aData, besttol2);
-
-  } while(!interpolok && hasCountChanged);
+  } while (!interpolok && hasCountChanged);
 
   if (!myDone)
   {
     // Loop is finished unsuccessfully. Fix tolerance by maximal deviation,
-    // using data from the last loop iteration or initial data. Use data set with minimal deflection.
+    // using data from the last loop iteration or initial data. Use data set with minimal
+    // deflection.
 
     // Original 2d curve.
     aData.myCOnS.Load(myHCurve2d);
-    myTolReached = ComputeTolReached(myC3d,aData.myCOnS, 2 * myNbSamples);
-    myCurve2d = Geom2dAdaptor::MakeCurve (*myHCurve2d);
+    myTolReached = ComputeTolReached(myC3d, aData.myCOnS, 2 * myNbSamples);
+    myCurve2d    = Geom2dAdaptor::MakeCurve(*myHCurve2d);
 
     // Approximation curve.
-    Standard_Integer num_knots = aData.myNbPnt + 7;
-    Standard_Integer num_poles = aData.myNbPnt + 3;
-    TColStd_Array1OfReal    Poles(1, num_poles);
-    TColStd_Array1OfReal    FlatKnots(1 ,num_knots);
+    Standard_Integer     num_knots = aData.myNbPnt + 7;
+    Standard_Integer     num_poles = aData.myNbPnt + 3;
+    TColStd_Array1OfReal Poles(1, num_poles);
+    TColStd_Array1OfReal FlatKnots(1, num_knots);
 
-    Interpolate(aData, tangent[0], tangent[1],
-                Poles, FlatKnots);
+    Interpolate(aData, tangent[0], tangent[1], Poles, FlatKnots);
 
-    Standard_Real besttol = sqrt(besttol2);
-    Handle(TColStd_HArray1OfReal) tol1d,tol2d,tol3d;
-    tol1d = new TColStd_HArray1OfReal(1,2) ;
+    Standard_Real                 besttol = sqrt(besttol2);
+    Handle(TColStd_HArray1OfReal) tol1d, tol2d, tol3d;
+    tol1d = new TColStd_HArray1OfReal(1, 2);
     tol1d->SetValue(1, mySurf->UResolution(besttol));
     tol1d->SetValue(2, mySurf->VResolution(besttol));
 
     Approx_SameParameter_Evaluator ev(FlatKnots, Poles, myHCurve2d);
-    AdvApprox_ApproxAFunction  anApproximator(2,0,0,tol1d,tol2d,tol3d,aData.myC3dPF,aData.myC3dPL,
-                                              aContinuity,11,40,ev);
-
-    if (!anApproximator.IsDone() &&
-        !anApproximator.HasResult() )
+    AdvApprox_ApproxAFunction      anApproximator(2,
+                                             0,
+                                             0,
+                                             tol1d,
+                                             tol2d,
+                                             tol3d,
+                                             aData.myC3dPF,
+                                             aData.myC3dPL,
+                                             aContinuity,
+                                             11,
+                                             40,
+                                             ev);
+
+    if (!anApproximator.IsDone() && !anApproximator.HasResult())
     {
       myDone = Standard_False;
       return;
     }
 
-    GeomLib_MakeCurvefromApprox  aCurveBuilder(anApproximator);
-    Handle(Geom2d_BSplineCurve) aC2d = aCurveBuilder.Curve2dFromTwo1d(1,2);
-    Handle(Adaptor2d_Curve2d) aHCurve2d = new Geom2dAdaptor_Curve(aC2d);
+    GeomLib_MakeCurvefromApprox aCurveBuilder(anApproximator);
+    Handle(Geom2d_BSplineCurve) aC2d      = aCurveBuilder.Curve2dFromTwo1d(1, 2);
+    Handle(Adaptor2d_Curve2d)   aHCurve2d = new Geom2dAdaptor_Curve(aC2d);
     aData.myCOnS.Load(aHCurve2d);
 
-    Standard_Real anApproxTol = ComputeTolReached(myC3d,aData.myCOnS,2 * myNbSamples);
+    Standard_Real anApproxTol = ComputeTolReached(myC3d, aData.myCOnS, 2 * myNbSamples);
     if (anApproxTol < myTolReached)
     {
       myTolReached = anApproxTol;
-      myCurve2d = aC2d;
-      myHCurve2d  = aHCurve2d;
+      myCurve2d    = aC2d;
+      myHCurve2d   = aHCurve2d;
     }
     myDone = Standard_True;
   }
-  
+
   myCurveOnSurface = Handle(Adaptor3d_CurveOnSurface)::DownCast(aData.myCOnS.ShallowCopy());
 }
 
-//=======================================================================
-//function : BuildInitialDistribution
-//purpose  : Sub-method in Build.
-//=======================================================================
-Standard_Boolean Approx_SameParameter::BuildInitialDistribution(Approx_SameParameter_Data &theData) const
+//=================================================================================================
+// function : BuildInitialDistribution
+// purpose  : Sub-method in Build.
+//=================================================================================================
+
+Standard_Boolean Approx_SameParameter::BuildInitialDistribution(
+  Approx_SameParameter_Data& theData) const
 {
   // Take a multiple of the sample pof CheckShape,
   // at least the control points will be correct.
@@ -542,22 +550,22 @@ Standard_Boolean Approx_SameParameter::BuildInitialDistribution(Approx_SameParam
   // and on curve 3d.
   const Standard_Real deltacons = (theData.myC2dPL - theData.myC2dPF) / myNbSamples;
   const Standard_Real deltac3d  = (theData.myC3dPL - theData.myC3dPF) / myNbSamples;
-  Standard_Real wcons = theData.myC2dPF;
-  Standard_Real wc3d  = theData.myC3dPF;
-  for (Standard_Integer ii = 0 ; ii < myNbSamples; ii++)
+  Standard_Real       wcons     = theData.myC2dPF;
+  Standard_Real       wc3d      = theData.myC3dPF;
+  for (Standard_Integer ii = 0; ii < myNbSamples; ii++)
   {
     theData.myPC2d[ii] = wcons;
-    theData.myPC3d[ii]  = wc3d;
+    theData.myPC3d[ii] = wc3d;
     wcons += deltacons;
-    wc3d  += deltac3d;
+    wc3d += deltac3d;
   }
-  theData.myNbPnt = myNbSamples;
+  theData.myNbPnt                 = myNbSamples;
   theData.myPC2d[theData.myNbPnt] = theData.myC2dPL;
-  theData.myPC3d[theData.myNbPnt]  = theData.myC3dPL;
+  theData.myPC3d[theData.myNbPnt] = theData.myC3dPL;
 
   // Change number of points in case of C0 continuity.
   GeomAbs_Shape Continuity = myHCurve2d->Continuity();
-  if(Continuity < GeomAbs_C1)
+  if (Continuity < GeomAbs_C1)
   {
     if (!IncreaseInitialNbSamples(theData))
     {
@@ -569,34 +577,38 @@ Standard_Boolean Approx_SameParameter::BuildInitialDistribution(Approx_SameParam
   return Standard_True;
 }
 
-//=======================================================================
-//function : IncreaseInitialNbSamples
-//purpose  : Get number of C1 intervals and build new distribution on them.
+//=================================================================================================
+// function : IncreaseInitialNbSamples
+// purpose  : Get number of C1 intervals and build new distribution on them.
 //           Sub-method in BuildInitialDistribution.
-//=======================================================================
-Standard_Boolean Approx_SameParameter::IncreaseInitialNbSamples(Approx_SameParameter_Data &theData) const
+//=================================================================================================
+
+Standard_Boolean Approx_SameParameter::IncreaseInitialNbSamples(
+  Approx_SameParameter_Data& theData) const
 {
-  Standard_Integer NbInt = myHCurve2d->NbIntervals(GeomAbs_C1) + 1;
-  TColStd_Array1OfReal aC1Intervals (1, NbInt);
+  Standard_Integer     NbInt = myHCurve2d->NbIntervals(GeomAbs_C1) + 1;
+  TColStd_Array1OfReal aC1Intervals(1, NbInt);
   myHCurve2d->Intervals(aC1Intervals, GeomAbs_C1);
 
   Standard_Integer inter = 1;
-  while(inter <= NbInt && aC1Intervals(inter) <= theData.myC3dPF + myDeltaMin) inter++;
-  while(NbInt > 0 && aC1Intervals(NbInt) >= theData.myC3dPL - myDeltaMin) NbInt--;
+  while (inter <= NbInt && aC1Intervals(inter) <= theData.myC3dPF + myDeltaMin)
+    inter++;
+  while (NbInt > 0 && aC1Intervals(NbInt) >= theData.myC3dPL - myDeltaMin)
+    NbInt--;
 
   // Compute new parameters.
   TColStd_SequenceOfReal aNewPar;
   aNewPar.Append(theData.myC3dPF);
   Standard_Integer ii = 1;
-  while(inter <= NbInt || (ii < myNbSamples && inter <= aC1Intervals.Length()) )
+  while (inter <= NbInt || (ii < myNbSamples && inter <= aC1Intervals.Length()))
   {
-    if(aC1Intervals(inter) < theData.myPC2d[ii])
+    if (aC1Intervals(inter) < theData.myPC2d[ii])
     {
       aNewPar.Append(aC1Intervals(inter));
-      if((theData.myPC2d[ii] - aC1Intervals(inter)) <= myDeltaMin)
+      if ((theData.myPC2d[ii] - aC1Intervals(inter)) <= myDeltaMin)
       {
         ii++;
-        if(ii > myNbSamples)
+        if (ii > myNbSamples)
         {
           ii = myNbSamples;
         }
@@ -605,7 +617,7 @@ Standard_Boolean Approx_SameParameter::IncreaseInitialNbSamples(Approx_SameParam
     }
     else
     {
-      if((aC1Intervals(inter) - theData.myPC2d[ii]) > myDeltaMin)
+      if ((aC1Intervals(inter) - theData.myPC2d[ii]) > myDeltaMin)
       {
         aNewPar.Append(theData.myPC2d[ii]);
       }
@@ -620,26 +632,27 @@ Standard_Boolean Approx_SameParameter::IncreaseInitialNbSamples(Approx_SameParam
     return Standard_False;
   }
 
-  for(ii = 1; ii < theData.myNbPnt; ii++)
+  for (ii = 1; ii < theData.myNbPnt; ii++)
   {
     // Copy only internal points.
     theData.myPC2d[ii] = theData.myPC3d[ii] = aNewPar.Value(ii + 1);
   }
-  theData.myPC3d[theData.myNbPnt]  = theData.myC3dPL;
+  theData.myPC3d[theData.myNbPnt] = theData.myC3dPL;
   theData.myPC2d[theData.myNbPnt] = theData.myC2dPL;
 
   return Standard_True;
 }
 
-//=======================================================================
-//function : CheckSameParameter
-//purpose  : Sub-method in Build.
-//=======================================================================
-Standard_Boolean Approx_SameParameter::CheckSameParameter(Approx_SameParameter_Data &theData,
-                                                          Standard_Real &theSqDist) const
+//=================================================================================================
+// function : CheckSameParameter
+// purpose  : Sub-method in Build.
+//=================================================================================================
+
+Standard_Boolean Approx_SameParameter::CheckSameParameter(Approx_SameParameter_Data& theData,
+                                                          Standard_Real& theSqDist) const
 {
-  const Standard_Real Tol2 = theData.myTol * theData.myTol;
-  Standard_Boolean isSameParam = Standard_True;
+  const Standard_Real Tol2        = theData.myTol * theData.myTol;
+  Standard_Boolean    isSameParam = Standard_True;
 
   // Compute initial distance on boundary points.
   gp_Pnt Pcons, Pc3d;
@@ -654,53 +667,55 @@ Standard_Boolean Approx_SameParameter::CheckSameParameter(Approx_SameParameter_D
   dmax2 = Max(dmax2, dist2);
 
   Extrema_LocateExtPC Projector;
-  Projector.Initialize (*myC3d, theData.myC3dPF, theData.myC3dPL, theData.myTol);
+  Projector.Initialize(*myC3d, theData.myC3dPF, theData.myC3dPL, theData.myTol);
 
-  Standard_Integer count = 1;
-  Standard_Real previousp = theData.myC3dPF, initp=0, curp;
-  Standard_Real bornesup = theData.myC3dPL - myDeltaMin;
+  Standard_Integer count     = 1;
+  Standard_Real    previousp = theData.myC3dPF, initp = 0, curp;
+  Standard_Real    bornesup = theData.myC3dPL - myDeltaMin;
   Standard_Boolean isProjOk = Standard_False;
   for (Standard_Integer ii = 1; ii < theData.myNbPnt; ii++)
   {
-    theData.myCOnS.D0(theData.myPC2d[ii],Pcons);
-    myC3d->D0(theData.myPC3d[ii],Pc3d);
+    theData.myCOnS.D0(theData.myPC2d[ii], Pcons);
+    myC3d->D0(theData.myPC3d[ii], Pc3d);
     dist2 = Pcons.SquareDistance(Pc3d);
 
     // Same parameter point.
-    Standard_Boolean isUseParam = (dist2 <= Tol2  && // Good distance.
-      (theData.myPC3d[ii] > theData.myPC3d[count-1] + myDeltaMin)); // Point is separated from previous.
-    if(isUseParam)
+    Standard_Boolean isUseParam =
+      (dist2 <= Tol2 && // Good distance.
+       (theData.myPC3d[ii]
+        > theData.myPC3d[count - 1] + myDeltaMin)); // Point is separated from previous.
+    if (isUseParam)
     {
-      if(dmax2 < dist2)
+      if (dmax2 < dist2)
         dmax2 = dist2;
       initp = previousp = theData.myPC3d[count] = theData.myPC3d[ii];
-      theData.myPC2d[count] = theData.myPC2d[ii];
+      theData.myPC2d[count]                     = theData.myPC2d[ii];
       count++;
       continue;
     }
 
     // Local search: local extrema and iterative projection algorithm.
-    if(!isProjOk)
+    if (!isProjOk)
       initp = theData.myPC3d[ii];
     isProjOk = isSameParam = Standard_False;
     Projector.Perform(Pcons, initp);
     if (Projector.IsDone())
     {
       // Local extrema is found.
-      curp = Projector.Point().Parameter();
+      curp     = Projector.Point().Parameter();
       isProjOk = Standard_True;
     }
     else
     {
-      ProjectPointOnCurve(initp,Pcons,theData.myTol,30, *myC3d,isProjOk,curp);
+      ProjectPointOnCurve(initp, Pcons, theData.myTol, 30, *myC3d, isProjOk, curp);
     }
-    isProjOk = isProjOk && // Good projection.
+    isProjOk = isProjOk &&                      // Good projection.
                curp > previousp + myDeltaMin && // Point is separated from previous.
-               curp < bornesup; // Inside of parameter space.
-    if(isProjOk)
+               curp < bornesup;                 // Inside of parameter space.
+    if (isProjOk)
     {
       initp = previousp = theData.myPC3d[count] = curp;
-      theData.myPC2d[count] = theData.myPC2d[ii];
+      theData.myPC2d[count]                     = theData.myPC2d[ii];
       count++;
       continue;
     }
@@ -710,32 +725,32 @@ Standard_Boolean Approx_SameParameter::CheckSameParameter(Approx_SameParameter_D
     if (!PR.IsDone() || PR.NbExt() == 0) // Lazy evaluation is used.
       continue;
 
-    const Standard_Integer aNbExt = PR.NbExt();
-    Standard_Integer anIndMin = 0;
-    Standard_Real aCurDistMin = RealLast();
-    for(Standard_Integer i = 1; i <= aNbExt; i++)
+    const Standard_Integer aNbExt      = PR.NbExt();
+    Standard_Integer       anIndMin    = 0;
+    Standard_Real          aCurDistMin = RealLast();
+    for (Standard_Integer i = 1; i <= aNbExt; i++)
     {
-      const gp_Pnt &aP = PR.Point(i).Value();
+      const gp_Pnt& aP     = PR.Point(i).Value();
       Standard_Real aDist2 = aP.SquareDistance(Pcons);
-      if(aDist2 < aCurDistMin)
+      if (aDist2 < aCurDistMin)
       {
         aCurDistMin = aDist2;
-        anIndMin = i;
+        anIndMin    = i;
       }
     }
-    if(anIndMin)
+    if (anIndMin)
     {
       curp = PR.Point(anIndMin).Parameter();
-      ifcurp > previousp + myDeltaMin && curp < bornesup)
+      if (curp > previousp + myDeltaMin && curp < bornesup)
       {
         initp = previousp = theData.myPC3d[count] = curp;
-        theData.myPC2d[count] = theData.myPC2d[ii];
+        theData.myPC2d[count]                     = theData.myPC2d[ii];
         count++;
         isProjOk = Standard_True;
       }
     }
   }
-  theData.myNbPnt = count;
+  theData.myNbPnt                 = count;
   theData.myPC2d[theData.myNbPnt] = theData.myC2dPL;
   theData.myPC3d[theData.myNbPnt] = theData.myC3dPL;
 
@@ -743,13 +758,14 @@ Standard_Boolean Approx_SameParameter::CheckSameParameter(Approx_SameParameter_D
   return isSameParam;
 }
 
-//=======================================================================
-//function : ComputeTangents
-//purpose  : Sub-method in Build.
-//=======================================================================
-Standard_Boolean Approx_SameParameter::ComputeTangents(const Adaptor3d_CurveOnSurface & theCOnS,
-                                                       Standard_Real &theFirstTangent,
-                                                       Standard_Real &theLastTangent) const
+//=================================================================================================
+// function : ComputeTangents
+// purpose  : Sub-method in Build.
+//=================================================================================================
+
+Standard_Boolean Approx_SameParameter::ComputeTangents(const Adaptor3d_CurveOnSurface& theCOnS,
+                                                       Standard_Real& theFirstTangent,
+                                                       Standard_Real& theLastTangent) const
 {
   const Standard_Real aSmallMagnitude = 1.0e-12;
   // Check tangency on curve border.
@@ -768,7 +784,7 @@ Standard_Boolean Approx_SameParameter::ComputeTangents(const Adaptor3d_CurveOnSu
 
   // Last point.
   const Standard_Real aParamLast = myC3d->LastParameter();
-  theCOnS.D1(aParamLast,aPntCOnS,aVecConS);
+  theCOnS.D1(aParamLast, aPntCOnS, aVecConS);
   myC3d->D1(aParamLast, aPnt, aVec);
 
   aMagnitude = aVecConS.Magnitude();
@@ -780,18 +796,19 @@ Standard_Boolean Approx_SameParameter::ComputeTangents(const Adaptor3d_CurveOnSu
   return Standard_True;
 }
 
-//=======================================================================
-//function : Interpolate
-//purpose  : Sub-method in Build.
-//=======================================================================
-Standard_Boolean Approx_SameParameter::Interpolate(const Approx_SameParameter_Data & theData,
-                                       const Standard_Real aTangFirst,
-                                       const Standard_Real aTangLast,
-                                       TColStd_Array1OfReal & thePoles,
-                                       TColStd_Array1OfReal & theFlatKnots) const
+//=================================================================================================
+// function : Interpolate
+// purpose  : Sub-method in Build.
+//=================================================================================================
+
+Standard_Boolean Approx_SameParameter::Interpolate(const Approx_SameParameter_Data& theData,
+                                                   const Standard_Real              aTangFirst,
+                                                   const Standard_Real              aTangLast,
+                                                   TColStd_Array1OfReal&            thePoles,
+                                                   TColStd_Array1OfReal& theFlatKnots) const
 {
-  Standard_Integer num_poles = theData.myNbPnt + 3;
-  TColStd_Array1OfInteger ContactOrder(1,num_poles);
+  Standard_Integer        num_poles = theData.myNbPnt + 3;
+  TColStd_Array1OfInteger ContactOrder(1, num_poles);
   TColStd_Array1OfReal    aParameters(1, num_poles);
 
   // Fill tables taking attention to end values.
@@ -799,24 +816,31 @@ Standard_Boolean Approx_SameParameter::Interpolate(const Approx_SameParameter_Da
   ContactOrder(2) = ContactOrder(num_poles - 1) = 1;
 
   theFlatKnots(1) = theFlatKnots(2) = theFlatKnots(3) = theFlatKnots(4) = theData.myC3dPF;
-  theFlatKnots(num_poles + 1) = theFlatKnots(num_poles + 2) = 
-    theFlatKnots(num_poles + 3) = theFlatKnots(num_poles + 4) = theData.myC3dPL;
+  theFlatKnots(num_poles + 1) = theFlatKnots(num_poles + 2) = theFlatKnots(num_poles + 3) =
+    theFlatKnots(num_poles + 4)                             = theData.myC3dPL;
 
-  thePoles(1) = theData.myC2dPF; thePoles(num_poles) = theData.myC2dPL;
-  thePoles(2) = aTangFirst; thePoles(num_poles - 1) = aTangLast;
+  thePoles(1)             = theData.myC2dPF;
+  thePoles(num_poles)     = theData.myC2dPL;
+  thePoles(2)             = aTangFirst;
+  thePoles(num_poles - 1) = aTangLast;
 
   aParameters(1) = aParameters(2) = theData.myC3dPF;
   aParameters(num_poles - 1) = aParameters(num_poles) = theData.myC3dPL;
 
   for (Standard_Integer ii = 3; ii <= num_poles - 2; ii++)
   {
-    thePoles(ii) = theData.myPC2d[ii - 2];
-    aParameters(ii) = theFlatKnots(ii+2) = theData.myPC3d[ii - 2];
+    thePoles(ii)    = theData.myPC2d[ii - 2];
+    aParameters(ii) = theFlatKnots(ii + 2) = theData.myPC3d[ii - 2];
   }
   Standard_Integer inversion_problem;
-  BSplCLib::Interpolate(3,theFlatKnots,aParameters,ContactOrder,
-                        1,thePoles(1),inversion_problem);
-  if(inversion_problem)
+  BSplCLib::Interpolate(3,
+                        theFlatKnots,
+                        aParameters,
+                        ContactOrder,
+                        1,
+                        thePoles(1),
+                        inversion_problem);
+  if (inversion_problem)
   {
     return Standard_False;
   }
@@ -824,64 +848,74 @@ Standard_Boolean Approx_SameParameter::Interpolate(const Approx_SameParameter_Da
   return Standard_True;
 }
 
-//=======================================================================
-//function : IncreaseNbPoles
-//purpose  : Sub-method in Build.
-//=======================================================================
-Standard_Boolean Approx_SameParameter::IncreaseNbPoles(const TColStd_Array1OfReal & thePoles,
-                                                       const TColStd_Array1OfReal & theFlatKnots,
-                                                       Approx_SameParameter_Data & theData,
-                                                       Standard_Real &theBestSqTol) const
+//=================================================================================================
+// function : IncreaseNbPoles
+// purpose  : Sub-method in Build.
+//=================================================================================================
+
+Standard_Boolean Approx_SameParameter::IncreaseNbPoles(const TColStd_Array1OfReal& thePoles,
+                                                       const TColStd_Array1OfReal& theFlatKnots,
+                                                       Approx_SameParameter_Data&  theData,
+                                                       Standard_Real& theBestSqTol) const
 {
   Extrema_LocateExtPC Projector;
-  Projector.Initialize (*myC3d, myC3d->FirstParameter(), myC3d->LastParameter(), theData.myTol);
-  Standard_Real curp = 0.0;
+  Projector.Initialize(*myC3d, myC3d->FirstParameter(), myC3d->LastParameter(), theData.myTol);
+  Standard_Real    curp   = 0.0;
   Standard_Boolean projok = Standard_False;
 
   // Project middle point to fix parameterization and check projection existence.
-  const Standard_Integer aDegree = 3;
+  const Standard_Integer aDegree           = 3;
   const Standard_Integer DerivativeRequest = 0;
-  Standard_Integer extrap_mode[2] = {aDegree, aDegree};
-  Standard_Real eval_result;
-  Standard_Real *PolesArray = (Standard_Real *) &thePoles(thePoles.Lower());
-  Standard_Integer newcount = 0;
+  Standard_Integer       extrap_mode[2]    = {aDegree, aDegree};
+  Standard_Real          eval_result;
+  Standard_Real*         PolesArray = (Standard_Real*)&thePoles(thePoles.Lower());
+  Standard_Integer       newcount   = 0;
   for (Standard_Integer ii = 0; ii < theData.myNbPnt; ii++)
   {
     theData.myNewPC2d[newcount] = theData.myPC2d[ii];
     theData.myNewPC3d[newcount] = theData.myPC3d[ii];
     newcount++;
 
-    if(theData.myNbPnt - ii + newcount == myMaxArraySize) continue;
-
-    BSplCLib::Eval(0.5*(theData.myPC3d[ii]+theData.myPC3d[ii+1]), Standard_False, DerivativeRequest,
-      extrap_mode[0], 3, theFlatKnots, 1, PolesArray[0], eval_result);
+    if (theData.myNbPnt - ii + newcount == myMaxArraySize)
+      continue;
 
-    if(eval_result < theData.myPC2d[ii] || eval_result > theData.myPC2d[ii+1])
+    BSplCLib::Eval(0.5 * (theData.myPC3d[ii] + theData.myPC3d[ii + 1]),
+                   Standard_False,
+                   DerivativeRequest,
+                   extrap_mode[0],
+                   3,
+                   theFlatKnots,
+                   1,
+                   PolesArray[0],
+                   eval_result);
+
+    if (eval_result < theData.myPC2d[ii] || eval_result > theData.myPC2d[ii + 1])
     {
-      Standard_Real ucons = 0.5*(theData.myPC2d[ii]+theData.myPC2d[ii+1]);
-      Standard_Real uc3d  = 0.5*(theData.myPC3d[ii]+theData.myPC3d[ii+1]);
+      Standard_Real ucons = 0.5 * (theData.myPC2d[ii] + theData.myPC2d[ii + 1]);
+      Standard_Real uc3d  = 0.5 * (theData.myPC3d[ii] + theData.myPC3d[ii + 1]);
 
       gp_Pnt Pcons;
-      theData.myCOnS.D0(ucons,Pcons);
+      theData.myCOnS.D0(ucons, Pcons);
       Projector.Perform(Pcons, uc3d);
       if (Projector.IsDone())
       {
-        curp = Projector.Point().Parameter();
+        curp                 = Projector.Point().Parameter();
         Standard_Real dist_2 = Projector.SquareDistance();
-        if(dist_2 > theBestSqTol) theBestSqTol = dist_2;
+        if (dist_2 > theBestSqTol)
+          theBestSqTol = dist_2;
         projok = 1;
       }
       else
       {
-        ProjectPointOnCurve(uc3d,Pcons,theData.myTol,30, *myC3d,projok,curp);
+        ProjectPointOnCurve(uc3d, Pcons, theData.myTol, 30, *myC3d, projok, curp);
       }
-      if(projok)
+      if (projok)
       {
-        if(curp > theData.myPC3d[ii] + myDeltaMin && curp < theData.myPC3d[ii+1] - myDeltaMin)
+        if (curp > theData.myPC3d[ii] + myDeltaMin && curp < theData.myPC3d[ii + 1] - myDeltaMin)
         {
           theData.myNewPC3d[newcount] = curp;
           theData.myNewPC2d[newcount] = ucons;
-          newcount ++;
+          newcount++;
         }
       }
     }
@@ -889,7 +923,7 @@ Standard_Boolean Approx_SameParameter::IncreaseNbPoles(const TColStd_Array1OfRea
   theData.myNewPC3d[newcount] = theData.myPC3d[theData.myNbPnt];
   theData.myNewPC2d[newcount] = theData.myPC2d[theData.myNbPnt];
 
-  if((theData.myNbPnt != newcount) && newcount < myMaxArraySize - 1)
+  if ((theData.myNbPnt != newcount) && newcount < myMaxArraySize - 1)
   {
     // Distribution is changed.
     theData.Swap(newcount);
@@ -898,45 +932,47 @@ Standard_Boolean Approx_SameParameter::IncreaseNbPoles(const TColStd_Array1OfRea
 
   // Increase number of samples in two times.
   newcount = 0;
-  for(Standard_Integer n = 0; n < theData.myNbPnt; n++)
+  for (Standard_Integer n = 0; n < theData.myNbPnt; n++)
   {
     theData.myNewPC3d[newcount] = theData.myPC3d[n];
     theData.myNewPC2d[newcount] = theData.myPC2d[n];
-    newcount ++;
+    newcount++;
 
-    if(theData.myNbPnt - n + newcount == myMaxArraySize) continue;
+    if (theData.myNbPnt - n + newcount == myMaxArraySize)
+      continue;
 
-    Standard_Real ucons = 0.5*(theData.myPC2d[n]+theData.myPC2d[n+1]);
-    Standard_Real uc3d  = 0.5*(theData.myPC3d[n]+theData.myPC3d[n+1]);
+    Standard_Real ucons = 0.5 * (theData.myPC2d[n] + theData.myPC2d[n + 1]);
+    Standard_Real uc3d  = 0.5 * (theData.myPC3d[n] + theData.myPC3d[n + 1]);
 
     gp_Pnt Pcons;
-    theData.myCOnS.D0(ucons,Pcons);
+    theData.myCOnS.D0(ucons, Pcons);
     Projector.Perform(Pcons, uc3d);
-    if (Projector.IsDone()) 
+    if (Projector.IsDone())
     {
-      curp = Projector.Point().Parameter();
+      curp                 = Projector.Point().Parameter();
       Standard_Real dist_2 = Projector.SquareDistance();
-      if(dist_2 > theBestSqTol) theBestSqTol = dist_2;
+      if (dist_2 > theBestSqTol)
+        theBestSqTol = dist_2;
       projok = 1;
     }
-    else 
+    else
     {
-      ProjectPointOnCurve(uc3d,Pcons,theData.myTol,30, *myC3d,projok,curp);
+      ProjectPointOnCurve(uc3d, Pcons, theData.myTol, 30, *myC3d, projok, curp);
     }
-    if(projok)
+    if (projok)
     {
-      if(curp > theData.myPC3d[n] + myDeltaMin && curp < theData.myPC3d[n+1] - myDeltaMin)
+      if (curp > theData.myPC3d[n] + myDeltaMin && curp < theData.myPC3d[n + 1] - myDeltaMin)
       {
         theData.myNewPC3d[newcount] = curp;
         theData.myNewPC2d[newcount] = ucons;
-        newcount ++;
+        newcount++;
       }
     }
   }
   theData.myNewPC3d[newcount] = theData.myPC3d[theData.myNbPnt];
   theData.myNewPC2d[newcount] = theData.myPC2d[theData.myNbPnt];
 
-  if(theData.myNbPnt != newcount)
+  if (theData.myNbPnt != newcount)
   {
     // Distribution is changed.
     theData.Swap(newcount);
index 257a01933603e4acd45a25b7ac7895b3a5de96ac..5c1550fc3fb0055c0d573684f99461d0da57d386 100644 (file)
@@ -27,90 +27,70 @@ class Geom_Surface;
 //! Approximation of a  PCurve  on a surface to  make its
 //! parameter be the same that the parameter of a given 3d
 //! reference curve.
-class Approx_SameParameter 
+class Approx_SameParameter
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
   //! Warning: the C3D and C2D must have the same parametric domain.
-  Standard_EXPORT Approx_SameParameter(const Handle(Geom_Curve)& C3D,
+  Standard_EXPORT Approx_SameParameter(const Handle(Geom_Curve)&   C3D,
                                        const Handle(Geom2d_Curve)& C2D,
                                        const Handle(Geom_Surface)& S,
-                                       const Standard_Real Tol);
+                                       const Standard_Real         Tol);
 
   //! Warning: the C3D and C2D must have the same parametric domain.
-  Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_Curve)& C3D,
-                                       const Handle(Geom2d_Curve)& C2D,
+  Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_Curve)&   C3D,
+                                       const Handle(Geom2d_Curve)&      C2D,
                                        const Handle(Adaptor3d_Surface)& S,
-                                       const Standard_Real Tol);
+                                       const Standard_Real              Tol);
 
   //! Warning: the C3D and C2D must have the same parametric domain.
-  Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_Curve)& C3D,
+  Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_Curve)&   C3D,
                                        const Handle(Adaptor2d_Curve2d)& C2D,
                                        const Handle(Adaptor3d_Surface)& S,
-                                       const Standard_Real Tol);
+                                       const Standard_Real              Tol);
 
   //!@Returns .false. if calculations failed,
   //! .true. if calculations succeed
-  Standard_Boolean IsDone() const
-  {
-    return myDone;
-  }
+  Standard_Boolean IsDone() const { return myDone; }
 
   //!@Returns tolerance (maximal distance) between 3d curve
-  //! and curve on surface, generated by 2d curve and surface. 
-  Standard_Real TolReached() const
-  {
-    return myTolReached;
-  }
+  //! and curve on surface, generated by 2d curve and surface.
+  Standard_Real TolReached() const { return myTolReached; }
 
   //! Tells whether the original data had already the same
   //! parameter up to the tolerance : in that case nothing
   //! is done.
-  Standard_Boolean IsSameParameter() const
-  {
-    return mySameParameter;
-  }
+  Standard_Boolean IsSameParameter() const { return mySameParameter; }
 
   //! Returns the 2D curve that has the same parameter as
   //! the 3D curve once evaluated on the surface up to the
   //! specified tolerance.
-  Handle(Geom2d_Curve) Curve2d() const
-  {
-    return myCurve2d;
-  }
+  Handle(Geom2d_Curve) Curve2d() const { return myCurve2d; }
 
   //! Returns the 3D curve that has the same parameter as
   //! the 3D curve once evaluated on the surface up to the
   //! specified tolerance.
-  Handle(Adaptor3d_Curve) Curve3d() const
-  {
-    return myC3d;
-  }
+  Handle(Adaptor3d_Curve) Curve3d() const { return myC3d; }
 
   //! Returns the 3D curve on surface that has the same parameter as
   //! the 3D curve up to the specified tolerance.
-  Handle(Adaptor3d_CurveOnSurface) CurveOnSurface() const
-  {
-    return myCurveOnSurface;
-  }
+  Handle(Adaptor3d_CurveOnSurface) CurveOnSurface() const { return myCurveOnSurface; }
 
 private:
-
   //! Internal data structure to unify access to the most actively used data.
   //! This structure is not intended to be class field since
   //! a lot of memory is used in intermediate computations.
   struct Approx_SameParameter_Data
   {
-    Adaptor3d_CurveOnSurface myCOnS; // Curve on surface.
-    Standard_Integer myNbPnt; // Number of points.
-    Standard_Real *myPC3d; // Parameters on 3d curve.
-    Standard_Real *myPC2d; // Parameters on 2d curve.
+    Adaptor3d_CurveOnSurface myCOnS;  // Curve on surface.
+    Standard_Integer         myNbPnt; // Number of points.
+    Standard_Real*           myPC3d;  // Parameters on 3d curve.
+    Standard_Real*           myPC2d;  // Parameters on 2d curve.
 
     // Second data arrays. Used in loop over poles.
-    Standard_Real *myNewPC3d; // Parameters on 3d curve.
-    Standard_Real *myNewPC2d; // Parameters on 2d curve.
+    Standard_RealmyNewPC3d; // Parameters on 3d curve.
+    Standard_RealmyNewPC2d; // Parameters on 2d curve.
 
     // Parameters ranges.
     Standard_Real myC3dPF; // Curve 3d Parameter First.
@@ -124,73 +104,72 @@ private:
     void Swap(const Standard_Integer theNewNbPoints)
     {
       myNbPnt = theNewNbPoints;
-      Standard_Real * temp;
+      Standard_Real* temp;
 
       // 3-D
-      temp = myPC3d;
-      myPC3d = myNewPC3d;
+      temp      = myPC3d;
+      myPC3d    = myNewPC3d;
       myNewPC3d = temp;
 
       // 2-D
-      temp = myPC2d;
-      myPC2d = myNewPC2d;
+      temp      = myPC2d;
+      myPC2d    = myNewPC2d;
       myNewPC2d = temp;
     }
   };
 
-
-  Approx_SameParameter(const Approx_SameParameter &);
-  Approx_SameParameter& operator=(const Approx_SameParameter &);
+  Approx_SameParameter(const Approx_SameParameter&);
+  Approx_SameParameter& operator=(const Approx_SameParameter&);
 
   //! Computes the pcurve (internal use only).
-  Standard_EXPORT void Build (const Standard_Real Tol);
+  Standard_EXPORT void Build(const Standard_Real Tol);
 
   //! Computes initial point distribution.
-  Standard_Boolean BuildInitialDistribution(Approx_SameParameter_Data &theData) const;
+  Standard_Boolean BuildInitialDistribution(Approx_SameParameter_DatatheData) const;
 
   //! Increases initial number of samples in case of the C0 continuity.
   //! Return new number of points and corresponding data arrays.
   //@return true if new number of samples is good and false otherwise.
-  Standard_Boolean IncreaseInitialNbSamples(Approx_SameParameter_Data &theData) const;
+  Standard_Boolean IncreaseInitialNbSamples(Approx_SameParameter_DatatheData) const;
 
   //! Computes tangents on boundary points.
   //@return true if tangents are not null and false otherwise.
-  Standard_Boolean ComputeTangents(const Adaptor3d_CurveOnSurface & theCOnS,
-                                   Standard_Real &theFirstTangent,
-                                   Standard_Real &theLastTangent) const;
+  Standard_Boolean ComputeTangents(const Adaptor3d_CurveOnSurface& theCOnS,
+                                   Standard_Real&                  theFirstTangent,
+                                   Standard_Real&                  theLastTangent) const;
 
   //! Method to check same parameter state
   //! and build dependency between 2d and 3d curves.
   //@return true if 2d and 3d curves have same parameter state and false otherwise.
-  Standard_Boolean CheckSameParameter(Approx_SameParameter_Data &theData,
-                                      Standard_Real &theSqDist) const;
+  Standard_Boolean CheckSameParameter(Approx_SameParameter_DatatheData,
+                                      Standard_Real&             theSqDist) const;
 
   //! Computes interpolated values.
   //!@Returns .false. if computations failed;
-  Standard_Boolean Interpolate(const Approx_SameParameter_Data & theData,
-                   const Standard_Real aTangFirst,
-                   const Standard_Real aTangLast,
-                   TColStd_Array1OfReal & thePoles,
-                   TColStd_Array1OfReal & theFlatKnots) const;
+  Standard_Boolean Interpolate(const Approx_SameParameter_Data& theData,
+                               const Standard_Real              aTangFirst,
+                               const Standard_Real              aTangLast,
+                               TColStd_Array1OfReal&            thePoles,
+                               TColStd_Array1OfReal&            theFlatKnots) const;
 
   //! Increases number of poles in poles loop.
   //@return true if poles is changed and false otherwise.
-  Standard_Boolean IncreaseNbPoles(const TColStd_Array1OfReal & thePoles,
-                                   const TColStd_Array1OfReal & theFlatKnots,
-                                   Approx_SameParameter_Data & theData,
-                                   Standard_Real &theBestSqTol) const;
+  Standard_Boolean IncreaseNbPoles(const TColStd_Array1OfReal& thePoles,
+                                   const TColStd_Array1OfReal& theFlatKnots,
+                                   Approx_SameParameter_Data theData,
+                                   Standard_Real&              theBestSqTol) const;
 
-  static const Standard_Integer myNbSamples = 22; // To be consistent with "checkshape".
+  static const Standard_Integer myNbSamples    = 22; // To be consistent with "checkshape".
   static const Standard_Integer myMaxArraySize = 1000;
-  const Standard_Real myDeltaMin; // Initialization is allowed only for integral types.
-
-  Standard_Boolean mySameParameter;
-  Standard_Boolean myDone;
-  Standard_Real myTolReached;
-  Handle(Geom2d_Curve) myCurve2d;
-  Handle(Adaptor2d_Curve2d) myHCurve2d;
-  Handle(Adaptor3d_Curve) myC3d;
-  Handle(Adaptor3d_Surface) mySurf;
+  const Standard_Real           myDeltaMin; // Initialization is allowed only for integral types.
+
+  Standard_Boolean                 mySameParameter;
+  Standard_Boolean                 myDone;
+  Standard_Real                    myTolReached;
+  Handle(Geom2d_Curve)             myCurve2d;
+  Handle(Adaptor2d_Curve2d)        myHCurve2d;
+  Handle(Adaptor3d_Curve)          myC3d;
+  Handle(Adaptor3d_Surface)        mySurf;
   Handle(Adaptor3d_CurveOnSurface) myCurveOnSurface;
 };
 
index 342b5a9e6e5dd7535bbffb84bf3e6f8c55e7112d..bf3436e9d078e7c4295e066c936381f5b7c826be 100644 (file)
 #ifndef Approx_SequenceOfHArray1OfReal_HeaderFile
 #define Approx_SequenceOfHArray1OfReal_HeaderFile
 
-#include <TColStd_HArray1OfReal.hxx>
 #include <NCollection_Sequence.hxx>
+#include <TColStd_HArray1OfReal.hxx>
 
 typedef NCollection_Sequence<Handle(TColStd_HArray1OfReal)> Approx_SequenceOfHArray1OfReal;
 
-
 #endif
index 4827a10e6e46b5c77889f76be6f9b5784c08baad..d6184bb1250e6cf2239da2343ac23693b5c42bfd 100644 (file)
@@ -20,9 +20,9 @@
 //! It is an auxiliary flag being used in inner computations
 enum Approx_Status
 {
-Approx_PointsAdded,
-Approx_NoPointsAdded,
-Approx_NoApproximation
+  Approx_PointsAdded,
+  Approx_NoPointsAdded,
+  Approx_NoApproximation
 };
 
 #endif // _Approx_Status_HeaderFile
index 49ebfd73a3b5734276b0a682fb47462938842aaa..aafc8f59683f525331e899d8ba992d2087ab33d9 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-
 #include <AdvApprox_ApproxAFunction.hxx>
 #include <AdvApprox_DichoCutting.hxx>
 #include <AdvApprox_PrefAndRec.hxx>
 #include <Approx_SweepApproximation.hxx>
 #include <Approx_SweepFunction.hxx>
 #include <BSplCLib.hxx>
-#include <gp_XYZ.hxx>
 #include <Standard_DomainError.hxx>
 #include <StdFail_NotDone.hxx>
-#include <TColgp_Array1OfPnt2d.hxx>
 #include <TColStd_Array1OfReal.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <gp_XYZ.hxx>
+
+//=================================================================================================
 
-//=======================================================================
-//class : Approx_SweepApproximation_Eval
-//purpose: evaluator class for approximation
-//=======================================================================
 class Approx_SweepApproximation_Eval : public AdvApprox_EvaluatorFunction
 {
- public:
-  Approx_SweepApproximation_Eval (Approx_SweepApproximation& theTool)
-    : Tool(theTool) {}
-  
-  virtual void Evaluate (Standard_Integer *Dimension,
-                        Standard_Real     StartEnd[2],
-                         Standard_Real    *Parameter,
-                         Standard_Integer *DerivativeRequest,
-                         Standard_Real    *Result, // [Dimension]
-                         Standard_Integer *ErrorCode);
-  
- private:
-  Approx_SweepApproximation &Tool;
+public:
+  Approx_SweepApproximation_Eval(Approx_SweepApproximation& theTool)
+      : Tool(theTool)
+  {
+  }
+
+  virtual void Evaluate(Standard_Integer* Dimension,
+                        Standard_Real     StartEnd[2],
+                        Standard_Real*    Parameter,
+                        Standard_Integer* DerivativeRequest,
+                        Standard_Real*    Result, // [Dimension]
+                        Standard_Integer* ErrorCode);
+
+private:
+  Approx_SweepApproximation& Tool;
 };
 
-void Approx_SweepApproximation_Eval::Evaluate (Standard_Integer *,/*Dimension*/
-                                               Standard_Real     StartEnd[2],
-                                               Standard_Real    *Parameter,
-                                               Standard_Integer *DerivativeRequest,
-                                               Standard_Real    *Result,// [Dimension]
-                                               Standard_Integer *ErrorCode)
+void Approx_SweepApproximation_Eval::Evaluate(Standard_Integer*, /*Dimension*/
+                                              Standard_Real     StartEnd[2],
+                                              Standard_Real*    Parameter,
+                                              Standard_Integer* DerivativeRequest,
+                                              Standard_Real*    Result, // [Dimension]
+                                              Standard_Integer* ErrorCode)
 {
-  *ErrorCode = Tool.Eval (*Parameter, *DerivativeRequest, 
-                          StartEnd[0], StartEnd[1], Result[0]);
+  *ErrorCode = Tool.Eval(*Parameter, *DerivativeRequest, StartEnd[0], StartEnd[1], Result[0]);
 }
 
-Approx_SweepApproximation::
-Approx_SweepApproximation(const Handle(Approx_SweepFunction)& Func) 
+Approx_SweepApproximation::Approx_SweepApproximation(const Handle(Approx_SweepFunction)& Func)
 {
-  myFunc  = Func;
+  myFunc = Func;
   //  Init of variables of control
   myParam = 0;
   myOrder = -1;
-  first = 1.e100; last = -1.e100;
-  done = Standard_False;
+  first   = 1.e100;
+  last    = -1.e100;
+  done    = Standard_False;
 }
 
-void Approx_SweepApproximation::Perform(const Standard_Real First,
-                                       const Standard_Real Last,
-                                       const Standard_Real Tol3d,
-                                       const Standard_Real BoundTol,
-                                       const Standard_Real Tol2d,
-                                       const Standard_Real TolAngular,
-                                       const GeomAbs_Shape Continuity,
-                                       const Standard_Integer Degmax,
-                                       const Standard_Integer Segmax)
+void Approx_SweepApproximation::Perform(const Standard_Real    First,
+                                        const Standard_Real    Last,
+                                        const Standard_Real    Tol3d,
+                                        const Standard_Real    BoundTol,
+                                        const Standard_Real    Tol2d,
+                                        const Standard_Real    TolAngular,
+                                        const GeomAbs_Shape    Continuity,
+                                        const Standard_Integer Degmax,
+                                        const Standard_Integer Segmax)
 {
- Standard_Integer NbPolSect, NbKnotSect, ii;
- Standard_Real Tol, Tol3dMin = Tol3d, The3D2DTol=0 ; 
- GeomAbs_Shape   continuity = Continuity;
-
-// (1) Characteristics of a section
- myFunc->SectionShape(NbPolSect, NbKnotSect, udeg);
- Num2DSS = myFunc->Nb2dCurves();
- tabUKnots = new (TColStd_HArray1OfReal)    (1, NbKnotSect);
- tabUMults = new (TColStd_HArray1OfInteger) (1, NbKnotSect);
- myFunc->Knots(tabUKnots->ChangeArray1());
- myFunc->Mults(tabUMults->ChangeArray1());
-
-// (2) Decompositition into sub-spaces
- Handle(TColStd_HArray1OfReal) OneDTol, TwoDTol, ThreeDTol;
- Num3DSS = NbPolSect;
-
-// (2.1) Tolerance 3d and 1d
- OneDTol = new (TColStd_HArray1OfReal) (1, Num3DSS);
- ThreeDTol = new (TColStd_HArray1OfReal) (1, Num3DSS);
-
- myFunc->GetTolerance(BoundTol, Tol3d, TolAngular, 
-                     ThreeDTol->ChangeArray1());
-
- for (ii=1; ii<=Num3DSS; ii++) 
-   if (ThreeDTol->Value(ii) < Tol3dMin) Tol3dMin = ThreeDTol->Value(ii);
-
- if (myFunc->IsRational()) {
-   Standard_Real Size;
-   Num1DSS = NbPolSect;
-   TColStd_Array1OfReal Wmin(1, Num1DSS);
-   myFunc->GetMinimalWeight(Wmin);
-   Size =  myFunc->MaximalSection();
-   Translation.SetXYZ
-     (myFunc->BarycentreOfSurf().XYZ());
-   for (ii=1; ii<=Num3DSS; ii++) {
-     Tol =  ThreeDTol->Value(ii)/2; // To take account of the error on the final result.
-     OneDTol->SetValue(ii, Tol * Wmin(ii) / Size);
-     Tol *= Wmin(ii); //Factor of projection
-     ThreeDTol->SetValue(ii, Max(Tol, 1.e-20) );
-   }
- }
- else { Num1DSS = 0; }
-
-// (2.2) Tolerance and Transformation 2d.
- if (Num2DSS == 0) {TwoDTol.Nullify();}
- else {
-   // for 2d define affinity using resolutions, to 
-   // avoid homogeneous tolerance of approximation (u/v and 2d/3d)
-   Standard_Real res, tolu, tolv; 
-   TwoDTol = new (TColStd_HArray1OfReal) (1, Num2DSS);
-   AAffin = new (Approx_HArray1OfGTrsf2d) (1, Num2DSS);
-   The3D2DTol= 0.9*BoundTol; // 10% of security
-   for (ii=1; ii<=Num2DSS; ii++) {
-     myFunc->Resolution(ii, The3D2DTol, tolu, tolv);   
-     if ( tolu> tolv ) {
-       res = tolv;
-       AAffin->ChangeValue(ii).SetValue(1,1, tolv/tolu); 
-     }
-     else {
-       res = tolu;
-       AAffin->ChangeValue(ii).SetValue(2,2, tolu/tolv);
-     }
-     TwoDTol->SetValue(ii, Min( Tol2d, res));
-   }
- }
-
-// (3) Approximation
-
-// Init
- myPoles = new (TColgp_HArray1OfPnt)(1, Num3DSS);
- myDPoles = new (TColgp_HArray1OfVec)(1, Num3DSS);
- myD2Poles = new (TColgp_HArray1OfVec)(1, Num3DSS);
-
- myWeigths = new (TColStd_HArray1OfReal)(1, Num3DSS);
- myDWeigths = new (TColStd_HArray1OfReal)(1, Num3DSS);
- myD2Weigths = new (TColStd_HArray1OfReal)(1, Num3DSS);
- if (Num2DSS>0)
- {
-   myPoles2d   = new (TColgp_HArray1OfPnt2d)(1, Num2DSS);
-   myDPoles2d  = new (TColgp_HArray1OfVec2d)(1, Num2DSS);
-   myD2Poles2d = new (TColgp_HArray1OfVec2d)(1, Num2DSS);  
-   COnSurfErr  = new (TColStd_HArray1OfReal)(1, Num2DSS);
- }
- else
- {
-   myPoles2d   = new TColgp_HArray1OfPnt2d();
-   myDPoles2d  = new TColgp_HArray1OfVec2d();
-   myD2Poles2d = new TColgp_HArray1OfVec2d();
-   COnSurfErr  = new TColStd_HArray1OfReal();
- }
-
-// Checks if myFunc->D2 is implemented
- if (continuity >= GeomAbs_C2) {
-   Standard_Boolean B;
-   B = myFunc->D2(First, First, Last, 
-                 myPoles->ChangeArray1(), myDPoles->ChangeArray1(), 
-                 myD2Poles->ChangeArray1(),
-                 myPoles2d->ChangeArray1(), myDPoles2d->ChangeArray1(), 
-                 myD2Poles2d->ChangeArray1(),
-                 myWeigths->ChangeArray1(), myDWeigths->ChangeArray1(),
-                 myD2Weigths->ChangeArray1());
-   if (!B) continuity =  GeomAbs_C1;
- }
-// Checks if myFunc->D1 is implemented
- if (continuity == GeomAbs_C1) {
-   Standard_Boolean B;
-   B = myFunc->D1(First, First, Last, 
-                 myPoles->ChangeArray1(), myDPoles->ChangeArray1(), 
-                 myPoles2d->ChangeArray1(), myDPoles2d->ChangeArray1(), 
-                 myWeigths->ChangeArray1(), myDWeigths->ChangeArray1());
-   if (!B) continuity =  GeomAbs_C0;
- }
-
-// So that F was at least 20 times more exact than its approx
- myFunc->SetTolerance(Tol3dMin/20, Tol2d/20);
- Standard_Integer NbIntervalC2 = myFunc->NbIntervals(GeomAbs_C2);
- Standard_Integer NbIntervalC3 = myFunc->NbIntervals(GeomAbs_C3);
-
- if (NbIntervalC3 > 1) {
-// (3.1) Approximation with preferential cut
-   TColStd_Array1OfReal Param_de_decoupeC2 (1, NbIntervalC2+1);
-   myFunc->Intervals(Param_de_decoupeC2, GeomAbs_C2);
-   TColStd_Array1OfReal Param_de_decoupeC3 (1, NbIntervalC3+1);
-   myFunc->Intervals(Param_de_decoupeC3, GeomAbs_C3);
-
-
-   AdvApprox_PrefAndRec Preferentiel(Param_de_decoupeC2,
-                                    Param_de_decoupeC3);
-   
-   Approx_SweepApproximation_Eval ev (*this);
-   Approximation(OneDTol,  TwoDTol, ThreeDTol,
-                The3D2DTol,
-                First,     Last, 
-                continuity,
-                Degmax,    Segmax, 
-                ev,
-                Preferentiel);
- }
- else {
-// (3.2) Approximation without preferential cut
-   AdvApprox_DichoCutting Dichotomie;
-   Approx_SweepApproximation_Eval ev (*this);
-   Approximation(OneDTol,  TwoDTol, ThreeDTol,
-                The3D2DTol,
-                First,     Last, 
-                continuity,
-                Degmax,    Segmax, 
-                ev,
-                Dichotomie);
- }
+  Standard_Integer NbPolSect, NbKnotSect, ii;
+  Standard_Real    Tol, Tol3dMin = Tol3d, The3D2DTol = 0;
+  GeomAbs_Shape    continuity = Continuity;
+
+  // (1) Characteristics of a section
+  myFunc->SectionShape(NbPolSect, NbKnotSect, udeg);
+  Num2DSS   = myFunc->Nb2dCurves();
+  tabUKnots = new (TColStd_HArray1OfReal)(1, NbKnotSect);
+  tabUMults = new (TColStd_HArray1OfInteger)(1, NbKnotSect);
+  myFunc->Knots(tabUKnots->ChangeArray1());
+  myFunc->Mults(tabUMults->ChangeArray1());
+
+  // (2) Decompositition into sub-spaces
+  Handle(TColStd_HArray1OfReal) OneDTol, TwoDTol, ThreeDTol;
+  Num3DSS = NbPolSect;
+
+  // (2.1) Tolerance 3d and 1d
+  OneDTol   = new (TColStd_HArray1OfReal)(1, Num3DSS);
+  ThreeDTol = new (TColStd_HArray1OfReal)(1, Num3DSS);
+
+  myFunc->GetTolerance(BoundTol, Tol3d, TolAngular, ThreeDTol->ChangeArray1());
+
+  for (ii = 1; ii <= Num3DSS; ii++)
+    if (ThreeDTol->Value(ii) < Tol3dMin)
+      Tol3dMin = ThreeDTol->Value(ii);
+
+  if (myFunc->IsRational())
+  {
+    Standard_Real Size;
+    Num1DSS = NbPolSect;
+    TColStd_Array1OfReal Wmin(1, Num1DSS);
+    myFunc->GetMinimalWeight(Wmin);
+    Size = myFunc->MaximalSection();
+    Translation.SetXYZ(myFunc->BarycentreOfSurf().XYZ());
+    for (ii = 1; ii <= Num3DSS; ii++)
+    {
+      Tol = ThreeDTol->Value(ii) / 2; // To take account of the error on the final result.
+      OneDTol->SetValue(ii, Tol * Wmin(ii) / Size);
+      Tol *= Wmin(ii); // Factor of projection
+      ThreeDTol->SetValue(ii, Max(Tol, 1.e-20));
+    }
+  }
+  else
+  {
+    Num1DSS = 0;
+  }
+
+  // (2.2) Tolerance and Transformation 2d.
+  if (Num2DSS == 0)
+  {
+    TwoDTol.Nullify();
+  }
+  else
+  {
+    // for 2d define affinity using resolutions, to
+    // avoid homogeneous tolerance of approximation (u/v and 2d/3d)
+    Standard_Real res, tolu, tolv;
+    TwoDTol    = new (TColStd_HArray1OfReal)(1, Num2DSS);
+    AAffin     = new (Approx_HArray1OfGTrsf2d)(1, Num2DSS);
+    The3D2DTol = 0.9 * BoundTol; // 10% of security
+    for (ii = 1; ii <= Num2DSS; ii++)
+    {
+      myFunc->Resolution(ii, The3D2DTol, tolu, tolv);
+      if (tolu > tolv)
+      {
+        res = tolv;
+        AAffin->ChangeValue(ii).SetValue(1, 1, tolv / tolu);
+      }
+      else
+      {
+        res = tolu;
+        AAffin->ChangeValue(ii).SetValue(2, 2, tolu / tolv);
+      }
+      TwoDTol->SetValue(ii, Min(Tol2d, res));
+    }
+  }
+
+  // (3) Approximation
+
+  // Init
+  myPoles   = new (TColgp_HArray1OfPnt)(1, Num3DSS);
+  myDPoles  = new (TColgp_HArray1OfVec)(1, Num3DSS);
+  myD2Poles = new (TColgp_HArray1OfVec)(1, Num3DSS);
+
+  myWeigths   = new (TColStd_HArray1OfReal)(1, Num3DSS);
+  myDWeigths  = new (TColStd_HArray1OfReal)(1, Num3DSS);
+  myD2Weigths = new (TColStd_HArray1OfReal)(1, Num3DSS);
+
+  if (Num2DSS > 0)
+  {
+    myPoles2d   = new (TColgp_HArray1OfPnt2d)(1, Num2DSS);
+    myDPoles2d  = new (TColgp_HArray1OfVec2d)(1, Num2DSS);
+    myD2Poles2d = new (TColgp_HArray1OfVec2d)(1, Num2DSS);
+    COnSurfErr  = new (TColStd_HArray1OfReal)(1, Num2DSS);
+  }
+  else
+  {
+    myPoles2d   = new TColgp_HArray1OfPnt2d();
+    myDPoles2d  = new TColgp_HArray1OfVec2d();
+    myD2Poles2d = new TColgp_HArray1OfVec2d();
+    COnSurfErr  = new TColStd_HArray1OfReal();
+  }
+
+  // Checks if myFunc->D2 is implemented
+  if (continuity >= GeomAbs_C2)
+  {
+    Standard_Boolean B;
+    B = myFunc->D2(First,
+                   First,
+                   Last,
+                   myPoles->ChangeArray1(),
+                   myDPoles->ChangeArray1(),
+                   myD2Poles->ChangeArray1(),
+                   myPoles2d->ChangeArray1(),
+                   myDPoles2d->ChangeArray1(),
+                   myD2Poles2d->ChangeArray1(),
+                   myWeigths->ChangeArray1(),
+                   myDWeigths->ChangeArray1(),
+                   myD2Weigths->ChangeArray1());
+    if (!B)
+      continuity = GeomAbs_C1;
+  }
+  // Checks if myFunc->D1 is implemented
+  if (continuity == GeomAbs_C1)
+  {
+    Standard_Boolean B;
+    B = myFunc->D1(First,
+                   First,
+                   Last,
+                   myPoles->ChangeArray1(),
+                   myDPoles->ChangeArray1(),
+                   myPoles2d->ChangeArray1(),
+                   myDPoles2d->ChangeArray1(),
+                   myWeigths->ChangeArray1(),
+                   myDWeigths->ChangeArray1());
+    if (!B)
+      continuity = GeomAbs_C0;
+  }
+
+  // So that F was at least 20 times more exact than its approx
+  myFunc->SetTolerance(Tol3dMin / 20, Tol2d / 20);
+
+  Standard_Integer NbIntervalC2 = myFunc->NbIntervals(GeomAbs_C2);
+  Standard_Integer NbIntervalC3 = myFunc->NbIntervals(GeomAbs_C3);
+
+  if (NbIntervalC3 > 1)
+  {
+    // (3.1) Approximation with preferential cut
+    TColStd_Array1OfReal Param_de_decoupeC2(1, NbIntervalC2 + 1);
+    myFunc->Intervals(Param_de_decoupeC2, GeomAbs_C2);
+    TColStd_Array1OfReal Param_de_decoupeC3(1, NbIntervalC3 + 1);
+    myFunc->Intervals(Param_de_decoupeC3, GeomAbs_C3);
+
+    AdvApprox_PrefAndRec Preferentiel(Param_de_decoupeC2, Param_de_decoupeC3);
+
+    Approx_SweepApproximation_Eval ev(*this);
+    Approximation(OneDTol,
+                  TwoDTol,
+                  ThreeDTol,
+                  The3D2DTol,
+                  First,
+                  Last,
+                  continuity,
+                  Degmax,
+                  Segmax,
+                  ev,
+                  Preferentiel);
+  }
+  else
+  {
+    // (3.2) Approximation without preferential cut
+    AdvApprox_DichoCutting         Dichotomie;
+    Approx_SweepApproximation_Eval ev(*this);
+    Approximation(OneDTol,
+                  TwoDTol,
+                  ThreeDTol,
+                  The3D2DTol,
+                  First,
+                  Last,
+                  continuity,
+                  Degmax,
+                  Segmax,
+                  ev,
+                  Dichotomie);
+  }
 }
 
-//========================================================================
-//function : Approximation
-//purpose  : Call F(t) and store the results
-//========================================================================
-void Approx_SweepApproximation::
-Approximation(const Handle(TColStd_HArray1OfReal)& OneDTol,
-             const Handle(TColStd_HArray1OfReal)& TwoDTol,
-             const Handle(TColStd_HArray1OfReal)& ThreeDTol,
-             const Standard_Real BoundTol,
-             const Standard_Real First,const Standard_Real Last,
-             const GeomAbs_Shape Continuity,const Standard_Integer Degmax,
-             const Standard_Integer Segmax,
-             const AdvApprox_EvaluatorFunction& TheApproxFunction,
-             const AdvApprox_Cutting& TheCuttingTool) 
+//=================================================================================================
+// function : Approximation
+// purpose  : Call F(t) and store the results
+//=================================================================================================
+
+void Approx_SweepApproximation::Approximation(const Handle(TColStd_HArray1OfReal)& OneDTol,
+                                              const Handle(TColStd_HArray1OfReal)& TwoDTol,
+                                              const Handle(TColStd_HArray1OfReal)& ThreeDTol,
+                                              const Standard_Real                  BoundTol,
+                                              const Standard_Real                  First,
+                                              const Standard_Real                  Last,
+                                              const GeomAbs_Shape                  Continuity,
+                                              const Standard_Integer               Degmax,
+                                              const Standard_Integer               Segmax,
+                                              const AdvApprox_EvaluatorFunction& TheApproxFunction,
+                                              const AdvApprox_Cutting&           TheCuttingTool)
 {
- AdvApprox_ApproxAFunction Approx(Num1DSS, 
-                                 Num2DSS,
-                                 Num3DSS,
-                                 OneDTol,
-                                 TwoDTol,
-                                 ThreeDTol,
-                                 First,
-                                 Last, 
-                                 Continuity,
-                                 Degmax,
-                                 Segmax, 
-                                 TheApproxFunction,
-                                 TheCuttingTool);
- done = Approx.HasResult();
-
- if (done) {
- // --> Fill Champs of the surface ----
-   Standard_Integer ii, jj;
-
-   vdeg = Approx.Degree();
-   // Unfortunately Adv_Approx stores the transposition of the required 
-   // so, writing tabPoles = Approx.Poles() will give an erroneous result
-   // It is only possible to allocate and recopy term by term...
-   tabPoles = new (TColgp_HArray2OfPnt)
-     (1, Num3DSS, 1, Approx.NbPoles());
-   tabWeights = new (TColStd_HArray2OfReal)
-     (1, Num3DSS, 1, Approx.NbPoles());
-
-   if (Num1DSS == Num3DSS) {
-     Standard_Real wpoid;
-     gp_Pnt P;
-     for (ii=1; ii <=Num3DSS; ii++) {
-       for (jj=1; jj <=Approx.NbPoles() ; jj++) {
-         P = Approx.Poles()->Value(jj,ii);
-         wpoid = Approx.Poles1d()->Value(jj,ii);
-         P.ChangeCoord() /= wpoid; // It is necessary to divide poles by weight
-         P.Translate(Translation); 
-        tabPoles->SetValue  (ii, jj, P);
-        tabWeights->SetValue(ii, jj, wpoid );
-       }
-     }
-   }
-   else {
-     tabWeights->Init(1);
-     for (ii=1; ii <=Num3DSS; ii++) {
-       for (jj=1; jj <=Approx.NbPoles() ; jj++) {
-        tabPoles->SetValue  (ii, jj, Approx.Poles  ()->Value(jj,ii) );
-       }
-     }
-   }
-   
-   // this is better
-   tabVKnots = Approx.Knots();
-   tabVMults = Approx.Multiplicities();
-
-   
-
-  // --> Filling of curves 2D  ----------
-   if (Num2DSS>0) {
-     gp_GTrsf2d TrsfInv;
-     deg2d = vdeg;
-     tab2dKnots = Approx.Knots();
-     tab2dMults = Approx.Multiplicities();
-
-     for (ii=1; ii<=Num2DSS; ii++) {
-       TrsfInv = AAffin->Value(ii).Inverted();
-       Handle(TColgp_HArray1OfPnt2d) P2d = 
-        new (TColgp_HArray1OfPnt2d) (1, Approx.NbPoles());
-       Approx.Poles2d( ii, P2d->ChangeArray1() );
-       // do not forget to apply inverted homothety.
-       for (jj=1; jj<=Approx.NbPoles(); jj++) {
-         TrsfInv.Transforms(P2d->ChangeValue(jj).ChangeCoord());
-       }
-       seqPoles2d.Append(P2d);
-     }
-   }
-  // ---> Filling of errors
-   MError3d = new (TColStd_HArray1OfReal) (1,Num3DSS);
-   AError3d = new (TColStd_HArray1OfReal) (1,Num3DSS);
-   for (ii=1; ii<=Num3DSS; ii++) {
-     MError3d->SetValue(ii, Approx.MaxError(3, ii));
-     AError3d->SetValue(ii, Approx.AverageError(3, ii));
-   }
-
-   if (myFunc->IsRational()) {
-     MError1d = new (TColStd_HArray1OfReal) (1,Num3DSS);
-     AError1d = new (TColStd_HArray1OfReal) (1,Num3DSS);
-     for (ii=1; ii<=Num1DSS; ii++) {
-       MError1d->SetValue(ii, Approx.MaxError(1, ii));
-       AError1d->SetValue(ii, Approx.AverageError(1, ii));
-     }
-   }
-
-   if (Num2DSS>0) {
-     tab2dError = new (TColStd_HArray1OfReal) (1,Num2DSS);
-     Ave2dError = new (TColStd_HArray1OfReal) (1,Num2DSS);
-     for (ii=1; ii<=Num2DSS; ii++) {
-       tab2dError->SetValue(ii, Approx.MaxError(2, ii));
-       Ave2dError->SetValue(ii, Approx.AverageError(2, ii));
-       COnSurfErr->SetValue(ii,
-         (tab2dError->Value(ii)/TwoDTol->Value(ii))*BoundTol);
-     }
-   }     
- }
+  AdvApprox_ApproxAFunction Approx(Num1DSS,
+                                   Num2DSS,
+                                   Num3DSS,
+                                   OneDTol,
+                                   TwoDTol,
+                                   ThreeDTol,
+                                   First,
+                                   Last,
+                                   Continuity,
+                                   Degmax,
+                                   Segmax,
+                                   TheApproxFunction,
+                                   TheCuttingTool);
+  done = Approx.HasResult();
+
+  if (done)
+  {
+    // --> Fill Champs of the surface ----
+    Standard_Integer ii, jj;
+
+    vdeg = Approx.Degree();
+    // Unfortunately Adv_Approx stores the transposition of the required
+    // so, writing tabPoles = Approx.Poles() will give an erroneous result
+    // It is only possible to allocate and recopy term by term...
+    tabPoles   = new (TColgp_HArray2OfPnt)(1, Num3DSS, 1, Approx.NbPoles());
+    tabWeights = new (TColStd_HArray2OfReal)(1, Num3DSS, 1, Approx.NbPoles());
+
+    if (Num1DSS == Num3DSS)
+    {
+      Standard_Real wpoid;
+      gp_Pnt        P;
+      for (ii = 1; ii <= Num3DSS; ii++)
+      {
+        for (jj = 1; jj <= Approx.NbPoles(); jj++)
+        {
+          P     = Approx.Poles()->Value(jj, ii);
+          wpoid = Approx.Poles1d()->Value(jj, ii);
+          P.ChangeCoord() /= wpoid; // It is necessary to divide poles by weight
+          P.Translate(Translation);
+          tabPoles->SetValue(ii, jj, P);
+          tabWeights->SetValue(ii, jj, wpoid);
+        }
+      }
+    }
+    else
+    {
+      tabWeights->Init(1);
+      for (ii = 1; ii <= Num3DSS; ii++)
+      {
+        for (jj = 1; jj <= Approx.NbPoles(); jj++)
+        {
+          tabPoles->SetValue(ii, jj, Approx.Poles()->Value(jj, ii));
+        }
+      }
+    }
+
+    // this is better
+    tabVKnots = Approx.Knots();
+    tabVMults = Approx.Multiplicities();
+
+    // --> Filling of curves 2D  ----------
+    if (Num2DSS > 0)
+    {
+      gp_GTrsf2d TrsfInv;
+      deg2d      = vdeg;
+      tab2dKnots = Approx.Knots();
+      tab2dMults = Approx.Multiplicities();
+
+      for (ii = 1; ii <= Num2DSS; ii++)
+      {
+        TrsfInv                           = AAffin->Value(ii).Inverted();
+        Handle(TColgp_HArray1OfPnt2d) P2d = new (TColgp_HArray1OfPnt2d)(1, Approx.NbPoles());
+        Approx.Poles2d(ii, P2d->ChangeArray1());
+        // do not forget to apply inverted homothety.
+        for (jj = 1; jj <= Approx.NbPoles(); jj++)
+        {
+          TrsfInv.Transforms(P2d->ChangeValue(jj).ChangeCoord());
+        }
+        seqPoles2d.Append(P2d);
+      }
+    }
+    // ---> Filling of errors
+    MError3d = new (TColStd_HArray1OfReal)(1, Num3DSS);
+    AError3d = new (TColStd_HArray1OfReal)(1, Num3DSS);
+    for (ii = 1; ii <= Num3DSS; ii++)
+    {
+      MError3d->SetValue(ii, Approx.MaxError(3, ii));
+      AError3d->SetValue(ii, Approx.AverageError(3, ii));
+    }
+
+    if (myFunc->IsRational())
+    {
+      MError1d = new (TColStd_HArray1OfReal)(1, Num3DSS);
+      AError1d = new (TColStd_HArray1OfReal)(1, Num3DSS);
+      for (ii = 1; ii <= Num1DSS; ii++)
+      {
+        MError1d->SetValue(ii, Approx.MaxError(1, ii));
+        AError1d->SetValue(ii, Approx.AverageError(1, ii));
+      }
+    }
+
+    if (Num2DSS > 0)
+    {
+      tab2dError = new (TColStd_HArray1OfReal)(1, Num2DSS);
+      Ave2dError = new (TColStd_HArray1OfReal)(1, Num2DSS);
+      for (ii = 1; ii <= Num2DSS; ii++)
+      {
+        tab2dError->SetValue(ii, Approx.MaxError(2, ii));
+        Ave2dError->SetValue(ii, Approx.AverageError(2, ii));
+        COnSurfErr->SetValue(ii, (tab2dError->Value(ii) / TwoDTol->Value(ii)) * BoundTol);
+      }
+    }
+  }
 }
 
-Standard_Integer Approx_SweepApproximation::Eval(const Standard_Real Parameter,
-                                                const Standard_Integer DerivativeRequest,
-                                                const Standard_Real First,
-                                                const Standard_Real Last,
-                                                Standard_Real& Result) 
+Standard_Integer Approx_SweepApproximation::Eval(const Standard_Real    Parameter,
+                                                 const Standard_Integer DerivativeRequest,
+                                                 const Standard_Real    First,
+                                                 const Standard_Real    Last,
+                                                 Standard_Real&         Result)
 {
- Standard_Integer ier=0;
- switch (DerivativeRequest) {
- case 0 : 
-   ier = ( ! D0(Parameter, First, Last, Result));
-   break;
- case 1 : 
-   ier = ( ! D1(Parameter, First, Last, Result));
-   break;
- case 2 : 
-   ier = ( ! D2(Parameter, First, Last,Result));
-   break;
- default :
-   ier = 2;
- }
- return ier;
+  Standard_Integer ier = 0;
+  switch (DerivativeRequest)
+  {
+    case 0:
+      ier = (!D0(Parameter, First, Last, Result));
+      break;
+    case 1:
+      ier = (!D1(Parameter, First, Last, Result));
+      break;
+    case 2:
+      ier = (!D2(Parameter, First, Last, Result));
+      break;
+    default:
+      ier = 2;
+  }
+  return ier;
 }
 
 Standard_Boolean Approx_SweepApproximation::D0(const Standard_Real Param,
-                                              const Standard_Real First,
-                                              const Standard_Real Last,
-                                              Standard_Real& Result) 
+                                               const Standard_Real First,
+                                               const Standard_Real Last,
+                                               Standard_Real&      Result)
 {
   Standard_Integer index, ii;
-  Standard_Boolean Ok=Standard_True;
-  Standard_Real * LocalResult =  &Result;
+  Standard_Boolean Ok          = Standard_True;
+  Standard_Real*   LocalResult = &Result;
 
   // Management of limits
-  if ((first!=First) || (Last!=last)) {
-       myFunc->SetInterval(First, Last);
-     }
+  if ((first != First) || (Last != last))
+  {
+    myFunc->SetInterval(First, Last);
+  }
 
-  if (! ( (Param==myParam) && (myOrder>=0)
-        && (first==First) && (Last==last)) ) {
+  if (!((Param == myParam) && (myOrder >= 0) && (first == First) && (Last == last)))
+  {
     // Positioning in case when the last operation is not repeated.
-    Ok = myFunc->D0(Param, First, Last,
-                   myPoles->ChangeArray1(),
-                   myPoles2d->ChangeArray1(),
-                   myWeigths->ChangeArray1());
+    Ok = myFunc->D0(Param,
+                    First,
+                    Last,
+                    myPoles->ChangeArray1(),
+                    myPoles2d->ChangeArray1(),
+                    myWeigths->ChangeArray1());
 
     //  poles3d are multiplied by weight after translation.
-    for (ii=1; ii<=Num1DSS; ii++) {
-      myPoles->ChangeValue(ii).ChangeCoord()
-       -= Translation.XYZ();
-      myPoles->ChangeValue(ii).ChangeCoord() 
-       *= myWeigths->Value(ii);
+    for (ii = 1; ii <= Num1DSS; ii++)
+    {
+      myPoles->ChangeValue(ii).ChangeCoord() -= Translation.XYZ();
+      myPoles->ChangeValue(ii).ChangeCoord() *= myWeigths->Value(ii);
     }
 
     //  The transformation is applied to poles 2d.
-    for (ii=1; ii<=Num2DSS; ii++) {
+    for (ii = 1; ii <= Num2DSS; ii++)
+    {
       AAffin->Value(ii).Transforms(myPoles2d->ChangeValue(ii).ChangeCoord());
     }
 
     // Update variables of controle and return
-    first = First;
-    last  = Last;
+    first   = First;
+    last    = Last;
     myOrder = 0;
     myParam = Param;
   }
 
   //  Extraction of results
   index = 0;
-  for (ii=1; ii<=Num1DSS; ii++) {
+  for (ii = 1; ii <= Num1DSS; ii++)
+  {
     LocalResult[index] = myWeigths->Value(ii);
     index++;
   }
-  for (ii=1; ii<=Num2DSS; ii++) {
-    LocalResult[index] =    myPoles2d->Value(ii).X();
-    LocalResult[index+1] =  myPoles2d->Value(ii).Y();
+  for (ii = 1; ii <= Num2DSS; ii++)
+  {
+    LocalResult[index]     = myPoles2d->Value(ii).X();
+    LocalResult[index + 1] = myPoles2d->Value(ii).Y();
     index += 2;
   }
-  for (ii=1; ii<=Num3DSS; ii++, index+=3) {
-    LocalResult[index]   = myPoles->Value(ii).X();
-    LocalResult[index+1] = myPoles->Value(ii).Y();
-    LocalResult[index+2] = myPoles->Value(ii).Z();
+  for (ii = 1; ii <= Num3DSS; ii++, index += 3)
+  {
+    LocalResult[index]     = myPoles->Value(ii).X();
+    LocalResult[index + 1] = myPoles->Value(ii).Y();
+    LocalResult[index + 2] = myPoles->Value(ii).Z();
   }
 
   return Ok;
 }
 
 Standard_Boolean Approx_SweepApproximation::D1(const Standard_Real Param,
-                                              const Standard_Real First,
-                                              const Standard_Real Last,
-                                              Standard_Real& Result) 
+                                               const Standard_Real First,
+                                               const Standard_Real Last,
+                                               Standard_Real&      Result)
 {
-  gp_XY Vcoord;
-  gp_Vec Vaux;
+  gp_XY            Vcoord;
+  gp_Vec           Vaux;
   Standard_Integer index, ii;
-  Standard_Boolean Ok=Standard_True;
-  Standard_Real * LocalResult =  &Result;
+  Standard_Boolean Ok          = Standard_True;
+  Standard_Real*   LocalResult = &Result;
 
-
-  if ((first!=First) || (Last!=last)) {
+  if ((first != First) || (Last != last))
+  {
     myFunc->SetInterval(First, Last);
   }
 
-  if (! ( (Param==myParam) && (myOrder>=1)
-        && (first==First) && (Last==last)) ){
+  if (!((Param == myParam) && (myOrder >= 1) && (first == First) && (Last == last)))
+  {
 
-    // Positioning 
-    Ok = myFunc->D1(Param, First, Last,
-                   myPoles->ChangeArray1(),
-                   myDPoles->ChangeArray1(),
-                   myPoles2d->ChangeArray1(),
-                   myDPoles2d->ChangeArray1(),
-                   myWeigths->ChangeArray1(),
-                   myDWeigths->ChangeArray1());
+    // Positioning
+    Ok = myFunc->D1(Param,
+                    First,
+                    Last,
+                    myPoles->ChangeArray1(),
+                    myDPoles->ChangeArray1(),
+                    myPoles2d->ChangeArray1(),
+                    myDPoles2d->ChangeArray1(),
+                    myWeigths->ChangeArray1(),
+                    myDWeigths->ChangeArray1());
 
     //  Take into account the multiplication of poles3d by weights.
     //  and the translation.
-    for ( ii=1; ii<=Num1DSS; ii++) {
-      //Translation on the section
-      myPoles->ChangeValue(ii).ChangeCoord()
-       -= Translation.XYZ();
-      // Homothety on all. 
+    for (ii = 1; ii <= Num1DSS; ii++)
+    {
+      // Translation on the section
+      myPoles->ChangeValue(ii).ChangeCoord() -= Translation.XYZ();
+      // Homothety on all.
       const Standard_Real aWeight = myWeigths->Value(ii);
       myDPoles->ChangeValue(ii) *= aWeight;
-      Vaux.SetXYZ( myPoles->Value(ii).Coord());
-      myDPoles->ChangeValue(ii) += myDWeigths->Value(ii)*Vaux;
+      Vaux.SetXYZ(myPoles->Value(ii).Coord());
+      myDPoles->ChangeValue(ii) += myDWeigths->Value(ii) * Vaux;
       myPoles->ChangeValue(ii).ChangeCoord() *= aWeight; // for the cash
     }
-      
 
     //  Apply transformation 2d to suitable vectors
-    for (ii=1; ii<=Num2DSS; ii++) {
-      Vcoord =  myDPoles2d->Value(ii).XY();
+    for (ii = 1; ii <= Num2DSS; ii++)
+    {
+      Vcoord = myDPoles2d->Value(ii).XY();
       AAffin->Value(ii).Transforms(Vcoord);
       myDPoles2d->ChangeValue(ii).SetXY(Vcoord);
       AAffin->Value(ii).Transforms(myPoles2d->ChangeValue(ii).ChangeCoord());
     }
 
     // Update control variables and return
-    first = First;
-    last  = Last;
+    first   = First;
+    last    = Last;
     myOrder = 1;
     myParam = Param;
   }
-  
+
   //  Extraction of results
   index = 0;
-  for (ii=1; ii<=Num1DSS; ii++) {
+  for (ii = 1; ii <= Num1DSS; ii++)
+  {
     LocalResult[index] = myDWeigths->Value(ii);
     index++;
   }
-  for (ii=1; ii<=Num2DSS; ii++) {
-    LocalResult[index] =    myDPoles2d->Value(ii).X();
-    LocalResult[index+1] =  myDPoles2d->Value(ii).Y();
+  for (ii = 1; ii <= Num2DSS; ii++)
+  {
+    LocalResult[index]     = myDPoles2d->Value(ii).X();
+    LocalResult[index + 1] = myDPoles2d->Value(ii).Y();
     index += 2;
   }
-  for (ii=1; ii<=Num3DSS; ii++, index+=3) {
-    LocalResult[index]   = myDPoles->Value(ii).X();
-    LocalResult[index+1] = myDPoles->Value(ii).Y();
-    LocalResult[index+2] = myDPoles->Value(ii).Z();
+  for (ii = 1; ii <= Num3DSS; ii++, index += 3)
+  {
+    LocalResult[index]     = myDPoles->Value(ii).X();
+    LocalResult[index + 1] = myDPoles->Value(ii).Y();
+    LocalResult[index + 2] = myDPoles->Value(ii).Z();
   }
   return Ok;
 }
 
 Standard_Boolean Approx_SweepApproximation::D2(const Standard_Real Param,
-                                              const Standard_Real First,
-                                              const Standard_Real Last,
-                                              Standard_Real& Result) 
+                                               const Standard_Real First,
+                                               const Standard_Real Last,
+                                               Standard_Real&      Result)
 {
-  gp_XY Vcoord;  
-  gp_Vec Vaux;
+  gp_XY            Vcoord;
+  gp_Vec           Vaux;
   Standard_Integer index, ii;
-  Standard_Boolean Ok=Standard_True;
-  Standard_Real * LocalResult =  &Result;
+  Standard_Boolean Ok          = Standard_True;
+  Standard_Real*   LocalResult = &Result;
 
   // management of limits
-  if ((first!=First) || (Last!=last)) {
-       myFunc->SetInterval(First, Last);
-     }
+  if ((first != First) || (Last != last))
+  {
+    myFunc->SetInterval(First, Last);
+  }
 
-  if (! ( (Param==myParam) && (myOrder>=2)
-        && (first==First) && (Last==last)) ) {
+  if (!((Param == myParam) && (myOrder >= 2) && (first == First) && (Last == last)))
+  {
     // Positioning in case when the last operation is not repeated
-    Ok = myFunc->D2(Param, First, Last,
-                   myPoles->ChangeArray1(),
-                   myDPoles->ChangeArray1(),
-                   myD2Poles->ChangeArray1(),
-                   myPoles2d->ChangeArray1(),
-                   myDPoles2d->ChangeArray1(),
-                   myD2Poles2d->ChangeArray1(),
-                   myWeigths->ChangeArray1(),
-                   myDWeigths->ChangeArray1(),
-                   myD2Weigths->ChangeArray1());
+    Ok = myFunc->D2(Param,
+                    First,
+                    Last,
+                    myPoles->ChangeArray1(),
+                    myDPoles->ChangeArray1(),
+                    myD2Poles->ChangeArray1(),
+                    myPoles2d->ChangeArray1(),
+                    myDPoles2d->ChangeArray1(),
+                    myD2Poles2d->ChangeArray1(),
+                    myWeigths->ChangeArray1(),
+                    myDWeigths->ChangeArray1(),
+                    myD2Weigths->ChangeArray1());
 
     //  Multiply poles3d by the weight after translations.
-    for (ii=1; ii<=Num1DSS; ii++) {
+    for (ii = 1; ii <= Num1DSS; ii++)
+    {
       // First translate
-      myPoles->ChangeValue(ii).ChangeCoord()
-       -= Translation.XYZ();
-       
-      //Calculate the second derivative
+      myPoles->ChangeValue(ii).ChangeCoord() -= Translation.XYZ();
+
+      // Calculate the second derivative
       myD2Poles->ChangeValue(ii) *= myWeigths->Value(ii);
-      Vaux.SetXYZ( myDPoles->Value(ii).XYZ());
-      myD2Poles->ChangeValue(ii) += (2*myDWeigths->Value(ii))*Vaux;
-      Vaux.SetXYZ( myPoles->Value(ii).Coord());
-      myD2Poles->ChangeValue(ii) += myD2Weigths->Value(ii)*Vaux;
+      Vaux.SetXYZ(myDPoles->Value(ii).XYZ());
+      myD2Poles->ChangeValue(ii) += (2 * myDWeigths->Value(ii)) * Vaux;
+      Vaux.SetXYZ(myPoles->Value(ii).Coord());
+      myD2Poles->ChangeValue(ii) += myD2Weigths->Value(ii) * Vaux;
 
-      //Then the remainder for the cash
+      // Then the remainder for the cash
       myDPoles->ChangeValue(ii) *= myWeigths->Value(ii);
-      Vaux.SetXYZ( myPoles->Value(ii).Coord());
-      myDPoles->ChangeValue(ii) += myDWeigths->Value(ii)*Vaux;
-      myPoles->ChangeValue(ii).ChangeCoord() 
-       *= myWeigths->Value(ii); 
+      Vaux.SetXYZ(myPoles->Value(ii).Coord());
+      myDPoles->ChangeValue(ii) += myDWeigths->Value(ii) * Vaux;
+      myPoles->ChangeValue(ii).ChangeCoord() *= myWeigths->Value(ii);
     }
 
     //  Apply transformation to poles 2d.
-    for (ii=1; ii<=Num2DSS; ii++) {
-      Vcoord =  myD2Poles2d->Value(ii).XY();
+    for (ii = 1; ii <= Num2DSS; ii++)
+    {
+      Vcoord = myD2Poles2d->Value(ii).XY();
       AAffin->Value(ii).Transforms(Vcoord);
       myD2Poles2d->ChangeValue(ii).SetXY(Vcoord);
-      Vcoord =  myDPoles2d->Value(ii).XY();
+      Vcoord = myDPoles2d->Value(ii).XY();
       AAffin->Value(ii).Transforms(Vcoord);
       myDPoles2d->ChangeValue(ii).SetXY(Vcoord);
       AAffin->Value(ii).Transforms(myPoles2d->ChangeValue(ii).ChangeCoord());
     }
 
     // Update variables of control and return
-    first = First;
-    last  = Last;
+    first   = First;
+    last    = Last;
     myOrder = 2;
     myParam = Param;
   }
 
   //  Extraction of results
   index = 0;
-  for (ii=1; ii<=Num1DSS; ii++) {
+  for (ii = 1; ii <= Num1DSS; ii++)
+  {
     LocalResult[index] = myD2Weigths->Value(ii);
     index++;
   }
-  for (ii=1; ii<=Num2DSS; ii++) {
-    LocalResult[index] =    myD2Poles2d->Value(ii).X();
-    LocalResult[index+1] =  myD2Poles2d->Value(ii).Y();
+  for (ii = 1; ii <= Num2DSS; ii++)
+  {
+    LocalResult[index]     = myD2Poles2d->Value(ii).X();
+    LocalResult[index + 1] = myD2Poles2d->Value(ii).Y();
     index += 2;
   }
-  for (ii=1; ii<=Num3DSS; ii++, index+=3) {
-    LocalResult[index]   = myD2Poles->Value(ii).X();
-    LocalResult[index+1] = myD2Poles->Value(ii).Y();
-    LocalResult[index+2] = myD2Poles->Value(ii).Z();
+  for (ii = 1; ii <= Num3DSS; ii++, index += 3)
+  {
+    LocalResult[index]     = myD2Poles->Value(ii).X();
+    LocalResult[index + 1] = myD2Poles->Value(ii).Y();
+    LocalResult[index + 2] = myD2Poles->Value(ii).Z();
   }
 
   return Ok;
 }
 
-void Approx_SweepApproximation::
-SurfShape(Standard_Integer& UDegree,
-         Standard_Integer& VDegree,Standard_Integer& NbUPoles,
-         Standard_Integer& NbVPoles,
-         Standard_Integer& NbUKnots,
-         Standard_Integer& NbVKnots) const
+void Approx_SweepApproximation::SurfShape(Standard_Integer& UDegree,
+                                          Standard_Integer& VDegree,
+                                          Standard_Integer& NbUPoles,
+                                          Standard_Integer& NbVPoles,
+                                          Standard_Integer& NbUKnots,
+                                          Standard_Integer& NbVKnots) const
 {
-  if (!done) {throw StdFail_NotDone("Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone("Approx_SweepApproximation");
+  }
   UDegree  = udeg;
   VDegree  = vdeg;
   NbUPoles = tabPoles->ColLength();
@@ -623,15 +685,17 @@ SurfShape(Standard_Integer& UDegree,
   NbVKnots = tabVKnots->Length();
 }
 
-void Approx_SweepApproximation::
-Surface(TColgp_Array2OfPnt& TPoles,
-       TColStd_Array2OfReal& TWeights,
-       TColStd_Array1OfReal& TUKnots,
-       TColStd_Array1OfReal& TVKnots,
-       TColStd_Array1OfInteger& TUMults,
-       TColStd_Array1OfInteger& TVMults) const
+void Approx_SweepApproximation::Surface(TColgp_Array2OfPnt&      TPoles,
+                                        TColStd_Array2OfReal&    TWeights,
+                                        TColStd_Array1OfReal&    TUKnots,
+                                        TColStd_Array1OfReal&    TVKnots,
+                                        TColStd_Array1OfInteger& TUMults,
+                                        TColStd_Array1OfInteger& TVMults) const
 {
-  if (!done) {throw StdFail_NotDone("Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone("Approx_SweepApproximation");
+  }
   TPoles   = tabPoles->Array2();
   TWeights = tabWeights->Array2();
   TUKnots  = tabUKnots->Array1();
@@ -642,109 +706,150 @@ Surface(TColgp_Array2OfPnt& TPoles,
 
 Standard_Real Approx_SweepApproximation::MaxErrorOnSurf() const
 {
- Standard_Integer ii;
- Standard_Real MaxError = 0, err;
- if (!done) {throw StdFail_NotDone("Approx_SweepApproximation");}
-
- if (myFunc->IsRational()) {
-   TColStd_Array1OfReal Wmin(1, Num1DSS);
-   myFunc->GetMinimalWeight(Wmin);
-   Standard_Real Size = myFunc->MaximalSection();
-   for (ii=1; ii<=Num3DSS; ii++) {
-     err = (Size*MError1d->Value(ii) + MError3d->Value(ii)) / Wmin(ii);
-     if (err>MaxError) MaxError = err;
-   }
- }
- else {
-  for (ii=1; ii<=Num3DSS; ii++) {
-     err = MError3d->Value(ii);
-     if (err>MaxError) MaxError = err;
-   } 
- } 
- return MaxError;
+  Standard_Integer ii;
+  Standard_Real    MaxError = 0, err;
+  if (!done)
+  {
+    throw StdFail_NotDone("Approx_SweepApproximation");
+  }
+
+  if (myFunc->IsRational())
+  {
+    TColStd_Array1OfReal Wmin(1, Num1DSS);
+    myFunc->GetMinimalWeight(Wmin);
+    Standard_Real Size = myFunc->MaximalSection();
+    for (ii = 1; ii <= Num3DSS; ii++)
+    {
+      err = (Size * MError1d->Value(ii) + MError3d->Value(ii)) / Wmin(ii);
+      if (err > MaxError)
+        MaxError = err;
+    }
+  }
+  else
+  {
+    for (ii = 1; ii <= Num3DSS; ii++)
+    {
+      err = MError3d->Value(ii);
+      if (err > MaxError)
+        MaxError = err;
+    }
+  }
+  return MaxError;
 }
 
- Standard_Real Approx_SweepApproximation::AverageErrorOnSurf() const
+Standard_Real Approx_SweepApproximation::AverageErrorOnSurf() const
 {
- Standard_Integer ii;
- Standard_Real MoyError = 0, err;
- if (!done) {throw StdFail_NotDone("Approx_SweepApproximation");}
-
- if (myFunc->IsRational()) {
-   TColStd_Array1OfReal Wmin(1, Num1DSS);
-   myFunc->GetMinimalWeight(Wmin);
-   Standard_Real Size = myFunc->MaximalSection();
-   for (ii=1; ii<=Num3DSS; ii++) {
-     err = (Size*AError1d->Value(ii) + AError3d->Value(ii)) / Wmin(ii);
-     MoyError += err;
-   }
- }
- else {
-  for (ii=1; ii<=Num3DSS; ii++) {
-     err = AError3d->Value(ii);
-     MoyError += err;
-   } 
- } 
- return MoyError/Num3DSS;
-}
+  Standard_Integer ii;
+  Standard_Real    MoyError = 0, err;
+  if (!done)
+  {
+    throw StdFail_NotDone("Approx_SweepApproximation");
+  }
 
+  if (myFunc->IsRational())
+  {
+    TColStd_Array1OfReal Wmin(1, Num1DSS);
+    myFunc->GetMinimalWeight(Wmin);
+    Standard_Real Size = myFunc->MaximalSection();
+    for (ii = 1; ii <= Num3DSS; ii++)
+    {
+      err = (Size * AError1d->Value(ii) + AError3d->Value(ii)) / Wmin(ii);
+      MoyError += err;
+    }
+  }
+  else
+  {
+    for (ii = 1; ii <= Num3DSS; ii++)
+    {
+      err = AError3d->Value(ii);
+      MoyError += err;
+    }
+  }
+  return MoyError / Num3DSS;
+}
 
 void Approx_SweepApproximation::Curves2dShape(Standard_Integer& Degree,
-                                             Standard_Integer& NbPoles,
-                                             Standard_Integer& NbKnots) const
+                                              Standard_Integer& NbPoles,
+                                              Standard_Integer& NbKnots) const
 {
-  if (!done) {throw StdFail_NotDone("Approx_SweepApproximation");}
-  if (seqPoles2d.Length() == 0) {throw Standard_DomainError("Approx_SweepApproximation");}
-  Degree = deg2d;
+  if (!done)
+  {
+    throw StdFail_NotDone("Approx_SweepApproximation");
+  }
+  if (seqPoles2d.Length() == 0)
+  {
+    throw Standard_DomainError("Approx_SweepApproximation");
+  }
+  Degree  = deg2d;
   NbPoles = seqPoles2d(1)->Length();
   NbKnots = tab2dKnots->Length();
 }
 
-void Approx_SweepApproximation::Curve2d(const Standard_Integer Index,
-                                       TColgp_Array1OfPnt2d& TPoles,
-                                       TColStd_Array1OfReal& TKnots,
-                                       TColStd_Array1OfInteger& TMults) const
+void Approx_SweepApproximation::Curve2d(const Standard_Integer   Index,
+                                        TColgp_Array1OfPnt2d&    TPoles,
+                                        TColStd_Array1OfReal&    TKnots,
+                                        TColStd_Array1OfInteger& TMults) const
 {
-  if (!done) {throw StdFail_NotDone("Approx_SweepApproximation");}
-  if (seqPoles2d.Length() == 0) {throw Standard_DomainError("Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone("Approx_SweepApproximation");
+  }
+  if (seqPoles2d.Length() == 0)
+  {
+    throw Standard_DomainError("Approx_SweepApproximation");
+  }
   TPoles = seqPoles2d(Index)->Array1();
-  TKnots  = tab2dKnots->Array1();
-  TMults  = tab2dMults->Array1(); 
+  TKnots = tab2dKnots->Array1();
+  TMults = tab2dMults->Array1();
 }
 
- Standard_Real Approx_SweepApproximation::Max2dError(const Standard_Integer Index) const
+Standard_Real Approx_SweepApproximation::Max2dError(const Standard_Integer Index) const
 {
-  if (!done) {throw StdFail_NotDone("Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone("Approx_SweepApproximation");
+  }
   return tab2dError->Value(Index);
 }
 
- Standard_Real Approx_SweepApproximation::Average2dError(const Standard_Integer Index) const
+Standard_Real Approx_SweepApproximation::Average2dError(const Standard_Integer Index) const
 {
-  if (!done) {throw StdFail_NotDone("Approx_SweepApproximation");}
-  return Ave2dError->Value(Index); 
+  if (!done)
+  {
+    throw StdFail_NotDone("Approx_SweepApproximation");
+  }
+  return Ave2dError->Value(Index);
 }
 
 Standard_Real Approx_SweepApproximation::TolCurveOnSurf(const Standard_Integer Index) const
 {
-  if (!done) {throw StdFail_NotDone("Approx_SweepApproximation");}
-  return  COnSurfErr->Value(Index);
+  if (!done)
+  {
+    throw StdFail_NotDone("Approx_SweepApproximation");
+  }
+  return COnSurfErr->Value(Index);
 }
 
- void Approx_SweepApproximation::Dump(Standard_OStream& o) const
+void Approx_SweepApproximation::Dump(Standard_OStream& o) const
 {
   o << "Dump of SweepApproximation" << std::endl;
-  if (done) { 
+  if (done)
+  {
     o << "Error 3d = " << MaxErrorOnSurf() << std::endl;
 
-    if (Num2DSS>0) {
+    if (Num2DSS > 0)
+    {
       o << "Error 2d = ";
-      for (Standard_Integer ii=1; ii<=Num2DSS; ii++) 
-       {  o << Max2dError(ii);
-          if (ii < Num2DSS) o << " , " << std::endl;
-        }
+      for (Standard_Integer ii = 1; ii <= Num2DSS; ii++)
+      {
+        o << Max2dError(ii);
+        if (ii < Num2DSS)
+          o << " , " << std::endl;
+      }
       std::cout << std::endl;
     }
-    o <<  tabVKnots->Length()-1 <<" Segment(s) of degree " << vdeg << std::endl;
+    o << tabVKnots->Length() - 1 << " Segment(s) of degree " << vdeg << std::endl;
   }
-  else std::cout << " Not Done " << std::endl;
+  else
+    std::cout << " Not Done " << std::endl;
 }
index bc374834566a5690de89d9e2a3f5c7baa1d5a9d6..04efa6036058d9952fde05864bad8cea0a12ae4b 100644 (file)
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
+#include <AdvApprox_EvaluatorFunction.hxx>
+#include <Approx_HArray1OfGTrsf2d.hxx>
+#include <GeomAbs_Shape.hxx>
 #include <Standard_Integer.hxx>
-#include <TColgp_HArray2OfPnt.hxx>
-#include <TColStd_HArray2OfReal.hxx>
-#include <TColStd_HArray1OfReal.hxx>
+#include <Standard_OStream.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColStd_Array2OfReal.hxx>
 #include <TColStd_HArray1OfInteger.hxx>
-#include <TColgp_SequenceOfArray1OfPnt2d.hxx>
-#include <Approx_HArray1OfGTrsf2d.hxx>
-#include <gp_Vec.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <TColStd_HArray2OfReal.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <TColgp_Array2OfPnt.hxx>
 #include <TColgp_HArray1OfPnt.hxx>
 #include <TColgp_HArray1OfPnt2d.hxx>
 #include <TColgp_HArray1OfVec.hxx>
 #include <TColgp_HArray1OfVec2d.hxx>
-#include <GeomAbs_Shape.hxx>
-#include <AdvApprox_EvaluatorFunction.hxx>
-#include <TColgp_Array2OfPnt.hxx>
-#include <TColStd_Array2OfReal.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <TColgp_Array1OfPnt2d.hxx>
-#include <Standard_OStream.hxx>
+#include <TColgp_HArray2OfPnt.hxx>
+#include <TColgp_SequenceOfArray1OfPnt2d.hxx>
+#include <gp_Vec.hxx>
 class Approx_SweepFunction;
 class AdvApprox_Cutting;
 
-
 //! Approximation  of  an  Surface   S(u,v)
 //! (and eventually associate  2d Curves) defined
 //! by section's law.
@@ -54,15 +53,13 @@ class AdvApprox_Cutting;
 //! To use this algorithme, you  have to implement Ft(u)
 //! as a derivative class  of Approx_SweepFunction.
 //! This algorithm can be used by blending, sweeping...
-class Approx_SweepApproximation 
+class Approx_SweepApproximation
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
-  
   Standard_EXPORT Approx_SweepApproximation(const Handle(Approx_SweepFunction)& Func);
-  
+
   //! Perform the Approximation
   //! [First, Last] : Approx_SweepApproximation.cdl
   //! Tol3d : Tolerance to surface approximation
@@ -78,138 +75,166 @@ public:
   //! Segmax     : The maximum number of span in v required on
   //! the surface
   //! Warning : The continuity ci can be obtained only if Ft is Ci
-  Standard_EXPORT void Perform (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol3d, const Standard_Real BoundTol, const Standard_Real Tol2d, const Standard_Real TolAngular, const GeomAbs_Shape Continuity = GeomAbs_C0, const Standard_Integer Degmax = 11, const Standard_Integer Segmax = 50);
-  
+  Standard_EXPORT void Perform(const Standard_Real    First,
+                               const Standard_Real    Last,
+                               const Standard_Real    Tol3d,
+                               const Standard_Real    BoundTol,
+                               const Standard_Real    Tol2d,
+                               const Standard_Real    TolAngular,
+                               const GeomAbs_Shape    Continuity = GeomAbs_C0,
+                               const Standard_Integer Degmax     = 11,
+                               const Standard_Integer Segmax     = 50);
+
   //! The EvaluatorFunction from AdvApprox;
-  Standard_EXPORT Standard_Integer Eval (const Standard_Real Parameter, const Standard_Integer DerivativeRequest, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
-  
+  Standard_EXPORT Standard_Integer Eval(const Standard_Real    Parameter,
+                                        const Standard_Integer DerivativeRequest,
+                                        const Standard_Real    First,
+                                        const Standard_Real    Last,
+                                        Standard_Real&         Result);
+
   //! returns if we have an result
-    Standard_Boolean IsDone() const;
-  
-  Standard_EXPORT void SurfShape (Standard_Integer& UDegree, Standard_Integer& VDegree, Standard_Integer& NbUPoles, Standard_Integer& NbVPoles, Standard_Integer& NbUKnots, Standard_Integer& NbVKnots) const;
-  
-  Standard_EXPORT void Surface (TColgp_Array2OfPnt& TPoles, TColStd_Array2OfReal& TWeights, TColStd_Array1OfReal& TUKnots, TColStd_Array1OfReal& TVKnots, TColStd_Array1OfInteger& TUMults, TColStd_Array1OfInteger& TVMults) const;
-  
-    Standard_Integer UDegree() const;
-  
-    Standard_Integer VDegree() const;
-  
-    const TColgp_Array2OfPnt& SurfPoles() const;
-  
-    const TColStd_Array2OfReal& SurfWeights() const;
-  
-    const TColStd_Array1OfReal& SurfUKnots() const;
-  
-    const TColStd_Array1OfReal& SurfVKnots() const;
-  
-    const TColStd_Array1OfInteger& SurfUMults() const;
-  
-    const TColStd_Array1OfInteger& SurfVMults() const;
-  
+  Standard_Boolean IsDone() const;
+
+  Standard_EXPORT void SurfShape(Standard_Integer& UDegree,
+                                 Standard_Integer& VDegree,
+                                 Standard_Integer& NbUPoles,
+                                 Standard_Integer& NbVPoles,
+                                 Standard_Integer& NbUKnots,
+                                 Standard_Integer& NbVKnots) const;
+
+  Standard_EXPORT void Surface(TColgp_Array2OfPnt&      TPoles,
+                               TColStd_Array2OfReal&    TWeights,
+                               TColStd_Array1OfReal&    TUKnots,
+                               TColStd_Array1OfReal&    TVKnots,
+                               TColStd_Array1OfInteger& TUMults,
+                               TColStd_Array1OfInteger& TVMults) const;
+
+  Standard_Integer UDegree() const;
+
+  Standard_Integer VDegree() const;
+
+  const TColgp_Array2OfPnt& SurfPoles() const;
+
+  const TColStd_Array2OfReal& SurfWeights() const;
+
+  const TColStd_Array1OfReal& SurfUKnots() const;
+
+  const TColStd_Array1OfReal& SurfVKnots() const;
+
+  const TColStd_Array1OfInteger& SurfUMults() const;
+
+  const TColStd_Array1OfInteger& SurfVMults() const;
+
   //! returns the maximum error in the surface approximation.
   Standard_EXPORT Standard_Real MaxErrorOnSurf() const;
-  
+
   //! returns the average error in the surface approximation.
   Standard_EXPORT Standard_Real AverageErrorOnSurf() const;
-  
-    Standard_Integer NbCurves2d() const;
-  
-  Standard_EXPORT void Curves2dShape (Standard_Integer& Degree, Standard_Integer& NbPoles, Standard_Integer& NbKnots) const;
-  
-  Standard_EXPORT void Curve2d (const Standard_Integer Index, TColgp_Array1OfPnt2d& TPoles, TColStd_Array1OfReal& TKnots, TColStd_Array1OfInteger& TMults) const;
-  
-    Standard_Integer Curves2dDegree() const;
-  
-    const TColgp_Array1OfPnt2d& Curve2dPoles (const Standard_Integer Index) const;
-  
-    const TColStd_Array1OfReal& Curves2dKnots() const;
-  
-    const TColStd_Array1OfInteger& Curves2dMults() const;
-  
-  //! returns the maximum error of the <Index>
-  //! 2d curve approximation.
-  Standard_EXPORT Standard_Real Max2dError (const Standard_Integer Index) const;
-  
-  //! returns the average error of the <Index>
-  //! 2d curve approximation.
-  Standard_EXPORT Standard_Real Average2dError (const Standard_Integer Index) const;
-  
-  //! returns the  maximum 3d  error  of the  <Index>
-  //! 2d curve approximation on the Surface.
-  Standard_EXPORT Standard_Real TolCurveOnSurf (const Standard_Integer Index) const;
-  
-  //! display information on approximation.
-  Standard_EXPORT void Dump (Standard_OStream& o) const;
 
+  Standard_Integer NbCurves2d() const;
 
+  Standard_EXPORT void Curves2dShape(Standard_Integer& Degree,
+                                     Standard_Integer& NbPoles,
+                                     Standard_Integer& NbKnots) const;
 
+  Standard_EXPORT void Curve2d(const Standard_Integer   Index,
+                               TColgp_Array1OfPnt2d&    TPoles,
+                               TColStd_Array1OfReal&    TKnots,
+                               TColStd_Array1OfInteger& TMults) const;
 
-protected:
+  Standard_Integer Curves2dDegree() const;
+
+  const TColgp_Array1OfPnt2d& Curve2dPoles(const Standard_Integer Index) const;
 
+  const TColStd_Array1OfReal& Curves2dKnots() const;
 
+  const TColStd_Array1OfInteger& Curves2dMults() const;
 
+  //! returns the maximum error of the <Index>
+  //! 2d curve approximation.
+  Standard_EXPORT Standard_Real Max2dError(const Standard_Integer Index) const;
 
+  //! returns the average error of the <Index>
+  //! 2d curve approximation.
+  Standard_EXPORT Standard_Real Average2dError(const Standard_Integer Index) const;
 
-private:
+  //! returns the  maximum 3d  error  of the  <Index>
+  //! 2d curve approximation on the Surface.
+  Standard_EXPORT Standard_Real TolCurveOnSurf(const Standard_Integer Index) const;
+
+  //! display information on approximation.
+  Standard_EXPORT void Dump(Standard_OStream& o) const;
 
-  
-  Standard_EXPORT void Approximation (const Handle(TColStd_HArray1OfReal)& OneDTol, const Handle(TColStd_HArray1OfReal)& TwoDTol, const Handle(TColStd_HArray1OfReal)& ThreeDTol, const Standard_Real BounTol, const Standard_Real First, const Standard_Real Last, const GeomAbs_Shape Continuity, const Standard_Integer Degmax, const Standard_Integer Segmax, const AdvApprox_EvaluatorFunction& TheApproxFunction, const AdvApprox_Cutting& TheCuttingTool);
-  
-  Standard_EXPORT Standard_Boolean D0 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
-  
-  Standard_EXPORT Standard_Boolean D1 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
-  
-  Standard_EXPORT Standard_Boolean D2 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
-
-
-  Handle(Approx_SweepFunction) myFunc;
-  Standard_Boolean done;
-  Standard_Integer Num1DSS;
-  Standard_Integer Num2DSS;
-  Standard_Integer Num3DSS;
-  Standard_Integer udeg;
-  Standard_Integer vdeg;
-  Standard_Integer deg2d;
-  Handle(TColgp_HArray2OfPnt) tabPoles;
-  Handle(TColStd_HArray2OfReal) tabWeights;
-  Handle(TColStd_HArray1OfReal) tabUKnots;
-  Handle(TColStd_HArray1OfReal) tabVKnots;
-  Handle(TColStd_HArray1OfReal) tab2dKnots;
+protected:
+private:
+  Standard_EXPORT void Approximation(const Handle(TColStd_HArray1OfReal)& OneDTol,
+                                     const Handle(TColStd_HArray1OfReal)& TwoDTol,
+                                     const Handle(TColStd_HArray1OfReal)& ThreeDTol,
+                                     const Standard_Real                  BounTol,
+                                     const Standard_Real                  First,
+                                     const Standard_Real                  Last,
+                                     const GeomAbs_Shape                  Continuity,
+                                     const Standard_Integer               Degmax,
+                                     const Standard_Integer               Segmax,
+                                     const AdvApprox_EvaluatorFunction&   TheApproxFunction,
+                                     const AdvApprox_Cutting&             TheCuttingTool);
+
+  Standard_EXPORT Standard_Boolean D0(const Standard_Real Param,
+                                      const Standard_Real First,
+                                      const Standard_Real Last,
+                                      Standard_Real&      Result);
+
+  Standard_EXPORT Standard_Boolean D1(const Standard_Real Param,
+                                      const Standard_Real First,
+                                      const Standard_Real Last,
+                                      Standard_Real&      Result);
+
+  Standard_EXPORT Standard_Boolean D2(const Standard_Real Param,
+                                      const Standard_Real First,
+                                      const Standard_Real Last,
+                                      Standard_Real&      Result);
+
+  Handle(Approx_SweepFunction)     myFunc;
+  Standard_Boolean                 done;
+  Standard_Integer                 Num1DSS;
+  Standard_Integer                 Num2DSS;
+  Standard_Integer                 Num3DSS;
+  Standard_Integer                 udeg;
+  Standard_Integer                 vdeg;
+  Standard_Integer                 deg2d;
+  Handle(TColgp_HArray2OfPnt)      tabPoles;
+  Handle(TColStd_HArray2OfReal)    tabWeights;
+  Handle(TColStd_HArray1OfReal)    tabUKnots;
+  Handle(TColStd_HArray1OfReal)    tabVKnots;
+  Handle(TColStd_HArray1OfReal)    tab2dKnots;
   Handle(TColStd_HArray1OfInteger) tabUMults;
   Handle(TColStd_HArray1OfInteger) tabVMults;
   Handle(TColStd_HArray1OfInteger) tab2dMults;
-  TColgp_SequenceOfArray1OfPnt2d seqPoles2d;
-  Handle(TColStd_HArray1OfReal) MError1d;
-  Handle(TColStd_HArray1OfReal) tab2dError;
-  Handle(TColStd_HArray1OfReal) MError3d;
-  Handle(TColStd_HArray1OfReal) AError1d;
-  Handle(TColStd_HArray1OfReal) Ave2dError;
-  Handle(TColStd_HArray1OfReal) AError3d;
-  Handle(Approx_HArray1OfGTrsf2d) AAffin;
-  Handle(TColStd_HArray1OfReal) COnSurfErr;
-  gp_Vec Translation;
-  Handle(TColgp_HArray1OfPnt) myPoles;
-  Handle(TColgp_HArray1OfPnt2d) myPoles2d;
-  Handle(TColStd_HArray1OfReal) myWeigths;
-  Handle(TColgp_HArray1OfVec) myDPoles;
-  Handle(TColgp_HArray1OfVec) myD2Poles;
-  Handle(TColgp_HArray1OfVec2d) myDPoles2d;
-  Handle(TColgp_HArray1OfVec2d) myD2Poles2d;
-  Handle(TColStd_HArray1OfReal) myDWeigths;
-  Handle(TColStd_HArray1OfReal) myD2Weigths;
-  Standard_Integer myOrder;
-  Standard_Real myParam;
-  Standard_Real first;
-  Standard_Real last;
-
-
+  TColgp_SequenceOfArray1OfPnt2d   seqPoles2d;
+  Handle(TColStd_HArray1OfReal)    MError1d;
+  Handle(TColStd_HArray1OfReal)    tab2dError;
+  Handle(TColStd_HArray1OfReal)    MError3d;
+  Handle(TColStd_HArray1OfReal)    AError1d;
+  Handle(TColStd_HArray1OfReal)    Ave2dError;
+  Handle(TColStd_HArray1OfReal)    AError3d;
+  Handle(Approx_HArray1OfGTrsf2d)  AAffin;
+  Handle(TColStd_HArray1OfReal)    COnSurfErr;
+  gp_Vec                           Translation;
+  Handle(TColgp_HArray1OfPnt)      myPoles;
+  Handle(TColgp_HArray1OfPnt2d)    myPoles2d;
+  Handle(TColStd_HArray1OfReal)    myWeigths;
+  Handle(TColgp_HArray1OfVec)      myDPoles;
+  Handle(TColgp_HArray1OfVec)      myD2Poles;
+  Handle(TColgp_HArray1OfVec2d)    myDPoles2d;
+  Handle(TColgp_HArray1OfVec2d)    myD2Poles2d;
+  Handle(TColStd_HArray1OfReal)    myDWeigths;
+  Handle(TColStd_HArray1OfReal)    myD2Weigths;
+  Standard_Integer                 myOrder;
+  Standard_Real                    myParam;
+  Standard_Real                    first;
+  Standard_Real                    last;
 };
 
-
 #include <Approx_SweepApproximation.lxx>
 
-
-
-
-
 #endif // _Approx_SweepApproximation_HeaderFile
index 3ab47f595b3abcf39461a21695a5ed4c0c41addf..ed1d309072525d0ddf36ce0f6ccc78fe15f3c0fe 100644 (file)
 // commercial license or contractual agreement.
 
 #include <StdFail_NotDone.hxx>
-#include <TColgp_HArray2OfPnt.hxx>
-#include <TColgp_HArray1OfPnt2d.hxx>
-#include <TColStd_HArray2OfReal.hxx>
-#include <TColStd_HArray1OfReal.hxx>
 #include <TColStd_HArray1OfInteger.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <TColStd_HArray2OfReal.hxx>
+#include <TColgp_HArray1OfPnt2d.hxx>
+#include <TColgp_HArray2OfPnt.hxx>
 
-inline  Standard_Boolean Approx_SweepApproximation::IsDone() const
+inline Standard_Boolean Approx_SweepApproximation::IsDone() const
 {
   return done;
 }
 
-inline  Standard_Integer Approx_SweepApproximation::UDegree() const
+inline Standard_Integer Approx_SweepApproximation::UDegree() const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
   return udeg;
 }
 
-inline  Standard_Integer Approx_SweepApproximation::VDegree() const
+inline Standard_Integer Approx_SweepApproximation::VDegree() const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
   return vdeg;
 }
 
 inline const TColgp_Array2OfPnt& Approx_SweepApproximation::SurfPoles() const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
   return tabPoles->Array2();
 }
 
 inline const TColStd_Array2OfReal& Approx_SweepApproximation::SurfWeights() const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
   return tabWeights->Array2();
 }
 
 inline const TColStd_Array1OfReal& Approx_SweepApproximation::SurfUKnots() const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
   return tabUKnots->Array1();
 }
 
 inline const TColStd_Array1OfReal& Approx_SweepApproximation::SurfVKnots() const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
   return tabVKnots->Array1();
 }
 
 inline const TColStd_Array1OfInteger& Approx_SweepApproximation::SurfUMults() const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
   return tabUMults->Array1();
 }
 
 inline const TColStd_Array1OfInteger& Approx_SweepApproximation::SurfVMults() const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
   return tabVMults->Array1();
 }
 
-inline  Standard_Integer Approx_SweepApproximation::NbCurves2d() const
+inline Standard_Integer Approx_SweepApproximation::NbCurves2d() const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
   return Num2DSS;
 }
 
-inline  Standard_Integer Approx_SweepApproximation::Curves2dDegree() const
+inline Standard_Integer Approx_SweepApproximation::Curves2dDegree() const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
-  if (seqPoles2d.Length() == 0) {throw Standard_DomainError();}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
+  if (seqPoles2d.Length() == 0)
+  {
+    throw Standard_DomainError();
+  }
   return deg2d;
 }
 
-inline const TColgp_Array1OfPnt2d& Approx_SweepApproximation::Curve2dPoles(const Standard_Integer Index) const
+inline const TColgp_Array1OfPnt2d& Approx_SweepApproximation::Curve2dPoles(
+  const Standard_Integer Index) const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
- if (seqPoles2d.Length() == 0) {throw Standard_DomainError();}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
+  if (seqPoles2d.Length() == 0)
+  {
+    throw Standard_DomainError();
+  }
   return seqPoles2d(Index)->Array1();
 }
 
 inline const TColStd_Array1OfReal& Approx_SweepApproximation::Curves2dKnots() const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
-  if (seqPoles2d.Length() == 0) {throw Standard_DomainError();}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
+  if (seqPoles2d.Length() == 0)
+  {
+    throw Standard_DomainError();
+  }
   return tab2dKnots->Array1();
 }
 
 inline const TColStd_Array1OfInteger& Approx_SweepApproximation::Curves2dMults() const
 {
-  if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
- if (seqPoles2d.Length() == 0) {throw Standard_DomainError();}
+  if (!done)
+  {
+    throw StdFail_NotDone(" Approx_SweepApproximation");
+  }
+  if (seqPoles2d.Length() == 0)
+  {
+    throw Standard_DomainError();
+  }
   return tab2dMults->Array1();
 }
 
-/* 
+/*
 inline  void Approx_SweepApproximation::TolReached(Standard_Real& Tol3d,Standard_Real& Tol2d) const
 {
 
index 66dba62da3ec8cf31b841e749efdb7054c043d5b..f70f9b5a5fcc93cdb5b74bf45f1818e8cdcd6485 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-
 #include <Approx_SweepFunction.hxx>
-#include <gp_Pnt.hxx>
 #include <Standard_NotImplemented.hxx>
 #include <Standard_Type.hxx>
+#include <gp_Pnt.hxx>
 
-IMPLEMENT_STANDARD_RTTIEXT(Approx_SweepFunction,Standard_Transient)
+IMPLEMENT_STANDARD_RTTIEXT(Approx_SweepFunction, Standard_Transient)
 
-// Standard_Boolean Approx_SweepFunction::D1(const Standard_Real Param,const Standard_Real First,const Standard_Real Last,TColgp_Array1OfPnt& Poles,TColgp_Array1OfVec& DPoles,TColgp_Array1OfPnt2d& Poles2d,TColgp_Array1OfVec2d& DPoles2d,TColStd_Array1OfReal& Weigths,TColStd_Array1OfReal& DWeigths) 
-Standard_Boolean Approx_SweepFunction::D1(const Standard_Real ,const Standard_Real ,const Standard_Real ,TColgp_Array1OfPnt& ,TColgp_Array1OfVec& ,TColgp_Array1OfPnt2d& ,TColgp_Array1OfVec2d& ,TColStd_Array1OfReal& ,TColStd_Array1OfReal& ) 
+// Standard_Boolean Approx_SweepFunction::D1(const Standard_Real Param,const Standard_Real
+// First,const Standard_Real Last,TColgp_Array1OfPnt& Poles,TColgp_Array1OfVec&
+// DPoles,TColgp_Array1OfPnt2d& Poles2d,TColgp_Array1OfVec2d& DPoles2d,TColStd_Array1OfReal&
+// Weigths,TColStd_Array1OfReal& DWeigths)
+Standard_Boolean Approx_SweepFunction::D1(const Standard_Real,
+                                          const Standard_Real,
+                                          const Standard_Real,
+                                          TColgp_Array1OfPnt&,
+                                          TColgp_Array1OfVec&,
+                                          TColgp_Array1OfPnt2d&,
+                                          TColgp_Array1OfVec2d&,
+                                          TColStd_Array1OfReal&,
+                                          TColStd_Array1OfReal&)
 {
- throw Standard_NotImplemented("Approx_SweepFunction::D1");
 throw Standard_NotImplemented("Approx_SweepFunction::D1");
 }
 
-// Standard_Boolean Approx_SweepFunction::D2(const Standard_Real Param,const Standard_Real First,const Standard_Real Last,TColgp_Array1OfPnt& Poles,TColgp_Array1OfVec& DPoles,TColgp_Array1OfVec& D2Poles,TColgp_Array1OfPnt2d& Poles2d,TColgp_Array1OfVec2d& DPoles2d,TColgp_Array1OfVec2d& D2Poles2d,TColStd_Array1OfReal& Weigths,TColStd_Array1OfReal& DWeigths,TColStd_Array1OfReal& D2Weigths) 
- Standard_Boolean Approx_SweepFunction::D2(const Standard_Real ,const Standard_Real ,const Standard_Real ,TColgp_Array1OfPnt& ,TColgp_Array1OfVec& ,TColgp_Array1OfVec& ,TColgp_Array1OfPnt2d& ,TColgp_Array1OfVec2d& ,TColgp_Array1OfVec2d& ,TColStd_Array1OfReal& ,TColStd_Array1OfReal& ,TColStd_Array1OfReal& ) 
+// Standard_Boolean Approx_SweepFunction::D2(const Standard_Real Param,const Standard_Real
+// First,const Standard_Real Last,TColgp_Array1OfPnt& Poles,TColgp_Array1OfVec&
+// DPoles,TColgp_Array1OfVec& D2Poles,TColgp_Array1OfPnt2d& Poles2d,TColgp_Array1OfVec2d&
+// DPoles2d,TColgp_Array1OfVec2d& D2Poles2d,TColStd_Array1OfReal& Weigths,TColStd_Array1OfReal&
+// DWeigths,TColStd_Array1OfReal& D2Weigths)
+Standard_Boolean Approx_SweepFunction::D2(const Standard_Real,
+                                          const Standard_Real,
+                                          const Standard_Real,
+                                          TColgp_Array1OfPnt&,
+                                          TColgp_Array1OfVec&,
+                                          TColgp_Array1OfVec&,
+                                          TColgp_Array1OfPnt2d&,
+                                          TColgp_Array1OfVec2d&,
+                                          TColgp_Array1OfVec2d&,
+                                          TColStd_Array1OfReal&,
+                                          TColStd_Array1OfReal&,
+                                          TColStd_Array1OfReal&)
 {
- throw Standard_NotImplemented("Approx_SweepFunction::D2");
 throw Standard_NotImplemented("Approx_SweepFunction::D2");
 }
 
-// void Approx_SweepFunction::Resolution(const Standard_Integer Index,const Standard_Real Tol,Standard_Real& TolU,Standard_Real& TolV) const
- void Approx_SweepFunction::Resolution(const Standard_Integer ,const Standard_Real ,Standard_Real& ,Standard_Real& ) const
+// void Approx_SweepFunction::Resolution(const Standard_Integer Index,const Standard_Real
+// Tol,Standard_Real& TolU,Standard_Real& TolV) const
+void Approx_SweepFunction::Resolution(const Standard_Integer,
+                                      const Standard_Real,
+                                      Standard_Real&,
+                                      Standard_Real&) const
 {
- throw Standard_NotImplemented("Approx_SweepFunction::Resolution");
 throw Standard_NotImplemented("Approx_SweepFunction::Resolution");
 }
 
- gp_Pnt Approx_SweepFunction::BarycentreOfSurf() const
+gp_Pnt Approx_SweepFunction::BarycentreOfSurf() const
 {
- throw Standard_NotImplemented("Approx_SweepFunction::BarycentreOfSurf");
 throw Standard_NotImplemented("Approx_SweepFunction::BarycentreOfSurf");
 }
 
- Standard_Real Approx_SweepFunction::MaximalSection() const
+Standard_Real Approx_SweepFunction::MaximalSection() const
 {
   throw Standard_NotImplemented("Approx_SweepFunction::MaximalSection()");
 }
 
 // void Approx_SweepFunction::GetMinimalWeight(TColStd_Array1OfReal& Weigths) const
- void Approx_SweepFunction::GetMinimalWeight(TColStd_Array1OfReal& ) const
+void Approx_SweepFunction::GetMinimalWeight(TColStd_Array1OfReal&) const
 {
- throw Standard_NotImplemented("Approx_SweepFunction::GetMinimalWeight");
 throw Standard_NotImplemented("Approx_SweepFunction::GetMinimalWeight");
 }
index c42f0800504056d9d063f34e4d96dcc5a90c1c94..2f6c4599d67004154dd7ed1a9c44d32f60ad8897 100644 (file)
 
 #include <Standard.hxx>
 
-#include <Standard_Transient.hxx>
+#include <GeomAbs_Shape.hxx>
+#include <Standard_Integer.hxx>
 #include <Standard_Real.hxx>
+#include <Standard_Transient.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColStd_Array1OfReal.hxx>
 #include <TColgp_Array1OfPnt.hxx>
 #include <TColgp_Array1OfPnt2d.hxx>
-#include <TColStd_Array1OfReal.hxx>
 #include <TColgp_Array1OfVec.hxx>
 #include <TColgp_Array1OfVec2d.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <GeomAbs_Shape.hxx>
 class gp_Pnt;
 
-
 class Approx_SweepFunction;
 DEFINE_STANDARD_HANDLE(Approx_SweepFunction, Standard_Transient)
 
@@ -41,106 +40,120 @@ class Approx_SweepFunction : public Standard_Transient
 {
 
 public:
-
-  
   //! compute the section for v = param
-  Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) = 0;
-  
+  Standard_EXPORT virtual Standard_Boolean D0(const Standard_Real   Param,
+                                              const Standard_Real   First,
+                                              const Standard_Real   Last,
+                                              TColgp_Array1OfPnt&   Poles,
+                                              TColgp_Array1OfPnt2d& Poles2d,
+                                              TColStd_Array1OfReal& Weigths) = 0;
+
   //! compute the first  derivative in v direction  of the
   //! section for v =  param
   //! Warning : It used only for C1 or C2 approximation
-  Standard_EXPORT virtual Standard_Boolean D1 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths);
-  
+  Standard_EXPORT virtual Standard_Boolean D1(const Standard_Real   Param,
+                                              const Standard_Real   First,
+                                              const Standard_Real   Last,
+                                              TColgp_Array1OfPnt&   Poles,
+                                              TColgp_Array1OfVec&   DPoles,
+                                              TColgp_Array1OfPnt2d& Poles2d,
+                                              TColgp_Array1OfVec2d& DPoles2d,
+                                              TColStd_Array1OfReal& Weigths,
+                                              TColStd_Array1OfReal& DWeigths);
+
   //! compute the second derivative  in v direction of the
   //! section  for v = param
   //! Warning : It used only for C2 approximation
-  Standard_EXPORT virtual Standard_Boolean D2 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfVec& D2Poles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColgp_Array1OfVec2d& D2Poles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths, TColStd_Array1OfReal& D2Weigths);
-  
+  Standard_EXPORT virtual Standard_Boolean D2(const Standard_Real   Param,
+                                              const Standard_Real   First,
+                                              const Standard_Real   Last,
+                                              TColgp_Array1OfPnt&   Poles,
+                                              TColgp_Array1OfVec&   DPoles,
+                                              TColgp_Array1OfVec&   D2Poles,
+                                              TColgp_Array1OfPnt2d& Poles2d,
+                                              TColgp_Array1OfVec2d& DPoles2d,
+                                              TColgp_Array1OfVec2d& D2Poles2d,
+                                              TColStd_Array1OfReal& Weigths,
+                                              TColStd_Array1OfReal& DWeigths,
+                                              TColStd_Array1OfReal& D2Weigths);
+
   //! get the number of 2d curves to  approximate.
   Standard_EXPORT virtual Standard_Integer Nb2dCurves() const = 0;
-  
+
   //! get the format of an  section
-  Standard_EXPORT virtual void SectionShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree) const = 0;
-  
+  Standard_EXPORT virtual void SectionShape(Standard_Integer& NbPoles,
+                                            Standard_Integer& NbKnots,
+                                            Standard_Integer& Degree) const = 0;
+
   //! get the Knots of the section
-  Standard_EXPORT virtual void Knots (TColStd_Array1OfReal& TKnots) const = 0;
-  
+  Standard_EXPORT virtual void Knots(TColStd_Array1OfReal& TKnots) const = 0;
+
   //! get the Multplicities of the section
-  Standard_EXPORT virtual void Mults (TColStd_Array1OfInteger& TMults) const = 0;
-  
+  Standard_EXPORT virtual void Mults(TColStd_Array1OfInteger& TMults) const = 0;
+
   //! Returns if the sections are rational or not
   Standard_EXPORT virtual Standard_Boolean IsRational() const = 0;
-  
+
   //! Returns  the number  of  intervals for  continuity
   //! <S>.
   //! May be one if Continuity(me) >= <S>
-  Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const = 0;
-  
+  Standard_EXPORT virtual Standard_Integer NbIntervals(const GeomAbs_Shape S) const = 0;
+
   //! Stores in <T> the  parameters bounding the intervals
   //! of continuity <S>.
   //!
   //! The array must provide  enough room to  accommodate
   //! for the parameters. i.e. T.Length() > NbIntervals()
-  Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const = 0;
-  
+  Standard_EXPORT virtual void Intervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const = 0;
+
   //! Sets the bounds of the parametric interval on
   //! the fonction
   //! This determines the derivatives in these values if the
   //! function is not Cn.
-  Standard_EXPORT virtual void SetInterval (const Standard_Real First, const Standard_Real Last) = 0;
-  
+  Standard_EXPORT virtual void SetInterval(const Standard_Real First, const Standard_Real Last) = 0;
+
   //! Returns the resolutions in the  sub-space 2d <Index>
   //! This information is usfull to find an good tolerance in
   //! 2d approximation.
-  Standard_EXPORT virtual void Resolution (const Standard_Integer Index, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const;
-  
+  Standard_EXPORT virtual void Resolution(const Standard_Integer Index,
+                                          const Standard_Real    Tol,
+                                          Standard_Real&         TolU,
+                                          Standard_Real&         TolV) const;
+
   //! Returns the tolerance to reach in approximation
   //! to satisfy.
   //! BoundTol error at the Boundary
   //! AngleTol tangent error at the Boundary (in radian)
   //! SurfTol error inside the surface.
-  Standard_EXPORT virtual void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, TColStd_Array1OfReal& Tol3d) const = 0;
-  
+  Standard_EXPORT virtual void GetTolerance(const Standard_Real   BoundTol,
+                                            const Standard_Real   SurfTol,
+                                            const Standard_Real   AngleTol,
+                                            TColStd_Array1OfReal& Tol3d) const = 0;
+
   //! Is useful, if (me) have to run numerical algorithm to perform D0, D1 or D2
-  Standard_EXPORT virtual void SetTolerance (const Standard_Real Tol3d, const Standard_Real Tol2d) = 0;
-  
+  Standard_EXPORT virtual void SetTolerance(const Standard_Real Tol3d,
+                                            const Standard_Real Tol2d) = 0;
+
   //! Get the barycentre of Surface.
   //! An very poor estimation is sufficient.
   //! This information is useful to perform well conditioned rational approximation.
   //! Warning: Used only if <me> IsRational
   Standard_EXPORT virtual gp_Pnt BarycentreOfSurf() const;
-  
+
   //! Returns the length of the greater section.
   //!  Thisinformation is useful to G1's control.
   //! Warning: With an little value, approximation can be slower.
   Standard_EXPORT virtual Standard_Real MaximalSection() const;
-  
+
   //! Compute the minimal value of weight for each poles in all  sections.
   //! This information is useful to control error in rational approximation.
   //! Warning: Used only if <me> IsRational
-  Standard_EXPORT virtual void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const;
-
+  Standard_EXPORT virtual void GetMinimalWeight(TColStd_Array1OfReal& Weigths) const;
 
-
-
-  DEFINE_STANDARD_RTTIEXT(Approx_SweepFunction,Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(Approx_SweepFunction, Standard_Transient)
 
 protected:
-
-
-
-
 private:
-
-
-
-
 };
 
-
-
-
-
-
-
 #endif // _Approx_SweepFunction_HeaderFile
index b115781ca5b3f76e558f88673cabcc39a7a0088d..b86f774a5f134decca5769e277758ce99be0bda6 100644 (file)
 // commercial license or contractual agreement.
 
 #include <AppParCurves_Constraint.hxx>
+#include <ApproxInt_KnotTools.hxx>
 #include <GeomAbs_SurfaceType.hxx>
+#include <IntSurf_PntOn2S.hxx>
 #include <IntSurf_Quadric.hxx>
+#include <Precision.hxx>
 #include <gp_Trsf.hxx>
 #include <gp_Trsf2d.hxx>
-#include <IntSurf_PntOn2S.hxx>
-#include <Precision.hxx>
-#include <ApproxInt_KnotTools.hxx>
 
 // If quantity of points is less than aMinNbPointsForApprox
 // then interpolation is used.
 const Standard_Integer aMinNbPointsForApprox = 5;
 
 // This constant should be removed in the future.
-const Standard_Real RatioTol = 1.5 ;
+const Standard_Real RatioTol = 1.5;
+
+//=================================================================================================
 
-//=======================================================================
-//function : ComputeTrsf3d
-//purpose  : 
-//=======================================================================
 static void ComputeTrsf3d(const Handle(TheWLine)& theline,
-                          Standard_Real& theXo,
-                          Standard_Real& theYo,
-                          Standard_Real& theZo)
+                          Standard_Real&          theXo,
+                          Standard_Real&          theYo,
+                          Standard_Real&          theZo)
 {
   const Standard_Integer aNbPnts = theline->NbPnts();
-  Standard_Real aXmin = RealLast(), aYmin = RealLast(), aZmin = RealLast();
-  for(Standard_Integer i=1;i<=aNbPnts;i++)
+  Standard_Real          aXmin = RealLast(), aYmin = RealLast(), aZmin = RealLast();
+  for (Standard_Integer i = 1; i <= aNbPnts; i++)
   {
     const gp_Pnt P = theline->Point(i).Value();
-    aXmin = Min(P.X(), aXmin);
-    aYmin = Min(P.Y(), aYmin);
-    aZmin = Min(P.Z(), aZmin);
+    aXmin          = Min(P.X(), aXmin);
+    aYmin          = Min(P.Y(), aYmin);
+    aZmin          = Min(P.Z(), aZmin);
   }
 
   theXo = -aXmin;
@@ -54,31 +52,29 @@ static void ComputeTrsf3d(const Handle(TheWLine)& theline,
   theZo = -aZmin;
 }
 
-//=======================================================================
-//function : ComputeTrsf2d
-//purpose  : 
-//=======================================================================
+//=================================================================================================
+
 static void ComputeTrsf2d(const Handle(TheWLine)& theline,
-                          const Standard_Boolean onFirst,
-                          Standard_Real& theUo,
-                          Standard_Real& theVo)
-{ 
+                          const Standard_Boolean  onFirst,
+                          Standard_Real&          theUo,
+                          Standard_Real&          theVo)
+{
   const Standard_Integer aNbPnts = theline->NbPnts();
-  Standard_Real aUmin = RealLast(), aVmin = RealLast();
+  Standard_Real          aUmin = RealLast(), aVmin = RealLast();
 
   // pointer to a member-function
-  void (IntSurf_PntOn2S::* pfunc)(Standard_Real&,Standard_Real&) const;
+  void (IntSurf_PntOn2S::*pfunc)(Standard_Real&, Standard_Real&) const;
 
   if (onFirst)
     pfunc = &IntSurf_PntOn2S::ParametersOnS1;
   else
     pfunc = &IntSurf_PntOn2S::ParametersOnS2;
-  
-  for(Standard_Integer i=1; i<=aNbPnts; i++)
+
+  for (Standard_Integer i = 1; i <= aNbPnts; i++)
   {
     const IntSurf_PntOn2S POn2S = theline->Point(i);
-    Standard_Real  U,V;
-    (POn2S.*pfunc)(U,V);
+    Standard_Real         U, V;
+    (POn2S.*pfunc)(U, V);
     aUmin = Min(U, aUmin);
     aVmin = Min(V, aVmin);
   }
@@ -87,112 +83,119 @@ static void ComputeTrsf2d(const Handle(TheWLine)& theline,
   theVo = -aVmin;
 }
 
-//=======================================================================
-//function : Parameters
-//purpose  :
-//=======================================================================
-void ApproxInt_Approx::Parameters(const ApproxInt_TheMultiLine& Line,
-                       const Standard_Integer firstP,
-                       const Standard_Integer lastP,
-                       const Approx_ParametrizationType Par,
-                       math_Vector& TheParameters)
+//=================================================================================================
+
+void ApproxInt_Approx::Parameters(const ApproxInt_TheMultiLine&    Line,
+                                  const Standard_Integer           firstP,
+                                  const Standard_Integer           lastP,
+                                  const Approx_ParametrizationType Par,
+                                  math_Vector&                     TheParameters)
 {
   Standard_Integer i, j, nbP2d, nbP3d;
-  Standard_Real dist;
+  Standard_Real    dist;
 
-  if (Par == Approx_ChordLength || Par == Approx_Centripetal) {
-    nbP3d = ApproxInt_TheMultiLineTool::NbP3d(Line);
-    nbP2d = ApproxInt_TheMultiLineTool::NbP2d(Line);
-    Standard_Integer mynbP3d=nbP3d, mynbP2d=nbP2d;
-    if (nbP3d == 0) mynbP3d = 1;
-    if (nbP2d == 0) mynbP2d = 1;
+  if (Par == Approx_ChordLength || Par == Approx_Centripetal)
+  {
+    nbP3d                    = ApproxInt_TheMultiLineTool::NbP3d(Line);
+    nbP2d                    = ApproxInt_TheMultiLineTool::NbP2d(Line);
+    Standard_Integer mynbP3d = nbP3d, mynbP2d = nbP2d;
+    if (nbP3d == 0)
+      mynbP3d = 1;
+    if (nbP2d == 0)
+      mynbP2d = 1;
 
     TheParameters(firstP) = 0.0;
-    dist = 0.0;
-    TColgp_Array1OfPnt tabP(1, mynbP3d);
-    TColgp_Array1OfPnt tabPP(1, mynbP3d);
+    dist                  = 0.0;
+    TColgp_Array1OfPnt   tabP(1, mynbP3d);
+    TColgp_Array1OfPnt   tabPP(1, mynbP3d);
     TColgp_Array1OfPnt2d tabP2d(1, mynbP2d);
     TColgp_Array1OfPnt2d tabPP2d(1, mynbP2d);
 
-    for (i = firstP+1; i <= lastP; i++) {
-      if (nbP3d != 0 && nbP2d != 0) ApproxInt_TheMultiLineTool::Value(Line, i-1, tabP, tabP2d);
-      else if (nbP2d != 0)          ApproxInt_TheMultiLineTool::Value(Line, i-1, tabP2d);
-      else if (nbP3d != 0)          ApproxInt_TheMultiLineTool::Value(Line, i-1, tabP);
-
-      if (nbP3d != 0 && nbP2d != 0) ApproxInt_TheMultiLineTool::Value(Line, i, tabPP, tabPP2d);
-      else if (nbP2d != 0)          ApproxInt_TheMultiLineTool::Value(Line, i, tabPP2d);
-      else if (nbP3d != 0)          ApproxInt_TheMultiLineTool::Value(Line, i, tabPP);
+    for (i = firstP + 1; i <= lastP; i++)
+    {
+      if (nbP3d != 0 && nbP2d != 0)
+        ApproxInt_TheMultiLineTool::Value(Line, i - 1, tabP, tabP2d);
+      else if (nbP2d != 0)
+        ApproxInt_TheMultiLineTool::Value(Line, i - 1, tabP2d);
+      else if (nbP3d != 0)
+        ApproxInt_TheMultiLineTool::Value(Line, i - 1, tabP);
+
+      if (nbP3d != 0 && nbP2d != 0)
+        ApproxInt_TheMultiLineTool::Value(Line, i, tabPP, tabPP2d);
+      else if (nbP2d != 0)
+        ApproxInt_TheMultiLineTool::Value(Line, i, tabPP2d);
+      else if (nbP3d != 0)
+        ApproxInt_TheMultiLineTool::Value(Line, i, tabPP);
       dist = 0;
-      for (j = 1; j <= nbP3d; j++) {
-        const gp_Pnt &aP1 = tabP(j),
-                     &aP2 = tabPP(j);
+      for (j = 1; j <= nbP3d; j++)
+      {
+        const gp_Pnt &aP1 = tabP(j), &aP2 = tabPP(j);
         dist += aP2.SquareDistance(aP1);
       }
-      for (j = 1; j <= nbP2d; j++) {
-        const gp_Pnt2d &aP12d = tabP2d(j),
-                       &aP22d = tabPP2d(j);
+      for (j = 1; j <= nbP2d; j++)
+      {
+        const gp_Pnt2d &aP12d = tabP2d(j), &aP22d = tabPP2d(j);
 
         dist += aP22d.SquareDistance(aP12d);
       }
 
       dist = Sqrt(dist);
-      if(Par == Approx_ChordLength)
+      if (Par == Approx_ChordLength)
       {
         TheParameters(i) = TheParameters(i - 1) + dist;
       }
       else
-      {// Par == Approx_Centripetal
+      { // Par == Approx_Centripetal
         TheParameters(i) = TheParameters(i - 1) + Sqrt(dist);
       }
     }
-    for (i = firstP; i <= lastP; i++) TheParameters(i) /= TheParameters(lastP);
+    for (i = firstP; i <= lastP; i++)
+      TheParameters(i) /= TheParameters(lastP);
   }
-  else {
-    for (i = firstP; i <= lastP; i++) {
-      TheParameters(i) = (Standard_Real(i)-firstP)/
-        (Standard_Real(lastP)-Standard_Real(firstP));
+  else
+  {
+    for (i = firstP; i <= lastP; i++)
+    {
+      TheParameters(i) =
+        (Standard_Real(i) - firstP) / (Standard_Real(lastP) - Standard_Real(firstP));
     }
   }
 }
 
-//=======================================================================
-//function : Default constructor
-//purpose  : 
-//=======================================================================
-ApproxInt_Approx::ApproxInt_Approx():
-                      myComputeLine(4, 8, 0.001, 0.001, 5),
-                      myComputeLineBezier(4, 8, 0.001, 0.001, 5),
-                      myWithTangency(Standard_True),
-                      myTol3d(0.001),
-                      myTol2d(0.001),
-                      myDegMin(4),
-                      myDegMax(8),
-                      myNbIterMax(5),
-                      myTolReached3d(0.0),
-                      myTolReached2d(0.0)
+//=================================================================================================
+
+ApproxInt_Approx::ApproxInt_Approx() :
+    myComputeLine(4, 8, 0.001, 0.001, 5),
+    myComputeLineBezier(4, 8, 0.001, 0.001, 5),
+    myWithTangency(Standard_True),
+    myTol3d(0.001),
+    myTol2d(0.001),
+    myDegMin(4),
+    myDegMax(8),
+    myNbIterMax(5),
+    myTolReached3d(0.0),
+    myTolReached2d(0.0)
 {
   myComputeLine.SetContinuity(2);
-  //myComputeLineBezier.SetContinuity(2);
+  // myComputeLineBezier.SetContinuity(2);
 }
 
-//=======================================================================
-//function : Perform
-//purpose  : Build without surfaces information.
-//=======================================================================
+//=================================================================================================
+
 void ApproxInt_Approx::Perform(const Handle(TheWLine)& theline,
-                               const Standard_Boolean ApproxXYZ,
-                               const Standard_Boolean ApproxU1V1,
-                               const Standard_Boolean ApproxU2V2,
-                               const Standard_Integer indicemin,
-                               const Standard_Integer indicemax)
+                               const Standard_Boolean  ApproxXYZ,
+                               const Standard_Boolean  ApproxU1V1,
+                               const Standard_Boolean  ApproxU2V2,
+                               const Standard_Integer  indicemin,
+                               const Standard_Integer  indicemax)
 {
   // Prepare DS.
   prepareDS(ApproxXYZ, ApproxU1V1, ApproxU2V2, indicemin, indicemax);
 
   const Standard_Integer nbpntbez = myData.indicemax - myData.indicemin;
-  if(nbpntbez < aMinNbPointsForApprox) 
+  if (nbpntbez < aMinNbPointsForApprox)
     myData.myBezierApprox = Standard_False;
-  else 
+  else
     myData.myBezierApprox = Standard_True;
 
   // Fill data structure.
@@ -200,33 +203,35 @@ void ApproxInt_Approx::Perform(const Handle(TheWLine)& theline,
 
   // Build knots.
   buildKnots(theline, NULL);
-  if (myKnots.Length() == 2 &&
-      indicemax - indicemin > 2 * myData.myNbPntMax)
+  if (myKnots.Length() == 2 && indicemax - indicemin > 2 * myData.myNbPntMax)
   {
     // At least 3 knots for BrepApprox.
     myKnots.ChangeLast() = (indicemax - indicemin) / 2;
     myKnots.Append(indicemax);
   }
 
-  myComputeLine.Init      (myDegMin, myDegMax, myTol3d, myTol2d, myNbIterMax, Standard_True, myData.parametrization);
-  myComputeLineBezier.Init(myDegMin, myDegMax, myTol3d, myTol2d, myNbIterMax, Standard_True, myData.parametrization);
+  myComputeLine
+    .Init(myDegMin, myDegMax, myTol3d, myTol2d, myNbIterMax, Standard_True, myData.parametrization);
+  myComputeLineBezier
+    .Init(myDegMin, myDegMax, myTol3d, myTol2d, myNbIterMax, Standard_True, myData.parametrization);
 
   buildCurve(theline, NULL);
 }
 
-//=======================================================================
-//function : Perform
-//purpose  : Definition of next steps according to surface types
+//=================================================================================================
+// function : Perform
+// purpose  : Definition of next steps according to surface types
 //            (i.e. coordination algorithm).
-//=======================================================================
-void ApproxInt_Approx::Perform(const ThePSurface& Surf1,
-                               const ThePSurface& Surf2,
+//=================================================================================================
+
+void ApproxInt_Approx::Perform(const ThePSurface&      Surf1,
+                               const ThePSurface&      Surf2,
                                const Handle(TheWLine)& theline,
-                               const Standard_Boolean ApproxXYZ,
-                               const Standard_Boolean ApproxU1V1,
-                               const Standard_Boolean ApproxU2V2,
-                               const Standard_Integer indicemin,
-                               const Standard_Integer indicemax) 
+                               const Standard_Boolean  ApproxXYZ,
+                               const Standard_Boolean  ApproxU1V1,
+                               const Standard_Boolean  ApproxU2V2,
+                               const Standard_Integer  indicemin,
+                               const Standard_Integer  indicemax)
 {
 
   myTolReached3d = myTolReached2d = 0.;
@@ -234,69 +239,70 @@ void ApproxInt_Approx::Perform(const ThePSurface& Surf1,
   const GeomAbs_SurfaceType typeS1 = ThePSurfaceTool::GetType(Surf1);
   const GeomAbs_SurfaceType typeS2 = ThePSurfaceTool::GetType(Surf2);
 
-  const Standard_Boolean isQuadric = ((typeS1 == GeomAbs_Plane) ||
-                                      (typeS1 == GeomAbs_Cylinder) ||
-                                      (typeS1 == GeomAbs_Sphere) ||
-                                      (typeS1 == GeomAbs_Cone) ||
-                                      (typeS2 == GeomAbs_Plane) ||
-                                      (typeS2 == GeomAbs_Cylinder) ||
-                                      (typeS2 == GeomAbs_Sphere) ||
-                                      (typeS2 == GeomAbs_Cone));
+  const Standard_Boolean isQuadric =
+    ((typeS1 == GeomAbs_Plane) || (typeS1 == GeomAbs_Cylinder) || (typeS1 == GeomAbs_Sphere) ||
+     (typeS1 == GeomAbs_Cone) || (typeS2 == GeomAbs_Plane) || (typeS2 == GeomAbs_Cylinder) ||
+     (typeS2 == GeomAbs_Sphere) || (typeS2 == GeomAbs_Cone));
 
-  if(isQuadric)
+  if (isQuadric)
   {
-    IntSurf_Quadric Quad;
-    Standard_Boolean SecondIsImplicit=Standard_False;
+    IntSurf_Quadric  Quad;
+    Standard_Boolean SecondIsImplicit = Standard_False;
     switch (typeS1)
     {
-    case GeomAbs_Plane:
-      Quad.SetValue(ThePSurfaceTool::Plane(Surf1));
-      break;
+      case GeomAbs_Plane:
+        Quad.SetValue(ThePSurfaceTool::Plane(Surf1));
+        break;
 
-    case GeomAbs_Cylinder:
-      Quad.SetValue(ThePSurfaceTool::Cylinder(Surf1));
-      break;
+      case GeomAbs_Cylinder:
+        Quad.SetValue(ThePSurfaceTool::Cylinder(Surf1));
+        break;
 
-    case GeomAbs_Sphere:
-      Quad.SetValue(ThePSurfaceTool::Sphere(Surf1));
-      break;
+      case GeomAbs_Sphere:
+        Quad.SetValue(ThePSurfaceTool::Sphere(Surf1));
+        break;
 
-    case GeomAbs_Cone:
-      Quad.SetValue(ThePSurfaceTool::Cone(Surf1));
-      break;
+      case GeomAbs_Cone:
+        Quad.SetValue(ThePSurfaceTool::Cone(Surf1));
+        break;
 
-    default:
-      {
+      default: {
         SecondIsImplicit = Standard_True;
         switch (typeS2)
         {
-        case GeomAbs_Plane:
-          Quad.SetValue(ThePSurfaceTool::Plane(Surf2));
-          break;
+          case GeomAbs_Plane:
+            Quad.SetValue(ThePSurfaceTool::Plane(Surf2));
+            break;
 
-        case GeomAbs_Cylinder:
-          Quad.SetValue(ThePSurfaceTool::Cylinder(Surf2));
-          break;
+          case GeomAbs_Cylinder:
+            Quad.SetValue(ThePSurfaceTool::Cylinder(Surf2));
+            break;
 
-        case GeomAbs_Sphere:
-          Quad.SetValue(ThePSurfaceTool::Sphere(Surf2));
-          break;
+          case GeomAbs_Sphere:
+            Quad.SetValue(ThePSurfaceTool::Sphere(Surf2));
+            break;
 
-        case GeomAbs_Cone:
-          Quad.SetValue(ThePSurfaceTool::Cone(Surf2));
-          break;
+          case GeomAbs_Cone:
+            Quad.SetValue(ThePSurfaceTool::Cone(Surf2));
+            break;
 
-        default:
-          break;
-        }//switch (typeS2)
+          default:
+            break;
+        } // switch (typeS2)
       }
 
       break;
-    }//switch (typeS1)
-
-    Perform(Quad, (SecondIsImplicit? Surf1: Surf2), theline,
-            ApproxXYZ, ApproxU1V1, ApproxU2V2,
-            indicemin, indicemax, !SecondIsImplicit);
+    } // switch (typeS1)
+
+    Perform(Quad,
+            (SecondIsImplicit ? Surf1 : Surf2),
+            theline,
+            ApproxXYZ,
+            ApproxU1V1,
+            ApproxU2V2,
+            indicemin,
+            indicemax,
+            !SecondIsImplicit);
 
     return;
   }
@@ -307,15 +313,15 @@ void ApproxInt_Approx::Perform(const ThePSurface& Surf1,
   prepareDS(ApproxXYZ, ApproxU1V1, ApproxU2V2, indicemin, indicemax);
 
   // Non-analytical case: Param-Param perform.
-  ApproxInt_ThePrmPrmSvSurfaces myPrmPrmSvSurfaces(Surf1,Surf2);
+  ApproxInt_ThePrmPrmSvSurfaces myPrmPrmSvSurfaces(Surf1, Surf2);
 
-  Standard_Integer nbpntbez = indicemax-indicemin;
+  Standard_Integer nbpntbez = indicemax - indicemin;
 
-  if(nbpntbez < aMinNbPointsForApprox)
+  if (nbpntbez < aMinNbPointsForApprox)
   {
     myData.myBezierApprox = Standard_False;
   }
-  else 
+  else
   {
     myData.myBezierApprox = Standard_True;
   }
@@ -323,55 +329,56 @@ void ApproxInt_Approx::Perform(const ThePSurface& Surf1,
   // Fill data structure.
   fillData(theline);
 
-  const Standard_Boolean cut = myData.myBezierApprox;
+  const Standard_Boolean cut       = myData.myBezierApprox;
   const Standard_Address ptrsvsurf = &myPrmPrmSvSurfaces;
 
   // Build knots.
   buildKnots(theline, ptrsvsurf);
 
-  myComputeLine.Init      ( myDegMin, myDegMax, myTol3d, myTol2d,
-                            myNbIterMax, cut, myData.parametrization);
-  myComputeLineBezier.Init( myDegMin, myDegMax, myTol3d, myTol2d,
-                            myNbIterMax, cut, myData.parametrization);
+  myComputeLine
+    .Init(myDegMin, myDegMax, myTol3d, myTol2d, myNbIterMax, cut, myData.parametrization);
+  myComputeLineBezier
+    .Init(myDegMin, myDegMax, myTol3d, myTol2d, myNbIterMax, cut, myData.parametrization);
 
   buildCurve(theline, ptrsvsurf);
 }
 
-//=======================================================================
-//function : Perform
-//purpose  : Analytic-Param perform.
-//=======================================================================
-void ApproxInt_Approx::Perform(const TheISurface& ISurf,
-                               const ThePSurface& PSurf,
+//=================================================================================================
+// function : Perform
+// purpose  : Analytic-Param perform.
+//=================================================================================================
+
+void ApproxInt_Approx::Perform(const TheISurface&      ISurf,
+                               const ThePSurface&      PSurf,
                                const Handle(TheWLine)& theline,
-                               const Standard_Boolean ApproxXYZ,
-                               const Standard_Boolean ApproxU1V1,
-                               const Standard_Boolean ApproxU2V2,
-                               const Standard_Integer indicemin,
-                               const Standard_Integer indicemax,
-                               const Standard_Boolean isTheQuadFirst)
+                               const Standard_Boolean  ApproxXYZ,
+                               const Standard_Boolean  ApproxU1V1,
+                               const Standard_Boolean  ApproxU2V2,
+                               const Standard_Integer  indicemin,
+                               const Standard_Integer  indicemax,
+                               const Standard_Boolean  isTheQuadFirst)
 {
   // Prepare DS.
   prepareDS(ApproxXYZ, ApproxU1V1, ApproxU2V2, indicemin, indicemax);
 
   // Non-analytical case: Analytic-Param perform.
-  ApproxInt_TheImpPrmSvSurfaces myImpPrmSvSurfaces = 
-                          isTheQuadFirst? ApproxInt_TheImpPrmSvSurfaces(ISurf, PSurf):
-                                          ApproxInt_TheImpPrmSvSurfaces(PSurf, ISurf);
+  ApproxInt_TheImpPrmSvSurfaces myImpPrmSvSurfaces =
+    isTheQuadFirst ? ApproxInt_TheImpPrmSvSurfaces(ISurf, PSurf)
+                   : ApproxInt_TheImpPrmSvSurfaces(PSurf, ISurf);
 
   myImpPrmSvSurfaces.SetUseSolver(Standard_False);
 
-  const Standard_Integer nbpntbez = indicemax-indicemin;
-  if(nbpntbez < aMinNbPointsForApprox)
+  const Standard_Integer nbpntbez = indicemax - indicemin;
+  if (nbpntbez < aMinNbPointsForApprox)
   {
     myData.myBezierApprox = Standard_False;
   }
-  else 
+  else
   {
     myData.myBezierApprox = Standard_True;
   }
 
-  const Standard_Boolean cut = myData.myBezierApprox;
+  const Standard_Boolean cut       = myData.myBezierApprox;
   const Standard_Address ptrsvsurf = &myImpPrmSvSurfaces;
 
   // Fill data structure.
@@ -380,157 +387,139 @@ void ApproxInt_Approx::Perform(const TheISurface& ISurf,
   // Build knots.
   buildKnots(theline, ptrsvsurf);
 
-  myComputeLine.Init      ( myDegMin, myDegMax, myTol3d, myTol2d,
-                            myNbIterMax, cut, myData.parametrization);
-  myComputeLineBezier.Init( myDegMin, myDegMax, myTol3d, myTol2d,
-                            myNbIterMax, cut, myData.parametrization);
+  myComputeLine
+    .Init(myDegMin, myDegMax, myTol3d, myTol2d, myNbIterMax, cut, myData.parametrization);
+  myComputeLineBezier
+    .Init(myDegMin, myDegMax, myTol3d, myTol2d, myNbIterMax, cut, myData.parametrization);
 
   buildCurve(theline, ptrsvsurf);
 }
 
-//=======================================================================
-//function : SetParameters
-//purpose  : 
-//=======================================================================
-void ApproxInt_Approx::SetParameters( const Standard_Real Tol3d,
-                                      const Standard_Real Tol2d,
-                                      const Standard_Integer DegMin,
-                                      const Standard_Integer DegMax,
-                                      const Standard_Integer NbIterMax,
-                                      const Standard_Integer NbPntMax,
-                                      const Standard_Boolean ApproxWithTangency,
-                                      const Approx_ParametrizationType Parametrization)
+//=================================================================================================
+
+void ApproxInt_Approx::SetParameters(const Standard_Real              Tol3d,
+                                     const Standard_Real              Tol2d,
+                                     const Standard_Integer           DegMin,
+                                     const Standard_Integer           DegMax,
+                                     const Standard_Integer           NbIterMax,
+                                     const Standard_Integer           NbPntMax,
+                                     const Standard_Boolean           ApproxWithTangency,
+                                     const Approx_ParametrizationType Parametrization)
 {
   myData.myNbPntMax = NbPntMax;
-  myWithTangency = ApproxWithTangency;
-  myTol3d        = Tol3d/RatioTol;
-  myTol2d        = Tol2d/RatioTol;
-  myDegMin       = DegMin;
-  myDegMax       = DegMax;
-  myNbIterMax    = NbIterMax;
-
-  myComputeLine.Init      ( myDegMin, myDegMax, myTol3d, myTol2d,
-                            myNbIterMax, Standard_True, Parametrization);
-  myComputeLineBezier.Init( myDegMin, myDegMax, myTol3d, myTol2d,
-                            myNbIterMax, Standard_True, Parametrization);
-
-  if(!ApproxWithTangency)
-  { 
-    myComputeLine.SetConstraints(AppParCurves_PassPoint,AppParCurves_PassPoint);
-    myComputeLineBezier.SetConstraints(AppParCurves_PassPoint,AppParCurves_PassPoint);
+  myWithTangency    = ApproxWithTangency;
+  myTol3d           = Tol3d / RatioTol;
+  myTol2d           = Tol2d / RatioTol;
+  myDegMin          = DegMin;
+  myDegMax          = DegMax;
+  myNbIterMax       = NbIterMax;
+
+  myComputeLine
+    .Init(myDegMin, myDegMax, myTol3d, myTol2d, myNbIterMax, Standard_True, Parametrization);
+  myComputeLineBezier
+    .Init(myDegMin, myDegMax, myTol3d, myTol2d, myNbIterMax, Standard_True, Parametrization);
+
+  if (!ApproxWithTangency)
+  {
+    myComputeLine.SetConstraints(AppParCurves_PassPoint, AppParCurves_PassPoint);
+    myComputeLineBezier.SetConstraints(AppParCurves_PassPoint, AppParCurves_PassPoint);
   }
-  
+
   myData.myBezierApprox = Standard_True;
 }
 
-//=======================================================================
-//function : NbMultiCurves
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Integer ApproxInt_Approx::NbMultiCurves() const
 {
   return 1;
 }
 
-//=======================================================================
-//function : UpdateTolReached
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 void ApproxInt_Approx::UpdateTolReached()
 {
   if (myData.myBezierApprox)
   {
-    const Standard_Integer NbCurves = myComputeLineBezier.NbMultiCurves() ;
-    for (Standard_Integer ICur = 1 ; ICur <= NbCurves ; ICur++)
+    const Standard_Integer NbCurves = myComputeLineBezier.NbMultiCurves();
+    for (Standard_Integer ICur = 1; ICur <= NbCurves; ICur++)
     {
-      Standard_Real Tol3D, Tol2D ;
-      myComputeLineBezier.Error (ICur, Tol3D, Tol2D) ;
+      Standard_Real Tol3D, Tol2D;
+      myComputeLineBezier.Error(ICur, Tol3D, Tol2D);
       myTolReached3d = Max(myTolReached3d, Tol3D);
       myTolReached2d = Max(myTolReached2d, Tol2D);
     }
   }
   else
   {
-    myComputeLine.Error (myTolReached3d, myTolReached2d);
+    myComputeLine.Error(myTolReached3d, myTolReached2d);
   }
 }
 
-//=======================================================================
-//function : TolReached3d
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Real ApproxInt_Approx::TolReached3d() const
 {
   return myTolReached3d * RatioTol;
 }
 
-//=======================================================================
-//function : TolReached2d
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Real ApproxInt_Approx::TolReached2d() const
 {
   return myTolReached2d * RatioTol;
 }
 
-//=======================================================================
-//function : IsDone
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean ApproxInt_Approx::IsDone() const
 {
-  if(myData.myBezierApprox)
-  { 
-    return(myComputeLineBezier.NbMultiCurves() > 0);
+  if (myData.myBezierApprox)
+  {
+    return (myComputeLineBezier.NbMultiCurves() > 0);
   }
   else
   {
-    return(myComputeLine.IsToleranceReached());
+    return (myComputeLine.IsToleranceReached());
   }
 }
 
-//=======================================================================
-//function : Value
-//purpose  :
-//=======================================================================
-const AppParCurves_MultiBSpCurve& ApproxInt_Approx::Value(const Standard_Integer ) const
+//=================================================================================================
+
+const AppParCurves_MultiBSpCurve& ApproxInt_Approx::Value(const Standard_Integer) const
 {
-  if(myData.myBezierApprox)
-  { 
-    return(myBezToBSpl.Value());
+  if (myData.myBezierApprox)
+  {
+    return (myBezToBSpl.Value());
   }
   else
-  { 
-    return(myComputeLine.Value());
+  {
+    return (myComputeLine.Value());
   }
 }
 
-//=======================================================================
-//function : fillData
-//purpose  : Fill ApproxInt data structure.
-//=======================================================================
+//=================================================================================================
+
 void ApproxInt_Approx::fillData(const Handle(TheWLine)& theline)
 {
-  if(myData.ApproxXYZ)
+  if (myData.ApproxXYZ)
     ComputeTrsf3d(theline, myData.Xo, myData.Yo, myData.Zo);
   else
     myData.Xo = myData.Yo = myData.Zo = 0.0;
 
-  if(myData.ApproxU1V1)
+  if (myData.ApproxU1V1)
     ComputeTrsf2d(theline, Standard_True, myData.U1o, myData.V1o);
   else
     myData.U1o = myData.V1o = 0.0;
 
-  if(myData.ApproxU2V2)
+  if (myData.ApproxU2V2)
     ComputeTrsf2d(theline, Standard_False, myData.U2o, myData.V2o);
   else
     myData.U2o = myData.V2o = 0.0;
 }
 
-//=======================================================================
-//function : prepareDS
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 void ApproxInt_Approx::prepareDS(const Standard_Boolean theApproxXYZ,
                                  const Standard_Boolean theApproxU1V1,
                                  const Standard_Boolean theApproxU2V2,
@@ -538,64 +527,73 @@ void ApproxInt_Approx::prepareDS(const Standard_Boolean theApproxXYZ,
                                  const Standard_Integer theIndicemax)
 {
   myTolReached3d = myTolReached2d = 0.0;
-  myData.ApproxU1V1 = theApproxU1V1;
-  myData.ApproxU2V2 = theApproxU2V2;
-  myData.ApproxXYZ = theApproxXYZ;
-  myData.indicemin = theIndicemin;
-  myData.indicemax = theIndicemax;
-  myData.parametrization = myComputeLineBezier.Parametrization();
+  myData.ApproxU1V1               = theApproxU1V1;
+  myData.ApproxU2V2               = theApproxU2V2;
+  myData.ApproxXYZ                = theApproxXYZ;
+  myData.indicemin                = theIndicemin;
+  myData.indicemax                = theIndicemax;
+  myData.parametrization          = myComputeLineBezier.Parametrization();
 }
 
-//=======================================================================
-//function : buildKnots
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 void ApproxInt_Approx::buildKnots(const Handle(TheWLine)& theline,
-                                  const Standard_Address thePtrSVSurf)
+                                  const Standard_Address  thePtrSVSurf)
 {
   myKnots.Clear();
-  if(!myData.myBezierApprox)
+  if (!myData.myBezierApprox)
   {
     myKnots.Append(myData.indicemin);
     myKnots.Append(myData.indicemax);
     return;
   }
 
-  const ApproxInt_TheMultiLine aTestLine( theline, thePtrSVSurf,
-                                          ((myData.ApproxXYZ)? 1 : 0),
-                                          ((myData.ApproxU1V1)? 1: 0) + ((myData.ApproxU2V2)? 1: 0),
-                                          myData.ApproxU1V1, myData.ApproxU2V2,
-                                          myData.Xo, myData.Yo, myData.Zo,
-                                          myData.U1o, myData.V1o, myData.U2o, myData.V2o,
-                                          myData.ApproxU1V1,
-                                          myData.indicemin, myData.indicemax);
-
-  const Standard_Integer  nbp3d = aTestLine.NbP3d(),
-                          nbp2d = aTestLine.NbP2d();
-  TColgp_Array1OfPnt aTabPnt3d(1, Max(1, nbp3d));
-  TColgp_Array1OfPnt2d aTabPnt2d(1, Max(1, nbp2d));
-  TColgp_Array1OfPnt aPntXYZ(myData.indicemin, myData.indicemax);
-  TColgp_Array1OfPnt2d aPntU1V1(myData.indicemin, myData.indicemax);
-  TColgp_Array1OfPnt2d aPntU2V2(myData.indicemin, myData.indicemax);
-
-  for(Standard_Integer i = myData.indicemin; i <= myData.indicemax; ++i)
+  const ApproxInt_TheMultiLine aTestLine(theline,
+                                         thePtrSVSurf,
+                                         ((myData.ApproxXYZ) ? 1 : 0),
+                                         ((myData.ApproxU1V1) ? 1 : 0) +
+                                           ((myData.ApproxU2V2) ? 1 : 0),
+                                         myData.ApproxU1V1,
+                                         myData.ApproxU2V2,
+                                         myData.Xo,
+                                         myData.Yo,
+                                         myData.Zo,
+                                         myData.U1o,
+                                         myData.V1o,
+                                         myData.U2o,
+                                         myData.V2o,
+                                         myData.ApproxU1V1,
+                                         myData.indicemin,
+                                         myData.indicemax);
+
+  const Standard_Integer nbp3d = aTestLine.NbP3d(), nbp2d = aTestLine.NbP2d();
+  TColgp_Array1OfPnt     aTabPnt3d(1, Max(1, nbp3d));
+  TColgp_Array1OfPnt2d   aTabPnt2d(1, Max(1, nbp2d));
+  TColgp_Array1OfPnt     aPntXYZ(myData.indicemin, myData.indicemax);
+  TColgp_Array1OfPnt2d   aPntU1V1(myData.indicemin, myData.indicemax);
+  TColgp_Array1OfPnt2d   aPntU2V2(myData.indicemin, myData.indicemax);
+
+  for (Standard_Integer i = myData.indicemin; i <= myData.indicemax; ++i)
   {
-    if (nbp3d != 0 && nbp2d != 0) aTestLine.Value(i, aTabPnt3d, aTabPnt2d);
-    else if (nbp2d != 0)          aTestLine.Value(i, aTabPnt2d);
-    else if (nbp3d != 0)          aTestLine.Value(i, aTabPnt3d);
+    if (nbp3d != 0 && nbp2d != 0)
+      aTestLine.Value(i, aTabPnt3d, aTabPnt2d);
+    else if (nbp2d != 0)
+      aTestLine.Value(i, aTabPnt2d);
+    else if (nbp3d != 0)
+      aTestLine.Value(i, aTabPnt3d);
     //
-    if(nbp3d > 0)
+    if (nbp3d > 0)
     {
       aPntXYZ(i) = aTabPnt3d(1);
     }
-    if(nbp2d > 1)
+    if (nbp2d > 1)
     {
       aPntU1V1(i) = aTabPnt2d(1);
       aPntU2V2(i) = aTabPnt2d(2);
     }
-    else if(nbp2d > 0)
+    else if (nbp2d > 0)
     {
-      if(myData.ApproxU1V1)
+      if (myData.ApproxU1V1)
       {
         aPntU1V1(i) = aTabPnt2d(1);
       }
@@ -612,18 +610,23 @@ void ApproxInt_Approx::buildKnots(const Handle(TheWLine)& theline,
   math_Vector aPars(myData.indicemin, myData.indicemax);
   Parameters(aTestLine, myData.indicemin, myData.indicemax, myData.parametrization, aPars);
 
-  ApproxInt_KnotTools::BuildKnots(aPntXYZ, aPntU1V1, aPntU2V2, aPars,
-    myData.ApproxXYZ, myData.ApproxU1V1, myData.ApproxU2V2, aMinNbPnts, myKnots);
+  ApproxInt_KnotTools::BuildKnots(aPntXYZ,
+                                  aPntU1V1,
+                                  aPntU2V2,
+                                  aPars,
+                                  myData.ApproxXYZ,
+                                  myData.ApproxU1V1,
+                                  myData.ApproxU2V2,
+                                  aMinNbPnts,
+                                  myKnots);
 }
 
-//=======================================================================
-//function : buildCurve
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 void ApproxInt_Approx::buildCurve(const Handle(TheWLine)& theline,
-                                  const Standard_Address thePtrSVSurf)
+                                  const Standard_Address  thePtrSVSurf)
 {
-  if(myData.myBezierApprox)
+  if (myData.myBezierApprox)
   {
     myBezToBSpl.Reset();
   }
@@ -635,15 +638,26 @@ void ApproxInt_Approx::buildCurve(const Handle(TheWLine)& theline,
   {
     // Base cycle: iterate over knots.
     imin = myKnots(kind);
-    imax = myKnots(kind+1);
-    ApproxInt_TheMultiLine myMultiLine(theline, thePtrSVSurf,
-                                       ((myData.ApproxXYZ)? 1 : 0),
-                                       ((myData.ApproxU1V1)? 1: 0) + ((myData.ApproxU2V2)? 1: 0),
-                                       myData.ApproxU1V1, myData.ApproxU2V2,
-                                       myData.Xo, myData.Yo, myData.Zo, myData.U1o, myData.V1o,
-                                       myData.U2o, myData.V2o, myData.ApproxU1V1, imin, imax);
-
-    if(myData.myBezierApprox)
+    imax = myKnots(kind + 1);
+    ApproxInt_TheMultiLine myMultiLine(theline,
+                                       thePtrSVSurf,
+                                       ((myData.ApproxXYZ) ? 1 : 0),
+                                       ((myData.ApproxU1V1) ? 1 : 0) +
+                                         ((myData.ApproxU2V2) ? 1 : 0),
+                                       myData.ApproxU1V1,
+                                       myData.ApproxU2V2,
+                                       myData.Xo,
+                                       myData.Yo,
+                                       myData.Zo,
+                                       myData.U1o,
+                                       myData.V1o,
+                                       myData.U2o,
+                                       myData.V2o,
+                                       myData.ApproxU1V1,
+                                       imin,
+                                       imax);
+
+    if (myData.myBezierApprox)
     {
       myComputeLineBezier.Perform(myMultiLine);
       if (myComputeLineBezier.NbMultiCurves() == 0)
@@ -657,28 +671,42 @@ void ApproxInt_Approx::buildCurve(const Handle(TheWLine)& theline,
     UpdateTolReached();
 
     Standard_Integer indice3d = 1, indice2d1 = 2, indice2d2 = 3;
-    if(!myData.ApproxXYZ)  { indice2d1--; indice2d2--; } 
-    if(!myData.ApproxU1V1) { indice2d2--; } 
-    if(myData.ApproxXYZ)
-    { 
-      if(myData.myBezierApprox)
+    if (!myData.ApproxXYZ)
+    {
+      indice2d1--;
+      indice2d2--;
+    }
+    if (!myData.ApproxU1V1)
+    {
+      indice2d2--;
+    }
+    if (myData.ApproxXYZ)
+    {
+      if (myData.myBezierApprox)
       {
-        for(Standard_Integer nbmc = myComputeLineBezier.NbMultiCurves() ; nbmc>=1; nbmc--)
+        for (Standard_Integer nbmc = myComputeLineBezier.NbMultiCurves(); nbmc >= 1; nbmc--)
         {
-          myComputeLineBezier.ChangeValue(nbmc).Transform(indice3d, -myData.Xo, 1.0, -myData.Yo, 1.0, -myData.Zo, 1.0);
+          myComputeLineBezier.ChangeValue(nbmc)
+            .Transform(indice3d, -myData.Xo, 1.0, -myData.Yo, 1.0, -myData.Zo, 1.0);
         }
       }
       else
       {
-        myComputeLine.ChangeValue().Transform(indice3d, -myData.Xo, 1.0, -myData.Yo, 1.0, -myData.Zo, 1.0);
+        myComputeLine.ChangeValue()
+          .Transform(indice3d, -myData.Xo, 1.0, -myData.Yo, 1.0, -myData.Zo, 1.0);
       }
     }
-    if(myData.ApproxU1V1)
+    if (myData.ApproxU1V1)
     {
-      if(myData.myBezierApprox) {
-        for(Standard_Integer nbmc = myComputeLineBezier.NbMultiCurves() ; nbmc>=1; nbmc--)
+      if (myData.myBezierApprox)
+      {
+        for (Standard_Integer nbmc = myComputeLineBezier.NbMultiCurves(); nbmc >= 1; nbmc--)
         {
-          myComputeLineBezier.ChangeValue(nbmc).Transform2d(indice2d1, -myData.U1o, 1.0, -myData.V1o, 1.0);
+          myComputeLineBezier.ChangeValue(nbmc).Transform2d(indice2d1,
+                                                            -myData.U1o,
+                                                            1.0,
+                                                            -myData.V1o,
+                                                            1.0);
         }
       }
       else
@@ -686,13 +714,17 @@ void ApproxInt_Approx::buildCurve(const Handle(TheWLine)& theline,
         myComputeLine.ChangeValue().Transform2d(indice2d1, -myData.U1o, 1.0, -myData.V1o, 1.0);
       }
     }
-    if(myData.ApproxU2V2)
+    if (myData.ApproxU2V2)
     {
-      if(myData.myBezierApprox)
+      if (myData.myBezierApprox)
       {
-        for(Standard_Integer nbmc = myComputeLineBezier.NbMultiCurves() ; nbmc>=1; nbmc--)
+        for (Standard_Integer nbmc = myComputeLineBezier.NbMultiCurves(); nbmc >= 1; nbmc--)
         {
-          myComputeLineBezier.ChangeValue(nbmc).Transform2d(indice2d2, -myData.U2o, 1.0, -myData.V2o, 1.0);
+          myComputeLineBezier.ChangeValue(nbmc).Transform2d(indice2d2,
+                                                            -myData.U2o,
+                                                            1.0,
+                                                            -myData.V2o,
+                                                            1.0);
         }
       }
       else
@@ -702,24 +734,21 @@ void ApproxInt_Approx::buildCurve(const Handle(TheWLine)& theline,
     }
 
     OtherInter = Standard_False;
-    if(myData.myBezierApprox)
+    if (myData.myBezierApprox)
     {
-      for(Standard_Integer nbmc = 1; 
-        nbmc <= myComputeLineBezier.NbMultiCurves();
-        nbmc++)
+      for (Standard_Integer nbmc = 1; nbmc <= myComputeLineBezier.NbMultiCurves(); nbmc++)
       {
-          myBezToBSpl.Append(myComputeLineBezier.Value(nbmc));
+        myBezToBSpl.Append(myComputeLineBezier.Value(nbmc));
       }
       kind++;
-      if(kind < myKnots.Upper())
+      if (kind < myKnots.Upper())
       {
         OtherInter = Standard_True;
       }
     }
-  }
-  while(OtherInter);
+  } while (OtherInter);
 
-  if(myData.myBezierApprox)
+  if (myData.myBezierApprox)
   {
     myBezToBSpl.Perform();
   }
index 6c992b70792f3aa0d97670aeb4519ca943464d3c..537adf6645ff27abe31ecbe1cef4ea8115075b51 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <GeomAbs_SurfaceType.hxx>
 #include <IntSurf_PntOn2S.hxx>
+#include <Precision.hxx>
+#include <StdFail_NotDone.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <math_FunctionSetRoot.hxx>
-#include <StdFail_NotDone.hxx>
-#include <GeomAbs_SurfaceType.hxx>
-#include <Precision.hxx>
 
-//=======================================================================
-//function : IsSingular
-//purpose  :    Returns TRUE if vectors theDU || theDV or if at least one
+//=================================================================================================
+// function : IsSingular
+// purpose  :    Returns TRUE if vectors theDU || theDV or if at least one
 //            of them has null-magnitude.
 //              theSqLinTol is square of linear tolerance.
 //              theAngTol is angular tolerance.
-//=======================================================================
-static Standard_Boolean IsSingular( const gp_Vec& theDU,
-                                    const gp_Vec& theDV,
-                                    const Standard_Real theSqLinTol,
-                                    const Standard_Real theAngTol)
+//=================================================================================================
+
+static Standard_Boolean IsSingular(const gp_Vec&       theDU,
+                                   const gp_Vec&       theDV,
+                                   const Standard_Real theSqLinTol,
+                                   const Standard_Real theAngTol)
 {
   gp_Vec aDU(theDU), aDV(theDV);
 
-  const Standard_Real aSqMagnDU = aDU.SquareMagnitude(),
-                      aSqMagnDV = aDV.SquareMagnitude();
+  const Standard_Real aSqMagnDU = aDU.SquareMagnitude(), aSqMagnDV = aDV.SquareMagnitude();
 
-  if(aSqMagnDU < theSqLinTol)
+  if (aSqMagnDU < theSqLinTol)
     return Standard_True;
 
   aDU.Divide(sqrt(aSqMagnDU));
 
-  if(aSqMagnDV < theSqLinTol)
+  if (aSqMagnDV < theSqLinTol)
     return Standard_True;
 
   aDV.Divide(sqrt(aSqMagnDV));
 
-  //Here aDU and aDV vectors have magnitude 1.0.
+  // Here aDU and aDV vectors have magnitude 1.0.
 
-  if(aDU.Crossed(aDV).SquareMagnitude() < theAngTol*theAngTol)
+  if (aDU.Crossed(aDV).SquareMagnitude() < theAngTol * theAngTol)
     return Standard_True;
 
   return Standard_False;
 }
 
-//=======================================================================
-//function : SingularProcessing
-//purpose  :    Computes 2D-representation (in UV-coordinates) of 
+//=================================================================================================
+// function : SingularProcessing
+// purpose  :    Computes 2D-representation (in UV-coordinates) of
 //            theTg3D vector on the surface in case when
 //            theDU.Crossed(theDV).Magnitude() == 0.0. Stores result in
 //            theTg2D variable.
 //              theDU and theDV are vectors of 1st derivative
 //            (with respect to U and V variables correspondingly).
-//              If theIsTo3DTgCompute == TRUE then theTg3D has not been 
+//              If theIsTo3DTgCompute == TRUE then theTg3D has not been
 //            defined yet (it should be computed).
 //              theLinTol is SQUARE of the tolerance.
 //
-//Algorithm:
+// Algorithm:
 //              Condition
-//                  Tg=theDU*theTg2D.X()+theDV*theTg2D.Y()  
+//                  Tg=theDU*theTg2D.X()+theDV*theTg2D.Y()
 //            has to be satisfied strictly.
 //              More over, vector Tg has to be NORMALIZED
 //            (if theIsTo3DTgCompute == TRUE then new computed vector will
 //            always have magnitude 1.0).
-//=======================================================================
-static Standard_Boolean SingularProcessing( const gp_Vec& theDU,
-                                            const gp_Vec& theDV,
-                                            const Standard_Boolean theIsTo3DTgCompute,
-                                            const Standard_Real theLinTol,
-                                            const Standard_Real theAngTol,
-                                            gp_Vec& theTg3D,
-                                            gp_Vec2d& theTg2D)
+//=================================================================================================
+
+static Standard_Boolean SingularProcessing(const gp_Vec&          theDU,
+                                           const gp_Vec&          theDV,
+                                           const Standard_Boolean theIsTo3DTgCompute,
+                                           const Standard_Real    theLinTol,
+                                           const Standard_Real    theAngTol,
+                                           gp_Vec&                theTg3D,
+                                           gp_Vec2d&              theTg2D)
 {
-  //Attention: @ \sin theAngTol \approx theAngTol @ (for cross-product)
+  // Attention: @ \sin theAngTol \approx theAngTol @ (for cross-product)
 
-  //Really, vector theTg3D has to be normalized (if theIsTo3DTgCompute == FALSE).
+  // Really, vector theTg3D has to be normalized (if theIsTo3DTgCompute == FALSE).
   const Standard_Real aSQTan = theTg3D.SquareMagnitude();
 
-  const Standard_Real aSqMagnDU = theDU.SquareMagnitude(),
-                      aSqMagnDV = theDV.SquareMagnitude();
+  const Standard_Real aSqMagnDU = theDU.SquareMagnitude(), aSqMagnDV = theDV.SquareMagnitude();
 
-  //There are some reasons of singularity
+  // There are some reasons of singularity
 
-  //1.
-  if((aSqMagnDU < theLinTol) && (aSqMagnDV < theLinTol))
+  // 1.
+  if ((aSqMagnDU < theLinTol) && (aSqMagnDV < theLinTol))
   {
-    //For future, this case can be processed as same as in case of 
-    //osculating surfaces (expanding in Taylor series). Here,
-    //we return only.
+    // For future, this case can be processed as same as in case of
+    // osculating surfaces (expanding in Taylor series). Here,
+    // we return only.
 
     return Standard_False;
   }
 
-  //2.
-  if(aSqMagnDU < theLinTol)
+  // 2.
+  if (aSqMagnDU < theLinTol)
   {
-    //In this case, theTg3D vector will be parallel with theDV.
-    //Its true direction shall be precised later (the algorithm is
-    //based on array of Walking-points).
-    
-    if(theIsTo3DTgCompute)
+    // In this case, theTg3D vector will be parallel with theDV.
+    // Its true direction shall be precised later (the algorithm is
+    // based on array of Walking-points).
+
+    if (theIsTo3DTgCompute)
     {
-      //theTg3D will be normalized. Its magnitude is
+      // theTg3D will be normalized. Its magnitude is
       const Standard_Real aTgMagn = 1.0;
 
       const Standard_Real aNorm = sqrt(aSqMagnDV);
-      theTg3D = theDV.Divided(aNorm);
-      theTg2D.SetCoord(0.0, aTgMagn/aNorm);
+      theTg3D                   = theDV.Divided(aNorm);
+      theTg2D.SetCoord(0.0, aTgMagn / aNorm);
     }
     else
     {
-      //theTg3D is already defined.
-      //Here we check only, if this tangent is parallel to theDV.
+      // theTg3D is already defined.
+      // Here we check only, if this tangent is parallel to theDV.
 
-      if(theDV.Crossed(theTg3D).SquareMagnitude() < 
-                    theAngTol*theAngTol*aSqMagnDV*aSQTan)
+      if (theDV.Crossed(theTg3D).SquareMagnitude() < theAngTol * theAngTol * aSqMagnDV * aSQTan)
       {
-        //theTg3D is parallel to theDV
-        
-        //Use sign "+" if theTg3D and theDV are codirectional
-        //and sign "-" if opposite
+        // theTg3D is parallel to theDV
+
+        // Use sign "+" if theTg3D and theDV are codirectional
+        // and sign "-" if opposite
         const Standard_Real aDP = theTg3D.Dot(theDV);
-        theTg2D.SetCoord(0.0, Sign(sqrt(aSQTan/aSqMagnDV), aDP));
+        theTg2D.SetCoord(0.0, Sign(sqrt(aSQTan / aSqMagnDV), aDP));
       }
       else
       {
-        //theTg3D is not parallel to theDV
-        //It is abnormal
+        // theTg3D is not parallel to theDV
+        // It is abnormal
 
         return Standard_False;
       }
@@ -147,41 +146,40 @@ static Standard_Boolean SingularProcessing( const gp_Vec& theDU,
     return Standard_True;
   }
 
-  //3.
-  if(aSqMagnDV < theLinTol)
+  // 3.
+  if (aSqMagnDV < theLinTol)
   {
-    //In this case, theTg3D vector will be parallel with theDU.
-    //Its true direction shall be precised later (the algorithm is
-    //based on array of Walking-points).
-    
-    if(theIsTo3DTgCompute)
+    // In this case, theTg3D vector will be parallel with theDU.
+    // Its true direction shall be precised later (the algorithm is
+    // based on array of Walking-points).
+
+    if (theIsTo3DTgCompute)
     {
-      //theTg3D will be normalized. Its magnitude is
+      // theTg3D will be normalized. Its magnitude is
       const Standard_Real aTgMagn = 1.0;
 
       const Standard_Real aNorm = sqrt(aSqMagnDU);
-      theTg3D = theDU.Divided(aNorm);
-      theTg2D.SetCoord(aTgMagn/aNorm, 0.0);
+      theTg3D                   = theDU.Divided(aNorm);
+      theTg2D.SetCoord(aTgMagn / aNorm, 0.0);
     }
     else
     {
-      //theTg3D is already defined.
-      //Here we check only, if this tangent is parallel to theDU.
+      // theTg3D is already defined.
+      // Here we check only, if this tangent is parallel to theDU.
 
-      if(theDU.Crossed(theTg3D).SquareMagnitude() < 
-                    theAngTol*theAngTol*aSqMagnDU*aSQTan)
+      if (theDU.Crossed(theTg3D).SquareMagnitude() < theAngTol * theAngTol * aSqMagnDU * aSQTan)
       {
-        //theTg3D is parallel to theDU
+        // theTg3D is parallel to theDU
 
-        //Use sign "+" if theTg3D and theDU are codirectional
-        //and sign "-" if opposite
+        // Use sign "+" if theTg3D and theDU are codirectional
+        // and sign "-" if opposite
         const Standard_Real aDP = theTg3D.Dot(theDU);
-        theTg2D.SetCoord(Sign(sqrt(aSQTan/aSqMagnDU), aDP), 0.0);
+        theTg2D.SetCoord(Sign(sqrt(aSQTan / aSqMagnDU), aDP), 0.0);
       }
       else
       {
-        //theTg3D is not parallel to theDU
-        //It is abnormal
+        // theTg3D is not parallel to theDU
+        // It is abnormal
 
         return Standard_False;
       }
@@ -190,42 +188,40 @@ static Standard_Boolean SingularProcessing( const gp_Vec& theDU,
     return Standard_True;
   }
 
-  //4. If aSqMagnDU > 0.0 && aSqMagnDV > 0.0 but theDV || theDU.
+  // 4. If aSqMagnDU > 0.0 && aSqMagnDV > 0.0 but theDV || theDU.
 
-  const Standard_Real aLenU = sqrt(aSqMagnDU),
-                      aLenV = sqrt(aSqMagnDV);
+  const Standard_Real aLenU = sqrt(aSqMagnDU), aLenV = sqrt(aSqMagnDV);
 
-  //aLenSum > 0.0 definitely
+  // aLenSum > 0.0 definitely
   const Standard_Real aLenSum = aLenU + aLenV;
 
-  if(theDV.Dot(theDU) > 0.0)
+  if (theDV.Dot(theDU) > 0.0)
   {
-    //Vectors theDV and theDU are codirectional.
+    // Vectors theDV and theDU are codirectional.
 
-    if(theIsTo3DTgCompute)
+    if (theIsTo3DTgCompute)
     {
-      theTg2D.SetCoord(1.0/aLenSum, 1.0/aLenSum);
-      theTg3D = theDU*theTg2D.X() + theDV*theTg2D.Y();
+      theTg2D.SetCoord(1.0 / aLenSum, 1.0 / aLenSum);
+      theTg3D = theDU * theTg2D.X() + theDV * theTg2D.Y();
     }
     else
     {
-      //theTg3D is already defined.
-      //Here we check only, if this tangent is parallel to theDU
+      // theTg3D is already defined.
+      // Here we check only, if this tangent is parallel to theDU
       //(and theDV together).
 
-      if(theDU.Crossed(theTg3D).SquareMagnitude() < 
-                    theAngTol*theAngTol*aSqMagnDU*aSQTan)
+      if (theDU.Crossed(theTg3D).SquareMagnitude() < theAngTol * theAngTol * aSqMagnDU * aSQTan)
       {
-        //theTg3D is parallel to theDU
+        // theTg3D is parallel to theDU
 
-        const Standard_Real aDP = theTg3D.Dot(theDU);
+        const Standard_Real aDP    = theTg3D.Dot(theDU);
         const Standard_Real aLenTg = Sign(sqrt(aSQTan), aDP);
-        theTg2D.SetCoord(aLenTg/aLenSum, aLenTg/aLenSum);
+        theTg2D.SetCoord(aLenTg / aLenSum, aLenTg / aLenSum);
       }
       else
       {
-        //theTg3D is not parallel to theDU
-        //It is abnormal
+        // theTg3D is not parallel to theDU
+        // It is abnormal
 
         return Standard_False;
       }
@@ -233,36 +229,35 @@ static Standard_Boolean SingularProcessing( const gp_Vec& theDU,
   }
   else
   {
-    //Vectors theDV and theDU are opposite.
+    // Vectors theDV and theDU are opposite.
 
-    if(theIsTo3DTgCompute)
+    if (theIsTo3DTgCompute)
     {
-      //Here we chose theDU as direction of theTg3D.
-      //True direction shall be precised later (the algorithm is
-      //based on array of Walking-points).
+      // Here we chose theDU as direction of theTg3D.
+      // True direction shall be precised later (the algorithm is
+      // based on array of Walking-points).
 
-      theTg2D.SetCoord(1.0/aLenSum, -1.0/aLenSum);
-      theTg3D = theDU*theTg2D.X() + theDV*theTg2D.Y();
+      theTg2D.SetCoord(1.0 / aLenSum, -1.0 / aLenSum);
+      theTg3D = theDU * theTg2D.X() + theDV * theTg2D.Y();
     }
     else
     {
-      //theTg3D is already defined.
-      //Here we check only, if this tangent is parallel to theDU
+      // theTg3D is already defined.
+      // Here we check only, if this tangent is parallel to theDU
       //(and theDV together).
 
-      if(theDU.Crossed(theTg3D).SquareMagnitude() < 
-                    theAngTol*theAngTol*aSqMagnDU*aSQTan)
+      if (theDU.Crossed(theTg3D).SquareMagnitude() < theAngTol * theAngTol * aSqMagnDU * aSQTan)
       {
-        //theTg3D is parallel to theDU
+        // theTg3D is parallel to theDU
 
-        const Standard_Real aDP = theTg3D.Dot(theDU);
+        const Standard_Real aDP    = theTg3D.Dot(theDU);
         const Standard_Real aLenTg = Sign(sqrt(aSQTan), aDP);
-        theTg2D.SetCoord(aLenTg/aLenSum, -aLenTg/aLenSum);
+        theTg2D.SetCoord(aLenTg / aLenSum, -aLenTg / aLenSum);
       }
       else
       {
-        //theTg3D is not parallel to theDU
-        //It is abnormal
+        // theTg3D is not parallel to theDU
+        // It is abnormal
 
         return Standard_False;
       }
@@ -272,9 +267,9 @@ static Standard_Boolean SingularProcessing( const gp_Vec& theDU,
   return Standard_True;
 }
 
-//=======================================================================
-//function : NonSingularProcessing
-//purpose  :    Computes 2D-representation (in UV-coordinates) of 
+//=================================================================================================
+// function : NonSingularProcessing
+// purpose  :    Computes 2D-representation (in UV-coordinates) of
 //            theTg3D vector on the surface in case when
 //            theDU.Crossed(theDV).Magnitude() > 0.0. Stores result in
 //            theTg2D variable.
@@ -282,199 +277,218 @@ static Standard_Boolean SingularProcessing( const gp_Vec& theDU,
 //            (with respect to U and V variables correspondingly).
 //              theLinTol is SQUARE of the tolerance.
 //
-//Algorithm:
+// Algorithm:
 //              Condition
-//                  Tg=theDU*theTg2D.X()+theDV*theTg2D.Y()  
+//                  Tg=theDU*theTg2D.X()+theDV*theTg2D.Y()
 //            has to be satisfied strictly.
 //              More over, vector Tg has always to be NORMALIZED.
-//=======================================================================
-static Standard_Boolean NonSingularProcessing(const gp_Vec& theDU,
-                                              const gp_Vec& theDV,
-                                              const gp_Vec& theTg3D,
+//=================================================================================================
+
+static Standard_Boolean NonSingularProcessing(const gp_Vec&       theDU,
+                                              const gp_Vec&       theDV,
+                                              const gp_Vec&       theTg3D,
                                               const Standard_Real theLinTol,
                                               const Standard_Real theAngTol,
-                                              gp_Vec2d& theTg2D)
+                                              gp_Vec2d&           theTg2D)
 {
-  const gp_Vec aNormal = theDU.Crossed(theDV);
+  const gp_Vec        aNormal = theDU.Crossed(theDV);
   const Standard_Real aSQMagn = aNormal.SquareMagnitude();
 
-  if(IsSingular(theDU, theDV, theLinTol, theAngTol))
+  if (IsSingular(theDU, theDV, theLinTol, theAngTol))
   {
     gp_Vec aTg(theTg3D);
-    return 
-      SingularProcessing(theDU, theDV, Standard_False,
-                          theLinTol, theAngTol, aTg, theTg2D);
+    return SingularProcessing(theDU, theDV, Standard_False, theLinTol, theAngTol, aTg, theTg2D);
   }
 
-  //If @\vec{T}=\vec{A}*U+\vec{B}*V@ then 
+  // If @\vec{T}=\vec{A}*U+\vec{B}*V@ then
 
   //  \left\{\begin{matrix}
-  //  \vec{A} \times \vec{T} = (\vec{A} \times \vec{B})*V 
-  //  \vec{B} \times \vec{T} = (\vec{B} \times \vec{A})*U 
+  //  \vec{A} \times \vec{T} = (\vec{A} \times \vec{B})*V
+  //  \vec{B} \times \vec{T} = (\vec{B} \times \vec{A})*U
   //  \end{matrix}\right.
 
-  //From here, values of U and V can be found very easily
+  // From here, values of U and V can be found very easily
   //(if @\left \| \vec{A} \times \vec{B} \right \| > 0.0 @,
-  //else it is singular case). 
+  // else it is singular case).
 
-  const gp_Vec aTgU(theTg3D.Crossed(theDU)), aTgV(theTg3D.Crossed(theDV));
-  const Standard_Real aDeltaU = aTgV.SquareMagnitude()/aSQMagn;
-  const Standard_Real aDeltaV = aTgU.SquareMagnitude()/aSQMagn;
+  const gp_Vec        aTgU(theTg3D.Crossed(theDU)), aTgV(theTg3D.Crossed(theDV));
+  const Standard_Real aDeltaU = aTgV.SquareMagnitude() / aSQMagn;
+  const Standard_Real aDeltaV = aTgU.SquareMagnitude() / aSQMagn;
 
   theTg2D.SetCoord(Sign(sqrt(aDeltaU), aTgV.Dot(aNormal)), -Sign(sqrt(aDeltaV), aTgU.Dot(aNormal)));
 
   return Standard_True;
 }
 
-//--------------------------------------------------------------------------------
-ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces( const TheISurface& ISurf
-                                                      ,const ThePSurface& PSurf):
-       MyIsTangent(Standard_False),
-       MyHasBeenComputed(Standard_False),
-       MyIsTangentbis(Standard_False),
-       MyHasBeenComputedbis(Standard_False),
-       MyImplicitFirst(Standard_True),
-       MyZerImpFunc(PSurf,ISurf)
-{ 
+//=================================================================================================
+
+ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces(const TheISurface& ISurf,
+                                                       const ThePSurface& PSurf) :
+    MyIsTangent(Standard_False),
+    MyHasBeenComputed(Standard_False),
+    MyIsTangentbis(Standard_False),
+    MyHasBeenComputedbis(Standard_False),
+    MyImplicitFirst(Standard_True),
+    MyZerImpFunc(PSurf, ISurf)
+{
   SetUseSolver(Standard_True);
 }
-//--------------------------------------------------------------------------------
-ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces( const ThePSurface& PSurf
-                                                      ,const TheISurface& ISurf):
-       MyIsTangent(Standard_False),
-       MyHasBeenComputed(Standard_False),
-       MyIsTangentbis(Standard_False),
-       MyHasBeenComputedbis(Standard_False),
-       MyImplicitFirst(Standard_False),
-       MyZerImpFunc(PSurf,ISurf)
-{ 
+
+//=================================================================================================
+
+ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces(const ThePSurface& PSurf,
+                                                       const TheISurface& ISurf) :
+    MyIsTangent(Standard_False),
+    MyHasBeenComputed(Standard_False),
+    MyIsTangentbis(Standard_False),
+    MyHasBeenComputedbis(Standard_False),
+    MyImplicitFirst(Standard_False),
+    MyZerImpFunc(PSurf, ISurf)
+{
   SetUseSolver(Standard_True);
 }
-//--------------------------------------------------------------------------------
+
+//=================================================================================================
+
 void ApproxInt_ImpPrmSvSurfaces::Pnt(const Standard_Real u1,
-                                    const Standard_Real v1,
-                                    const Standard_Real u2,
-                                    const Standard_Real v2,
-                                    gp_Pnt& P) { 
-  gp_Pnt aP;
-  gp_Vec aT;
-  gp_Vec2d aTS1,aTS2;
-  Standard_Real tu1=u1;
-  Standard_Real tu2=u2;
-  Standard_Real tv1=v1;
-  Standard_Real tv2=v2;
-  this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
-  P=MyPnt;
+                                     const Standard_Real v1,
+                                     const Standard_Real u2,
+                                     const Standard_Real v2,
+                                     gp_Pnt&             P)
+{
+  gp_Pnt        aP;
+  gp_Vec        aT;
+  gp_Vec2d      aTS1, aTS2;
+  Standard_Real tu1 = u1;
+  Standard_Real tu2 = u2;
+  Standard_Real tv1 = v1;
+  Standard_Real tv2 = v2;
+  this->Compute(tu1, tv1, tu2, tv2, aP, aT, aTS1, aTS2);
+  P = MyPnt;
 }
-//--------------------------------------------------------------------------------
+
+//=================================================================================================
+
 Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Tangency(const Standard_Real u1,
-                                                     const Standard_Real v1,
-                                                     const Standard_Real u2,
-                                                     const Standard_Real v2,
-                                                     gp_Vec& T) { 
-  gp_Pnt aP;
-  gp_Vec aT;
-  gp_Vec2d aTS1,aTS2;
-  Standard_Real tu1=u1;
-  Standard_Real tu2=u2;
-  Standard_Real tv1=v1;
-  Standard_Real tv2=v2;
-  Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
-  T=MyTg;
-  return(t);
+                                                      const Standard_Real v1,
+                                                      const Standard_Real u2,
+                                                      const Standard_Real v2,
+                                                      gp_Vec&             T)
+{
+  gp_Pnt           aP;
+  gp_Vec           aT;
+  gp_Vec2d         aTS1, aTS2;
+  Standard_Real    tu1 = u1;
+  Standard_Real    tu2 = u2;
+  Standard_Real    tv1 = v1;
+  Standard_Real    tv2 = v2;
+  Standard_Boolean t   = this->Compute(tu1, tv1, tu2, tv2, aP, aT, aTS1, aTS2);
+  T                    = MyTg;
+  return (t);
 }
-//--------------------------------------------------------------------------------
+
+//=================================================================================================
+
 Standard_Boolean ApproxInt_ImpPrmSvSurfaces::TangencyOnSurf1(const Standard_Real u1,
-                                                            const Standard_Real v1,
-                                                            const Standard_Real u2,
-                                                            const Standard_Real v2,
-                                                            gp_Vec2d& T) { 
-  gp_Pnt aP;
-  gp_Vec aT;
-  gp_Vec2d aTS1,aTS2;
-  Standard_Real tu1=u1;
-  Standard_Real tu2=u2;
-  Standard_Real tv1=v1;
-  Standard_Real tv2=v2;
-  Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
-  T=MyTguv1;
-  return(t);
+                                                             const Standard_Real v1,
+                                                             const Standard_Real u2,
+                                                             const Standard_Real v2,
+                                                             gp_Vec2d&           T)
+{
+  gp_Pnt           aP;
+  gp_Vec           aT;
+  gp_Vec2d         aTS1, aTS2;
+  Standard_Real    tu1 = u1;
+  Standard_Real    tu2 = u2;
+  Standard_Real    tv1 = v1;
+  Standard_Real    tv2 = v2;
+  Standard_Boolean t   = this->Compute(tu1, tv1, tu2, tv2, aP, aT, aTS1, aTS2);
+  T                    = MyTguv1;
+  return (t);
 }
-//--------------------------------------------------------------------------------
+
+//=================================================================================================
+
 Standard_Boolean ApproxInt_ImpPrmSvSurfaces::TangencyOnSurf2(const Standard_Real u1,
-                                                            const Standard_Real v1,
-                                                            const Standard_Real u2,
-                                                            const Standard_Real v2,
-                                                            gp_Vec2d& T) { 
-  gp_Pnt aP;
-  gp_Vec aT;
-  gp_Vec2d aTS1,aTS2;
-  Standard_Real tu1=u1;
-  Standard_Real tu2=u2;
-  Standard_Real tv1=v1;
-  Standard_Real tv2=v2;
-  Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
-  T=MyTguv2;
-  return(t);
+                                                             const Standard_Real v1,
+                                                             const Standard_Real u2,
+                                                             const Standard_Real v2,
+                                                             gp_Vec2d&           T)
+{
+  gp_Pnt           aP;
+  gp_Vec           aT;
+  gp_Vec2d         aTS1, aTS2;
+  Standard_Real    tu1 = u1;
+  Standard_Real    tu2 = u2;
+  Standard_Real    tv1 = v1;
+  Standard_Real    tv2 = v2;
+  Standard_Boolean t   = this->Compute(tu1, tv1, tu2, tv2, aP, aT, aTS1, aTS2);
+  T                    = MyTguv2;
+  return (t);
 }
 
-//=======================================================================
-//function : Compute
-//purpose  :    Computes point on curve, 3D and 2D-tangents of a curve and
+//=================================================================================================
+// function : Compute
+// purpose  :    Computes point on curve, 3D and 2D-tangents of a curve and
 //            parameters on the surfaces.
-//=======================================================================
-Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Compute( Standard_Real& u1,
-                                                      Standard_Real& v1,
-                                                      Standard_Real& u2,
-                                                      Standard_Real& v2,
-                                                      gp_Pnt& P,
-                                                      gp_Vec& Tg,
-                                                      gp_Vec2d& Tguv1,
-                                                      gp_Vec2d& Tguv2)
-{ 
-  const IntSurf_Quadric&  aQSurf = MyZerImpFunc.ISurface();
-  const ThePSurface&      aPSurf = MyZerImpFunc.PSurface();
-  gp_Vec2d& aQuadTg = MyImplicitFirst ? Tguv1 : Tguv2;
-  gp_Vec2d& aPrmTg = MyImplicitFirst ? Tguv2 : Tguv1;
-
-  //for square
-  constexpr Standard_Real aNullValue =  Precision::Approximation()*
-                                    Precision::Approximation(),
-                      anAngTol = Precision::Angular();
-
-  Standard_Real tu1=u1;
-  Standard_Real tu2=u2;
-  Standard_Real tv1=v1;
-  Standard_Real tv2=v2;
-  
-  if(MyHasBeenComputed) { 
-    if(  (MyParOnS1.X()==u1)&&(MyParOnS1.Y()==v1)
-       &&(MyParOnS2.X()==u2)&&(MyParOnS2.Y()==v2)) {
-      return(MyIsTangent);
+//=================================================================================================
+
+Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Compute(Standard_Real& u1,
+                                                     Standard_Real& v1,
+                                                     Standard_Real& u2,
+                                                     Standard_Real& v2,
+                                                     gp_Pnt&        P,
+                                                     gp_Vec&        Tg,
+                                                     gp_Vec2d&      Tguv1,
+                                                     gp_Vec2d&      Tguv2)
+{
+  const IntSurf_Quadric& aQSurf  = MyZerImpFunc.ISurface();
+  const ThePSurface&     aPSurf  = MyZerImpFunc.PSurface();
+  gp_Vec2d&              aQuadTg = MyImplicitFirst ? Tguv1 : Tguv2;
+  gp_Vec2d&              aPrmTg  = MyImplicitFirst ? Tguv2 : Tguv1;
+
+  // for square
+  constexpr Standard_Real aNullValue = Precision::Approximation() * Precision::Approximation(),
+                          anAngTol   = Precision::Angular();
+
+  Standard_Real tu1 = u1;
+  Standard_Real tu2 = u2;
+  Standard_Real tv1 = v1;
+  Standard_Real tv2 = v2;
+
+  if (MyHasBeenComputed)
+  {
+    if ((MyParOnS1.X() == u1) && (MyParOnS1.Y() == v1) && (MyParOnS2.X() == u2) &&
+        (MyParOnS2.Y() == v2))
+    {
+      return (MyIsTangent);
     }
-    else if(MyHasBeenComputedbis == Standard_False) { 
-      MyTgbis         = MyTg;
-      MyTguv1bis      = MyTguv1;
-      MyTguv2bis      = MyTguv2;
-      MyPntbis        = MyPnt;
-      MyParOnS1bis    = MyParOnS1;
-      MyParOnS2bis    = MyParOnS2;
-      MyIsTangentbis  = MyIsTangent;
-      MyHasBeenComputedbis = MyHasBeenComputed; 
+    else if (MyHasBeenComputedbis == Standard_False)
+    {
+      MyTgbis              = MyTg;
+      MyTguv1bis           = MyTguv1;
+      MyTguv2bis           = MyTguv2;
+      MyPntbis             = MyPnt;
+      MyParOnS1bis         = MyParOnS1;
+      MyParOnS2bis         = MyParOnS2;
+      MyIsTangentbis       = MyIsTangent;
+      MyHasBeenComputedbis = MyHasBeenComputed;
     }
   }
 
-  if(MyHasBeenComputedbis) { 
-    if(  (MyParOnS1bis.X()==u1)&&(MyParOnS1bis.Y()==v1)
-       &&(MyParOnS2bis.X()==u2)&&(MyParOnS2bis.Y()==v2)) {
+  if (MyHasBeenComputedbis)
+  {
+    if ((MyParOnS1bis.X() == u1) && (MyParOnS1bis.Y() == v1) && (MyParOnS2bis.X() == u2) &&
+        (MyParOnS2bis.Y() == v2))
+    {
 
-      gp_Vec            TV(MyTg);
-      gp_Vec2d          TV1(MyTguv1);
-      gp_Vec2d          TV2(MyTguv2);
-      gp_Pnt            TP(MyPnt);
-      gp_Pnt2d          TP1(MyParOnS1);
-      gp_Pnt2d          TP2(MyParOnS2);
-      Standard_Boolean  TB=MyIsTangent;
+      gp_Vec           TV(MyTg);
+      gp_Vec2d         TV1(MyTguv1);
+      gp_Vec2d         TV2(MyTguv2);
+      gp_Pnt           TP(MyPnt);
+      gp_Pnt2d         TP1(MyParOnS1);
+      gp_Pnt2d         TP2(MyParOnS2);
+      Standard_Boolean TB = MyIsTangent;
 
       MyTg        = MyTgbis;
       MyTguv1     = MyTguv1bis;
@@ -484,132 +498,142 @@ Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Compute( Standard_Real& u1,
       MyParOnS2   = MyParOnS2bis;
       MyIsTangent = MyIsTangentbis;
 
-      MyTgbis         = TV;
-      MyTguv1bis      = TV1;
-      MyTguv2bis      = TV2;
-      MyPntbis        = TP;
-      MyParOnS1bis    = TP1;
-      MyParOnS2bis    = TP2;
-      MyIsTangentbis  = TB;
+      MyTgbis        = TV;
+      MyTguv1bis     = TV1;
+      MyTguv2bis     = TV2;
+      MyPntbis       = TP;
+      MyParOnS1bis   = TP1;
+      MyParOnS2bis   = TP2;
+      MyIsTangentbis = TB;
 
-      return(MyIsTangent);
+      return (MyIsTangent);
     }
   }
 
-  math_Vector X(1,2);
-  math_Vector BornInf(1,2), BornSup(1,2), Tolerance(1,2);
+  math_Vector X(1, 2);
+  math_Vector BornInf(1, 2), BornSup(1, 2), Tolerance(1, 2);
   //--- ThePSurfaceTool::GetResolution(aPSurf,Tolerance(1),Tolerance(2));
-  Tolerance(1) = 1.0e-8; Tolerance(2) = 1.0e-8;
-  Standard_Real binfu,bsupu,binfv,bsupv;
-  binfu = ThePSurfaceTool::FirstUParameter(aPSurf);
-  binfv = ThePSurfaceTool::FirstVParameter(aPSurf);
-  bsupu = ThePSurfaceTool::LastUParameter(aPSurf);
-  bsupv = ThePSurfaceTool::LastVParameter(aPSurf);
-  BornInf(1) = binfu; BornSup(1) = bsupu; 
-  BornInf(2) = binfv; BornSup(2) = bsupv;
+  Tolerance(1) = 1.0e-8;
+  Tolerance(2) = 1.0e-8;
+  Standard_Real binfu, bsupu, binfv, bsupv;
+  binfu                      = ThePSurfaceTool::FirstUParameter(aPSurf);
+  binfv                      = ThePSurfaceTool::FirstVParameter(aPSurf);
+  bsupu                      = ThePSurfaceTool::LastUParameter(aPSurf);
+  bsupv                      = ThePSurfaceTool::LastVParameter(aPSurf);
+  BornInf(1)                 = binfu;
+  BornSup(1)                 = bsupu;
+  BornInf(2)                 = binfv;
+  BornSup(2)                 = bsupv;
   Standard_Real TranslationU = 0., TranslationV = 0.;
-  
-  if (!FillInitialVectorOfSolution(u1, v1, u2, v2,
-                                   binfu, bsupu, binfv, bsupv,
+
+  if (!FillInitialVectorOfSolution(u1,
+                                   v1,
+                                   u2,
+                                   v2,
+                                   binfu,
+                                   bsupu,
+                                   binfv,
+                                   bsupv,
                                    X,
-                                   TranslationU, TranslationV))
+                                   TranslationU,
+                                   TranslationV))
   {
-    MyIsTangent=MyIsTangentbis=Standard_False;
+    MyIsTangent = MyIsTangentbis = Standard_False;
     MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
-    return(Standard_False);
+    return (Standard_False);
   }
 
   Standard_Boolean aRsnldIsDone = Standard_False;
-  Standard_Real PourTesterU = X(1);
-  Standard_Real PourTesterV = X(2);
+  Standard_Real    PourTesterU  = X(1);
+  Standard_Real    PourTesterV  = X(2);
   if (GetUseSolver())
   {
-    math_FunctionSetRoot  Rsnld(MyZerImpFunc);
+    math_FunctionSetRoot Rsnld(MyZerImpFunc);
     Rsnld.SetTolerance(Tolerance);
     Rsnld.Perform(MyZerImpFunc, X, BornInf, BornSup);
     aRsnldIsDone = Rsnld.IsDone();
     if (aRsnldIsDone)
       Rsnld.Root(X);
   }
-  if(aRsnldIsDone || !GetUseSolver()) 
+  if (aRsnldIsDone || !GetUseSolver())
   {
     MyHasBeenComputed = Standard_True;
-    
-    Standard_Real DistAvantApresU = Abs(PourTesterU-X(1));
-    Standard_Real DistAvantApresV = Abs(PourTesterV-X(2));
-    
+
+    Standard_Real DistAvantApresU = Abs(PourTesterU - X(1));
+    Standard_Real DistAvantApresV = Abs(PourTesterV - X(2));
+
     MyPnt = P = ThePSurfaceTool::Value(aPSurf, X(1), X(2));
-    
-    if( (DistAvantApresV <= 0.001 ) &&
-        (DistAvantApresU <= 0.001 ))
+
+    if ((DistAvantApresV <= 0.001) && (DistAvantApresU <= 0.001))
     {
-      gp_Vec aD1uPrm,aD1vPrm;
-      gp_Vec aD1uQuad,aD1vQuad;
-
-      if(MyImplicitFirst)
-      { 
-        u2 = X(1)-TranslationU;
-        v2 = X(2)-TranslationV;
-
-        if(aQSurf.TypeQuadric() != GeomAbs_Plane)
-        { 
-          while(u1-tu1>M_PI)  u1-=M_PI+M_PI;
-          while(tu1-u1>M_PI)  u1+=M_PI+M_PI;
+      gp_Vec aD1uPrm, aD1vPrm;
+      gp_Vec aD1uQuad, aD1vQuad;
+
+      if (MyImplicitFirst)
+      {
+        u2 = X(1) - TranslationU;
+        v2 = X(2) - TranslationV;
+
+        if (aQSurf.TypeQuadric() != GeomAbs_Plane)
+        {
+          while (u1 - tu1 > M_PI)
+            u1 -= M_PI + M_PI;
+          while (tu1 - u1 > M_PI)
+            u1 += M_PI + M_PI;
         }
 
-        MyParOnS1.SetCoord(tu1,tv1);
-        MyParOnS2.SetCoord(tu2,tv2);
+        MyParOnS1.SetCoord(tu1, tv1);
+        MyParOnS2.SetCoord(tu2, tv2);
 
         gp_Pnt aP2;
 
         ThePSurfaceTool::D1(aPSurf, X(1), X(2), P, aD1uPrm, aD1vPrm);
-        aQSurf.D1(u1,v1, aP2, aD1uQuad, aD1vQuad);
+        aQSurf.D1(u1, v1, aP2, aD1uQuad, aD1vQuad);
 
-        //Middle-point of P-P2 segment
+        // Middle-point of P-P2 segment
         P.BaryCenter(1.0, aP2, 1.0);
       }
       else
       {
-        u1 = X(1)-TranslationU;
-        v1 = X(2)-TranslationV;
-        //aQSurf.Parameters(P, u2, v2);
-        if(aQSurf.TypeQuadric() != GeomAbs_Plane)
+        u1 = X(1) - TranslationU;
+        v1 = X(2) - TranslationV;
+        // aQSurf.Parameters(P, u2, v2);
+        if (aQSurf.TypeQuadric() != GeomAbs_Plane)
         {
-          while(u2-tu2>M_PI)  u2-=M_PI+M_PI;
-          while(tu2-u2>M_PI)  u2+=M_PI+M_PI;
+          while (u2 - tu2 > M_PI)
+            u2 -= M_PI + M_PI;
+          while (tu2 - u2 > M_PI)
+            u2 += M_PI + M_PI;
         }
 
-        MyParOnS1.SetCoord(tu1,tv1);
-        MyParOnS2.SetCoord(tu2,tu2);
+        MyParOnS1.SetCoord(tu1, tv1);
+        MyParOnS2.SetCoord(tu2, tu2);
 
         gp_Pnt aP2;
         ThePSurfaceTool::D1(aPSurf, X(1), X(2), P, aD1uPrm, aD1vPrm);
 
         aQSurf.D1(u2, v2, aP2, aD1uQuad, aD1vQuad);
 
-        //Middle-point of P-P2 segment
+        // Middle-point of P-P2 segment
         P.BaryCenter(1.0, aP2, 1.0);
       }
 
       MyPnt = P;
 
-      //Normals to the surfaces
-      gp_Vec  aNormalPrm(aD1uPrm.Crossed(aD1vPrm)), 
-              aNormalImp(aQSurf.Normale(MyPnt));
+      // Normals to the surfaces
+      gp_Vec aNormalPrm(aD1uPrm.Crossed(aD1vPrm)), aNormalImp(aQSurf.Normale(MyPnt));
 
       const Standard_Real aSQMagnPrm = aNormalPrm.SquareMagnitude(),
                           aSQMagnImp = aNormalImp.SquareMagnitude();
 
-      Standard_Boolean  isPrmSingular = Standard_False,
-                        isImpSingular = Standard_False;
+      Standard_Boolean isPrmSingular = Standard_False, isImpSingular = Standard_False;
 
-      if(IsSingular(aD1uPrm, aD1vPrm, aNullValue, anAngTol))
+      if (IsSingular(aD1uPrm, aD1vPrm, aNullValue, anAngTol))
       {
         isPrmSingular = Standard_True;
-        if(!SingularProcessing(aD1uPrm, aD1vPrm, Standard_True,
-                                aNullValue, anAngTol, Tg, aPrmTg))
+        if (!SingularProcessing(aD1uPrm, aD1vPrm, Standard_True, aNullValue, anAngTol, Tg, aPrmTg))
         {
-          MyIsTangent = Standard_False;
+          MyIsTangent       = Standard_False;
           MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
           return Standard_False;
         }
@@ -621,15 +645,20 @@ Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Compute( Standard_Real& u1,
         aNormalPrm.Divide(sqrt(aSQMagnPrm));
       }
 
-      //Analogically for implicit surface
-      if(aSQMagnImp < aNullValue)
+      // Analogically for implicit surface
+      if (aSQMagnImp < aNullValue)
       {
         isImpSingular = Standard_True;
 
-        if(!SingularProcessing(aD1uQuad, aD1vQuad, !isPrmSingular,
-                                  aNullValue, anAngTol, Tg, aQuadTg))
+        if (!SingularProcessing(aD1uQuad,
+                                aD1vQuad,
+                                !isPrmSingular,
+                                aNullValue,
+                                anAngTol,
+                                Tg,
+                                aQuadTg))
         {
-          MyIsTangent = Standard_False;
+          MyIsTangent       = Standard_False;
           MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
           return Standard_False;
         }
@@ -641,289 +670,354 @@ Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Compute( Standard_Real& u1,
         aNormalImp.Divide(sqrt(aSQMagnImp));
       }
 
-      if(isImpSingular && isPrmSingular)
+      if (isImpSingular && isPrmSingular)
       {
-        //All is OK. All abnormal cases were processed above.
+        // All is OK. All abnormal cases were processed above.
 
         MyTguv1 = Tguv1;
         MyTguv2 = Tguv2;
 
-        MyIsTangent=Standard_True;
+        MyIsTangent = Standard_True;
         return MyIsTangent;
       }
-      else if(!(isImpSingular || isPrmSingular))
+      else if (!(isImpSingular || isPrmSingular))
       {
-        //Processing pure non-singular case
+        // Processing pure non-singular case
         //(3D- and 2D-tangents are still not defined)
 
-        //Ask to pay attention to the fact that here
-        //aNormalImp and aNormalPrm are normalized.
-        //Therefore, @ \left \| \vec{Tg} \right \| = 0.0 @
-        //if and only if (aNormalImp || aNormalPrm).
+        // Ask to pay attention to the fact that here
+        // aNormalImp and aNormalPrm are normalized.
+        // Therefore, @ \left \| \vec{Tg} \right \| = 0.0 @
+        // if and only if (aNormalImp || aNormalPrm).
         Tg = aNormalImp.Crossed(aNormalPrm);
       }
 
       const Standard_Real aSQMagnTg = Tg.SquareMagnitude();
 
-      if(aSQMagnTg < aNullValue)
+      if (aSQMagnTg < aNullValue)
       {
-        MyIsTangent = Standard_False;
+        MyIsTangent       = Standard_False;
         MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
         return Standard_False;
       }
 
-      //Normalize Tg vector
+      // Normalize Tg vector
       Tg.Divide(sqrt(aSQMagnTg));
       MyTg = Tg;
 
-      if(!isPrmSingular)
+      if (!isPrmSingular)
       {
-        //If isPrmSingular==TRUE then aPrmTg has already been computed.
+        // If isPrmSingular==TRUE then aPrmTg has already been computed.
 
-        if(!NonSingularProcessing(aD1uPrm, aD1vPrm, Tg, aNullValue, anAngTol, aPrmTg))
+        if (!NonSingularProcessing(aD1uPrm, aD1vPrm, Tg, aNullValue, anAngTol, aPrmTg))
         {
-          MyIsTangent = Standard_False;
+          MyIsTangent       = Standard_False;
           MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
           return Standard_False;
         }
       }
 
-      if(!isImpSingular)
+      if (!isImpSingular)
       {
-        //If isImpSingular==TRUE then aQuadTg has already been computed.
+        // If isImpSingular==TRUE then aQuadTg has already been computed.
 
-        if(!NonSingularProcessing(aD1uQuad, aD1vQuad, Tg, aNullValue, anAngTol, aQuadTg))
+        if (!NonSingularProcessing(aD1uQuad, aD1vQuad, Tg, aNullValue, anAngTol, aQuadTg))
         {
-          MyIsTangent = Standard_False;
+          MyIsTangent       = Standard_False;
           MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
           return Standard_False;
         }
       }
-        
+
       MyTguv1 = Tguv1;
       MyTguv2 = Tguv2;
 
-      MyIsTangent=Standard_True;
+      MyIsTangent = Standard_True;
 
 #ifdef OCCT_DEBUG
-      //cout << "+++++++++++++++++  ApproxInt_ImpPrmSvSurfaces::Compute(...)  ++++++++++" << endl;
-      //printf( "P2d_1(%+10.20f, %+10.20f); P2d_2(%+10.20f, %+10.20f)\n"
-      //        "P(%+10.20f, %+10.20f, %+10.20f);\n"
-      //        "Tg = {%+10.20f, %+10.20f, %+10.20f};\n"
-      //        "Tguv1 = {%+10.20f, %+10.20f};\n"
-      //        "Tguv2 = {%+10.20f, %+10.20f}\n",
-      //        u1, v1, u2, v2,
-      //        P.X(), P.Y(), P.Z(),
-      //        Tg.X(), Tg.Y(), Tg.Z(),
-      //        Tguv1.X(), Tguv1.Y(), Tguv2.X(), Tguv2.Y());
-      //cout << "-----------------------------------------------------------------------" << endl;
+      // cout << "+++++++++++++++++  ApproxInt_ImpPrmSvSurfaces::Compute(...)  ++++++++++" << endl;
+      // printf( "P2d_1(%+10.20f, %+10.20f); P2d_2(%+10.20f, %+10.20f)\n"
+      //         "P(%+10.20f, %+10.20f, %+10.20f);\n"
+      //         "Tg = {%+10.20f, %+10.20f, %+10.20f};\n"
+      //         "Tguv1 = {%+10.20f, %+10.20f};\n"
+      //         "Tguv2 = {%+10.20f, %+10.20f}\n",
+      //         u1, v1, u2, v2,
+      //         P.X(), P.Y(), P.Z(),
+      //         Tg.X(), Tg.Y(), Tg.Z(),
+      //         Tguv1.X(), Tguv1.Y(), Tguv2.X(), Tguv2.Y());
+      // cout << "-----------------------------------------------------------------------" << endl;
 #endif
 
-      return Standard_True; 
+      return Standard_True;
     }
-    else { 
+    else
+    {
       //-- cout<<" ApproxInt_ImpImpSvSurfaces.gxx : Distance apres recadrage Trop Grande "<<endl;
-    
-      MyIsTangent=Standard_False;
+
+      MyIsTangent       = Standard_False;
       MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
       return Standard_False;
     }
   }
-  else { 
-    MyIsTangent = Standard_False;
+  else
+  {
+    MyIsTangent       = Standard_False;
     MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
     return Standard_False;
   }
 }
 
-//=======================================================================
-//function : SeekPoint
-//purpose  :    Computes point on curve and
+//=================================================================================================
+// function : SeekPoint
+// purpose  :    Computes point on curve and
 //            parameters on the surfaces.
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean ApproxInt_ImpPrmSvSurfaces::SeekPoint(const Standard_Real u1,
                                                        const Standard_Real v1,
                                                        const Standard_Real u2,
                                                        const Standard_Real v2,
-                                                       IntSurf_PntOn2S& Point) { 
-  gp_Pnt aP;
-  gp_Vec aT;
-  gp_Vec2d aTS1,aTS2;
-  const IntSurf_Quadric&  aQSurf = MyZerImpFunc.ISurface();
-  const ThePSurface&      aPSurf = MyZerImpFunc.PSurface();
-
-  math_Vector X(1,2);
-  math_Vector BornInf(1,2), BornSup(1,2), Tolerance(1,2);
+                                                       IntSurf_PntOn2S&    Point)
+{
+  gp_Pnt                 aP;
+  gp_Vec                 aT;
+  gp_Vec2d               aTS1, aTS2;
+  const IntSurf_Quadric& aQSurf = MyZerImpFunc.ISurface();
+  const ThePSurface&     aPSurf = MyZerImpFunc.PSurface();
+
+  math_Vector X(1, 2);
+  math_Vector BornInf(1, 2), BornSup(1, 2), Tolerance(1, 2);
   //--- ThePSurfaceTool::GetResolution(aPSurf,Tolerance(1),Tolerance(2));
-  Tolerance(1) = 1.0e-8; Tolerance(2) = 1.0e-8;
-  Standard_Real binfu,bsupu,binfv,bsupv;
-  binfu = ThePSurfaceTool::FirstUParameter(aPSurf);
-  binfv = ThePSurfaceTool::FirstVParameter(aPSurf);
-  bsupu = ThePSurfaceTool::LastUParameter(aPSurf);
-  bsupv = ThePSurfaceTool::LastVParameter(aPSurf);
-  BornInf(1) = binfu; BornSup(1) = bsupu; 
-  BornInf(2) = binfv; BornSup(2) = bsupv;
+  Tolerance(1) = 1.0e-8;
+  Tolerance(2) = 1.0e-8;
+  Standard_Real binfu, bsupu, binfv, bsupv;
+  binfu                      = ThePSurfaceTool::FirstUParameter(aPSurf);
+  binfv                      = ThePSurfaceTool::FirstVParameter(aPSurf);
+  bsupu                      = ThePSurfaceTool::LastUParameter(aPSurf);
+  bsupv                      = ThePSurfaceTool::LastVParameter(aPSurf);
+  BornInf(1)                 = binfu;
+  BornSup(1)                 = bsupu;
+  BornInf(2)                 = binfv;
+  BornSup(2)                 = bsupv;
   Standard_Real TranslationU = 0., TranslationV = 0.;
-  
-  if (!FillInitialVectorOfSolution(u1, v1, u2, v2,
-                                   binfu, bsupu, binfv, bsupv,
+
+  if (!FillInitialVectorOfSolution(u1,
+                                   v1,
+                                   u2,
+                                   v2,
+                                   binfu,
+                                   bsupu,
+                                   binfv,
+                                   bsupv,
                                    X,
-                                   TranslationU, TranslationV))
+                                   TranslationU,
+                                   TranslationV))
     return Standard_False;
 
   Standard_Real NewU1, NewV1, NewU2, NewV2;
-  
-  math_FunctionSetRoot  Rsnld(MyZerImpFunc);
+
+  math_FunctionSetRoot Rsnld(MyZerImpFunc);
   Rsnld.SetTolerance(Tolerance);
-  Rsnld.Perform(MyZerImpFunc,X,BornInf,BornSup);
-  if(Rsnld.IsDone()) { 
+  Rsnld.Perform(MyZerImpFunc, X, BornInf, BornSup);
+  if (Rsnld.IsDone())
+  {
     MyHasBeenComputed = Standard_True;
     Rsnld.Root(X);
-  
+
     MyPnt = ThePSurfaceTool::Value(aPSurf, X(1), X(2));
-    
-    if(MyImplicitFirst)
-    { 
-      NewU2 = X(1)-TranslationU;
-      NewV2 = X(2)-TranslationV;
+
+    if (MyImplicitFirst)
+    {
+      NewU2 = X(1) - TranslationU;
+      NewV2 = X(2) - TranslationV;
 
       aQSurf.Parameters(MyPnt, NewU1, NewV1);
-      //adjust U
+      // adjust U
       if (aQSurf.TypeQuadric() != GeomAbs_Plane)
       {
-        Standard_Real sign = (NewU1 > u1)? -1 : 1;
+        Standard_Real sign = (NewU1 > u1) ? -1 : 1;
         while (Abs(u1 - NewU1) > M_PI)
-          NewU1 += sign*(M_PI+M_PI);
+          NewU1 += sign * (M_PI + M_PI);
       }
     }
     else
     {
-      NewU1 = X(1)-TranslationU;
-      NewV1 = X(2)-TranslationV;
+      NewU1 = X(1) - TranslationU;
+      NewV1 = X(2) - TranslationV;
 
       aQSurf.Parameters(MyPnt, NewU2, NewV2);
-      //adjust U
+      // adjust U
       if (aQSurf.TypeQuadric() != GeomAbs_Plane)
       {
-        Standard_Real sign = (NewU2 > u2)? -1 : 1;
+        Standard_Real sign = (NewU2 > u2) ? -1 : 1;
         while (Abs(u2 - NewU2) > M_PI)
-          NewU2 += sign*(M_PI+M_PI);
+          NewU2 += sign * (M_PI + M_PI);
       }
     }
   }
   else
     return Standard_False;
-  
+
   Point.SetValue(MyPnt, NewU1, NewV1, NewU2, NewV2);
   return Standard_True;
 }
-//--------------------------------------------------------------------------------
-
-Standard_Boolean
-ApproxInt_ImpPrmSvSurfaces::FillInitialVectorOfSolution(const Standard_Real u1,
-                                                        const Standard_Real v1,
-                                                        const Standard_Real u2,
-                                                        const Standard_Real v2,
-                                                        const Standard_Real binfu,
-                                                        const Standard_Real bsupu,
-                                                        const Standard_Real binfv,
-                                                        const Standard_Real bsupv,
-                                                        math_Vector& X,
-                                                        Standard_Real& TranslationU,
-                                                        Standard_Real& TranslationV)
+
+//=================================================================================================
+
+Standard_Boolean ApproxInt_ImpPrmSvSurfaces::FillInitialVectorOfSolution(
+  const Standard_Real u1,
+  const Standard_Real v1,
+  const Standard_Real u2,
+  const Standard_Real v2,
+  const Standard_Real binfu,
+  const Standard_Real bsupu,
+  const Standard_Real binfv,
+  const Standard_Real bsupv,
+  math_Vector&        X,
+  Standard_Real&      TranslationU,
+  Standard_Real&      TranslationV)
 {
-  const ThePSurface&      aPSurf = MyZerImpFunc.PSurface();
+  const ThePSurface& aPSurf = MyZerImpFunc.PSurface();
 
-  math_Vector F(1,1);
+  math_Vector F(1, 1);
 
   TranslationU = 0.0;
   TranslationV = 0.0;
 
-  if(MyImplicitFirst) { 
-    if(u2<binfu-0.0000000001) { 
-      if(ThePSurfaceTool::IsUPeriodic(aPSurf)) { 
-       Standard_Real d = ThePSurfaceTool::UPeriod(aPSurf);
-       do {  TranslationU+=d; } while(u2+TranslationU < binfu);
+  if (MyImplicitFirst)
+  {
+    if (u2 < binfu - 0.0000000001)
+    {
+      if (ThePSurfaceTool::IsUPeriodic(aPSurf))
+      {
+        Standard_Real d = ThePSurfaceTool::UPeriod(aPSurf);
+        do
+        {
+          TranslationU += d;
+        } while (u2 + TranslationU < binfu);
       }
-      else 
-       return(Standard_False);
+      else
+        return (Standard_False);
     }
-    else if(u2>bsupu+0.0000000001) { 
-      if(ThePSurfaceTool::IsUPeriodic(aPSurf)) { 
-       Standard_Real d = ThePSurfaceTool::UPeriod(aPSurf);
-       do { TranslationU-=d; } while(u2+TranslationU > bsupu);
+    else if (u2 > bsupu + 0.0000000001)
+    {
+      if (ThePSurfaceTool::IsUPeriodic(aPSurf))
+      {
+        Standard_Real d = ThePSurfaceTool::UPeriod(aPSurf);
+        do
+        {
+          TranslationU -= d;
+        } while (u2 + TranslationU > bsupu);
       }
       else
-       return(Standard_False);
+        return (Standard_False);
     }
-    if(v2<binfv-0.0000000001) { 
-      if(ThePSurfaceTool::IsVPeriodic(aPSurf)) { 
-       Standard_Real d = ThePSurfaceTool::VPeriod(aPSurf);
-       do { TranslationV+=d; } while(v2+TranslationV < binfv);
+    if (v2 < binfv - 0.0000000001)
+    {
+      if (ThePSurfaceTool::IsVPeriodic(aPSurf))
+      {
+        Standard_Real d = ThePSurfaceTool::VPeriod(aPSurf);
+        do
+        {
+          TranslationV += d;
+        } while (v2 + TranslationV < binfv);
       }
       else
-       return(Standard_False);
+        return (Standard_False);
     }
-    else if(v2>bsupv+0.0000000001) { 
-      if(ThePSurfaceTool::IsVPeriodic(aPSurf)) { 
-       Standard_Real d = ThePSurfaceTool::VPeriod(aPSurf);
-       do { TranslationV-=d; } while(v2+TranslationV > bsupv);
+    else if (v2 > bsupv + 0.0000000001)
+    {
+      if (ThePSurfaceTool::IsVPeriodic(aPSurf))
+      {
+        Standard_Real d = ThePSurfaceTool::VPeriod(aPSurf);
+        do
+        {
+          TranslationV -= d;
+        } while (v2 + TranslationV > bsupv);
       }
       else
-       return(Standard_False);
+        return (Standard_False);
     }
-    X(1) = u2+TranslationU; 
-    X(2) = v2+TranslationV;
+    X(1) = u2 + TranslationU;
+    X(2) = v2 + TranslationV;
   }
-  else { 
-    if(u1<binfu-0.0000000001) { 
-      if(ThePSurfaceTool::IsUPeriodic(aPSurf)) { 
-       Standard_Real d = ThePSurfaceTool::UPeriod(aPSurf);
-       do {  TranslationU+=d;  } while(u1+TranslationU < binfu);
+  else
+  {
+    if (u1 < binfu - 0.0000000001)
+    {
+      if (ThePSurfaceTool::IsUPeriodic(aPSurf))
+      {
+        Standard_Real d = ThePSurfaceTool::UPeriod(aPSurf);
+        do
+        {
+          TranslationU += d;
+        } while (u1 + TranslationU < binfu);
       }
       else
-       return(Standard_False);
+        return (Standard_False);
     }
-    else if(u1>bsupu+0.0000000001) { 
-      if(ThePSurfaceTool::IsUPeriodic(aPSurf)) { 
-       Standard_Real d = ThePSurfaceTool::UPeriod(aPSurf);
-       do { TranslationU-=d; } while(u1+TranslationU > bsupu);
+    else if (u1 > bsupu + 0.0000000001)
+    {
+      if (ThePSurfaceTool::IsUPeriodic(aPSurf))
+      {
+        Standard_Real d = ThePSurfaceTool::UPeriod(aPSurf);
+        do
+        {
+          TranslationU -= d;
+        } while (u1 + TranslationU > bsupu);
       }
       else
-       return(Standard_False);
+        return (Standard_False);
     }
-    if(v1<binfv-0.0000000001) { 
-      if(ThePSurfaceTool::IsVPeriodic(aPSurf)) { 
-       Standard_Real d = ThePSurfaceTool::VPeriod(aPSurf);
-       do { TranslationV+=d; } while(v1+TranslationV < binfv);
+    if (v1 < binfv - 0.0000000001)
+    {
+      if (ThePSurfaceTool::IsVPeriodic(aPSurf))
+      {
+        Standard_Real d = ThePSurfaceTool::VPeriod(aPSurf);
+        do
+        {
+          TranslationV += d;
+        } while (v1 + TranslationV < binfv);
       }
       else
-       return(Standard_False);
+        return (Standard_False);
     }
-    else if(v1>bsupv+0.0000000001) { 
-      if(ThePSurfaceTool::IsVPeriodic(aPSurf)) { 
-       Standard_Real d = ThePSurfaceTool::VPeriod(aPSurf);
-       do { TranslationV-=d; } while(v1+TranslationV > bsupv);
+    else if (v1 > bsupv + 0.0000000001)
+    {
+      if (ThePSurfaceTool::IsVPeriodic(aPSurf))
+      {
+        Standard_Real d = ThePSurfaceTool::VPeriod(aPSurf);
+        do
+        {
+          TranslationV -= d;
+        } while (v1 + TranslationV > bsupv);
       }
       else
-       return(Standard_False);
+        return (Standard_False);
     }
-    X(1) = u1+TranslationU;
-    X(2) = v1+TranslationV;
+    X(1) = u1 + TranslationU;
+    X(2) = v1 + TranslationV;
   }
-  
-  //----------------------------------------------------
-  //Make a small step from boundaries in order to avoid
-  //finding "outboundaried" solution (Rsnld -> NotDone).
+
+  //=================================================================================================
+
+  // Make a small step from boundaries in order to avoid
+  // finding "outboundaried" solution (Rsnld -> NotDone).
   if (GetUseSolver())
   {
-    Standard_Real du = Max(Precision::Confusion(), ThePSurfaceTool::UResolution(aPSurf, Precision::Confusion()));
-    Standard_Real dv = Max(Precision::Confusion(), ThePSurfaceTool::VResolution(aPSurf, Precision::Confusion()));
-    if (X(1) - 0.0000000001 <= binfu) X(1) = X(1) + du;
-    if (X(1) + 0.0000000001 >= bsupu) X(1) = X(1) - du;
-    if (X(2) - 0.0000000001 <= binfv) X(2) = X(2) + dv;
-    if (X(2) + 0.0000000001 >= bsupv) X(2) = X(2) - dv;
+    Standard_Real du =
+      Max(Precision::Confusion(), ThePSurfaceTool::UResolution(aPSurf, Precision::Confusion()));
+    Standard_Real dv =
+      Max(Precision::Confusion(), ThePSurfaceTool::VResolution(aPSurf, Precision::Confusion()));
+    if (X(1) - 0.0000000001 <= binfu)
+      X(1) = X(1) + du;
+    if (X(1) + 0.0000000001 >= bsupu)
+      X(1) = X(1) - du;
+    if (X(2) - 0.0000000001 <= binfv)
+      X(2) = X(2) + dv;
+    if (X(2) + 0.0000000001 >= bsupv)
+      X(2) = X(2) - dv;
   }
-  
+
   return Standard_True;
 }
index d7acaf76d5a35c9555a4b92b3507f51b7ef0b6ad..308ffcdfb392e8cb7a64c1f4fa5ee5aa4ba0c8dd 100644 (file)
 // commercial license or contractual agreement.
 
 #include <ApproxInt_KnotTools.hxx>
-#include <TColgp_Array1OfPnt2d.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <math_Vector.hxx>
-#include <Geom_BSplineCurve.hxx>
 #include <Geom2d_BSplineCurve.hxx>
+#include <GeomInt_TheMultiLineOfWLApprox.hxx>
+#include <GeomInt_WLApprox.hxx>
+#include <Geom_BSplineCurve.hxx>
 #include <NCollection_Sequence.hxx>
+#include <NCollection_Vector.hxx>
 #include <PLib.hxx>
 #include <Precision.hxx>
-#include <NCollection_Vector.hxx>
+#include <TColStd_Array1OfReal.hxx>
 #include <TColgp_Array1OfPnt.hxx>
-#include <GeomInt_WLApprox.hxx>
-#include <GeomInt_TheMultiLineOfWLApprox.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <math_Vector.hxx>
 
 // (Sqrt(5.0) - 1.0) / 4.0
-//static const Standard_Real aSinCoeff = 0.30901699437494742410229341718282;
+// static const Standard_Real aSinCoeff = 0.30901699437494742410229341718282;
 static const Standard_Real aSinCoeff2 = 0.09549150281252627; // aSinCoeff^2 = (3. - Sqrt(5.)) / 8.
 static const Standard_Integer aMaxPntCoeff = 15;
 
-//=======================================================================
-//function : EvalCurv
-//purpose  : Evaluate curvature in dim-dimension point.
-//=======================================================================
-static Standard_Real EvalCurv(const Standard_Real dim, 
+//=================================================================================================
+// function : EvalCurv
+// purpose  : Evaluate curvature in dim-dimension point.
+//=================================================================================================
+
+static Standard_Real EvalCurv(const Standard_Real  dim,
                               const Standard_Real* V1,
                               const Standard_Real* V2)
 {
@@ -44,22 +45,22 @@ static Standard_Real EvalCurv(const Standard_Real dim,
   // Curvature is curv = |V1^V2|/|V1|^3
   // V1^V2 is outer product of two vectors:
   // P(i,j) = V1(i)*V2(j) - V1(j)*V2(i);
-  Standard_Real mp = 0.;
+  Standard_Real    mp = 0.;
   Standard_Integer i, j;
-  Standard_Real p;
-  for(i = 1; i < dim; ++i)
+  Standard_Real    p;
+  for (i = 1; i < dim; ++i)
   {
-    for(j = 0; j < i; ++j)
+    for (j = 0; j < i; ++j)
     {
-      p = V1[i]*V2[j] - V1[j]*V2[i];
-      mp += p*p;
+      p = V1[i] * V2[j] - V1[j] * V2[i];
+      mp += p * p;
     }
   }
   //
   Standard_Real q = 0.;
-  for(i = 0; i < dim; ++i)
+  for (i = 0; i < dim; ++i)
   {
-    q += V1[i]*V1[i];
+    q += V1[i] * V1[i];
   }
 
   if (q < 1 / Precision::Infinite())
@@ -78,7 +79,7 @@ static Standard_Real EvalCurv(const Standard_Real dim,
   }
 
   q = Min(q, Precision::Infinite());
-  q *= q*q;
+  q *= q * q;
 
   //
   Standard_Real curv = Sqrt(mp / q);
@@ -86,20 +87,16 @@ static Standard_Real EvalCurv(const Standard_Real dim,
   return curv;
 }
 
-//=======================================================================
-//function : BuildCurvature
-//purpose  : 
-//=======================================================================
+//=================================================================================================
 
-void ApproxInt_KnotTools::BuildCurvature(
-  const NCollection_LocalArray<Standard_Real>& theCoords,
-  const Standard_Integer theDim,
-  const math_Vector& thePars,
-  TColStd_Array1OfReal& theCurv,
-  Standard_Real& theMaxCurv)
+void ApproxInt_KnotTools::BuildCurvature(const NCollection_LocalArray<Standard_Real>& theCoords,
+                                         const Standard_Integer                       theDim,
+                                         const math_Vector&                           thePars,
+                                         TColStd_Array1OfReal&                        theCurv,
+                                         Standard_Real&                               theMaxCurv)
 {
   // Arrays are allocated for max theDim = 7: 1 3d curve + 2 2d curves.
-  Standard_Real Val[21], Par[3], Res[21];
+  Standard_Real    Val[21], Par[3], Res[21];
   Standard_Integer i, j, m, ic;
   Standard_Integer dim = theDim;
   //
@@ -113,8 +110,8 @@ void ApproxInt_KnotTools::BuildCurvature(
   for (j = 0; j < 3; ++j)
   {
     Standard_Integer k = i + j;
-    ic = (k - theCurv.Lower()) * dim;
-    Standard_Integer l = dim*j;
+    ic                 = (k - theCurv.Lower()) * dim;
+    Standard_Integer l = dim * j;
     for (m = 0; m < dim; ++m)
     {
       Val[l + m] = theCoords[ic + m];
@@ -135,8 +132,8 @@ void ApproxInt_KnotTools::BuildCurvature(
     for (j = 0; j < 3; ++j)
     {
       Standard_Integer k = i + j - 1;
-      ic = (k - theCurv.Lower()) * dim;
-      Standard_Integer l = dim*j;
+      ic                 = (k - theCurv.Lower()) * dim;
+      Standard_Integer l = dim * j;
       for (m = 0; m < dim; ++m)
       {
         Val[l + m] = theCoords[ic + m];
@@ -156,8 +153,8 @@ void ApproxInt_KnotTools::BuildCurvature(
   for (j = 0; j < 3; ++j)
   {
     Standard_Integer k = i + j - 2;
-    ic = (k - theCurv.Lower()) * dim;
-    Standard_Integer l = dim*j;
+    ic                 = (k - theCurv.Lower()) * dim;
+    Standard_Integer l = dim * j;
     for (m = 0; m < dim; ++m)
     {
       Val[l + m] = theCoords[ic + m];
@@ -171,35 +168,32 @@ void ApproxInt_KnotTools::BuildCurvature(
   {
     theMaxCurv = theCurv(i);
   }
-
 }
 
-//=======================================================================
-//function : ComputeKnotInds
-//purpose  : 
-//=======================================================================
+//=================================================================================================
+
 void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_Real>& theCoords,
-                                          const Standard_Integer theDim, 
-                                          const math_Vector& thePars,
-                                          NCollection_Sequence<Standard_Integer>& theInds)
+                                          const Standard_Integer                       theDim,
+                                          const math_Vector&                           thePars,
+                                          NCollection_Sequence<Standard_Integer>&      theInds)
 {
-  //I: Create discrete curvature.
+  // I: Create discrete curvature.
   NCollection_Sequence<Standard_Integer> aFeatureInds;
-  TColStd_Array1OfReal aCurv(thePars.Lower(), thePars.Upper());
-  Standard_Real aMaxCurv = 0.;
+  TColStd_Array1OfReal                   aCurv(thePars.Lower(), thePars.Upper());
+  Standard_Real                          aMaxCurv = 0.;
   BuildCurvature(theCoords, theDim, thePars, aCurv, aMaxCurv);
-  //  
+  //
   Standard_Integer i, j, dim = theDim;
 #ifdef APPROXINT_KNOTTOOLS_DEBUG
   std::cout << "Discrete curvature array is" << std::endl;
-  for(i = aCurv.Lower(); i <= aCurv.Upper(); ++i)
+  for (i = aCurv.Lower(); i <= aCurv.Upper(); ++i)
   {
     std::cout << i << " " << aCurv(i) << std::endl;
   }
 #endif
 
   theInds.Append(aCurv.Lower());
-  if(aMaxCurv <= Precision::Confusion())
+  if (aMaxCurv <= Precision::Confusion())
   {
     // Linear case.
     theInds.Append(aCurv.Upper());
@@ -208,32 +202,30 @@ void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_
 
   // II: Find extremas of curvature.
   // Not used Precision::PConfusion, by different from "param space" eps nature.
-  Standard_Real eps  = 1.0e-9,
-                eps1 = 1.0e3 * eps;
-  for(i = aCurv.Lower() + 1; i < aCurv.Upper(); ++i)
+  Standard_Real eps = 1.0e-9, eps1 = 1.0e3 * eps;
+  for (i = aCurv.Lower() + 1; i < aCurv.Upper(); ++i)
   {
-    Standard_Real d1 = aCurv(i) - aCurv(i - 1),
-                  d2 = aCurv(i) - aCurv(i + 1),
-                  ad1 = Abs(d1), ad2 = Abs(d2);
+    Standard_Real d1 = aCurv(i) - aCurv(i - 1), d2 = aCurv(i) - aCurv(i + 1), ad1 = Abs(d1),
+                  ad2 = Abs(d2);
 
-    if(d1*d2 > 0. && ad1 > eps && ad2 > eps)
+    if (d1 * d2 > 0. && ad1 > eps && ad2 > eps)
     {
-      if(i != theInds.Last())
+      if (i != theInds.Last())
       {
         theInds.Append(i);
         aFeatureInds.Append(i);
       }
     }
-    else if((ad1 < eps && ad2 > eps1) || (ad1 > eps1 && ad2 < eps))
+    else if ((ad1 < eps && ad2 > eps1) || (ad1 > eps1 && ad2 < eps))
     {
-      if(i != theInds.Last())
+      if (i != theInds.Last())
       {
         theInds.Append(i);
         aFeatureInds.Append(i);
       }
     }
   }
-  if(aCurv.Upper() != theInds.Last())
+  if (aCurv.Upper() != theInds.Last())
   {
     theInds.Append(aCurv.Upper());
   }
@@ -242,72 +234,71 @@ void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_
   {
     std::cout << "Feature indices new: " << std::endl;
     i;
-    for(i = theInds.Lower(); i <= theInds.Upper();  ++i)
+    for (i = theInds.Lower(); i <= theInds.Upper(); ++i)
     {
       std::cout << i << " : " << theInds(i) << std::endl;
     }
   }
 #endif
 
-  //III: Put knots in monotone intervals of curvature.
+  // III: Put knots in monotone intervals of curvature.
   Standard_Boolean Ok;
   i = 1;
   do
   {
     i++;
     //
-    Ok = InsKnotBefI(i, aCurv, theCoords, dim, theInds, Standard_True); 
-    if(Ok)
+    Ok = InsKnotBefI(i, aCurv, theCoords, dim, theInds, Standard_True);
+    if (Ok)
     {
       i--;
     }
-  }
-  while(i < theInds.Length());
+  } while (i < theInds.Length());
 
-  //IV: Checking feature points.
+  // IV: Checking feature points.
   j = 2;
-  for(i = 1; i <= aFeatureInds.Length(); ++i)
+  for (i = 1; i <= aFeatureInds.Length(); ++i)
   {
     Standard_Integer anInd = aFeatureInds(i);
-    for(; j <= theInds.Length() - 1;)
+    for (; j <= theInds.Length() - 1;)
     {
-      if(theInds(j) == anInd)
+      if (theInds(j) == anInd)
       {
-        Standard_Integer anIndPrev = theInds(j-1);
-        Standard_Integer anIndNext = theInds(j+1);
-        Standard_Integer ici = (anIndPrev - aCurv.Lower()) * theDim,
-          ici1 = (anIndNext - aCurv.Lower()) * theDim,
-          icm = (anInd - aCurv.Lower()) * theDim;
+        Standard_Integer anIndPrev = theInds(j - 1);
+        Standard_Integer anIndNext = theInds(j + 1);
+        Standard_Integer ici       = (anIndPrev - aCurv.Lower()) * theDim,
+                         ici1      = (anIndNext - aCurv.Lower()) * theDim,
+                         icm       = (anInd - aCurv.Lower()) * theDim;
         NCollection_LocalArray<Standard_Real> V1(theDim), V2(theDim);
-        Standard_Real mp = 0., m1 = 0., m2 = 0.;
-        Standard_Real p;
-        for(Standard_Integer k = 0; k < theDim; ++k)
+        Standard_Real                         mp = 0., m1 = 0., m2 = 0.;
+        Standard_Real                         p;
+        for (Standard_Integer k = 0; k < theDim; ++k)
         {
           V1[k] = theCoords[icm + k] - theCoords[ici + k];
-          m1 += V1[k]*V1[k];
+          m1 += V1[k] * V1[k];
           V2[k] = theCoords[ici1 + k] - theCoords[icm + k];
-          m2 += V2[k]*V2[k];
+          m2 += V2[k] * V2[k];
         }
-        for(Standard_Integer k = 1; k < theDim; ++k)
+        for (Standard_Integer k = 1; k < theDim; ++k)
         {
-          for(Standard_Integer l = 0; l < k; ++l)
+          for (Standard_Integer l = 0; l < k; ++l)
           {
-            p = V1[k]*V2[l] - V1[l]*V2[k];
-            mp += p*p;
+            p = V1[k] * V2[l] - V1[l] * V2[k];
+            mp += p * p;
           }
         }
-        //mp *= 2.; //P(j,i) = -P(i,j);
+        // mp *= 2.; //P(j,i) = -P(i,j);
         //
 
-        if(mp > aSinCoeff2 * m1 * m2) // Sqrt (mp/(m1*m2)) > aSinCoeff
+        if (mp > aSinCoeff2 * m1 * m2) // Sqrt (mp/(m1*m2)) > aSinCoeff
         {
-          //Insert new knots
+          // Insert new knots
           Standard_Real d1 = Abs(aCurv(anInd) - aCurv(anIndPrev));
           Standard_Real d2 = Abs(aCurv(anInd) - aCurv(anIndNext));
-          if(d1 > d2)
+          if (d1 > d2)
           {
             Ok = InsKnotBefI(j, aCurv, theCoords, dim, theInds, Standard_False);
-            if(Ok)
+            if (Ok)
             {
               j++;
             }
@@ -318,8 +309,8 @@ void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_
           }
           else
           {
-            Ok = InsKnotBefI(j+1, aCurv, theCoords, dim, theInds, Standard_False);
-            if(!Ok)
+            Ok = InsKnotBefI(j + 1, aCurv, theCoords, dim, theInds, Standard_False);
+            if (!Ok)
             {
               break;
             }
@@ -340,25 +331,22 @@ void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_
   //
 }
 
+//=================================================================================================
 
-//=======================================================================
-//function : FilterKnots
-//purpose  :
-//=======================================================================
-void ApproxInt_KnotTools::FilterKnots(NCollection_Sequence<Standard_Integer>& theInds, 
-                                      const Standard_Integer theMinNbPnts,
-                                      NCollection_Vector<Standard_Integer>& theLKnots)
+void ApproxInt_KnotTools::FilterKnots(NCollection_Sequence<Standard_Integer>& theInds,
+                                      const Standard_Integer                  theMinNbPnts,
+                                      NCollection_Vector<Standard_Integer>&   theLKnots)
 {
   // Maximum number of points per knot interval.
-  Standard_Integer aMaxNbPnts = aMaxPntCoeff*theMinNbPnts;
-  Standard_Integer i = 1;
+  Standard_Integer aMaxNbPnts = aMaxPntCoeff * theMinNbPnts;
+  Standard_Integer i          = 1;
   Standard_Integer aMinNbStep = theMinNbPnts / 2;
 
   // I: Filter too big number of points per knot interval.
-  while(i < theInds.Length())
+  while (i < theInds.Length())
   {
     Standard_Integer nbint = theInds(i + 1) - theInds(i) + 1;
-    if(nbint <= aMaxNbPnts)
+    if (nbint <= aMaxNbPnts)
     {
       ++i;
       continue;
@@ -366,7 +354,7 @@ void ApproxInt_KnotTools::FilterKnots(NCollection_Sequence<Standard_Integer>& th
     else
     {
       Standard_Integer ind = theInds(i) + nbint / 2;
-      theInds.InsertAfter(i, ind);     
+      theInds.InsertAfter(i, ind);
     }
   }
 
@@ -374,14 +362,14 @@ void ApproxInt_KnotTools::FilterKnots(NCollection_Sequence<Standard_Integer>& th
   i = 1;
   theLKnots.Append(theInds(i));
   Standard_Integer anIndsPrev = theInds(i);
-  for(i = 2; i <= theInds.Length(); ++i)
+  for (i = 2; i <= theInds.Length(); ++i)
   {
-    if(theInds(i) - anIndsPrev <= theMinNbPnts)
+    if (theInds(i) - anIndsPrev <= theMinNbPnts)
     {
       if (i != theInds.Length())
       {
         Standard_Integer anIdx = i + 1;
-        for; anIdx <= theInds.Length(); ++anIdx)
+        for (; anIdx <= theInds.Length(); ++anIdx)
         {
           if (theInds(anIdx) - anIndsPrev >= theMinNbPnts)
             break;
@@ -389,16 +377,15 @@ void ApproxInt_KnotTools::FilterKnots(NCollection_Sequence<Standard_Integer>& th
         anIdx--;
 
         Standard_Integer aMidIdx = (theInds(anIdx) + anIndsPrev) / 2;
-        if (aMidIdx - anIndsPrev        < theMinNbPnts &&
-            aMidIdx - theInds(anIdx)    < theMinNbPnts &&
-            theInds(anIdx) - anIndsPrev >= aMinNbStep)
+        if (aMidIdx - anIndsPrev < theMinNbPnts && aMidIdx - theInds(anIdx) < theMinNbPnts
+            && theInds(anIdx) - anIndsPrev >= aMinNbStep)
         {
           if (theInds(anIdx) - anIndsPrev > 2 * theMinNbPnts)
           {
             // Bad distribution points merge into one knot interval.
             theLKnots.Append(anIndsPrev + theMinNbPnts);
             anIndsPrev = anIndsPrev + theMinNbPnts;
-            i = anIdx - 1;
+            i          = anIdx - 1;
           }
           else
           {
@@ -407,12 +394,12 @@ void ApproxInt_KnotTools::FilterKnots(NCollection_Sequence<Standard_Integer>& th
               // Bad distribution points merge into one knot interval.
               theLKnots.Append(theInds(anIdx - 1));
               anIndsPrev = theInds(anIdx - 1);
-              i = anIdx - 1;
+              i          = anIdx - 1;
               if (theInds(anIdx) - theInds(anIdx - 1) <= theMinNbPnts / 2)
               {
                 theLKnots.SetValue(theLKnots.Upper(), theInds(anIdx));
-                anIndsPrev = theInds(anIdx );
-                i = anIdx;
+                anIndsPrev = theInds(anIdx);
+                i          = anIdx;
               }
             }
             else
@@ -420,23 +407,23 @@ void ApproxInt_KnotTools::FilterKnots(NCollection_Sequence<Standard_Integer>& th
               // Bad distribution points merge into one knot interval.
               theLKnots.Append(theInds(anIdx));
               anIndsPrev = theInds(anIdx);
-              i = anIdx;
+              i          = anIdx;
             }
           }
         }
         else if (anIdx == theInds.Upper() && // Last point obtained.
-                 theLKnots.Length() >= 2) // It is possible to modify last item.
+                 theLKnots.Length() >= 2)    // It is possible to modify last item.
         {
           // Current bad interval from i to last.
           // Trying to add knot to divide sequence on two parts:
           // Last good index -> Last index - theMinNbPnts -> Last index
           Standard_Integer aLastGoodIdx = theLKnots.Value(theLKnots.Upper() - 1);
-          if ( theInds.Last() - 2 * theMinNbPnts >= aLastGoodIdx)
+          if (theInds.Last() - 2 * theMinNbPnts >= aLastGoodIdx)
           {
             theLKnots(theLKnots.Upper()) = theInds.Last() - theMinNbPnts;
             theLKnots.Append(theInds.Last());
             anIndsPrev = theInds(anIdx);
-            i = anIdx;
+            i          = anIdx;
           }
         }
       } // if (i != theInds.Length())
@@ -450,51 +437,50 @@ void ApproxInt_KnotTools::FilterKnots(NCollection_Sequence<Standard_Integer>& th
   }
 
   // III: Fill Last Knot.
-  if(theLKnots.Length() < 2)
+  if (theLKnots.Length() < 2)
   {
     theLKnots.Append(theInds.Last());
   }
   else
   {
-    if(theLKnots.Last() < theInds.Last())
+    if (theLKnots.Last() < theInds.Last())
     {
       theLKnots(theLKnots.Upper()) = theInds.Last();
     }
   }
 }
-//=======================================================================
-//function : InsKnotBefI
-//purpose  :
-//=======================================================================
-Standard_Boolean ApproxInt_KnotTools::InsKnotBefI(const Standard_Integer theI,
-                                                  const TColStd_Array1OfReal& theCurv,
-                                                  const NCollection_LocalArray<Standard_Real>& theCoords,
-                                                  const Standard_Integer theDim, 
-                                                  NCollection_Sequence<Standard_Integer>& theInds,
-                                                  const Standard_Boolean ChkCurv)
+
+//=================================================================================================
+
+Standard_Boolean ApproxInt_KnotTools::InsKnotBefI(
+  const Standard_Integer                       theI,
+  const TColStd_Array1OfReal&                  theCurv,
+  const NCollection_LocalArray<Standard_Real>& theCoords,
+  const Standard_Integer                       theDim,
+  NCollection_Sequence<Standard_Integer>&      theInds,
+  const Standard_Boolean                       ChkCurv)
 {
   Standard_Integer anInd1 = theInds(theI);
-  Standard_Integer anInd = theInds(theI - 1);
+  Standard_Integer anInd  = theInds(theI - 1);
   //
-  if((anInd1-anInd) == 1)
+  if ((anInd1 - anInd) == 1)
   {
     return Standard_False;
   }
   //
-  Standard_Real curv = 0.5*(theCurv(anInd) + theCurv(anInd1));
-  Standard_Integer mid = 0, j, jj;
+  Standard_Real       curv                  = 0.5 * (theCurv(anInd) + theCurv(anInd1));
+  Standard_Integer    mid                   = 0, j, jj;
   const Standard_Real aLimitCurvatureChange = 3.0;
-  for(j = anInd+1; j < anInd1; ++j)
+  for (j = anInd + 1; j < anInd1; ++j)
   {
     mid = 0;
 
     // I: Curvature change criteria:
     // Non-null curvature.
-    if (theCurv(j)     > Precision::Confusion() && 
-        theCurv(anInd) > Precision::Confusion() )
+    if (theCurv(j) > Precision::Confusion() && theCurv(anInd) > Precision::Confusion())
     {
-      if (theCurv(j) / theCurv(anInd) > aLimitCurvatureChange || 
-          theCurv(j) / theCurv(anInd) < 1.0 / aLimitCurvatureChange)
+      if (theCurv(j) / theCurv(anInd) > aLimitCurvatureChange
+          || theCurv(j) / theCurv(anInd) < 1.0 / aLimitCurvatureChange)
       {
         // Curvature on current interval changed more than 3 times.
         mid = j;
@@ -505,9 +491,9 @@ Standard_Boolean ApproxInt_KnotTools::InsKnotBefI(const Standard_Integer theI,
 
     // II: Angular criteria:
     Standard_Real ac = theCurv(j - 1), ac1 = theCurv(j);
-    if((curv >= ac && curv <= ac1) || (curv >= ac1 && curv <= ac))
+    if ((curv >= ac && curv <= ac1) || (curv >= ac1 && curv <= ac))
     {
-      if(Abs(curv - ac) < Abs(curv - ac1))
+      if (Abs(curv - ac) < Abs(curv - ac1))
       {
         mid = j - 1;
       }
@@ -516,41 +502,41 @@ Standard_Boolean ApproxInt_KnotTools::InsKnotBefI(const Standard_Integer theI,
         mid = j;
       }
     }
-    if(mid == anInd)
+    if (mid == anInd)
     {
       mid++;
     }
-    if(mid == anInd1)
+    if (mid == anInd1)
     {
       mid--;
     }
-    if(mid > 0)
+    if (mid > 0)
     {
-      if(ChkCurv)
+      if (ChkCurv)
       {
-        Standard_Integer ici = (anInd - theCurv.Lower()) * theDim,
-          ici1 = (anInd1 - theCurv.Lower()) * theDim,
-          icm = (mid - theCurv.Lower()) * theDim;
+        Standard_Integer ici  = (anInd - theCurv.Lower()) * theDim,
+                         ici1 = (anInd1 - theCurv.Lower()) * theDim,
+                         icm  = (mid - theCurv.Lower()) * theDim;
         NCollection_LocalArray<Standard_Real> V1(theDim), V2(theDim);
-        Standard_Integer i;
-        Standard_Real mp = 0., m1 = 0., m2 = 0.;
-        Standard_Real p;
-        for(i = 0; i < theDim; ++i)
+        Standard_Integer                      i;
+        Standard_Real                         mp = 0., m1 = 0., m2 = 0.;
+        Standard_Real                         p;
+        for (i = 0; i < theDim; ++i)
         {
           V1[i] = theCoords[icm + i] - theCoords[ici + i];
-          m1 += V1[i]*V1[i];
+          m1 += V1[i] * V1[i];
           V2[i] = theCoords[ici1 + i] - theCoords[icm + i];
-          m2 += V2[i]*V2[i];
+          m2 += V2[i] * V2[i];
         }
-        for(i = 1; i < theDim; ++i)
+        for (i = 1; i < theDim; ++i)
         {
-          for(jj = 0; jj < i; ++jj)
+          for (jj = 0; jj < i; ++jj)
           {
-            p = V1[i]*V2[jj] - V1[jj]*V2[i];
-            mp += p*p;
+            p = V1[i] * V2[jj] - V1[jj] * V2[i];
+            mp += p * p;
           }
         }
-        //mp *= 2.; //P(j,i) = -P(i,j);
+        // mp *= 2.; //P(j,i) = -P(i,j);
         //
 
         if (mp > aSinCoeff2 * m1 * m2) // Sqrt (mp / m1m2) > aSinCoeff
@@ -570,37 +556,35 @@ Standard_Boolean ApproxInt_KnotTools::InsKnotBefI(const Standard_Integer theI,
   return Standard_False;
 }
 
-//=======================================================================
-//function : BuildKnots
-//purpose  :
-//=======================================================================
-void ApproxInt_KnotTools::BuildKnots(const TColgp_Array1OfPnt& thePntsXYZ,
-                                     const TColgp_Array1OfPnt2d& thePntsU1V1,
-                                     const TColgp_Array1OfPnt2d& thePntsU2V2,
-                                     const math_Vector& thePars,
-                                     const Standard_Boolean theApproxXYZ,
-                                     const Standard_Boolean theApproxU1V1,
-                                     const Standard_Boolean theApproxU2V2,
-                                     const Standard_Integer theMinNbPnts,
+//=================================================================================================
+
+void ApproxInt_KnotTools::BuildKnots(const TColgp_Array1OfPnt&             thePntsXYZ,
+                                     const TColgp_Array1OfPnt2d&           thePntsU1V1,
+                                     const TColgp_Array1OfPnt2d&           thePntsU2V2,
+                                     const math_Vector&                    thePars,
+                                     const Standard_Boolean                theApproxXYZ,
+                                     const Standard_Boolean                theApproxU1V1,
+                                     const Standard_Boolean                theApproxU2V2,
+                                     const Standard_Integer                theMinNbPnts,
                                      NCollection_Vector<Standard_Integer>& theKnots)
 {
   NCollection_Sequence<Standard_Integer> aKnots;
-  Standard_Integer aDim = 0;
+  Standard_Integer                       aDim = 0;
 
   // I: Convert input data to the corresponding format.
-  if(theApproxXYZ)
+  if (theApproxXYZ)
     aDim += 3;
-  if(theApproxU1V1)
+  if (theApproxU1V1)
     aDim += 2;
-  if(theApproxU2V2)
+  if (theApproxU2V2)
     aDim += 2;
 
-  NCollection_LocalArray<Standard_Real> aCoords(thePars.Length()*aDim);
-  Standard_Integer i, j;
-  for(i = thePars.Lower(); i <= thePars.Upper(); ++i)
+  NCollection_LocalArray<Standard_Real> aCoords(thePars.Length() * aDim);
+  Standard_Integer                      i, j;
+  for (i = thePars.Lower(); i <= thePars.Upper(); ++i)
   {
     j = (i - thePars.Lower()) * aDim;
-    if(theApproxXYZ)
+    if (theApproxXYZ)
     {
       aCoords[j] = thePntsXYZ.Value(i).X();
       ++j;
@@ -609,14 +593,14 @@ void ApproxInt_KnotTools::BuildKnots(const TColgp_Array1OfPnt& thePntsXYZ,
       aCoords[j] = thePntsXYZ.Value(i).Z();
       ++j;
     }
-    if(theApproxU1V1)
+    if (theApproxU1V1)
     {
       aCoords[j] = thePntsU1V1.Value(i).X();
       ++j;
       aCoords[j] = thePntsU1V1.Value(i).Y();
       ++j;
     }
-    if(theApproxU2V2)
+    if (theApproxU2V2)
     {
       aCoords[j] = thePntsU2V2.Value(i).X();
       ++j;
@@ -629,33 +613,31 @@ void ApproxInt_KnotTools::BuildKnots(const TColgp_Array1OfPnt& thePntsXYZ,
   ComputeKnotInds(aCoords, aDim, thePars, aKnots);
 
 #if defined(APPROXINT_KNOTTOOLS_DEBUG)
-    std::cout << "Draft knot sequence: " << std::endl;
-    for(i = aKnots.Lower(); i <= aKnots.Upper();  ++i)
-    {
-      std::cout << i << " : " << aKnots(i) << std::endl;
-    }
+  std::cout << "Draft knot sequence: " << std::endl;
+  for (i = aKnots.Lower(); i <= aKnots.Upper(); ++i)
+  {
+    std::cout << i << " : " << aKnots(i) << std::endl;
+  }
 #endif
 
   // III: Build output knot sequence.
   FilterKnots(aKnots, theMinNbPnts, theKnots);
 
 #if defined(APPROXINT_KNOTTOOLS_DEBUG)
-    std::cout << "Result knot sequence: " << std::endl;
-    for(i = theKnots.Lower(); i <= theKnots.Upper();  ++i)
-    {
-      std::cout << i << " : " << theKnots(i) << std::endl;
-    }
+  std::cout << "Result knot sequence: " << std::endl;
+  for (i = theKnots.Lower(); i <= theKnots.Upper(); ++i)
+  {
+    std::cout << i << " : " << theKnots(i) << std::endl;
+  }
 #endif
-
 }
-//=======================================================================
-//function : MaxParamRatio
-//purpose  :
-//=======================================================================
+
+//=================================================================================================
+
 static Standard_Real MaxParamRatio(const math_Vector& thePars)
 {
   Standard_Integer i;
-  Standard_Real aMaxRatio = 0.;
+  Standard_Real    aMaxRatio = 0.;
   //
   for (i = thePars.Lower() + 1; i < thePars.Upper(); ++i)
   {
@@ -667,30 +649,41 @@ static Standard_Real MaxParamRatio(const math_Vector& thePars)
   }
   return aMaxRatio;
 }
-//=======================================================================
-//function : DefineParType
-//purpose  :
-//=======================================================================
-Approx_ParametrizationType ApproxInt_KnotTools::DefineParType(
-  const Handle(IntPatch_WLine)& theWL,
-  const Standard_Integer theFpar, const Standard_Integer theLpar,
-  const Standard_Boolean theApproxXYZ,
-  const Standard_Boolean theApproxU1V1,
-  const Standard_Boolean theApproxU2V2
-)
+
+//=================================================================================================
+
+Approx_ParametrizationType ApproxInt_KnotTools::DefineParType(const Handle(IntPatch_WLine)& theWL,
+                                                              const Standard_Integer        theFpar,
+                                                              const Standard_Integer        theLpar,
+                                                              const Standard_Boolean theApproxXYZ,
+                                                              const Standard_Boolean theApproxU1V1,
+                                                              const Standard_Boolean theApproxU2V2)
 {
   if (theLpar - theFpar == 1)
     return Approx_IsoParametric;
 
-  const Standard_Integer  nbp3d = theApproxXYZ ? 1 : 0,
-    nbp2d = (theApproxU1V1 ? 1 : 0) + (theApproxU2V2 ? 1 : 0);
-
-  GeomInt_TheMultiLineOfWLApprox aTestLine(theWL, nbp3d, nbp2d, theApproxU1V1, theApproxU2V2,
-    0., 0., 0., 0., 0., 0., 0., theApproxU1V1, theFpar, theLpar);
-
-  TColgp_Array1OfPnt aTabPnt3d(1, Max(1, nbp3d));
+  const Standard_Integer nbp3d = theApproxXYZ ? 1 : 0,
+                         nbp2d = (theApproxU1V1 ? 1 : 0) + (theApproxU2V2 ? 1 : 0);
+
+  GeomInt_TheMultiLineOfWLApprox aTestLine(theWL,
+                                           nbp3d,
+                                           nbp2d,
+                                           theApproxU1V1,
+                                           theApproxU2V2,
+                                           0.,
+                                           0.,
+                                           0.,
+                                           0.,
+                                           0.,
+                                           0.,
+                                           0.,
+                                           theApproxU1V1,
+                                           theFpar,
+                                           theLpar);
+
+  TColgp_Array1OfPnt   aTabPnt3d(1, Max(1, nbp3d));
   TColgp_Array1OfPnt2d aTabPnt2d(1, Max(1, nbp2d));
-  TColgp_Array1OfPnt aPntXYZ(theFpar, theLpar);
+  TColgp_Array1OfPnt   aPntXYZ(theFpar, theLpar);
   TColgp_Array1OfPnt2d aPntU1V1(theFpar, theLpar);
   TColgp_Array1OfPnt2d aPntU2V2(theFpar, theLpar);
 
@@ -698,9 +691,12 @@ Approx_ParametrizationType ApproxInt_KnotTools::DefineParType(
 
   for (i = theFpar; i <= theLpar; ++i)
   {
-    if (nbp3d != 0 && nbp2d != 0) aTestLine.Value(i, aTabPnt3d, aTabPnt2d);
-    else if (nbp2d != 0)          aTestLine.Value(i, aTabPnt2d);
-    else if (nbp3d != 0)          aTestLine.Value(i, aTabPnt3d);
+    if (nbp3d != 0 && nbp2d != 0)
+      aTestLine.Value(i, aTabPnt3d, aTabPnt2d);
+    else if (nbp2d != 0)
+      aTestLine.Value(i, aTabPnt2d);
+    else if (nbp3d != 0)
+      aTestLine.Value(i, aTabPnt3d);
     //
     if (nbp3d > 0)
     {
@@ -733,7 +729,7 @@ Approx_ParametrizationType ApproxInt_KnotTools::DefineParType(
   if (theApproxU2V2)
     aDim += 2;
 
-  Standard_Integer aLength = theLpar - theFpar + 1;
+  Standard_Integer                      aLength = theLpar - theFpar + 1;
   NCollection_LocalArray<Standard_Real> aCoords(aLength * aDim);
   for (i = theFpar; i <= theLpar; ++i)
   {
@@ -763,26 +759,25 @@ Approx_ParametrizationType ApproxInt_KnotTools::DefineParType(
     }
   }
 
-  //Analysis of curvature
-  const Standard_Real aCritRat = 500.;
-  const Standard_Real aCritParRat = 100.;
-  math_Vector aPars(theFpar, theLpar);
+  // Analysis of curvature
+  const Standard_Real        aCritRat    = 500.;
+  const Standard_Real        aCritParRat = 100.;
+  math_Vector                aPars(theFpar, theLpar);
   Approx_ParametrizationType aParType = Approx_ChordLength;
   GeomInt_WLApprox::Parameters(aTestLine, theFpar, theLpar, aParType, aPars);
   TColStd_Array1OfReal aCurv(aPars.Lower(), aPars.Upper());
-  Standard_Real aMaxCurv = 0.;
+  Standard_Real        aMaxCurv = 0.;
   BuildCurvature(aCoords, aDim, aPars, aCurv, aMaxCurv);
 
-  if (aMaxCurv < Precision::PConfusion() 
-      || Precision::IsPositiveInfinite(aMaxCurv))
+  if (aMaxCurv < Precision::PConfusion() || Precision::IsPositiveInfinite(aMaxCurv))
   {
-    //Linear case
+    // Linear case
     return aParType;
   }
 
   Standard_Real aMidCurv = 0.;
-  Standard_Real eps = Epsilon(1.);
-  j = 0;
+  Standard_Real eps      = Epsilon(1.);
+  j                      = 0;
   for (i = aCurv.Lower(); i <= aCurv.Upper(); ++i)
   {
     if (aMaxCurv - aCurv(i) < eps)
@@ -802,10 +797,10 @@ Approx_ParametrizationType ApproxInt_KnotTools::DefineParType(
     return aParType;
 
   Standard_Real aRat = aMaxCurv / aMidCurv;
-  
+
   if (aRat > aCritRat)
   {
-    if(aRat > 5.*aCritRat)
+    if (aRat > 5. * aCritRat)
       aParType = Approx_Centripetal;
     else
     {
index b2bfa6c6b5804868a700a698f5167eaf172d0f4e..5a23977e15b0aed5d56a47e50dfd9eee8cb7cd21 100644 (file)
 #ifndef _ApproxInt_KnotTools_HeaderFile
 #define _ApproxInt_KnotTools_HeaderFile
 
+#include <Approx_ParametrizationType.hxx>
+#include <NCollection_List.hxx>
+#include <NCollection_LocalArray.hxx>
+#include <NCollection_Sequence.hxx>
+#include <NCollection_Vector.hxx>
+#include <Standard_Boolean.hxx>
 #include <Standard_DefineAlloc.hxx>
+#include <Standard_Integer.hxx>
 #include <Standard_Macro.hxx>
-#include <Standard_Boolean.hxx>
 #include <Standard_Real.hxx>
-#include <Standard_Integer.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColgp_Array1OfPnt.hxx>
 #include <TColgp_Array1OfPnt2d.hxx>
-#include <NCollection_Sequence.hxx>
-#include <NCollection_List.hxx>
 #include <math_Vector.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <NCollection_LocalArray.hxx>
-#include <NCollection_Vector.hxx>
-#include <Approx_ParametrizationType.hxx>
 
 class IntPatch_WLine;
 
 // Corresponds for debug information output.
 // Debug information is also printed when OCCT_DEBUG defined.
-//#define APPROXINT_KNOTTOOLS_DEBUG
+// #define APPROXINT_KNOTTOOLS_DEBUG
 
-//! This class intended to build knots sequence on discrete set of points for further approximation into bspline curve.
+//! This class intended to build knots sequence on discrete set of points for further approximation
+//! into bspline curve.
 //!
 //! Short description of algorithm:
 //! 1) Build discrete curvature on points set.
@@ -47,7 +48,6 @@ class IntPatch_WLine;
 class ApproxInt_KnotTools
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
   //! Main function to build optimal knot sequence.
@@ -61,34 +61,33 @@ public:
   //! @param theApproxU2V2 - Flag existence of second 2d set.
   //! @param theMinNbPnts - Minimal number of points per knot interval.
   //! @param theKnots - output knots sequence.
-  Standard_EXPORT static void BuildKnots(const TColgp_Array1OfPnt& thePntsXYZ,
-                                         const TColgp_Array1OfPnt2d& thePntsU1V1,
-                                         const TColgp_Array1OfPnt2d& thePntsU2V2,
-                                         const math_Vector& thePars,
-                                         const Standard_Boolean theApproxXYZ,
-                                         const Standard_Boolean theApproxU1V1,
-                                         const Standard_Boolean theApproxU2V2,
-                                         const Standard_Integer theMinNbPnts,
+  Standard_EXPORT static void BuildKnots(const TColgp_Array1OfPnt&             thePntsXYZ,
+                                         const TColgp_Array1OfPnt2d&           thePntsU1V1,
+                                         const TColgp_Array1OfPnt2d&           thePntsU2V2,
+                                         const math_Vector&                    thePars,
+                                         const Standard_Boolean                theApproxXYZ,
+                                         const Standard_Boolean                theApproxU1V1,
+                                         const Standard_Boolean                theApproxU2V2,
+                                         const Standard_Integer                theMinNbPnts,
                                          NCollection_Vector<Standard_Integer>& theKnots);
 
   //! Builds discrete curvature
-  Standard_EXPORT static void BuildCurvature(
-    const NCollection_LocalArray<Standard_Real>& theCoords,
-    const Standard_Integer theDim,
-    const math_Vector& thePars,
-    TColStd_Array1OfReal& theCurv,
-    Standard_Real& theMaxCurv);
-
-  //! Defines preferable parametrization type for theWL 
-  Standard_EXPORT static Approx_ParametrizationType DefineParType(const Handle(IntPatch_WLine)& theWL,
-    const Standard_Integer theFpar, const Standard_Integer theLpar,
-    const Standard_Boolean theApproxXYZ,
-    const Standard_Boolean theApproxU1V1,
-    const Standard_Boolean theApproxU2V2);
+  Standard_EXPORT static void BuildCurvature(const NCollection_LocalArray<Standard_Real>& theCoords,
+                                             const Standard_Integer                       theDim,
+                                             const math_Vector&                           thePars,
+                                             TColStd_Array1OfReal&                        theCurv,
+                                             Standard_Real& theMaxCurv);
 
+  //! Defines preferable parametrization type for theWL
+  Standard_EXPORT static Approx_ParametrizationType DefineParType(
+    const Handle(IntPatch_WLine)& theWL,
+    const Standard_Integer        theFpar,
+    const Standard_Integer        theLpar,
+    const Standard_Boolean        theApproxXYZ,
+    const Standard_Boolean        theApproxU1V1,
+    const Standard_Boolean        theApproxU2V2);
 
 private:
-
   //! Compute indices of knots:
   //!
   //! I: Build discrete curvature in points set,
@@ -100,25 +99,25 @@ private:
   //!
   //! IV: Put additional knots near extrema points.
   static void ComputeKnotInds(const NCollection_LocalArray<Standard_Real>& theCoords,
-                              const Standard_Integer theDim,
-                              const math_Vector& thePars,
-                              NCollection_Sequence<Standard_Integer>& theInds);
+                              const Standard_Integer                       theDim,
+                              const math_Vector&                           thePars,
+                              NCollection_Sequence<Standard_Integer>&      theInds);
 
   //! Insert knots before index I.
   //!
   //! I: Check curvature change:
-  //! if ( maxCurvature / minCurvature ) of current interval greater than 
+  //! if ( maxCurvature / minCurvature ) of current interval greater than
   //! threshold value, then stop and use upper index as knot.
   //!
   //! II: Check midpoint criteria:
   //! If exist point between two knot indices with angle greater than
   //! threshold value, then stop and put this index as knot.
-  static Standard_Boolean InsKnotBefI(const Standard_Integer theI,
-                                      const TColStd_Array1OfReal& theCurv,
+  static Standard_Boolean InsKnotBefI(const Standard_Integer                       theI,
+                                      const TColStd_Array1OfReal&                  theCurv,
                                       const NCollection_LocalArray<Standard_Real>& theCoords,
-                                      const Standard_Integer theDim, 
-                                      NCollection_Sequence<Standard_Integer>& theInds,
-                                      const Standard_Boolean ChkCurv);
+                                      const Standard_Integer                       theDim,
+                                      NCollection_Sequence<Standard_Integer>&      theInds,
+                                      const Standard_Boolean                       ChkCurv);
 
   //! Perform knots filtration.
   //!
@@ -127,9 +126,9 @@ private:
   //! II: Filter points with too small amount of points per knot interval.
   //!
   //! III: Fill Last Knot.
-  static void FilterKnots(NCollection_Sequence<Standard_Integer>& theInds, 
-                          const Standard_Integer theMinNbPnts,
-                          NCollection_Vector<Standard_Integer>& theLKnots);
+  static void FilterKnots(NCollection_Sequence<Standard_Integer>& theInds,
+                          const Standard_Integer                  theMinNbPnts,
+                          NCollection_Vector<Standard_Integer>&   theLKnots);
 };
 
 #endif
index c047e781a1b8e480ab0d3d2933211685db369fff..1a69839e0e2cc8a2335bccfa0e85ac11639583a1 100644 (file)
 
 #include <Approx_Status.hxx>
 
-//================================================================================
-inline Standard_Integer ApproxInt_MultiLineTool::NbP2d(const TheMultiLine& ML) { 
-  return(ML.NbP2d());
-}
-//--------------------------------------------------------------------------------
-inline Standard_Integer ApproxInt_MultiLineTool::NbP3d(const TheMultiLine& ML) { 
-  return(ML.NbP3d()); 
-}
-//--------------------------------------------------------------------------------
-inline Standard_Integer ApproxInt_MultiLineTool::FirstPoint(const TheMultiLine& ML) { 
-  return(ML.FirstPoint());
-}
-//--------------------------------------------------------------------------------
-inline Standard_Integer ApproxInt_MultiLineTool::LastPoint(const TheMultiLine& ML) { 
-  return(ML.LastPoint());
-}
-//--------------------------------------------------------------------------------
-inline void ApproxInt_MultiLineTool::Value( const TheMultiLine&     ML
-                                          ,const Standard_Integer Index
-                                          ,TColgp_Array1OfPnt&        TabPnt) { 
-  ML.Value(Index,TabPnt);
-}
-//--------------------------------------------------------------------------------
-inline void ApproxInt_MultiLineTool::Value( const TheMultiLine&     ML
-                                          ,const Standard_Integer Index
-                                          ,TColgp_Array1OfPnt2d&       TabPnt2d) { 
-  ML.Value(Index,TabPnt2d);
-}
-//--------------------------------------------------------------------------------
-inline void ApproxInt_MultiLineTool::Value( const TheMultiLine&     ML
-                                          ,const Standard_Integer Index
-                                          ,TColgp_Array1OfPnt&        TabPnt
-                                          ,TColgp_Array1OfPnt2d&      TabPnt2d) { 
-  ML.Value(Index,TabPnt,TabPnt2d);
-}
-//--------------------------------------------------------------------------------
-inline Standard_Boolean ApproxInt_MultiLineTool::Tangency( const TheMultiLine&    ML
-                                                         ,const Standard_Integer Index
-                                                         ,TColgp_Array1OfVec&        TabVec) { 
-  return(ML.Tangency(Index,TabVec));
-}
-//--------------------------------------------------------------------------------
-inline Standard_Boolean ApproxInt_MultiLineTool::Tangency( const TheMultiLine&     ML
-                                                         ,const Standard_Integer Index
-                                                         ,TColgp_Array1OfVec2d&      TabVec2d) { 
-  return(ML.Tangency(Index,TabVec2d));
-}
-//--------------------------------------------------------------------------------
-inline Standard_Boolean ApproxInt_MultiLineTool::Tangency( const TheMultiLine&     ML
-                                                         ,const Standard_Integer Index
-                                                         ,TColgp_Array1OfVec&        TabVec
-                                                         ,TColgp_Array1OfVec2d&      TabVec2d) { 
-  return(ML.Tangency(Index,TabVec,TabVec2d));
-}
-
-//--------------------------------------------------------------------------------
-inline Standard_Boolean ApproxInt_MultiLineTool::Curvature( const TheMultiLine&     //ML
-                                                         ,const Standard_Integer   //Index
-                                                         ,TColgp_Array1OfVec&  ) { //TabVec 
+//=================================================================================================
+
+inline Standard_Integer ApproxInt_MultiLineTool::NbP2d(const TheMultiLine& ML)
+{
+  return (ML.NbP2d());
+}
+
+//=================================================================================================
+
+inline Standard_Integer ApproxInt_MultiLineTool::NbP3d(const TheMultiLine& ML)
+{
+  return (ML.NbP3d());
+}
+
+//=================================================================================================
+
+inline Standard_Integer ApproxInt_MultiLineTool::FirstPoint(const TheMultiLine& ML)
+{
+  return (ML.FirstPoint());
+}
+
+//=================================================================================================
+
+inline Standard_Integer ApproxInt_MultiLineTool::LastPoint(const TheMultiLine& ML)
+{
+  return (ML.LastPoint());
+}
+
+//=================================================================================================
+
+inline void ApproxInt_MultiLineTool::Value(const TheMultiLine&    ML,
+                                           const Standard_Integer Index,
+                                           TColgp_Array1OfPnt&    TabPnt)
+{
+  ML.Value(Index, TabPnt);
+}
+
+//=================================================================================================
+
+inline void ApproxInt_MultiLineTool::Value(const TheMultiLine&    ML,
+                                           const Standard_Integer Index,
+                                           TColgp_Array1OfPnt2d&  TabPnt2d)
+{
+  ML.Value(Index, TabPnt2d);
+}
+
+//=================================================================================================
+
+inline void ApproxInt_MultiLineTool::Value(const TheMultiLine&    ML,
+                                           const Standard_Integer Index,
+                                           TColgp_Array1OfPnt&    TabPnt,
+                                           TColgp_Array1OfPnt2d&  TabPnt2d)
+{
+  ML.Value(Index, TabPnt, TabPnt2d);
+}
+
+//=================================================================================================
+
+inline Standard_Boolean ApproxInt_MultiLineTool::Tangency(const TheMultiLine&    ML,
+                                                          const Standard_Integer Index,
+                                                          TColgp_Array1OfVec&    TabVec)
+{
+  return (ML.Tangency(Index, TabVec));
+}
+
+//=================================================================================================
+
+inline Standard_Boolean ApproxInt_MultiLineTool::Tangency(const TheMultiLine&    ML,
+                                                          const Standard_Integer Index,
+                                                          TColgp_Array1OfVec2d&  TabVec2d)
+{
+  return (ML.Tangency(Index, TabVec2d));
+}
+
+//=================================================================================================
+
+inline Standard_Boolean ApproxInt_MultiLineTool::Tangency(const TheMultiLine&    ML,
+                                                          const Standard_Integer Index,
+                                                          TColgp_Array1OfVec&    TabVec,
+                                                          TColgp_Array1OfVec2d&  TabVec2d)
+{
+  return (ML.Tangency(Index, TabVec, TabVec2d));
+}
+
+//=================================================================================================
+
+inline Standard_Boolean ApproxInt_MultiLineTool::Curvature(const TheMultiLine& // ML
+                                                           ,
+                                                           const Standard_Integer // Index
+                                                           ,
+                                                           TColgp_Array1OfVec&)
+{ // TabVec
   return Standard_False;
 }
-//--------------------------------------------------------------------------------
-inline Standard_Boolean ApproxInt_MultiLineTool::Curvature( const TheMultiLine&      //ML
-                                                         ,const Standard_Integer    //Index
-                                                         ,TColgp_Array1OfVec2d& ) { //TabVec2d
+
+//=================================================================================================
+
+inline Standard_Boolean ApproxInt_MultiLineTool::Curvature(const TheMultiLine& // ML
+                                                           ,
+                                                           const Standard_Integer // Index
+                                                           ,
+                                                           TColgp_Array1OfVec2d&)
+{ // TabVec2d
   return Standard_False;
 }
-//--------------------------------------------------------------------------------
-inline Standard_Boolean ApproxInt_MultiLineTool::Curvature( const TheMultiLine&      //ML
-                                                         ,const Standard_Integer    //Index
-                                                         ,TColgp_Array1OfVec&       //TabVec
-                                                         ,TColgp_Array1OfVec2d& ) { //TabVec2d
+
+//=================================================================================================
+
+inline Standard_Boolean ApproxInt_MultiLineTool::Curvature(const TheMultiLine& // ML
+                                                           ,
+                                                           const Standard_Integer // Index
+                                                           ,
+                                                           TColgp_Array1OfVec& // TabVec
+                                                           ,
+                                                           TColgp_Array1OfVec2d&)
+{ // TabVec2d
   return Standard_False;
 }
-//--------------------------------------------------------------------------------
-inline Approx_Status ApproxInt_MultiLineTool::WhatStatus(const TheMultiLine& ML
-                                                        ,const Standard_Integer
-                                                        ,const Standard_Integer) { 
+
+//=================================================================================================
+
+inline Approx_Status ApproxInt_MultiLineTool::WhatStatus(const TheMultiLine& ML,
+                                                         const Standard_Integer,
+                                                         const Standard_Integer)
+{
   //--  PointsAdded,
   //--  NoPointsAdded,
   //--  NoApproximation
   //--  Approx_PointsAdded
-  return(ML.WhatStatus());
-}
-//--------------------------------------------------------------------------------     
-inline TheMultiLine ApproxInt_MultiLineTool::MakeMLBetween(const TheMultiLine& ML,
-                                                          const Standard_Integer I1,
-                                                          const Standard_Integer I2,
-                                                          const Standard_Integer NbPMin) { 
-  
-  return(ML.MakeMLBetween(I1,I2,NbPMin));
-}
-//--------------------------------------------------------------------------------     
-inline Standard_Boolean ApproxInt_MultiLineTool::MakeMLOneMorePoint(const TheMultiLine& ML,
+  return (ML.WhatStatus());
+}
+
+//=================================================================================================
+
+inline TheMultiLine ApproxInt_MultiLineTool::MakeMLBetween(const TheMultiLine&    ML,
+                                                           const Standard_Integer I1,
+                                                           const Standard_Integer I2,
+                                                           const Standard_Integer NbPMin)
+{
+
+  return (ML.MakeMLBetween(I1, I2, NbPMin));
+}
+
+//=================================================================================================
+
+inline Standard_Boolean ApproxInt_MultiLineTool::MakeMLOneMorePoint(const TheMultiLine&    ML,
                                                                     const Standard_Integer I1,
                                                                     const Standard_Integer I2,
                                                                     const Standard_Integer indbad,
                                                                     TheMultiLine& OtherLine)
-{ 
-  return (ML.MakeMLOneMorePoint(I1,I2,indbad,OtherLine));
+{
+  return (ML.MakeMLOneMorePoint(I1, I2, indbad, OtherLine));
 }
 
 inline void ApproxInt_MultiLineTool::Dump(const TheMultiLine& ML)
-{ 
+{
   ML.Dump();
 }
-//================================================================================
+
+//=================================================================================================
index a05b5411f4763deab36bfa077633189ababddb82..75c895b46671d95043a87b243243a1a1a1fac3c5 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-
 #include <ApproxInt_SvSurfaces.hxx>
 
-//=======================================================================
-//function : ~ApproxInt_SvSurfaces
-//purpose  : Destructor
-//=======================================================================
-ApproxInt_SvSurfaces::~ApproxInt_SvSurfaces()
-{
-}
+//=================================================================================================
+// function : ~ApproxInt_SvSurfaces
+// purpose  : Destructor
+//=================================================================================================
+
+ApproxInt_SvSurfaces::~ApproxInt_SvSurfaces() {}
index 89509550b75e00253fac8e14baf02bdebda35b33..7a8b4e5e917b032f1df64e646b386092086358c7 100644 (file)
@@ -28,72 +28,74 @@ class gp_Vec;
 class gp_Vec2d;
 class IntSurf_PntOn2S;
 
-//! This class is root class for classes dedicated to calculate 
+//! This class is root class for classes dedicated to calculate
 //! 2d and 3d points and tangents of intersection lines of two surfaces of different types
 //! for given u, v parameters of intersection point on two surfaces.
-//! 
+//!
 //! The field myUseSolver is used to manage type of calculation:
-//! if myUseSolver = true, input parameters u1, v1, u2, v2 are considered as first approximation of 
-//! exact intersection point, then coordinates u1, v1, u2, v2 are refined with help of 
+//! if myUseSolver = true, input parameters u1, v1, u2, v2 are considered as first approximation of
+//! exact intersection point, then coordinates u1, v1, u2, v2 are refined with help of
 //! the solver used in intersection algorithm and required values are calculated.
-//! if myUseSolver = false, u1, v1, u2, v2 are considered as "exact" intersection points on two surfaces
-//! and required values are calculated directly using u1, v1, u2, v2
+//! if myUseSolver = false, u1, v1, u2, v2 are considered as "exact" intersection points on two
+//! surfaces and required values are calculated directly using u1, v1, u2, v2
 class ApproxInt_SvSurfaces
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
-  ApproxInt_SvSurfaces() : myUseSolver (false) {}
+  ApproxInt_SvSurfaces()
+      : myUseSolver(false)
+  {
+  }
 
   //! returns True if Tg,Tguv1 Tguv2 can be computed.
-  Standard_EXPORT virtual Standard_Boolean Compute (Standard_Real& u1, Standard_Real& v1,
-                                                    Standard_Real& u2, Standard_Real& v2,
-                                                    gp_Pnt& Pt,
-                                                    gp_Vec& Tg,
-                                                    gp_Vec2d& Tguv1,
-                                                    gp_Vec2d& Tguv2) = 0;
-  
-  Standard_EXPORT virtual void Pnt (const Standard_Real u1, const Standard_Real v1,
-                                    const Standard_Real u2, const Standard_Real v2,
-                                    gp_Pnt& P) = 0;
+  Standard_EXPORT virtual Standard_Boolean Compute(Standard_Real& u1,
+                                                   Standard_Real& v1,
+                                                   Standard_Real& u2,
+                                                   Standard_Real& v2,
+                                                   gp_Pnt&        Pt,
+                                                   gp_Vec&        Tg,
+                                                   gp_Vec2d&      Tguv1,
+                                                   gp_Vec2d&      Tguv2) = 0;
+
+  Standard_EXPORT virtual void Pnt(const Standard_Real u1,
+                                   const Standard_Real v1,
+                                   const Standard_Real u2,
+                                   const Standard_Real v2,
+                                   gp_Pnt&             P) = 0;
 
   //! computes point on curve and parameters on the surfaces
-  Standard_EXPORT virtual Standard_Boolean SeekPoint(const Standard_Real u1, const Standard_Real v1,
-                                                     const Standard_Real u2, const Standard_Real v2,
-                                                     IntSurf_PntOn2S& Point) = 0;
-  
-  Standard_EXPORT virtual Standard_Boolean Tangency (const Standard_Real u1, const Standard_Real v1,
-                                                     const Standard_Real u2, const Standard_Real v2,
-                                                     gp_Vec& Tg) = 0;
-  
-  Standard_EXPORT virtual Standard_Boolean TangencyOnSurf1 (const Standard_Real u1,
-                                                            const Standard_Real v1,
-                                                            const Standard_Real u2,
-                                                            const Standard_Real v2,
-                                                            gp_Vec2d& Tg) = 0;
-  
-  Standard_EXPORT virtual Standard_Boolean TangencyOnSurf2 (const Standard_Real u1,
-                                                            const Standard_Real v1,
-                                                            const Standard_Real u2,
-                                                            const Standard_Real v2,
-                                                            gp_Vec2d& Tg) = 0;
+  Standard_EXPORT virtual Standard_Boolean SeekPoint(const Standard_Real u1,
+                                                     const Standard_Real v1,
+                                                     const Standard_Real u2,
+                                                     const Standard_Real v2,
+                                                     IntSurf_PntOn2S&    Point) = 0;
+
+  Standard_EXPORT virtual Standard_Boolean Tangency(const Standard_Real u1,
+                                                    const Standard_Real v1,
+                                                    const Standard_Real u2,
+                                                    const Standard_Real v2,
+                                                    gp_Vec&             Tg) = 0;
+
+  Standard_EXPORT virtual Standard_Boolean TangencyOnSurf1(const Standard_Real u1,
+                                                           const Standard_Real v1,
+                                                           const Standard_Real u2,
+                                                           const Standard_Real v2,
+                                                           gp_Vec2d&           Tg) = 0;
+
+  Standard_EXPORT virtual Standard_Boolean TangencyOnSurf2(const Standard_Real u1,
+                                                           const Standard_Real v1,
+                                                           const Standard_Real u2,
+                                                           const Standard_Real v2,
+                                                           gp_Vec2d&           Tg) = 0;
   Standard_EXPORT virtual ~ApproxInt_SvSurfaces();
 
-  void SetUseSolver (const Standard_Boolean theUseSol)
-  {
-    myUseSolver = theUseSol;
-  }
+  void SetUseSolver(const Standard_Boolean theUseSol) { myUseSolver = theUseSol; }
 
-  virtual Standard_Boolean GetUseSolver() const
-  {
-    return myUseSolver;
-  }
+  virtual Standard_Boolean GetUseSolver() const { return myUseSolver; }
 
 private:
-
   Standard_Boolean myUseSolver;
-
 };
 
 #endif // _ApproxInt_SvSurfaces_HeaderFile
index 14642a5c9dab7ada744066bc45d2772023af5605..2212efb1bcd9286922dc27a86cd50bf27455f72b 100644 (file)
@@ -15,9 +15,9 @@
 
 #include <Message.hxx>
 #include <OSD_File.hxx>
-#include <OSD_StreamBuffer.hxx>
 #include <OSD_Path.hxx>
 #include <OSD_Protection.hxx>
+#include <OSD_StreamBuffer.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_HAsciiString.hxx>
 
@@ -34,132 +34,123 @@ enum DE_ConfigurationContext_KindOfLine
 
 namespace
 {
-  //=======================================================================
-  //function : GetLine
-  //purpose  :
-  //=======================================================================
-  static Standard_Boolean GetLine(OSD_File& theFile, TCollection_AsciiString& theLine)
+//=================================================================================================
+
+static Standard_Boolean GetLine(OSD_File& theFile, TCollection_AsciiString& theLine)
+{
+  TCollection_AsciiString aBuffer;
+  Standard_Integer        aBufSize = 10;
+  Standard_Integer        aLen;
+  theLine.Clear();
+  do
   {
-    TCollection_AsciiString aBuffer;
-    Standard_Integer aBufSize = 10;
-    Standard_Integer aLen;
-    theLine.Clear();
-    do
+    theFile.ReadLine(aBuffer, aBufSize, aLen);
+    theLine += aBuffer;
+    if (theFile.IsAtEnd())
     {
-      theFile.ReadLine(aBuffer, aBufSize, aLen);
-      theLine += aBuffer;
-      if (theFile.IsAtEnd())
+      if (!theLine.Length())
       {
-        if (!theLine.Length())
-        {
-          return Standard_False;
-        }
-        else
-        {
-          theLine += "\n";
-        }
+        return Standard_False;
       }
-    } while (theLine.Value(theLine.Length()) != '\n');
-    return Standard_True;
-  }
+      else
+      {
+        theLine += "\n";
+      }
+    }
+  } while (theLine.Value(theLine.Length()) != '\n');
+  return Standard_True;
+}
 
-  //=======================================================================
-  //function : WhatKindOfLine
-  //purpose  :
-  //=======================================================================
-  static DE_ConfigurationContext_KindOfLine WhatKindOfLine(const TCollection_AsciiString& theLine,
-                                                           TCollection_AsciiString& theToken1,
-                                                           TCollection_AsciiString& theToken2)
+//=================================================================================================
+
+static DE_ConfigurationContext_KindOfLine WhatKindOfLine(const TCollection_AsciiString& theLine,
+                                                         TCollection_AsciiString&       theToken1,
+                                                         TCollection_AsciiString&       theToken2)
+{
+  static const TCollection_AsciiString aWhiteSpace = " \t\r\n";
+  Standard_Integer                     aPos1 = 0, aPos2 = 0, aPos = 0;
+  TCollection_AsciiString              aLine(theLine);
+  aLine.LeftAdjust();
+  aLine.RightAdjust();
+  if (!aLine.EndsWith(':')
+      && (!aLine.EndsWith(' ') || !aLine.EndsWith('\t') || !aLine.EndsWith('\n')))
   {
-    static const TCollection_AsciiString aWhiteSpace = " \t\r\n";
-    Standard_Integer aPos1 = 0, aPos2 = 0, aPos = 0;
-    TCollection_AsciiString aLine(theLine);
-    aLine.LeftAdjust();
-    aLine.RightAdjust();
-    if (!aLine.EndsWith(':') && (!aLine.EndsWith(' ') || !aLine.EndsWith('\t') || !aLine.EndsWith('\n')))
-    {
-      aLine.InsertAfter(aLine.Length(), " ");
-    }
+    aLine.InsertAfter(aLine.Length(), " ");
+  }
 
-    if (aLine.Value(1) == '!')
-    {
-      return DE_ConfigurationContext_KindOfLine_Comment;
-    }
-    aPos1 = aLine.FirstLocationNotInSet(aWhiteSpace, 1, aLine.Length());
-    if (aLine.Value(aPos1) == '\n')
-    {
-      return DE_ConfigurationContext_KindOfLine_Empty;
-    }
+  if (aLine.Value(1) == '!')
+  {
+    return DE_ConfigurationContext_KindOfLine_Comment;
+  }
+  aPos1 = aLine.FirstLocationNotInSet(aWhiteSpace, 1, aLine.Length());
+  if (aLine.Value(aPos1) == '\n')
+  {
+    return DE_ConfigurationContext_KindOfLine_Empty;
+  }
 
-    aPos2 = aLine.Location(1, ':', aPos1, aLine.Length());
-    if (aPos2 == 0 || aPos1 == aPos2)
-    {
-      return DE_ConfigurationContext_KindOfLine_Error;
-    }
+  aPos2 = aLine.Location(1, ':', aPos1, aLine.Length());
+  if (aPos2 == 0 || aPos1 == aPos2)
+  {
+    return DE_ConfigurationContext_KindOfLine_Error;
+  }
 
-    for (aPos = aPos2 - 1; aLine.Value(aPos) == '\t' || aLine.Value(aPos) == ' '; aPos--);
+  for (aPos = aPos2 - 1; aLine.Value(aPos) == '\t' || aLine.Value(aPos) == ' '; aPos--)
+    ;
 
-    theToken1 = aLine.SubString(aPos1, aPos);
-    if(aPos2 != aLine.Length())
-    {
-      aPos2++;
-    }
-    aPos = aLine.FirstLocationNotInSet(aWhiteSpace, aPos2, aLine.Length());
-    if (aPos != 0)
+  theToken1 = aLine.SubString(aPos1, aPos);
+  if (aPos2 != aLine.Length())
+  {
+    aPos2++;
+  }
+  aPos = aLine.FirstLocationNotInSet(aWhiteSpace, aPos2, aLine.Length());
+  if (aPos != 0)
+  {
+    if (aLine.Value(aPos) == '\\')
     {
-      if (aLine.Value(aPos) == '\\')
+      switch (aLine.Value(aPos + 1))
       {
-        switch (aLine.Value(aPos + 1))
-        {
-          case '\\':
-          case ' ':
-          case '\t':
-            aPos++;
-            break;
-        }
+        case '\\':
+        case ' ':
+        case '\t':
+          aPos++;
+          break;
       }
     }
-    if (aPos == aLine.Length() || aPos == 0)
-    {
-      theToken2.Clear();
-    }
-    else
-    {
-      aLine.Remove(1, aPos - 1);
-      aLine.Remove(aLine.Length());
-      theToken2 = aLine;
-    }
-    return DE_ConfigurationContext_KindOfLine_Resource;
   }
+  if (aPos == aLine.Length() || aPos == 0)
+  {
+    theToken2.Clear();
+  }
+  else
+  {
+    aLine.Remove(1, aPos - 1);
+    aLine.Remove(aLine.Length());
+    theToken2 = aLine;
+  }
+  return DE_ConfigurationContext_KindOfLine_Resource;
+}
 
-  //=======================================================================
-  //function : MakeName
-  //purpose  :
-  //=======================================================================
-  static TCollection_AsciiString MakeName(const TCollection_AsciiString& theScope,
-                                          const TCollection_AsciiString& theParam)
+//=================================================================================================
+
+static TCollection_AsciiString MakeName(const TCollection_AsciiString& theScope,
+                                        const TCollection_AsciiString& theParam)
+{
+  TCollection_AsciiString aStr(theScope);
+  if (!aStr.IsEmpty())
   {
-    TCollection_AsciiString aStr(theScope);
-    if (!aStr.IsEmpty())
-    {
-      aStr += '.';
-    }
-    aStr += theParam;
-    return aStr;
+    aStr += '.';
   }
+  aStr += theParam;
+  return aStr;
 }
+} // namespace
+
+//=================================================================================================
+
+DE_ConfigurationContext::DE_ConfigurationContext() {}
+
+//=================================================================================================
 
-//=======================================================================
-//function : DE_ConfigurationContext
-//purpose  :
-//=======================================================================
-DE_ConfigurationContext::DE_ConfigurationContext()
-{}
-
-//=======================================================================
-//function : Load
-//purpose  :
-//=======================================================================
 Standard_Boolean DE_ConfigurationContext::Load(const TCollection_AsciiString& theConfiguration)
 {
   OSD_Path aPath = theConfiguration;
@@ -181,15 +172,13 @@ Standard_Boolean DE_ConfigurationContext::Load(const TCollection_AsciiString& th
   return true;
 }
 
-//=======================================================================
-//function : LoadFile
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_ConfigurationContext::LoadFile(const TCollection_AsciiString& theFile)
 {
   myResource.Clear();
-  OSD_Path aPath(theFile);
-  OSD_File aFile = aPath;
+  OSD_Path                aPath(theFile);
+  OSD_File                aFile    = aPath;
   TCollection_AsciiString FileName = aPath.Name();
   aFile.Open(OSD_ReadOnly, OSD_Protection());
   if (aFile.Failed())
@@ -209,15 +198,13 @@ Standard_Boolean DE_ConfigurationContext::LoadFile(const TCollection_AsciiString
   return Standard_True;
 }
 
-//=======================================================================
-//function : LoadStr
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_ConfigurationContext::LoadStr(const TCollection_AsciiString& theResource)
 {
   myResource.Clear();
-  TCollection_AsciiString aLine = "";
-  const Standard_Integer aLength = theResource.Length();
+  TCollection_AsciiString aLine   = "";
+  const Standard_Integer  aLength = theResource.Length();
   for (Standard_Integer anInd = 1; anInd <= aLength; anInd++)
   {
     const Standard_Character aChar = theResource.Value(anInd);
@@ -236,71 +223,60 @@ Standard_Boolean DE_ConfigurationContext::LoadStr(const TCollection_AsciiString&
   return Standard_True;
 }
 
-//=======================================================================
-//function : IsParamSet
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_ConfigurationContext::IsParamSet(const TCollection_AsciiString& theParam,
                                                      const TCollection_AsciiString& theScope) const
 {
-  TCollection_AsciiString  aResource(MakeName(theScope, theParam));
+  TCollection_AsciiString aResource(MakeName(theScope, theParam));
   return myResource.IsBound(aResource);
 }
 
-//=======================================================================
-//function : RealVal
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Real DE_ConfigurationContext::RealVal(const TCollection_AsciiString& theParam,
-                                               const Standard_Real theDefValue,
+                                               const Standard_Real            theDefValue,
                                                const TCollection_AsciiString& theScope) const
 {
   Standard_Real aVal = 0.;
   return GetReal(theParam, aVal, theScope) ? aVal : theDefValue;
 }
 
-//=======================================================================
-//function : IntegerVal
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Integer DE_ConfigurationContext::IntegerVal(const TCollection_AsciiString& theParam,
-                                                     const Standard_Integer theDefValue,
+                                                     const Standard_Integer         theDefValue,
                                                      const TCollection_AsciiString& theScope) const
 {
   Standard_Integer aVal = 0;
   return GetInteger(theParam, aVal, theScope) ? aVal : theDefValue;
 }
 
-//=======================================================================
-//function : BooleanVal
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_ConfigurationContext::BooleanVal(const TCollection_AsciiString& theParam,
-                                                     const Standard_Boolean theDefValue,
+                                                     const Standard_Boolean         theDefValue,
                                                      const TCollection_AsciiString& theScope) const
 {
   Standard_Boolean aVal = Standard_False;
   return GetBoolean(theParam, aVal, theScope) ? aVal : theDefValue;
 }
 
-//=======================================================================
-//function : StringVal
-//purpose  :
-//=======================================================================
-TCollection_AsciiString DE_ConfigurationContext::StringVal(const TCollection_AsciiString& theParam,
-                                                           const TCollection_AsciiString& theDefValue,
-                                                           const TCollection_AsciiString& theScope) const
+//=================================================================================================
+
+TCollection_AsciiString DE_ConfigurationContext::StringVal(
+  const TCollection_AsciiString& theParam,
+  const TCollection_AsciiString& theDefValue,
+  const TCollection_AsciiString& theScope) const
 {
   TCollection_AsciiString aVal = "";
   return GetString(theParam, aVal, theScope) ? aVal : theDefValue;
 }
 
-//=======================================================================
-//function : GetReal
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_ConfigurationContext::GetReal(const TCollection_AsciiString& theParam,
-                                                  Standard_Real& theValue,
+                                                  Standard_Real&                 theValue,
                                                   const TCollection_AsciiString& theScope) const
 {
   TCollection_AsciiString aStr;
@@ -316,12 +292,10 @@ Standard_Boolean DE_ConfigurationContext::GetReal(const TCollection_AsciiString&
   return Standard_False;
 }
 
-//=======================================================================
-//function : GetInteger
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_ConfigurationContext::GetInteger(const TCollection_AsciiString& theParam,
-                                                     Standard_Integer& theValue,
+                                                     Standard_Integer&              theValue,
                                                      const TCollection_AsciiString& theScope) const
 {
   TCollection_AsciiString aStr;
@@ -337,12 +311,10 @@ Standard_Boolean DE_ConfigurationContext::GetInteger(const TCollection_AsciiStri
   return Standard_False;
 }
 
-//=======================================================================
-//function : GetBoolean
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_ConfigurationContext::GetBoolean(const TCollection_AsciiString& theParam,
-                                                     Standard_Boolean& theValue,
+                                                     Standard_Boolean&              theValue,
                                                      const TCollection_AsciiString& theScope) const
 {
   TCollection_AsciiString aStr;
@@ -358,25 +330,22 @@ Standard_Boolean DE_ConfigurationContext::GetBoolean(const TCollection_AsciiStri
   return Standard_False;
 }
 
-//=======================================================================
-//function : GetString
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_ConfigurationContext::GetString(const TCollection_AsciiString& theParam,
-                                                    TCollection_AsciiString& theStr,
+                                                    TCollection_AsciiString&       theStr,
                                                     const TCollection_AsciiString& theScope) const
 {
   TCollection_AsciiString aResource = MakeName(theScope, theParam);
   return myResource.Find(aResource, theStr);
 }
 
-//=======================================================================
-//function : GetStringSeq
-//purpose  :
-//=======================================================================
-Standard_Boolean DE_ConfigurationContext::GetStringSeq(const TCollection_AsciiString& theParam,
-                                                       TColStd_ListOfAsciiString& theValue,
-                                                       const TCollection_AsciiString& theScope) const
+//=================================================================================================
+
+Standard_Boolean DE_ConfigurationContext::GetStringSeq(
+  const TCollection_AsciiString& theParam,
+  TColStd_ListOfAsciiString&     theValue,
+  const TCollection_AsciiString& theScope) const
 {
   TCollection_AsciiString aStr;
   if (!GetString(theParam, aStr, theScope))
@@ -385,7 +354,7 @@ Standard_Boolean DE_ConfigurationContext::GetStringSeq(const TCollection_AsciiSt
   }
   theValue.Clear();
   TCollection_AsciiString anElem;
-  const Standard_Integer aLength = aStr.Length();
+  const Standard_Integer  aLength = aStr.Length();
   for (Standard_Integer anInd = 1; anInd <= aLength; anInd++)
   {
     const Standard_Character aChar = aStr.Value(anInd);
@@ -401,17 +370,15 @@ Standard_Boolean DE_ConfigurationContext::GetStringSeq(const TCollection_AsciiSt
   return Standard_True;
 }
 
-//=======================================================================
-//function : load
-//purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_ConfigurationContext::load(const TCollection_AsciiString& theResourceLine)
 {
   if (theResourceLine.IsEmpty())
   {
     return Standard_False;
   }
-  TCollection_AsciiString aToken1, aToken2;
+  TCollection_AsciiString            aToken1, aToken2;
   DE_ConfigurationContext_KindOfLine aKind = WhatKindOfLine(theResourceLine, aToken1, aToken2);
   switch (aKind)
   {
index ad8ad8ac661592801e7aa19f856f207f8b564910..4bb63924e8685057ba1d3ad47377277150ae3672 100644 (file)
@@ -20,7 +20,7 @@
 typedef NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> DE_ResourceMap;
 
 //! Provides convenient interface to resource file
-//! Allows loading of the resource file and getting attributes' 
+//! Allows loading of the resource file and getting attributes'
 //! values starting from some scope, for example
 //! if scope is defined as "ToV4" and requested parameter
 //! is "exec.op", value of "ToV4.exec.op" parameter from
@@ -64,7 +64,7 @@ public:
   //! @param[in] theScope base parameter name
   //! @return Standard_False if parameter is not defined or has a wrong type
   Standard_EXPORT Standard_Boolean GetReal(const TCollection_AsciiString& theParam,
-                                           Standard_Real& theValue,
+                                           Standard_Real&                 theValue,
                                            const TCollection_AsciiString& theScope = "") const;
 
   //! Gets value of parameter as being of specific type
@@ -73,7 +73,7 @@ public:
   //! @param[in] theScope base parameter name
   //! @return Standard_False if parameter is not defined or has a wrong type
   Standard_EXPORT Standard_Boolean GetInteger(const TCollection_AsciiString& theParam,
-                                              Standard_Integer& theValue,
+                                              Standard_Integer&              theValue,
                                               const TCollection_AsciiString& theScope = "") const;
 
   //! Gets value of parameter as being of specific type
@@ -82,7 +82,7 @@ public:
   //! @param[in] theScope base parameter name
   //! @return Standard_False if parameter is not defined or has a wrong type
   Standard_EXPORT Standard_Boolean GetBoolean(const TCollection_AsciiString& theParam,
-                                              Standard_Boolean& theValue,
+                                              Standard_Boolean&              theValue,
                                               const TCollection_AsciiString& theScope = "") const;
 
   //! Gets value of parameter as being of specific type
@@ -91,7 +91,7 @@ public:
   //! @param[in] theScope base parameter name
   //! @return Standard_False if parameter is not defined or has a wrong type
   Standard_EXPORT Standard_Boolean GetString(const TCollection_AsciiString& theParam,
-                                             TCollection_AsciiString& theValue,
+                                             TCollection_AsciiString&       theValue,
                                              const TCollection_AsciiString& theScope = "") const;
 
   //! Gets value of parameter as being of specific type
@@ -100,7 +100,7 @@ public:
   //! @param[in] theScope base parameter name
   //! @return Standard_False if parameter is not defined or has a wrong type
   Standard_EXPORT Standard_Boolean GetStringSeq(const TCollection_AsciiString& theParam,
-                                                TColStd_ListOfAsciiString& theValue,
+                                                TColStd_ListOfAsciiString&     theValue,
                                                 const TCollection_AsciiString& theScope = "") const;
 
   //! Gets value of parameter as being of specific type
@@ -109,7 +109,7 @@ public:
   //! @param[in] theScope base parameter name
   //! @return specific type value
   Standard_EXPORT Standard_Real RealVal(const TCollection_AsciiString& theParam,
-                                        const Standard_Real theDefValue,
+                                        const Standard_Real            theDefValue,
                                         const TCollection_AsciiString& theScope = "") const;
 
   //! Gets value of parameter as being of specific type
@@ -118,7 +118,7 @@ public:
   //! @param[in] theScope base parameter name
   //! @return specific type value
   Standard_EXPORT Standard_Integer IntegerVal(const TCollection_AsciiString& theParam,
-                                              const Standard_Integer theDefValue,
+                                              const Standard_Integer         theDefValue,
                                               const TCollection_AsciiString& theScope = "") const;
 
   //! Gets value of parameter as being of specific type
@@ -127,7 +127,7 @@ public:
   //! @param[in] theScope base parameter name
   //! @return specific type value
   Standard_EXPORT Standard_Boolean BooleanVal(const TCollection_AsciiString& theParam,
-                                              const Standard_Boolean theDefValue,
+                                              const Standard_Boolean         theDefValue,
                                               const TCollection_AsciiString& theScope = "") const;
 
   //! Gets value of parameter as being of specific type
@@ -135,25 +135,23 @@ public:
   //! @param[in] theDefValue value by default if param is not found or has wrong type
   //! @param[in] theScope base parameter name
   //! @return specific type value
-  Standard_EXPORT TCollection_AsciiString StringVal(const TCollection_AsciiString& theParam,
-                                                    const TCollection_AsciiString& theDefValue,
-                                                    const TCollection_AsciiString& theScope = "") const;
+  Standard_EXPORT TCollection_AsciiString
+    StringVal(const TCollection_AsciiString& theParam,
+              const TCollection_AsciiString& theDefValue,
+              const TCollection_AsciiString& theScope = "") const;
 
   //! Gets internal resource map
   //! @return map with resource value
   Standard_EXPORT const DE_ResourceMap& GetInternalMap() const { return myResource; }
 
 protected:
-
   //! Update the resource with param value from the line
   //! @paramp[in] theResourceLine line contains the parameter
   //! @return true if theResourceLine has loaded correctly
   Standard_Boolean load(const TCollection_AsciiString& theResourceLine);
 
 private:
-
   DE_ResourceMap myResource; //!< Internal parameters map
-
 };
 
 #endif // _DE_ConfigurationContext_HeaderFile
index 2d978fc71ab880d1fffef3b4c6b60d517e2a5169..a7e057b719dc12e32a1deb4b1427348849e8f76a 100644 (file)
@@ -13,9 +13,9 @@
 
 #include <DE_ConfigurationNode.hxx>
 
+#include <DE_ConfigurationContext.hxx>
 #include <DE_Provider.hxx>
 #include <DE_Wrapper.hxx>
-#include <DE_ConfigurationContext.hxx>
 #include <Message.hxx>
 #include <OSD_File.hxx>
 #include <OSD_Path.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(DE_ConfigurationNode, Standard_Transient)
 
-//=======================================================================
-// function : DE_ConfigurationNode
-// purpose  :
-//=======================================================================
-DE_ConfigurationNode::DE_ConfigurationNode() :
-  myIsEnabled(Standard_True)
-{}
-
-//=======================================================================
-// function : DE_ConfigurationNode
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
+DE_ConfigurationNode::DE_ConfigurationNode()
+    : myIsEnabled(Standard_True)
+{
+}
+
+//=================================================================================================
+
 DE_ConfigurationNode::DE_ConfigurationNode(const Handle(DE_ConfigurationNode)& theConfigurationNode)
 {
   GlobalParameters = theConfigurationNode->GlobalParameters;
-  myIsEnabled = theConfigurationNode->IsEnabled();
+  myIsEnabled      = theConfigurationNode->IsEnabled();
 }
 
-//=======================================================================
-// function : Load
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 bool DE_ConfigurationNode::Load(const TCollection_AsciiString& theResourcePath)
 {
   Handle(DE_ConfigurationContext) aResource = new DE_ConfigurationContext();
@@ -52,20 +47,18 @@ bool DE_ConfigurationNode::Load(const TCollection_AsciiString& theResourcePath)
   return Load(aResource);
 }
 
-//=======================================================================
-// function : Save
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 bool DE_ConfigurationNode::Save(const TCollection_AsciiString& theResourcePath) const
 {
-  OSD_Path aPath = theResourcePath;
-  OSD_File aFile(aPath);
+  OSD_Path       aPath = theResourcePath;
+  OSD_File       aFile(aPath);
   OSD_Protection aProt;
   {
     try
     {
       OCC_CATCH_SIGNALS
-        aFile.Build(OSD_ReadWrite, aProt);
+      aFile.Build(OSD_ReadWrite, aProt);
     }
     catch (Standard_Failure const&)
     {
@@ -84,10 +77,8 @@ bool DE_ConfigurationNode::Save(const TCollection_AsciiString& theResourcePath)
   return true;
 }
 
-//=======================================================================
-// function : UpdateLoad
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 bool DE_ConfigurationNode::UpdateLoad(const Standard_Boolean theToImport,
                                       const Standard_Boolean theToKeep)
 {
@@ -96,28 +87,22 @@ bool DE_ConfigurationNode::UpdateLoad(const Standard_Boolean theToImport,
   return true;
 }
 
-//=======================================================================
-// function : IsImportSupported
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 bool DE_ConfigurationNode::IsImportSupported() const
 {
   return false;
 }
 
-//=======================================================================
-// function : IsExportSupported
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 bool DE_ConfigurationNode::IsExportSupported() const
 {
   return false;
 }
 
-//=======================================================================
-// function : CheckForSupport
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 bool DE_ConfigurationNode::CheckExtension(const TCollection_AsciiString& theExtension) const
 {
   TCollection_AsciiString anExtension(theExtension);
@@ -130,8 +115,7 @@ bool DE_ConfigurationNode::CheckExtension(const TCollection_AsciiString& theExte
     anExtension.Remove(1);
   }
   const TColStd_ListOfAsciiString& anExtensions = GetExtensions();
-  for (TColStd_ListOfAsciiString::Iterator anIter(anExtensions);
-       anIter.More(); anIter.Next())
+  for (TColStd_ListOfAsciiString::Iterator anIter(anExtensions); anIter.More(); anIter.Next())
   {
     if (TCollection_AsciiString::IsSameString(anIter.Value(), anExtension, Standard_False))
     {
@@ -141,10 +125,8 @@ bool DE_ConfigurationNode::CheckExtension(const TCollection_AsciiString& theExte
   return false;
 }
 
-//=======================================================================
-// function : CheckForSupport
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 bool DE_ConfigurationNode::CheckContent(const Handle(NCollection_Buffer)& theBuffer) const
 {
   (void)theBuffer;
index d424dc92fa2f4340dc8b058db3d753754c4b5cf2..6022baa213bfc8b3e755b4d0287c7b44f90037db 100644 (file)
@@ -50,7 +50,6 @@ class DE_ConfigurationNode : public Standard_Transient
 {
   DEFINE_STANDARD_RTTIEXT(DE_ConfigurationNode, Standard_Transient)
 public:
-
   //! Initializes all field by default
   Standard_EXPORT DE_ConfigurationNode();
 
@@ -93,7 +92,6 @@ public:
                                           const Standard_Boolean theToKeep);
 
 public:
-
   //! Checks the import supporting
   //! @return Standard_True if import is support
   Standard_EXPORT virtual bool IsImportSupported() const;
@@ -125,20 +123,13 @@ public:
   Standard_EXPORT virtual bool CheckContent(const Handle(NCollection_Buffer)& theBuffer) const;
 
 public:
-
   //! Gets the provider loading status
   //! @return Standard_True if the load is correct
-  Standard_Boolean IsEnabled() const
-  {
-    return myIsEnabled;
-  }
+  Standard_Boolean IsEnabled() const { return myIsEnabled; }
 
   //! Sets the provider loading status
   //! @param[in] theIsLoaded input load status
-  void SetEnabled(const Standard_Boolean theIsLoaded)
-  {
-    myIsEnabled = theIsLoaded;
-  }
+  void SetEnabled(const Standard_Boolean theIsLoaded) { myIsEnabled = theIsLoaded; }
 
   //! Custom function to activate commercial DE component.
   //! The input is special sequence of values that described in
@@ -150,18 +141,18 @@ public:
   Standard_EXPORT virtual void CustomActivation(const TColStd_ListOfAsciiString&) {};
 
 public:
-
   //!< Internal parameters for transfer process
   struct DE_SectionGlobal
   {
-    Standard_Real LengthUnit = 1.0; //!< Target Unit (scaling based on MM) for the transfer process, default 1.0 (MM)
-    Standard_Real SystemUnit = 1.0; //!< System Unit (scaling based on MM) to be used when initial unit is unknown, default 1.0 (MM)
+    Standard_Real LengthUnit =
+      1.0; //!< Target Unit (scaling based on MM) for the transfer process, default 1.0 (MM)
+    Standard_Real SystemUnit = 1.0; //!< System Unit (scaling based on MM) to be used when initial
+                                    //!< unit is unknown, default 1.0 (MM)
   } GlobalParameters;
 
 private:
-
-  Standard_Boolean myIsEnabled; //!< Flag to use a current provider for Read or Write process via DE_Wrapper
-
+  Standard_Boolean
+    myIsEnabled; //!< Flag to use a current provider for Read or Write process via DE_Wrapper
 };
 
 #endif // _DE_ConfigurationNode_HeaderFile
index aee45f7f228b249d0bc83986c64d0a9866946389..77572d3859b617ab81a51b8dc246389d7238551a 100644 (file)
 
 IMPLEMENT_STANDARD_RTTIEXT(DE_Provider, Standard_Transient)
 
-//=======================================================================
-// function : DE_Provider
-// purpose  :
-//=======================================================================
-DE_Provider::DE_Provider()
-{}
-
-//=======================================================================
-// function : DE_Provider
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
+DE_Provider::DE_Provider() {}
+
+//=================================================================================================
+
 DE_Provider::DE_Provider(const Handle(DE_ConfigurationNode)& theNode)
-  :myNode(theNode)
-{}
+    : myNode(theNode)
+{
+}
 
-//=======================================================================
-// function : Read
-// purpose  :
-//=======================================================================
-Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
+//=================================================================================================
+
+Standard_Boolean DE_Provider::Read(const TCollection_AsciiString&  thePath,
                                    const Handle(TDocStd_Document)& theDocument,
-                                   Handle(XSControl_WorkSession)& theWS,
-                                   const Message_ProgressRange& theProgress)
+                                   Handle(XSControl_WorkSession)&  theWS,
+                                   const Message_ProgressRange&    theProgress)
 {
   (void)thePath;
   (void)theDocument;
   (void)theWS;
   (void)theProgress;
-  Message::SendFail() << "Error: provider " << GetFormat() <<
-    " " << GetVendor() <<" doesn't support read operation";
+  Message::SendFail() << "Error: provider " << GetFormat() << " " << GetVendor()
+                      << " doesn't support read operation";
   return Standard_False;
 }
 
-//=======================================================================
-// function : Write
-// purpose  :
-//=======================================================================
-Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
+//=================================================================================================
+
+Standard_Boolean DE_Provider::Write(const TCollection_AsciiString&  thePath,
                                     const Handle(TDocStd_Document)& theDocument,
-                                    Handle(XSControl_WorkSession)& theWS,
-                                    const Message_ProgressRange& theProgress)
+                                    Handle(XSControl_WorkSession)&  theWS,
+                                    const Message_ProgressRange&    theProgress)
 {
   (void)thePath;
   (void)theDocument;
   (void)theWS;
   (void)theProgress;
-  Message::SendFail() << "Error: provider " << GetFormat() <<
-    " " << GetVendor() << " doesn't support write operation";
+  Message::SendFail() << "Error: provider " << GetFormat() << " " << GetVendor()
+                      << " doesn't support write operation";
   return Standard_False;
 }
 
-//=======================================================================
-// function : Read
-// purpose  :
-//=======================================================================
-Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
+//=================================================================================================
+
+Standard_Boolean DE_Provider::Read(const TCollection_AsciiString&  thePath,
                                    const Handle(TDocStd_Document)& theDocument,
-                                   const Message_ProgressRange& theProgress)
+                                   const Message_ProgressRange&    theProgress)
 {
   (void)thePath;
   (void)theDocument;
   (void)theProgress;
-  Message::SendFail() << "Error: provider " << GetFormat() <<
-    " " << GetVendor() << " doesn't support read operation";
+  Message::SendFail() << "Error: provider " << GetFormat() << " " << GetVendor()
+                      << " doesn't support read operation";
   return Standard_False;
 }
 
-//=======================================================================
-// function : Write
-// purpose  :
-//=======================================================================
-Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
+//=================================================================================================
+
+Standard_Boolean DE_Provider::Write(const TCollection_AsciiString&  thePath,
                                     const Handle(TDocStd_Document)& theDocument,
-                                    const Message_ProgressRange& theProgress)
+                                    const Message_ProgressRange&    theProgress)
 {
   (void)thePath;
   (void)theDocument;
   (void)theProgress;
-  Message::SendFail() << "Error: provider " << GetFormat() <<
-    " " << GetVendor() << " doesn't support write operation";
+  Message::SendFail() << "Error: provider " << GetFormat() << " " << GetVendor()
+                      << " doesn't support write operation";
   return Standard_False;
 }
 
-//=======================================================================
-// function : Read
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
-                                   TopoDS_Shape& theShape,
+                                   TopoDS_Shape&                  theShape,
                                    Handle(XSControl_WorkSession)& theWS,
-                                   const Message_ProgressRange& theProgress)
+                                   const Message_ProgressRange&   theProgress)
 {
   (void)thePath;
   (void)theShape;
   (void)theWS;
   (void)theProgress;
-  Message::SendFail() << "Error: provider " << GetFormat() <<
-    " " << GetVendor() << " doesn't support read operation";
+  Message::SendFail() << "Error: provider " << GetFormat() << " " << GetVendor()
+                      << " doesn't support read operation";
   return Standard_False;
 }
 
-//=======================================================================
-// function : Write
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
-                                    const TopoDS_Shape& theShape,
+                                    const TopoDS_Shape&            theShape,
                                     Handle(XSControl_WorkSession)& theWS,
-                                    const Message_ProgressRange& theProgress)
+                                    const Message_ProgressRange&   theProgress)
 {
   (void)thePath;
   (void)theShape;
   (void)theWS;
   (void)theProgress;
-  Message::SendFail() << "Error: provider " << GetFormat() <<
-    " " << GetVendor() << " doesn't support write operation";
+  Message::SendFail() << "Error: provider " << GetFormat() << " " << GetVendor()
+                      << " doesn't support write operation";
   return Standard_False;
 }
 
-//=======================================================================
-// function : Read
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
-                                   TopoDS_Shape& theShape,
-                                   const Message_ProgressRange& theProgress)
+                                   TopoDS_Shape&                  theShape,
+                                   const Message_ProgressRange&   theProgress)
 {
   (void)thePath;
   (void)theShape;
   (void)theProgress;
-  Message::SendFail() << "Error: provider " << GetFormat() <<
-    " " << GetVendor() << " doesn't support read operation";
+  Message::SendFail() << "Error: provider " << GetFormat() << " " << GetVendor()
+                      << " doesn't support read operation";
   return Standard_False;
 }
 
-//=======================================================================
-// function : Write
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
-                                    const TopoDS_Shape& theShape,
-                                    const Message_ProgressRange& theProgress)
+                                    const TopoDS_Shape&            theShape,
+                                    const Message_ProgressRange&   theProgress)
 {
   (void)thePath;
   (void)theShape;
   (void)theProgress;
-  Message::SendFail() << "Error: provider " << GetFormat() <<
-    " " << GetVendor() << " doesn't support write operation";
+  Message::SendFail() << "Error: provider " << GetFormat() << " " << GetVendor()
+                      << " doesn't support write operation";
   return Standard_False;
 }
index 5fffb3053fa383e44f44a0f9e8694d0c119d18b1..4613250a5b29b06bada46015364e32750e3e2f4a 100644 (file)
@@ -44,7 +44,6 @@ public:
   DEFINE_STANDARD_RTTIEXT(DE_Provider, Standard_Transient)
 
 public:
-
   //! Default constructor
   //! Configure translation process with global configuration
   Standard_EXPORT DE_Provider();
@@ -54,17 +53,17 @@ public:
   Standard_EXPORT DE_Provider(const Handle(DE_ConfigurationNode)& theNode);
 
 public:
-
   //! Reads a CAD file, according internal configuration
   //! @param[in] thePath path to the import CAD file
   //! @param[out] theDocument document to save result
   //! @param[in] theWS current work session
   //! @param[in] theProgress progress indicator
   //! @return True if Read was successful
-  Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
-                                                const Handle(TDocStd_Document)& theDocument,
-                                                Handle(XSControl_WorkSession)& theWS,
-                                                const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT virtual Standard_Boolean Read(
+    const TCollection_AsciiString&  thePath,
+    const Handle(TDocStd_Document)& theDocument,
+    Handle(XSControl_WorkSession)&  theWS,
+    const Message_ProgressRange&    theProgress = Message_ProgressRange());
 
   //! Writes a CAD file, according internal configuration
   //! @param[in] thePath path to the export CAD file
@@ -72,28 +71,31 @@ public:
   //! @param[in] theWS current work session
   //! @param[in] theProgress progress indicator
   //! @return True if Write was successful
-  Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
-                                                 const Handle(TDocStd_Document)& theDocument,
-                                                 Handle(XSControl_WorkSession)& theWS,
-                                                 const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT virtual Standard_Boolean Write(
+    const TCollection_AsciiString&  thePath,
+    const Handle(TDocStd_Document)& theDocument,
+    Handle(XSControl_WorkSession)&  theWS,
+    const Message_ProgressRange&    theProgress = Message_ProgressRange());
 
   //! Reads a CAD file, according internal configuration
   //! @param[in] thePath path to the import CAD file
   //! @param[out] theDocument document to save result
   //! @param[in] theProgress progress indicator
   //! @return True if Read was successful
-  Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
-                                                const Handle(TDocStd_Document)& theDocument,
-                                                const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT virtual Standard_Boolean Read(
+    const TCollection_AsciiString&  thePath,
+    const Handle(TDocStd_Document)& theDocument,
+    const Message_ProgressRange&    theProgress = Message_ProgressRange());
 
   //! Writes a CAD file, according internal configuration
   //! @param[in] thePath path to the export CAD file
   //! @param[out] theDocument document to export
   //! @param[in] theProgress progress indicator
   //! @return True if Write was successful
-  Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
-                                                 const Handle(TDocStd_Document)& theDocument,
-                                                 const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT virtual Standard_Boolean Write(
+    const TCollection_AsciiString&  thePath,
+    const Handle(TDocStd_Document)& theDocument,
+    const Message_ProgressRange&    theProgress = Message_ProgressRange());
 
   //! Reads a CAD file, according internal configuration
   //! @param[in] thePath path to the import CAD file
@@ -101,10 +103,11 @@ public:
   //! @param[in] theWS current work session
   //! @param[in] theProgress progress indicator
   //! @return True if Read was successful
-  Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
-                                                TopoDS_Shape& theShape,
-                                                Handle(XSControl_WorkSession)& theWS,
-                                                const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT virtual Standard_Boolean Read(
+    const TCollection_AsciiString& thePath,
+    TopoDS_Shape&                  theShape,
+    Handle(XSControl_WorkSession)& theWS,
+    const Message_ProgressRange&   theProgress = Message_ProgressRange());
 
   //! Writes a CAD file, according internal configuration
   //! @param[in] thePath path to the export CAD file
@@ -112,31 +115,33 @@ public:
   //! @param[in] theWS current work session
   //! @param[in] theProgress progress indicator
   //! @return True if Write was successful
-  Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
-                                                 const TopoDS_Shape& theShape,
-                                                 Handle(XSControl_WorkSession)& theWS,
-                                                 const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT virtual Standard_Boolean Write(
+    const TCollection_AsciiString& thePath,
+    const TopoDS_Shape&            theShape,
+    Handle(XSControl_WorkSession)& theWS,
+    const Message_ProgressRange&   theProgress = Message_ProgressRange());
 
   //! Reads a CAD file, according internal configuration
   //! @param[in] thePath path to the import CAD file
   //! @param[out] theShape shape to save result
   //! @param[in] theProgress progress indicator
   //! @return True if Read was successful
-  Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
-                                                TopoDS_Shape& theShape,
-                                                const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT virtual Standard_Boolean Read(
+    const TCollection_AsciiString& thePath,
+    TopoDS_Shape&                  theShape,
+    const Message_ProgressRange&   theProgress = Message_ProgressRange());
 
   //! Writes a CAD file, according internal configuration
   //! @param[in] thePath path to the export CAD file
   //! @param[out] theShape shape to export
   //! @param[in] theProgress progress indicator
   //! @return True if Write was successful
-  Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
-                                                 const TopoDS_Shape& theShape,
-                                                 const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT virtual Standard_Boolean Write(
+    const TCollection_AsciiString& thePath,
+    const TopoDS_Shape&            theShape,
+    const Message_ProgressRange&   theProgress = Message_ProgressRange());
 
 public:
-
   //! Gets CAD format name of associated provider
   //! @return provider CAD format
   Standard_EXPORT virtual TCollection_AsciiString GetFormat() const = 0;
@@ -147,20 +152,13 @@ public:
 
   //! Gets internal configuration node
   //! @return configuration node object
-  Handle(DE_ConfigurationNode) GetNode() const
-  {
-    return myNode;
-  }
+  Handle(DE_ConfigurationNode) GetNode() const { return myNode; }
 
   //! Sets internal configuration node
   //! @param[in] theNode configuration node to set
-  void SetNode(const Handle(DE_ConfigurationNode)& theNode)
-  {
-    myNode = theNode;
-  }
+  void SetNode(const Handle(DE_ConfigurationNode)& theNode) { myNode = theNode; }
 
 private:
-
   Handle(DE_ConfigurationNode) myNode; //!< Internal configuration for the own format
 };
 
index 8d9bf2a1a707b44ab50dc0714230702d8a6332cc..0be4676a7a0f694a96e1dfab840393727d6c2a44 100644 (file)
@@ -21,151 +21,260 @@ IMPLEMENT_STANDARD_RTTIEXT(DE_ShapeFixConfigurationNode, DE_ConfigurationNode)
 
 namespace
 {
-  static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
-  {
-    static const TCollection_AsciiString aScope = "provider";
-    return aScope;
-  }
+static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
+{
+  static const TCollection_AsciiString aScope = "provider";
+  return aScope;
 }
+} // namespace
+
+//=================================================================================================
 
-//=======================================================================
-// function : DE_ShapeFixConfigurationNode
-// purpose  :
-//=======================================================================
 DE_ShapeFixConfigurationNode::DE_ShapeFixConfigurationNode()
-  : DE_ConfigurationNode()
-{}
-
-//=======================================================================
-// function : DE_ShapeFixConfigurationNode
-// purpose  :
-//=======================================================================
-DE_ShapeFixConfigurationNode::DE_ShapeFixConfigurationNode(const Handle(DE_ShapeFixConfigurationNode)& theNode)
-  : DE_ConfigurationNode(theNode)
+    : DE_ConfigurationNode()
+{
+}
+
+//=================================================================================================
+
+DE_ShapeFixConfigurationNode::DE_ShapeFixConfigurationNode(
+  const Handle(DE_ShapeFixConfigurationNode)& theNode)
+    : DE_ConfigurationNode(theNode)
 {
 }
 
-//=======================================================================
-// function : Load
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 bool DE_ShapeFixConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
 {
-  TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".healing";
-
-  HealingParameters.Tolerance3d = theResource->RealVal("tolerance3d", HealingParameters.Tolerance3d, aScope);
-  HealingParameters.MaxTolerance3d = theResource->RealVal("max.tolerance3d", HealingParameters.MaxTolerance3d, aScope);
-  HealingParameters.MinTolerance3d = theResource->RealVal("min.tolerance3d", HealingParameters.MinTolerance3d, aScope);
-  HealingParameters.FixFreeShellMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("free.shell", (int)HealingParameters.FixFreeShellMode, aScope);
-  HealingParameters.FixFreeFaceMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("free.face", (int)HealingParameters.FixFreeFaceMode, aScope);
-  HealingParameters.FixFreeWireMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("free.wire", (int)HealingParameters.FixFreeWireMode, aScope);
-  HealingParameters.FixSameParameterMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("same.parameter", (int)HealingParameters.FixSameParameterMode, aScope);
-  HealingParameters.FixSolidMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("solid", (int)HealingParameters.FixSolidMode, aScope);
-  HealingParameters.FixShellOrientationMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("shell.orientation", (int)HealingParameters.FixShellOrientationMode, aScope);
-  HealingParameters.CreateOpenSolidMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("create.open.solid", (int)HealingParameters.CreateOpenSolidMode, aScope);
-  HealingParameters.FixShellMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("shell", (int)HealingParameters.FixShellMode, aScope);
-  HealingParameters.FixFaceOrientationMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("face.orientation", (int)HealingParameters.FixFaceOrientationMode, aScope);
-  HealingParameters.FixFaceMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("face", (int)HealingParameters.FixFaceMode, aScope);
-  HealingParameters.FixWireMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("wire", (int)HealingParameters.FixWireMode, aScope);
-  HealingParameters.FixOrientationMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("orientation", (int)HealingParameters.FixOrientationMode, aScope);
-  HealingParameters.FixAddNaturalBoundMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("add.natural.bound", (int)HealingParameters.FixAddNaturalBoundMode, aScope);
-  HealingParameters.FixMissingSeamMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("missing.seam", (int)HealingParameters.FixMissingSeamMode, aScope);
-  HealingParameters.FixSmallAreaWireMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("small.area.wire", (int)HealingParameters.FixSmallAreaWireMode, aScope);
-  HealingParameters.RemoveSmallAreaFaceMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("remove.small.area.face", (int)HealingParameters.RemoveSmallAreaFaceMode, aScope);
-  HealingParameters.FixIntersectingWiresMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("intersecting.wires", (int)HealingParameters.FixIntersectingWiresMode, aScope);
-  HealingParameters.FixLoopWiresMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("loop.wires", (int)HealingParameters.FixLoopWiresMode, aScope);
-  HealingParameters.FixSplitFaceMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("split.face", (int)HealingParameters.FixSplitFaceMode, aScope);
-  HealingParameters.AutoCorrectPrecisionMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("auto.correct.precision", (int)HealingParameters.AutoCorrectPrecisionMode, aScope);
-  HealingParameters.ModifyTopologyMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("modify.topology", (int)HealingParameters.ModifyTopologyMode, aScope);
-  HealingParameters.ModifyGeometryMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("modify.geometry", (int)HealingParameters.ModifyGeometryMode, aScope);
-  HealingParameters.ClosedWireMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("closed.wire", (int)HealingParameters.ClosedWireMode, aScope);
-  HealingParameters.PreferencePCurveMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("preference.pcurve", (int)HealingParameters.PreferencePCurveMode, aScope);
-  HealingParameters.FixReorderMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("reorder.edges", (int)HealingParameters.FixReorderMode, aScope);
-  HealingParameters.FixSmallMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("remove.small.edges", (int)HealingParameters.FixSmallMode, aScope);
-  HealingParameters.FixConnectedMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("connected.edges", (int)HealingParameters.FixConnectedMode, aScope);
-  HealingParameters.FixEdgeCurvesMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("edge.curves", (int)HealingParameters.FixEdgeCurvesMode, aScope);
-  HealingParameters.FixDegeneratedMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("add.degenerated.edges", (int)HealingParameters.FixDegeneratedMode, aScope);
-  HealingParameters.FixLackingMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("add.lacking.edges", (int)HealingParameters.FixLackingMode, aScope);
-  HealingParameters.FixSelfIntersectionMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("selfintersection", (int)HealingParameters.FixSelfIntersectionMode, aScope);
-  HealingParameters.RemoveLoopMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("remove.loop", (int)HealingParameters.RemoveLoopMode, aScope);
-  HealingParameters.FixReversed2dMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("reversed2d", (int)HealingParameters.FixReversed2dMode, aScope);
-  HealingParameters.FixRemovePCurveMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("remove.pcurve", (int)HealingParameters.FixRemovePCurveMode, aScope);
-  HealingParameters.FixRemoveCurve3dMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("remove.curve3d", (int)HealingParameters.FixRemoveCurve3dMode, aScope);
-  HealingParameters.FixAddPCurveMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("add.pcurve", (int)HealingParameters.FixAddPCurveMode, aScope);
-  HealingParameters.FixAddCurve3dMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("add.curve3d", (int)HealingParameters.FixAddCurve3dMode, aScope);
-  HealingParameters.FixSeamMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("correct.order.in.seam", (int)HealingParameters.FixSeamMode, aScope);
-  HealingParameters.FixShiftedMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("shifted", (int)HealingParameters.FixShiftedMode, aScope);
-  HealingParameters.FixEdgeSameParameterMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("edge.same.parameter", (int)HealingParameters.FixEdgeSameParameterMode, aScope);
-  HealingParameters.FixNotchedEdgesMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("notched.edges", (int)HealingParameters.FixNotchedEdgesMode, aScope);
-  HealingParameters.FixTailMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("tail", (int)HealingParameters.FixTailMode, aScope);
-  HealingParameters.MaxTailAngle = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("max.tail.angle", (int)HealingParameters.MaxTailAngle, aScope);
-  HealingParameters.MaxTailWidth = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("max.tail.width", (int)HealingParameters.MaxTailWidth, aScope);
-  HealingParameters.FixSelfIntersectingEdgeMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("selfintersecting.edge", (int)HealingParameters.FixSelfIntersectingEdgeMode, aScope);
-  HealingParameters.FixIntersectingEdgesMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("intersecting.edges", (int)HealingParameters.FixIntersectingEdgesMode, aScope);
-  HealingParameters.FixNonAdjacentIntersectingEdgesMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("nonadjacent.intersecting.edges", (int)HealingParameters.FixNonAdjacentIntersectingEdgesMode, aScope);
-  HealingParameters.FixVertexPositionMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("vertex.position", (int)HealingParameters.FixVertexPositionMode, aScope);
-  HealingParameters.FixVertexToleranceMode = (DE_ShapeFixParameters::FixMode)
-    theResource->IntegerVal("vertex.tolerance", (int)HealingParameters.FixVertexToleranceMode, aScope);
+  TCollection_AsciiString aScope =
+    THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".healing";
+
+  HealingParameters.Tolerance3d =
+    theResource->RealVal("tolerance3d", HealingParameters.Tolerance3d, aScope);
+  HealingParameters.MaxTolerance3d =
+    theResource->RealVal("max.tolerance3d", HealingParameters.MaxTolerance3d, aScope);
+  HealingParameters.MinTolerance3d =
+    theResource->RealVal("min.tolerance3d", HealingParameters.MinTolerance3d, aScope);
+  HealingParameters.FixFreeShellMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("free.shell",
+                                                            (int)HealingParameters.FixFreeShellMode,
+                                                            aScope);
+  HealingParameters.FixFreeFaceMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("free.face",
+                                                            (int)HealingParameters.FixFreeFaceMode,
+                                                            aScope);
+  HealingParameters.FixFreeWireMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("free.wire",
+                                                            (int)HealingParameters.FixFreeWireMode,
+                                                            aScope);
+  HealingParameters.FixSameParameterMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "same.parameter",
+    (int)HealingParameters.FixSameParameterMode,
+    aScope);
+  HealingParameters.FixSolidMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("solid",
+                                                            (int)HealingParameters.FixSolidMode,
+                                                            aScope);
+  HealingParameters.FixShellOrientationMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+      "shell.orientation",
+      (int)HealingParameters.FixShellOrientationMode,
+      aScope);
+  HealingParameters.CreateOpenSolidMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "create.open.solid",
+    (int)HealingParameters.CreateOpenSolidMode,
+    aScope);
+  HealingParameters.FixShellMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("shell",
+                                                            (int)HealingParameters.FixShellMode,
+                                                            aScope);
+  HealingParameters.FixFaceOrientationMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+      "face.orientation",
+      (int)HealingParameters.FixFaceOrientationMode,
+      aScope);
+  HealingParameters.FixFaceMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("face",
+                                                            (int)HealingParameters.FixFaceMode,
+                                                            aScope);
+  HealingParameters.FixWireMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("wire",
+                                                            (int)HealingParameters.FixWireMode,
+                                                            aScope);
+  HealingParameters.FixOrientationMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "orientation",
+    (int)HealingParameters.FixOrientationMode,
+    aScope);
+  HealingParameters.FixAddNaturalBoundMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+      "add.natural.bound",
+      (int)HealingParameters.FixAddNaturalBoundMode,
+      aScope);
+  HealingParameters.FixMissingSeamMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "missing.seam",
+    (int)HealingParameters.FixMissingSeamMode,
+    aScope);
+  HealingParameters.FixSmallAreaWireMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "small.area.wire",
+    (int)HealingParameters.FixSmallAreaWireMode,
+    aScope);
+  HealingParameters.RemoveSmallAreaFaceMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+      "remove.small.area.face",
+      (int)HealingParameters.RemoveSmallAreaFaceMode,
+      aScope);
+  HealingParameters.FixIntersectingWiresMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+      "intersecting.wires",
+      (int)HealingParameters.FixIntersectingWiresMode,
+      aScope);
+  HealingParameters.FixLoopWiresMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("loop.wires",
+                                                            (int)HealingParameters.FixLoopWiresMode,
+                                                            aScope);
+  HealingParameters.FixSplitFaceMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("split.face",
+                                                            (int)HealingParameters.FixSplitFaceMode,
+                                                            aScope);
+  HealingParameters.AutoCorrectPrecisionMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+      "auto.correct.precision",
+      (int)HealingParameters.AutoCorrectPrecisionMode,
+      aScope);
+  HealingParameters.ModifyTopologyMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "modify.topology",
+    (int)HealingParameters.ModifyTopologyMode,
+    aScope);
+  HealingParameters.ModifyGeometryMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "modify.geometry",
+    (int)HealingParameters.ModifyGeometryMode,
+    aScope);
+  HealingParameters.ClosedWireMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("closed.wire",
+                                                            (int)HealingParameters.ClosedWireMode,
+                                                            aScope);
+  HealingParameters.PreferencePCurveMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "preference.pcurve",
+    (int)HealingParameters.PreferencePCurveMode,
+    aScope);
+  HealingParameters.FixReorderMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("reorder.edges",
+                                                            (int)HealingParameters.FixReorderMode,
+                                                            aScope);
+  HealingParameters.FixSmallMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("remove.small.edges",
+                                                            (int)HealingParameters.FixSmallMode,
+                                                            aScope);
+  HealingParameters.FixConnectedMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("connected.edges",
+                                                            (int)HealingParameters.FixConnectedMode,
+                                                            aScope);
+  HealingParameters.FixEdgeCurvesMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "edge.curves",
+    (int)HealingParameters.FixEdgeCurvesMode,
+    aScope);
+  HealingParameters.FixDegeneratedMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "add.degenerated.edges",
+    (int)HealingParameters.FixDegeneratedMode,
+    aScope);
+  HealingParameters.FixLackingMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("add.lacking.edges",
+                                                            (int)HealingParameters.FixLackingMode,
+                                                            aScope);
+  HealingParameters.FixSelfIntersectionMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+      "selfintersection",
+      (int)HealingParameters.FixSelfIntersectionMode,
+      aScope);
+  HealingParameters.RemoveLoopMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("remove.loop",
+                                                            (int)HealingParameters.RemoveLoopMode,
+                                                            aScope);
+  HealingParameters.FixReversed2dMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "reversed2d",
+    (int)HealingParameters.FixReversed2dMode,
+    aScope);
+  HealingParameters.FixRemovePCurveMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "remove.pcurve",
+    (int)HealingParameters.FixRemovePCurveMode,
+    aScope);
+  HealingParameters.FixRemoveCurve3dMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "remove.curve3d",
+    (int)HealingParameters.FixRemoveCurve3dMode,
+    aScope);
+  HealingParameters.FixAddPCurveMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("add.pcurve",
+                                                            (int)HealingParameters.FixAddPCurveMode,
+                                                            aScope);
+  HealingParameters.FixAddCurve3dMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "add.curve3d",
+    (int)HealingParameters.FixAddCurve3dMode,
+    aScope);
+  HealingParameters.FixSeamMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("correct.order.in.seam",
+                                                            (int)HealingParameters.FixSeamMode,
+                                                            aScope);
+  HealingParameters.FixShiftedMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("shifted",
+                                                            (int)HealingParameters.FixShiftedMode,
+                                                            aScope);
+  HealingParameters.FixEdgeSameParameterMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+      "edge.same.parameter",
+      (int)HealingParameters.FixEdgeSameParameterMode,
+      aScope);
+  HealingParameters.FixNotchedEdgesMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "notched.edges",
+    (int)HealingParameters.FixNotchedEdgesMode,
+    aScope);
+  HealingParameters.FixTailMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("tail",
+                                                            (int)HealingParameters.FixTailMode,
+                                                            aScope);
+  HealingParameters.MaxTailAngle =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("max.tail.angle",
+                                                            (int)HealingParameters.MaxTailAngle,
+                                                            aScope);
+  HealingParameters.MaxTailWidth =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("max.tail.width",
+                                                            (int)HealingParameters.MaxTailWidth,
+                                                            aScope);
+  HealingParameters.FixSelfIntersectingEdgeMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+      "selfintersecting.edge",
+      (int)HealingParameters.FixSelfIntersectingEdgeMode,
+      aScope);
+  HealingParameters.FixIntersectingEdgesMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+      "intersecting.edges",
+      (int)HealingParameters.FixIntersectingEdgesMode,
+      aScope);
+  HealingParameters.FixNonAdjacentIntersectingEdgesMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+      "nonadjacent.intersecting.edges",
+      (int)HealingParameters.FixNonAdjacentIntersectingEdgesMode,
+      aScope);
+  HealingParameters.FixVertexPositionMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+    "vertex.position",
+    (int)HealingParameters.FixVertexPositionMode,
+    aScope);
+  HealingParameters.FixVertexToleranceMode =
+    (DE_ShapeFixParameters::FixMode)theResource->IntegerVal(
+      "vertex.tolerance",
+      (int)HealingParameters.FixVertexToleranceMode,
+      aScope);
 
   return true;
 }
 
-//=======================================================================
-// function : Save
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const
 {
   TCollection_AsciiString aResult;
-  TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".healing";
+  TCollection_AsciiString aScope =
+    THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".healing";
 
   aResult += "!\n";
   aResult += "!Shape healing parameters:\n";
@@ -191,301 +300,376 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const
 
   aResult += "!\n";
   aResult += "!Defines the mode for applying fixes of ShapeFix_Shell for ShapeFix_Shape\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "free.shell :\t " + (int)HealingParameters.FixFreeShellMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for applying fixes of ShapeFix_Face for ShapeFix_Shape\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "free.face :\t " + (int)HealingParameters.FixFreeFaceMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for applying fixes of ShapeFix_Wire for ShapeFix_Shape\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "free.wire :\t " + (int)HealingParameters.FixFreeWireMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for applying ShapeFix::SameParameter after all fixes\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "same.parameter :\t " + (int)HealingParameters.FixSameParameterMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for applying fixes of ShapeFix_Solid\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "solid :\t " + (int)HealingParameters.FixSolidMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
-  aResult += "!Defines the mode for applying analysis and fixes of orientation of shells in the solid\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "shell.orientation :\t " + (int)HealingParameters.FixShellOrientationMode + "\n";
+  aResult +=
+    "!Defines the mode for applying analysis and fixes of orientation of shells in the solid\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
+  aResult +=
+    aScope + "shell.orientation :\t " + (int)HealingParameters.FixShellOrientationMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
-  aResult += "!Defines the mode for creation of solids. If operation is executed then solids are created from open shells ";
+  aResult += "!Defines the mode for creation of solids. If operation is executed then solids are "
+             "created from open shells ";
   aResult += "else solids are created from closed shells only\n";
-  aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "create.open.solid :\t " + (int)HealingParameters.CreateOpenSolidMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for applying fixes of ShapeFix_Shell for ShapeFix_Solid\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "shell :\t " + (int)HealingParameters.FixShellMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
-  aResult += "!Defines the mode for applying analysis and fixes of orientation of faces in the shell\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "face.orientation :\t " + (int)HealingParameters.FixFaceOrientationMode + "\n";
+  aResult +=
+    "!Defines the mode for applying analysis and fixes of orientation of faces in the shell\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
+  aResult +=
+    aScope + "face.orientation :\t " + (int)HealingParameters.FixFaceOrientationMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for applying fixes of ShapeFix_Face\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "face :\t " + (int)HealingParameters.FixFaceMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for applying fixes of ShapeFix_Wire\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "wire :\t " + (int)HealingParameters.FixWireMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for applying a fix for the orientation of faces in the shell\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "orientation :\t " + (int)HealingParameters.FixOrientationMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
-  aResult += "!Defines the add natural bound mode. If operation is executed then natural boundary is added on faces that miss them\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "add.natural.bound :\t " + (int)HealingParameters.FixAddNaturalBoundMode + "\n";
+  aResult += "!Defines the add natural bound mode. If operation is executed then natural boundary "
+             "is added on faces that miss them\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
+  aResult +=
+    aScope + "add.natural.bound :\t " + (int)HealingParameters.FixAddNaturalBoundMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the fix missing seam mode (tries to insert seam is missed)\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "missing.seam :\t " + (int)HealingParameters.FixMissingSeamMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the fix small area wire mode (drops small wires)\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "small.area.wire :\t " + (int)HealingParameters.FixSmallAreaWireMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the remove face with small area (drops faces with small outer wires)\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "remove.small.area.face :\t " + (int)HealingParameters.RemoveSmallAreaFaceMode + "\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
+  aResult +=
+    aScope + "remove.small.area.face :\t " + (int)HealingParameters.RemoveSmallAreaFaceMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the fix intersecting wires mode in ShapeFix_Face\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "intersecting.wires :\t " + (int)HealingParameters.FixIntersectingWiresMode + "\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
+  aResult +=
+    aScope + "intersecting.wires :\t " + (int)HealingParameters.FixIntersectingWiresMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the fix loop wires mode in ShapeFix_Face\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "loop.wires :\t " + (int)HealingParameters.FixLoopWiresMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the fix split face mode in ShapeFix_Face\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "split.face :\t " + (int)HealingParameters.FixSplitFaceMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the auto-correct precision mode in ShapeFix_Face\n";
-  aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "auto.correct.precision :\t " + (int)HealingParameters.AutoCorrectPrecisionMode + "\n";
+  aResult +=
+    "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult +=
+    aScope + "auto.correct.precision :\t " + (int)HealingParameters.AutoCorrectPrecisionMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
-  aResult += "!Defines the mode allowed to modify topology of the wire during fixing (adding/removing edges etc.)\n";
-  aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Defines the mode allowed to modify topology of the wire during fixing "
+             "(adding/removing edges etc.)\n";
+  aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "modify.topology :\t " + (int)HealingParameters.ModifyTopologyMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode allowed to modify geometry of the edges and vertices\n";
-  aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult +=
+    "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
   aResult += aScope + "modify.geometry :\t " + (int)HealingParameters.ModifyGeometryMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
-  aResult += "!Defines the mode allowed to defines whether the wire is to be closed (by calling methods like FixDegenerated() ";
+  aResult += "!Defines the mode allowed to defines whether the wire is to be closed (by calling "
+             "methods like FixDegenerated() ";
   aResult += "!and FixConnected() for lastand first edges\n";
-  aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult +=
+    "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
   aResult += aScope + "closed.wire :\t " + (int)HealingParameters.ClosedWireMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
-  aResult += "!Defines the mode allowed to defines the 2d representation of the wire is preferable over 3d one ";
+  aResult += "!Defines the mode allowed to defines the 2d representation of the wire is preferable "
+             "over 3d one ";
   aResult += "(in the case of ambiguity in FixEdgeCurves)\n";
   aResult += "!and FixConnected() for lastand first edges\n";
-  aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult +=
+    "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
   aResult += aScope + "preference.pcurve :\t " + (int)HealingParameters.PreferencePCurveMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode allowed to reorder edges in the wire\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "reorder.edges :\t " + (int)HealingParameters.FixReorderMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode allowed to remove small edges\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "remove.small.edges :\t " + (int)HealingParameters.FixSmallMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for fix connecting edges in the wire\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "connected.edges :\t " + (int)HealingParameters.FixConnectedMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for fix edges (3Dcurves and 2D curves)\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "edge.curves :\t " + (int)HealingParameters.FixEdgeCurvesMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for add degenerated edges\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "add.degenerated.edges :\t " + (int)HealingParameters.FixDegeneratedMode + "\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
+  aResult +=
+    aScope + "add.degenerated.edges :\t " + (int)HealingParameters.FixDegeneratedMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for add lacking edges\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "add.lacking.edges :\t " + (int)HealingParameters.FixLackingMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for fix selfintersection edges\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "selfintersection :\t " + (int)HealingParameters.FixSelfIntersectionMode + "\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
+  aResult +=
+    aScope + "selfintersection :\t " + (int)HealingParameters.FixSelfIntersectionMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode allowed to remove loop\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "remove.loop :\t " + (int)HealingParameters.RemoveLoopMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode allowed to fix edge if pcurve is directed opposite to 3d curve\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "reversed2d :\t " + (int)HealingParameters.FixReversed2dMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
-  aResult += "!Defines the mode allowed to remove the pcurve(s) of the edge if it does not match the vertices\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Defines the mode allowed to remove the pcurve(s) of the edge if it does not match "
+             "the vertices\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "remove.pcurve :\t " + (int)HealingParameters.FixRemovePCurveMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
-  aResult += "!Defines the mode allowed to remove 3d curve of the edge if it does not match the vertices\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult +=
+    "!Defines the mode allowed to remove 3d curve of the edge if it does not match the vertices\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "remove.curve3d :\t " + (int)HealingParameters.FixRemoveCurve3dMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
-  aResult += "!Defines the mode allowed to add pcurve(s) of the edge if missing (by projecting 3d curve)\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult +=
+    "!Defines the mode allowed to add pcurve(s) of the edge if missing (by projecting 3d curve)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "add.pcurve :\t " + (int)HealingParameters.FixAddPCurveMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode allowed to build 3d curve of the edge if missing\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "add.curve3d :\t " + (int)HealingParameters.FixAddCurve3dMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
-  aResult += "!Defines the mode allowed to correct order of pcurves in the seam edge depends on its orientation\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Defines the mode allowed to correct order of pcurves in the seam edge depends on "
+             "its orientation\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "correct.order.in.seam :\t " + (int)HealingParameters.FixSeamMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
-  aResult += "!Defines the mode allowed to shifts wrong 2D curves back, ensuring that the 2D curves of the edges in the wire are connected\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Defines the mode allowed to shifts wrong 2D curves back, ensuring that the 2D "
+             "curves of the edges in the wire are connected\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "shifted :\t " + (int)HealingParameters.FixShiftedMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for applying EdgeSameParameter\n";
-  aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "edge.same.parameter :\t " + (int)HealingParameters.FixEdgeSameParameterMode + "\n";
+  aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
+  aResult +=
+    aScope + "edge.same.parameter :\t " + (int)HealingParameters.FixEdgeSameParameterMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for fix notched edges\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "notched.edges :\t " + (int)HealingParameters.FixNotchedEdgesMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for fix tail in wire\n";
-  aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "tail :\t " + (int)HealingParameters.FixTailMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for max angle of the tails\n";
-  aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "max.tail.angle :\t " + (int)HealingParameters.MaxTailAngle + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for max tail width\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "max.tail.width :\t " + (int)HealingParameters.MaxTailWidth + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for fix selfintersecting of edge\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "selfintersecting.edge :\t " + (int)HealingParameters.FixSelfIntersectingEdgeMode + "\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
+  aResult += aScope + "selfintersecting.edge :\t "
+             + (int)HealingParameters.FixSelfIntersectingEdgeMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for fix intersecting edges\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "intersecting.edges :\t " + (int)HealingParameters.FixIntersectingEdgesMode + "\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
+  aResult +=
+    aScope + "intersecting.edges :\t " + (int)HealingParameters.FixIntersectingEdgesMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for fix non adjacent intersecting edges\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "nonadjacent.intersecting.edges :\t " + (int)HealingParameters.FixNonAdjacentIntersectingEdgesMode + "\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
+  aResult += aScope + "nonadjacent.intersecting.edges :\t "
+             + (int)HealingParameters.FixNonAdjacentIntersectingEdgesMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for applying ShapeFix::FixVertexPosition before all fixes\n";
-  aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
+  aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
   aResult += aScope + "vertex.position :\t " + (int)HealingParameters.FixVertexPositionMode + "\n";
   aResult += "!\n";
 
   aResult += "!\n";
   aResult += "!Defines the mode for increases the tolerances of the edge vertices to comprise ";
-  aResult += "!the ends of 3d curve and pcurve on the given face (first method) or all pcurves stored in an edge (second one)\n";
-  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
-  aResult += aScope + "vertex.tolerance :\t " + (int)HealingParameters.FixVertexToleranceMode + "\n";
+  aResult += "!the ends of 3d curve and pcurve on the given face (first method) or all pcurves "
+             "stored in an edge (second one)\n";
+  aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), "
+             "\"Fix\"(1)\n";
+  aResult +=
+    aScope + "vertex.tolerance :\t " + (int)HealingParameters.FixVertexToleranceMode + "\n";
   aResult += "!\n";
 
   return aResult;
index 7596a4c8595aba359fb70f0c365737a070aec792..79d9422ddbc042b7380847ea7c3f294c223ec0a7 100644 (file)
@@ -25,27 +25,26 @@ class DE_ShapeFixConfigurationNode : public DE_ConfigurationNode
 {
   DEFINE_STANDARD_RTTIEXT(DE_ShapeFixConfigurationNode, DE_ConfigurationNode)
 public:
-
   //! Initializes all field by default
   Standard_EXPORT DE_ShapeFixConfigurationNode();
 
   //! Copies values of all fields
   //! @param[in] theConfigurationNode object to copy
-  Standard_EXPORT DE_ShapeFixConfigurationNode(const Handle(DE_ShapeFixConfigurationNode)& theConfigurationNode);
+  Standard_EXPORT DE_ShapeFixConfigurationNode(
+    const Handle(DE_ShapeFixConfigurationNode)& theConfigurationNode);
 
   //! Updates values according the resource
   //! @param[in] theResource input resource to use
   //! @return True if Load was successful
-  Standard_EXPORT virtual bool Load(const Handle(DE_ConfigurationContext)& theResource) Standard_OVERRIDE;
+  Standard_EXPORT virtual bool Load(const Handle(DE_ConfigurationContext)& theResource)
+    Standard_OVERRIDE;
 
   //! Writes configuration to the string
   //! @return result resource string
   Standard_EXPORT virtual TCollection_AsciiString Save() const Standard_OVERRIDE;
 
 public:
-
   DE_ShapeFixParameters HealingParameters; //!< Shape healing parameters
-
 };
 
 #endif // _DE_ShapeFixConfigurationNode_HeaderFile
index 54ced338db7accff1c06270ee5448a512e4c901c..0a40a57059e86a57c68e530789adf62dbd3b04c9 100644 (file)
@@ -19,8 +19,8 @@
 #include <Message_ProgressRange.hxx>
 #include <NCollection_Buffer.hxx>
 #include <OSD_File.hxx>
-#include <OSD_Path.hxx>
 #include <OSD_FileSystem.hxx>
+#include <OSD_Path.hxx>
 #include <OSD_Protection.hxx>
 #include <Standard_ErrorHandler.hxx>
 #include <TopoDS_Shape.hxx>
@@ -29,44 +29,41 @@ IMPLEMENT_STANDARD_RTTIEXT(DE_Wrapper, Standard_Transient)
 
 namespace
 {
-  static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
-  {
-    static const TCollection_AsciiString aScope ("global");
-    return aScope;
-  }
+static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
+{
+  static const TCollection_AsciiString aScope("global");
+  return aScope;
+}
 
-  static Handle(DE_Wrapper)& THE_GLOBAL_CONFIGURATION()
-  {
-    static Handle(DE_Wrapper) aConf = new DE_Wrapper();
-    return aConf;
-  }
+static Handle(DE_Wrapper)& THE_GLOBAL_CONFIGURATION()
+{
+  static Handle(DE_Wrapper) aConf = new DE_Wrapper();
+  return aConf;
 }
+} // namespace
+
+//=================================================================================================
 
-//=======================================================================
-// function : DE_Wrapper
-// purpose  :
-//=======================================================================
 DE_Wrapper::DE_Wrapper()
-  :myKeepUpdates(Standard_False)
-{}
+    : myKeepUpdates(Standard_False)
+{
+}
+
+//=================================================================================================
 
-//=======================================================================
-// function : DE_Wrapper
-// purpose  :
-//=======================================================================
 DE_Wrapper::DE_Wrapper(const Handle(DE_Wrapper)& theWrapper)
-  : DE_Wrapper()
+    : DE_Wrapper()
 {
   if (theWrapper.IsNull())
   {
     return;
   }
   GlobalParameters = theWrapper->GlobalParameters;
-  for (DE_ConfigurationFormatMap::Iterator aFormatIter(theWrapper->Nodes());
-       aFormatIter.More(); aFormatIter.Next())
+  for (DE_ConfigurationFormatMap::Iterator aFormatIter(theWrapper->Nodes()); aFormatIter.More();
+       aFormatIter.Next())
   {
-    for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value());
-         aVendorIter.More(); aVendorIter.Next())
+    for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value()); aVendorIter.More();
+         aVendorIter.Next())
     {
       Bind(aVendorIter.Value());
     }
@@ -74,19 +71,15 @@ DE_Wrapper::DE_Wrapper(const Handle(DE_Wrapper)& theWrapper)
   theWrapper->myKeepUpdates = myKeepUpdates;
 }
 
-//=======================================================================
-// function : GlobalWrapper
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 const Handle(DE_Wrapper)& DE_Wrapper::GlobalWrapper()
 {
   return THE_GLOBAL_CONFIGURATION();
 }
 
-//=======================================================================
-// function : SetGlobalWrapper
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 void DE_Wrapper::SetGlobalWrapper(const Handle(DE_Wrapper)& theWrapper)
 {
   if (!theWrapper.IsNull())
@@ -95,24 +88,20 @@ void DE_Wrapper::SetGlobalWrapper(const Handle(DE_Wrapper)& theWrapper)
   }
 }
 
-//=======================================================================
-// function : GlobalLoadMutex
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Mutex& DE_Wrapper::GlobalLoadMutex()
 {
   static Standard_Mutex THE_GLOBAL_LOAD_MUTEX;
   return THE_GLOBAL_LOAD_MUTEX;
 }
 
-//=======================================================================
-// function : Read
-// purpose  :
-//=======================================================================
-Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
+//=================================================================================================
+
+Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString&  thePath,
                                   const Handle(TDocStd_Document)& theDocument,
-                                  Handle(XSControl_WorkSession)& theWS,
-                                  const Message_ProgressRange& theProgress)
+                                  Handle(XSControl_WorkSession)&  theWS,
+                                  const Message_ProgressRange&    theProgress)
 {
   if (theDocument.IsNull())
   {
@@ -130,14 +119,12 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
   return aProvider->Read(thePath, theDocument, theWS, theProgress);
 }
 
-//=======================================================================
-// function : Write
-// purpose  :
-//=======================================================================
-Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
+//=================================================================================================
+
+Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString&  thePath,
                                    const Handle(TDocStd_Document)& theDocument,
-                                   Handle(XSControl_WorkSession)& theWS,
-                                   const Message_ProgressRange& theProgress)
+                                   Handle(XSControl_WorkSession)&  theWS,
+                                   const Message_ProgressRange&    theProgress)
 {
   if (theDocument.IsNull())
   {
@@ -155,13 +142,11 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
   return aProvider->Write(thePath, theDocument, theWS, theProgress);
 }
 
-//=======================================================================
-// function : Read
-// purpose  :
-//=======================================================================
-Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
+//=================================================================================================
+
+Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString&  thePath,
                                   const Handle(TDocStd_Document)& theDocument,
-                                  const Message_ProgressRange& theProgress)
+                                  const Message_ProgressRange&    theProgress)
 {
   if (theDocument.IsNull())
   {
@@ -175,13 +160,11 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
   return aProvider->Read(thePath, theDocument, theProgress);
 }
 
-//=======================================================================
-// function : Write
-// purpose  :
-//=======================================================================
-Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
+//=================================================================================================
+
+Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString&  thePath,
                                    const Handle(TDocStd_Document)& theDocument,
-                                   const Message_ProgressRange& theProgress)
+                                   const Message_ProgressRange&    theProgress)
 {
   if (theDocument.IsNull())
   {
@@ -195,14 +178,12 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
   return aProvider->Write(thePath, theDocument, theProgress);
 }
 
-//=======================================================================
-// function : Read
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
-                                  TopoDS_Shape& theShape,
+                                  TopoDS_Shape&                  theShape,
                                   Handle(XSControl_WorkSession)& theWS,
-                                  const Message_ProgressRange& theProgress)
+                                  const Message_ProgressRange&   theProgress)
 {
   if (theWS.IsNull())
   {
@@ -216,14 +197,12 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
   return aProvider->Read(thePath, theShape, theWS, theProgress);
 }
 
-//=======================================================================
-// function : Write
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
-                                   const TopoDS_Shape& theShape,
+                                   const TopoDS_Shape&            theShape,
                                    Handle(XSControl_WorkSession)& theWS,
-                                   const Message_ProgressRange& theProgress)
+                                   const Message_ProgressRange&   theProgress)
 {
   if (theWS.IsNull())
   {
@@ -237,13 +216,11 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
   return aProvider->Write(thePath, theShape, theWS, theProgress);
 }
 
-//=======================================================================
-// function : Read
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
-                                  TopoDS_Shape& theShape,
-                                  const Message_ProgressRange& theProgress)
+                                  TopoDS_Shape&                  theShape,
+                                  const Message_ProgressRange&   theProgress)
 {
 
   Handle(DE_Provider) aProvider;
@@ -254,13 +231,11 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
   return aProvider->Read(thePath, theShape, theProgress);
 }
 
-//=======================================================================
-// function : Write
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
-                                   const TopoDS_Shape& theShape,
-                                   const Message_ProgressRange& theProgress)
+                                   const TopoDS_Shape&            theShape,
+                                   const Message_ProgressRange&   theProgress)
 {
   Handle(DE_Provider) aProvider;
   if (!FindProvider(thePath, Standard_False, aProvider))
@@ -270,34 +245,34 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
   return aProvider->Write(thePath, theShape, theProgress);
 }
 
-//=======================================================================
-// function : Load
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Wrapper::Load(const TCollection_AsciiString& theResource,
-                                  const Standard_Boolean theIsRecursive)
+                                  const Standard_Boolean         theIsRecursive)
 {
   Handle(DE_ConfigurationContext) aResource = new DE_ConfigurationContext();
   aResource->Load(theResource);
   return Load(aResource, theIsRecursive);
 }
 
-//=======================================================================
-// function : Load
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Wrapper::Load(const Handle(DE_ConfigurationContext)& theResource,
-                                  const Standard_Boolean theIsRecursive)
+                                  const Standard_Boolean                 theIsRecursive)
 {
-  GlobalParameters.LengthUnit = theResource->RealVal("general.length.unit", GlobalParameters.LengthUnit, THE_CONFIGURATION_SCOPE());
-  GlobalParameters.SystemUnit = theResource->RealVal("general.system.unit", GlobalParameters.SystemUnit, THE_CONFIGURATION_SCOPE());
+  GlobalParameters.LengthUnit = theResource->RealVal("general.length.unit",
+                                                     GlobalParameters.LengthUnit,
+                                                     THE_CONFIGURATION_SCOPE());
+  GlobalParameters.SystemUnit = theResource->RealVal("general.system.unit",
+                                                     GlobalParameters.SystemUnit,
+                                                     THE_CONFIGURATION_SCOPE());
   if (theIsRecursive)
   {
-    for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
-         aFormatIter.More(); aFormatIter.Next())
+    for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration); aFormatIter.More();
+         aFormatIter.Next())
     {
-      for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value());
-           aVendorIter.More(); aVendorIter.Next())
+      for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value()); aVendorIter.More();
+           aVendorIter.Next())
       {
         aVendorIter.Value()->Load(theResource);
       }
@@ -307,23 +282,21 @@ Standard_Boolean DE_Wrapper::Load(const Handle(DE_ConfigurationContext)& theReso
   return Standard_True;
 }
 
-//=======================================================================
-// function : Save
-// purpose  :
-//=======================================================================
-Standard_Boolean DE_Wrapper::Save(const TCollection_AsciiString& theResourcePath,
-                                  const Standard_Boolean theIsRecursive,
+//=================================================================================================
+
+Standard_Boolean DE_Wrapper::Save(const TCollection_AsciiString&   theResourcePath,
+                                  const Standard_Boolean           theIsRecursive,
                                   const TColStd_ListOfAsciiString& theFormats,
                                   const TColStd_ListOfAsciiString& theVendors)
 {
-  OSD_Path aPath = theResourcePath;
-  OSD_File aFile(aPath);
+  OSD_Path       aPath = theResourcePath;
+  OSD_File       aFile(aPath);
   OSD_Protection aProt;
   {
     try
     {
       OCC_CATCH_SIGNALS
-        aFile.Build(OSD_ReadWrite, aProt);
+      aFile.Build(OSD_ReadWrite, aProt);
     }
     catch (Standard_Failure const&)
     {
@@ -340,11 +313,9 @@ Standard_Boolean DE_Wrapper::Save(const TCollection_AsciiString& theResourcePath
   return Standard_True;
 }
 
-//=======================================================================
-// function : Save
-// purpose  :
-//=======================================================================
-TCollection_AsciiString DE_Wrapper::Save(const Standard_Boolean theIsRecursive,
+//=================================================================================================
+
+TCollection_AsciiString DE_Wrapper::Save(const Standard_Boolean           theIsRecursive,
                                          const TColStd_ListOfAsciiString& theFormats,
                                          const TColStd_ListOfAsciiString& theVendors)
 {
@@ -359,13 +330,13 @@ TCollection_AsciiString DE_Wrapper::Save(const Standard_Boolean theIsRecursive,
   aResult += "!*****************************************************************************\n";
   aResult += "!DE_Wrapper\n";
   aResult += "!Priority vendor list. For every CAD format set indexed list of vendors\n";
-  for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
-       aFormatIter.More(); aFormatIter.Next())
+  for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration); aFormatIter.More();
+       aFormatIter.Next())
   {
     const TCollection_AsciiString& aFormat = aFormatIter.Key();
     aResult += THE_CONFIGURATION_SCOPE() + '.' + "priority" + '.' + aFormat + " :\t ";
-    for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value());
-         aVendorIter.More(); aVendorIter.Next())
+    for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value()); aVendorIter.More();
+         aVendorIter.Next())
     {
       const TCollection_AsciiString& aVendorName = aVendorIter.Value()->GetVendor();
       aResult += aVendorName + " ";
@@ -374,20 +345,22 @@ TCollection_AsciiString DE_Wrapper::Save(const Standard_Boolean theIsRecursive,
   }
   aResult += "!Global parameters. Used for all providers\n";
   aResult += "!Length scale unit value. Should be more than 0. Default value: 1.0(MM)\n";
-  aResult += THE_CONFIGURATION_SCOPE() + ".general.length.unit :\t " + GlobalParameters.LengthUnit + "\n";
+  aResult +=
+    THE_CONFIGURATION_SCOPE() + ".general.length.unit :\t " + GlobalParameters.LengthUnit + "\n";
   aResult += "!System unit value. Should be more than 0. Default value: 1.0(MM)\n";
-  aResult += THE_CONFIGURATION_SCOPE() + ".general.system.unit :\t " + GlobalParameters.SystemUnit + "\n";
+  aResult +=
+    THE_CONFIGURATION_SCOPE() + ".general.system.unit :\t " + GlobalParameters.SystemUnit + "\n";
   if (theIsRecursive)
   {
-    for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
-         aFormatIter.More(); aFormatIter.Next())
+    for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration); aFormatIter.More();
+         aFormatIter.Next())
     {
       if (!theFormats.IsEmpty() && !theFormats.Contains(aFormatIter.Key()))
       {
         continue;
       }
-      for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value());
-           aVendorIter.More(); aVendorIter.Next())
+      for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value()); aVendorIter.More();
+           aVendorIter.Next())
       {
         if (!theVendors.IsEmpty() && !theVendors.Contains(aVendorIter.Key()))
         {
@@ -403,10 +376,8 @@ TCollection_AsciiString DE_Wrapper::Save(const Standard_Boolean theIsRecursive,
   return aResult;
 }
 
-//=======================================================================
-// function : Bind
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Wrapper::Bind(const Handle(DE_ConfigurationNode)& theNode)
 {
   if (theNode.IsNull())
@@ -415,7 +386,7 @@ Standard_Boolean DE_Wrapper::Bind(const Handle(DE_ConfigurationNode)& theNode)
   }
   const TCollection_AsciiString aFileFormat = theNode->GetFormat();
   const TCollection_AsciiString aVendorName = theNode->GetVendor();
-  DE_ConfigurationVendorMap* aVendorMap = myConfiguration.ChangeSeek(aFileFormat);
+  DE_ConfigurationVendorMap*    aVendorMap  = myConfiguration.ChangeSeek(aFileFormat);
   if (aVendorMap == NULL)
   {
     DE_ConfigurationVendorMap aTmpVendorMap;
@@ -424,10 +395,8 @@ Standard_Boolean DE_Wrapper::Bind(const Handle(DE_ConfigurationNode)& theNode)
   return aVendorMap->Add(aVendorName, theNode) > 0;
 }
 
-//=======================================================================
-// function : UnBind
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Wrapper::UnBind(const Handle(DE_ConfigurationNode)& theNode)
 {
   if (theNode.IsNull())
@@ -436,7 +405,7 @@ Standard_Boolean DE_Wrapper::UnBind(const Handle(DE_ConfigurationNode)& theNode)
   }
   const TCollection_AsciiString aFileFormat = theNode->GetFormat();
   const TCollection_AsciiString aVendorName = theNode->GetVendor();
-  DE_ConfigurationVendorMap* aVendorMap = myConfiguration.ChangeSeek(aFileFormat);
+  DE_ConfigurationVendorMap*    aVendorMap  = myConfiguration.ChangeSeek(aFileFormat);
   if (aVendorMap == NULL)
   {
     return false;
@@ -446,25 +415,21 @@ Standard_Boolean DE_Wrapper::UnBind(const Handle(DE_ConfigurationNode)& theNode)
   return aVendorMap->Size() != aPrevSize;
 }
 
-//=======================================================================
-// function : Find
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Wrapper::Find(const TCollection_AsciiString& theFormat,
                                   const TCollection_AsciiString& theVendor,
-                                  Handle(DE_ConfigurationNode)& theNode) const
+                                  Handle(DE_ConfigurationNode)&  theNode) const
 {
   const DE_ConfigurationVendorMap* aVendorMap = myConfiguration.Seek(theFormat);
   return aVendorMap != nullptr && aVendorMap->FindFromKey(theVendor, theNode);
 }
 
-//=======================================================================
-// function : ChangePriority
-// purpose  :
-//=======================================================================
-void DE_Wrapper::ChangePriority(const TCollection_AsciiString& theFormat,
+//=================================================================================================
+
+void DE_Wrapper::ChangePriority(const TCollection_AsciiString&   theFormat,
                                 const TColStd_ListOfAsciiString& theVendorPriority,
-                                const Standard_Boolean theToDisable)
+                                const Standard_Boolean           theToDisable)
 {
   DE_ConfigurationVendorMap aVendorMap;
   if (!myConfiguration.Find(theFormat, aVendorMap))
@@ -473,11 +438,11 @@ void DE_Wrapper::ChangePriority(const TCollection_AsciiString& theFormat,
   }
   DE_ConfigurationVendorMap aNewVendorMap;
   // Sets according to the input priority
-  for (TColStd_ListOfAsciiString::Iterator aPriorIter(theVendorPriority);
-       aPriorIter.More(); aPriorIter.Next())
+  for (TColStd_ListOfAsciiString::Iterator aPriorIter(theVendorPriority); aPriorIter.More();
+       aPriorIter.Next())
   {
     const TCollection_AsciiString& aVendorName = aPriorIter.Value();
-    Handle(DE_ConfigurationNode) aNode;
+    Handle(DE_ConfigurationNode)   aNode;
     if (aVendorMap.FindFromKey(aVendorName, aNode))
     {
       aNode->SetEnabled(Standard_True);
@@ -485,8 +450,8 @@ void DE_Wrapper::ChangePriority(const TCollection_AsciiString& theFormat,
     }
   }
   // Sets not used elements
-  for (DE_ConfigurationVendorMap::Iterator aVendorIter(aVendorMap);
-       aVendorIter.More(); aVendorIter.Next())
+  for (DE_ConfigurationVendorMap::Iterator aVendorIter(aVendorMap); aVendorIter.More();
+       aVendorIter.Next())
   {
     const TCollection_AsciiString& aVendorName = aVendorIter.Key();
     if (!theVendorPriority.Contains(aVendorName))
@@ -502,51 +467,44 @@ void DE_Wrapper::ChangePriority(const TCollection_AsciiString& theFormat,
   myConfiguration.Bind(theFormat, aNewVendorMap);
 }
 
-//=======================================================================
-// function : ChangePriority
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 void DE_Wrapper::ChangePriority(const TColStd_ListOfAsciiString& theVendorPriority,
-                                const Standard_Boolean theToDisable)
+                                const Standard_Boolean           theToDisable)
 {
-  for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
-       aFormatIter.More(); aFormatIter.Next())
+  for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration); aFormatIter.More();
+       aFormatIter.Next())
   {
     ChangePriority(aFormatIter.Key(), theVendorPriority, theToDisable);
   }
 }
 
-//=======================================================================
-// function : Nodes
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 const DE_ConfigurationFormatMap& DE_Wrapper::Nodes() const
 {
   return myConfiguration;
 }
 
-//=======================================================================
-// function : Copy
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Handle(DE_Wrapper) DE_Wrapper::Copy() const
 {
   return new DE_Wrapper(*this);
 }
 
-//=======================================================================
-// function : FindProvider
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_Boolean DE_Wrapper::FindProvider(const TCollection_AsciiString& thePath,
-                                          const Standard_Boolean theToImport,
-                                          Handle(DE_Provider)& theProvider) const
+                                          const Standard_Boolean         theToImport,
+                                          Handle(DE_Provider)&           theProvider) const
 {
   Handle(NCollection_Buffer) aBuffer;
   if (theToImport)
   {
     const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
-    std::shared_ptr<std::istream> aStream = aFileSystem->OpenIStream(thePath, std::ios::in | std::ios::binary);
+    std::shared_ptr<std::istream> aStream =
+      aFileSystem->OpenIStream(thePath, std::ios::in | std::ios::binary);
     if (aStream.get() != nullptr)
     {
       aBuffer = new NCollection_Buffer(NCollection_BaseAllocator::CommonBaseAllocator(), 2048);
@@ -554,23 +512,22 @@ Standard_Boolean DE_Wrapper::FindProvider(const TCollection_AsciiString& thePath
       aBuffer->ChangeData()[2047] = '\0';
     }
   }
-  OSD_Path aPath(thePath);
+  OSD_Path                      aPath(thePath);
   const TCollection_AsciiString anExtr = aPath.Extension();
-  for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
-       aFormatIter.More(); aFormatIter.Next())
+  for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration); aFormatIter.More();
+       aFormatIter.Next())
   {
-    for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value());
-         aVendorIter.More(); aVendorIter.Next())
+    for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value()); aVendorIter.More();
+         aVendorIter.Next())
     {
       const Handle(DE_ConfigurationNode)& aNode = aVendorIter.Value();
-      if (aNode->IsEnabled() &&
-          ((theToImport && aNode->IsImportSupported()) ||
-          (!theToImport && aNode->IsExportSupported())) &&
-          (aNode->CheckExtension(anExtr) ||
-          (theToImport && aNode->CheckContent(aBuffer))) &&
-          aNode->UpdateLoad(theToImport, myKeepUpdates))
+      if (aNode->IsEnabled()
+          && ((theToImport && aNode->IsImportSupported())
+              || (!theToImport && aNode->IsExportSupported()))
+          && (aNode->CheckExtension(anExtr) || (theToImport && aNode->CheckContent(aBuffer)))
+          && aNode->UpdateLoad(theToImport, myKeepUpdates))
       {
-        theProvider = aNode->BuildProvider();
+        theProvider             = aNode->BuildProvider();
         aNode->GlobalParameters = GlobalParameters;
         return Standard_True;
       }
@@ -579,17 +536,15 @@ Standard_Boolean DE_Wrapper::FindProvider(const TCollection_AsciiString& thePath
   return Standard_False;
 }
 
-//=======================================================================
-// function : UpdateLoad
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 Standard_EXPORT void DE_Wrapper::UpdateLoad(const Standard_Boolean theToForceUpdate) const
 {
-  for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
-       aFormatIter.More(); aFormatIter.Next())
+  for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration); aFormatIter.More();
+       aFormatIter.Next())
   {
-    for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value());
-         aVendorIter.More(); aVendorIter.Next())
+    for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value()); aVendorIter.More();
+         aVendorIter.Next())
     {
       const Handle(DE_ConfigurationNode)& aNode = aVendorIter.Value();
       aNode->UpdateLoad(Standard_True, Standard_True);
@@ -601,15 +556,13 @@ Standard_EXPORT void DE_Wrapper::UpdateLoad(const Standard_Boolean theToForceUpd
   }
 }
 
-//=======================================================================
-// function : sort
-// purpose  :
-//=======================================================================
+//=================================================================================================
+
 void DE_Wrapper::sort(const Handle(DE_ConfigurationContext)& theResource)
 {
   const TCollection_AsciiString aScope(THE_CONFIGURATION_SCOPE() + '.' + "priority");
-  for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
-       aFormatIter.More(); aFormatIter.Next())
+  for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration); aFormatIter.More();
+       aFormatIter.Next())
   {
     TColStd_ListOfAsciiString aVendorPriority;
     if (!theResource->GetStringSeq(aFormatIter.Key(), aVendorPriority, aScope))
index e775161640b5dad86302719b952774fd07966e2b..fc8809aba8f1452c4c9d9a192fe8b4a06aa7ef4f 100644 (file)
@@ -25,8 +25,10 @@ class TopoDS_Shape;
 class XSControl_WorkSession;
 class TDocStd_Document;
 
-typedef NCollection_IndexedDataMap<TCollection_AsciiString, Handle(DE_ConfigurationNode)> DE_ConfigurationVendorMap;
-typedef NCollection_DataMap<TCollection_AsciiString, DE_ConfigurationVendorMap> DE_ConfigurationFormatMap;
+typedef NCollection_IndexedDataMap<TCollection_AsciiString, Handle(DE_ConfigurationNode)>
+  DE_ConfigurationVendorMap;
+typedef NCollection_DataMap<TCollection_AsciiString, DE_ConfigurationVendorMap>
+  DE_ConfigurationFormatMap;
 
 //! The main class for working with CAD file exchange.
 //! Loads and Saves special CAD transfer property.
@@ -54,7 +56,6 @@ class DE_Wrapper : public Standard_Transient
   DEFINE_STANDARD_RTTIEXT(DE_Wrapper, Standard_Transient)
 
 public:
-
   //! Initializes all field by default
   Standard_EXPORT DE_Wrapper();
 
@@ -74,17 +75,17 @@ public:
   Standard_EXPORT static Standard_Mutex& GlobalLoadMutex();
 
 public:
-
   //! Reads a CAD file, according internal configuration
   //! @param[in] thePath path to the import CAD file
   //! @param[out] theDocument document to save result
   //! @param[in] theWS current work session
   //! @param[in] theProgress progress indicator
   //! @return true if Read operation has ended correctly
-  Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
-                                        const Handle(TDocStd_Document)& theDocument,
-                                        Handle(XSControl_WorkSession)& theWS,
-                                        const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT Standard_Boolean
+    Read(const TCollection_AsciiString&  thePath,
+         const Handle(TDocStd_Document)& theDocument,
+         Handle(XSControl_WorkSession)&  theWS,
+         const Message_ProgressRange&    theProgress = Message_ProgressRange());
 
   //! Writes a CAD file, according internal configuration
   //! @param[in] thePath path to the export CAD file
@@ -92,28 +93,31 @@ public:
   //! @param[in] theWS current work session
   //! @param[in] theProgress progress indicator
   //! @return true if Write operation has ended correctly
-  Standard_EXPORT Standard_Boolean Write(const TCollection_AsciiString& thePath,
-                                         const Handle(TDocStd_Document)& theDocument,
-                                         Handle(XSControl_WorkSession)& theWS,
-                                         const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT Standard_Boolean
+    Write(const TCollection_AsciiString&  thePath,
+          const Handle(TDocStd_Document)& theDocument,
+          Handle(XSControl_WorkSession)&  theWS,
+          const Message_ProgressRange&    theProgress = Message_ProgressRange());
 
   //! Reads a CAD file, according internal configuration
   //! @param[in] thePath path to the import CAD file
   //! @param[out] theDocument document to save result
   //! @param[in] theProgress progress indicator
   //! @return true if Read operation has ended correctly
-  Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
-                                        const Handle(TDocStd_Document)& theDocument,
-                                        const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT Standard_Boolean
+    Read(const TCollection_AsciiString&  thePath,
+         const Handle(TDocStd_Document)& theDocument,
+         const Message_ProgressRange&    theProgress = Message_ProgressRange());
 
   //! Writes a CAD file, according internal configuration
   //! @param[in] thePath path to the export CAD file
   //! @param[out] theDocument document to export
   //! @param[in] theProgress progress indicator
   //! @return true if Write operation has ended correctly
-  Standard_EXPORT Standard_Boolean Write(const TCollection_AsciiString& thePath,
-                                         const Handle(TDocStd_Document)& theDocument,
-                                         const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT Standard_Boolean
+    Write(const TCollection_AsciiString&  thePath,
+          const Handle(TDocStd_Document)& theDocument,
+          const Message_ProgressRange&    theProgress = Message_ProgressRange());
 
   //! Reads a CAD file, according internal configuration
   //! @param[in] thePath path to the import CAD file
@@ -121,10 +125,11 @@ public:
   //! @param[in] theWS current work session
   //! @param[in] theProgress progress indicator
   //! @return true if Read operation has ended correctly
-  Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
-                                        TopoDS_Shape& theShape,
-                                        Handle(XSControl_WorkSession)& theWS,
-                                        const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT Standard_Boolean
+    Read(const TCollection_AsciiString& thePath,
+         TopoDS_Shape&                  theShape,
+         Handle(XSControl_WorkSession)& theWS,
+         const Message_ProgressRange&   theProgress = Message_ProgressRange());
 
   //! Writes a CAD file, according internal configuration
   //! @param[in] thePath path to the export CAD file
@@ -132,37 +137,39 @@ public:
   //! @param[in] theWS current work session
   //! @param[in] theProgress progress indicator
   //! @return true if Write operation has ended correctly
-  Standard_EXPORT Standard_Boolean Write(const TCollection_AsciiString& thePath,
-                                         const TopoDS_Shape& theShape,
-                                         Handle(XSControl_WorkSession)& theWS,
-                                         const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT Standard_Boolean
+    Write(const TCollection_AsciiString& thePath,
+          const TopoDS_Shape&            theShape,
+          Handle(XSControl_WorkSession)& theWS,
+          const Message_ProgressRange&   theProgress = Message_ProgressRange());
 
   //! Reads a CAD file, according internal configuration
   //! @param[in] thePath path to the import CAD file
   //! @param[out] theShape shape to save result
   //! @param[in] theProgress progress indicator
   //! @return true if Read operation has ended correctly
-  Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
-                                        TopoDS_Shape& theShape,
-                                        const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT Standard_Boolean
+    Read(const TCollection_AsciiString& thePath,
+         TopoDS_Shape&                  theShape,
+         const Message_ProgressRange&   theProgress = Message_ProgressRange());
 
   //! Writes a CAD file, according internal configuration
   //! @param[in] thePath path to the export CAD file
   //! @param[out] theShape shape to export
   //! @param[in] theProgress progress indicator
   //! @return true if Write operation has ended correctly
-  Standard_EXPORT Standard_Boolean Write(const TCollection_AsciiString& thePath,
-                                         const TopoDS_Shape& theShape,
-                                         const Message_ProgressRange& theProgress = Message_ProgressRange());
+  Standard_EXPORT Standard_Boolean
+    Write(const TCollection_AsciiString& thePath,
+          const TopoDS_Shape&            theShape,
+          const Message_ProgressRange&   theProgress = Message_ProgressRange());
 
 public:
-
   //! Updates values according the resource file
   //! @param[in] theResource file path to resource or resource value
   //! @param[in] theIsRecursive flag to update all nodes
   //! @return true if theResource has loaded correctly
   Standard_EXPORT Standard_Boolean Load(const TCollection_AsciiString& theResource = "",
-                                        const Standard_Boolean theIsRecursive = Standard_True);
+                                        const Standard_Boolean theIsRecursive      = Standard_True);
 
   //! Updates values according the resource
   //! @param[in] theResource input resource to use
@@ -177,19 +184,21 @@ public:
   //! @param[in] theFormats list of formats to save. If empty, saves all available
   //! @param[in] theVendors list of providers to save. If empty, saves all available
   //! @return true if the Configuration has saved correctly
-  Standard_EXPORT Standard_Boolean Save(const TCollection_AsciiString& theResourcePath,
-                                        const Standard_Boolean theIsRecursive = Standard_True,
-                                        const TColStd_ListOfAsciiString& theFormats = TColStd_ListOfAsciiString(),
-                                        const TColStd_ListOfAsciiString& theVendors = TColStd_ListOfAsciiString());
+  Standard_EXPORT Standard_Boolean
+    Save(const TCollection_AsciiString&   theResourcePath,
+         const Standard_Boolean           theIsRecursive = Standard_True,
+         const TColStd_ListOfAsciiString& theFormats     = TColStd_ListOfAsciiString(),
+         const TColStd_ListOfAsciiString& theVendors     = TColStd_ListOfAsciiString());
 
   //! Writes configuration to the string
   //! @param[in] theIsRecursive flag to write values of all nodes
   //! @param[in] theFormats list of formats to save. If empty, saves all available
   //! @param[in] theVendors list of providers to save. If empty, saves all available
   //! @return result resource string
-  Standard_EXPORT TCollection_AsciiString Save(const Standard_Boolean theIsRecursive = Standard_True,
-                                               const TColStd_ListOfAsciiString& theFormats = TColStd_ListOfAsciiString(),
-                                               const TColStd_ListOfAsciiString& theVendors = TColStd_ListOfAsciiString());
+  Standard_EXPORT TCollection_AsciiString
+    Save(const Standard_Boolean           theIsRecursive = Standard_True,
+         const TColStd_ListOfAsciiString& theFormats     = TColStd_ListOfAsciiString(),
+         const TColStd_ListOfAsciiString& theVendors     = TColStd_ListOfAsciiString());
 
   //! Creates new node copy and adds to the map
   //! @param[in] theNode input node to copy
@@ -208,13 +217,13 @@ public:
   //! @return Standard_True if the node is found
   Standard_EXPORT Standard_Boolean Find(const TCollection_AsciiString& theFormat,
                                         const TCollection_AsciiString& theVendor,
-                                        Handle(DE_ConfigurationNode)& theNode) const;
+                                        Handle(DE_ConfigurationNode)&  theNode) const;
 
   //! Changes provider priority to one format if it exists
   //! @param[in] theFormat input node CAD format
   //! @param[in] theVendorPriority priority of work with vendors
   //! @param[in] theToDisable flag for disabling nodes that are not included in the priority
-  Standard_EXPORT void ChangePriority(const TCollection_AsciiString& theFormat,
+  Standard_EXPORT void ChangePriority(const TCollection_AsciiString&   theFormat,
                                       const TColStd_ListOfAsciiString& theVendorPriority,
                                       const Standard_Boolean theToDisable = Standard_False);
 
@@ -231,11 +240,12 @@ public:
   //! @param[out] theProvider created new provider
   //! @return Standard_True if provider found and created
   Standard_EXPORT virtual Standard_Boolean FindProvider(const TCollection_AsciiString& thePath,
-                                                        const Standard_Boolean theToImport,
+                                                        const Standard_Boolean         theToImport,
                                                         Handle(DE_Provider)& theProvider) const;
 
   //! Updates all registered nodes, all changes will be saved in nodes
-  //! @param[in] theToForceUpdate flag that turns on/of nodes, according to updated ability to import/export
+  //! @param[in] theToForceUpdate flag that turns on/of nodes, according to updated ability to
+  //! import/export
   Standard_EXPORT void UpdateLoad(const Standard_Boolean theToForceUpdate = Standard_False) const;
 
   //! Gets flag that keeps changes on configuration nodes which are being updated, false by default
@@ -253,7 +263,6 @@ public:
   Standard_EXPORT virtual Handle(DE_Wrapper) Copy() const;
 
 protected:
-
   //! Sorts the vendors according to the priority to work
   //! Formats omitted from the resource are not modified
   //! Vendors omitted from the format scope are disabled
@@ -261,12 +270,12 @@ protected:
   void sort(const Handle(DE_ConfigurationContext)& theResource);
 
 public:
-
-  DE_ConfigurationNode::DE_SectionGlobal GlobalParameters; //!< Internal parameters for the all translators
+  DE_ConfigurationNode::DE_SectionGlobal
+    GlobalParameters; //!< Internal parameters for the all translators
 
 private:
-
-  Standard_Boolean myKeepUpdates; //!< Flag that keeps changes on configuration nodes which are being updated
+  Standard_Boolean
+    myKeepUpdates; //!< Flag that keeps changes on configuration nodes which are being updated
   DE_ConfigurationFormatMap myConfiguration; //!< Internal map of formats
 };