0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[occt.git] / src / GeomFill / GeomFill_LocationGuide.cxx
index 300fd9f..ef26645 100644 (file)
@@ -5,8 +5,8 @@
 //
 // This file is part of Open CASCADE Technology software library.
 //
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
 // by the Free Software Foundation, with special exception defined in the file
 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
 // distribution for complete text of the license and disclaimer of any warranty.
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <GeomFill_LocationGuide.ixx>
-#include <gp.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Vec.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Trsf.hxx>
-#include <gp_GTrsf.hxx>
-#include <gp_XYZ.hxx>
-#include <gp_Ax1.hxx>
-#include <gp_Pnt2d.hxx>
-
-#include <math_Vector.hxx>
-#include <math_Gauss.hxx>
-#include <math_FunctionSetRoot.hxx>
-#include <Precision.hxx>
-
-#include <Geom_SurfaceOfRevolution.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <Geom_Curve.hxx>
 
-#include <Adaptor3d_SurfaceOfRevolution.hxx>
+#include <Adaptor3d_HCurve.hxx>
 #include <Adaptor3d_HSurface.hxx>
-
-#include <IntCurveSurface_IntersectionPoint.hxx>
 #include <Adaptor3d_Surface.hxx>
+#include <ElCLib.hxx>
+#include <Extrema_ExtCS.hxx>
+#include <Extrema_POnSurf.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Surface.hxx>
+#include <Geom_SurfaceOfRevolution.hxx>
+#include <Geom_TrimmedCurve.hxx>
 #include <GeomAdaptor.hxx>
-#include <GeomAdaptor_HSurface.hxx>
 #include <GeomAdaptor_HCurve.hxx>
-
-
-#include <GeomFill_FunctionGuide.ixx>
-#include <GeomFill_UniformSection.hxx>
+#include <GeomAdaptor_HSurface.hxx>
+#include <GeomFill_FunctionGuide.hxx>
+#include <GeomFill_LocationGuide.hxx>
+#include <GeomFill_LocationLaw.hxx>
+#include <GeomFill_SectionLaw.hxx>
 #include <GeomFill_SectionPlacement.hxx>
-#include <Geom_TrimmedCurve.hxx>
+#include <GeomFill_TrihedronWithGuide.hxx>
+#include <GeomFill_UniformSection.hxx>
 #include <GeomLib.hxx>
-#include <ElCLib.hxx>
-
+#include <gp.hxx>
+#include <gp_Ax1.hxx>
+#include <gp_Dir.hxx>
+#include <gp_GTrsf.hxx>
+#include <gp_Mat.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Trsf.hxx>
+#include <gp_Vec.hxx>
+#include <gp_XYZ.hxx>
+#include <IntCurveSurface_IntersectionPoint.hxx>
+#include <math_FunctionSetRoot.hxx>
+#include <math_Gauss.hxx>
+#include <math_Matrix.hxx>
+#include <math_Vector.hxx>
+#include <Precision.hxx>
+#include <Standard_ConstructionError.hxx>
+#include <Standard_NotImplemented.hxx>
+#include <Standard_OutOfRange.hxx>
+#include <Standard_Type.hxx>
+#include <TColgp_HArray1OfPnt.hxx>
 #include <TColStd_HArray1OfInteger.hxx>
 #include <TColStd_HArray1OfReal.hxx>
-#include <TColgp_HArray1OfPnt.hxx>
 
-#include <Extrema_ExtCS.hxx>
-#include <Extrema_POnSurf.hxx>
+IMPLEMENT_STANDARD_RTTIEXT(GeomFill_LocationGuide,GeomFill_LocationLaw)
 
 #if DRAW
 static Standard_Integer Affich = 0;
 #include <Approx_Curve3d.hxx>
 #include <DrawTrSurf.hxx>
+#include <GeomFill_TrihedronWithGuide.hxx>
 #endif
 
 //=======================================================================
 //function : TraceRevol
 //purpose  : Trace la surface de revolution (Debug)
 //=======================================================================
-#if DEB
+#ifdef OCCT_DEBUG
 static void TraceRevol(const Standard_Real t,
                        const Standard_Real s,
                       const Handle(GeomFill_TrihedronWithGuide)& Law,
@@ -79,11 +85,10 @@ static void TraceRevol(const Standard_Real t,
 {
   gp_Vec T, N, B;
   gp_Pnt P;
-  Standard_Boolean Ok;
   gp_Ax3 Rep(gp::Origin(), gp::DZ(), gp::DX());
 
   Curve->D0(t, P);
-  Ok = Law->D0(t, T, N, B);
+  Law->D0(t, T, N, B);
 
   gp_Mat M(N.XYZ(), B.XYZ(), T.XYZ());
   M *= Trans;
@@ -223,7 +228,7 @@ static void InGoodPeriod(const Standard_Real Prec,
   gp_Vec T,N,B;
   Standard_Integer ii, Deg;
   Standard_Boolean isconst, israt=Standard_False;
-  Standard_Real t, v,w, OldAngle=0, Angle, DeltaG, DeltaU, Diff;
+  Standard_Real t, v,w, OldAngle=0, Angle, DeltaG, Diff;
   Standard_Real CurAngle =  PrecAngle, a1/*, a2*/;
   gp_Pnt2d p1,p2;
   Handle(Geom_SurfaceOfRevolution) Revol; // surface de revolution
@@ -283,7 +288,6 @@ static void InGoodPeriod(const Standard_Real Prec,
   Sup(3) = Ul + Delta/10;
 
   // JALONNEMENT
-  DeltaU = (Ul-Uf)/(2+NbKnots);
   if (uperiodic) UPeriod = Ul-Uf;
 
   for (ii=1; ii<=myNbPts; ii++) {
@@ -345,40 +349,40 @@ static void InGoodPeriod(const Standard_Real Prec,
     Standard_Real theU = 0., theV = 0.;
     
     if (!DistMini.IsDone() || DistMini.NbExt() == 0) {
-#if DEB
+#ifdef OCCT_DEBUG
       cout <<"LocationGuide : Pas d'intersection"<<endl;
       TraceRevol(t, U, myLaw, mySec, myCurve, Trans);
 #endif 
       Standard_Boolean SOS=Standard_False;
       if (ii>1) {
-       // Intersection de secour entre surf revol et guide
-       // equation 
-       X(1) = myPoles2d->Value(1,ii-1).Y();
-       X(2) = myPoles2d->Value(2,ii-1).X();
-       X(3) = myPoles2d->Value(2,ii-1).Y();
-       GeomFill_FunctionGuide E (mySec, myGuide, U);
-       E.SetParam(U, P, T.XYZ(), N.XYZ()); 
-       // resolution   =>  angle
-       math_FunctionSetRoot Result(E, X, TolRes, 
-                                   Inf, Sup); 
-       
-       if (Result.IsDone() && 
-           (Result.FunctionSetErrors().Norm() < TolRes(1)*TolRes(1)) ) {
-#if DEB
-         cout << "Ratrappage Reussi !" << endl;
+        // Intersection de secour entre surf revol et guide
+        // equation 
+        X(1) = myPoles2d->Value(1,ii-1).Y();
+        X(2) = myPoles2d->Value(2,ii-1).X();
+        X(3) = myPoles2d->Value(2,ii-1).Y();
+        GeomFill_FunctionGuide E (mySec, myGuide, U);
+        E.SetParam(U, P, T.XYZ(), N.XYZ()); 
+        // resolution   =>  angle
+        math_FunctionSetRoot Result(E, TolRes);
+        Result.Perform(E, X, Inf, Sup);
+
+        if (Result.IsDone() && 
+          (Result.FunctionSetErrors().Norm() < TolRes(1)*TolRes(1)) ) {
+#ifdef OCCT_DEBUG
+            cout << "Ratrappage Reussi !" << endl;
 #endif
-         SOS = Standard_True;
-         math_Vector RR(1,3);
-         Result.Root(RR);
-         PInt.SetValues(P, RR(2), RR(3), RR(1), IntCurveSurface_Out);
-          theU = PInt.U();
-          theV = PInt.V();
-       }  
-       else {
-#if DEB
-         cout << "Echec du Ratrappage !" << endl;
+            SOS = Standard_True;
+            math_Vector RR(1,3);
+            Result.Root(RR);
+            PInt.SetValues(P, RR(2), RR(3), RR(1), IntCurveSurface_Out);
+            theU = PInt.U();
+            theV = PInt.V();
+        }
+        else {
+#ifdef OCCT_DEBUG
+          cout << "Echec du Ratrappage !" << endl;
 #endif
-       }
+        }
       }
       if (!SOS) {
        myStatus = GeomFill_ImpossibleContact;
@@ -421,7 +425,7 @@ static void InGoodPeriod(const Standard_Real Prec,
        }
       }
       
-#if DEB                
+#ifdef OCCT_DEBUG
       if (Abs(Diff) > DeltaG) {
        cout << "Location :: Diff on Guide : " << 
          Diff << endl;
@@ -437,7 +441,7 @@ static void InGoodPeriod(const Standard_Real Prec,
          InGoodPeriod (OldAngle, 2*M_PI, Angle);
          Diff = Angle - OldAngle;
        }
-#if DEB
+#ifdef OCCT_DEBUG
       if (Abs(Diff) > M_PI/4) {
        cout << "Diff d'angle trop grand !!" << endl;
       } 
@@ -453,8 +457,8 @@ static void InGoodPeriod(const Standard_Real Prec,
        InGoodPeriod (myPoles2d->Value(2, ii-1).Y(), UPeriod, v);
       }
       Diff = v -  myPoles2d->Value(2, ii-1).Y();
-#if DEB
-      if (Abs(Diff) > DeltaU) {
+#ifdef OCCT_DEBUG
+      if (Abs(Diff) > (Ul-Uf)/(2+NbKnots)) {
        cout << "Diff sur section trop grand !!" << endl;
       } 
 #endif
@@ -616,8 +620,8 @@ static void InGoodPeriod(const Standard_Real Prec,
     GeomFill_FunctionGuide E (mySec, myGuide, U);
     E.SetParam(Param, P, t, n); 
     // resolution   =>  angle
-    math_FunctionSetRoot Result(E, X, TolRes, 
-                               Inf, Sup, Iter); 
+    math_FunctionSetRoot Result(E, TolRes, Iter);
+    Result.Perform(E, X, Inf, Sup);
 
     if (Result.IsDone()) {
       // solution
@@ -632,7 +636,7 @@ static void InGoodPeriod(const Standard_Real Prec,
       M.SetCols(n, b, t);
     }
     else {
-#if DEB
+#ifdef OCCT_DEBUG
       cout << "LocationGuide::D0 : No Result !"<<endl;
       TraceRevol(Param, U, myLaw, mySec, myCurve, Trans);
 #endif
@@ -684,11 +688,11 @@ static void InGoodPeriod(const Standard_Real Prec,
     GeomFill_FunctionGuide E (mySec, myGuide, myFirstS + 
                                (Param-myCurve->FirstParameter())*ratio);
     E.SetParam(Param, P, t, n);
-      
+
     // resolution
-    math_FunctionSetRoot Result(E, X, TolRes, 
-                               Inf, Sup, Iter); 
-    
+    math_FunctionSetRoot Result(E, TolRes, Iter);
+    Result.Perform(E, X, Inf, Sup);
+
     if (Result.IsDone()) {
       // solution 
       Result.Root(R);   
@@ -704,7 +708,7 @@ static void InGoodPeriod(const Standard_Real Prec,
       M.SetCols(n, b, t);
     }
     else {
-#if DEB
+#ifdef OCCT_DEBUG
       Standard_Real U = myFirstS + ratio*(Param-myCurve->FirstParameter());
       cout << "LocationGuide::D0 : No Result !"<<endl;
       TraceRevol(Param, U, myLaw, mySec, myCurve, Trans);
@@ -756,7 +760,7 @@ static void InGoodPeriod(const Standard_Real Prec,
   if (rotation) {  
     return Standard_False;
  /*   
-#ifdef DEB
+#ifdef OCCT_DEBUG
     Standard_Real U = myFirstS + ratio*(Param-myCurve->FirstParameter());
 #else
     myCurve->FirstParameter() ;
@@ -803,7 +807,7 @@ static void InGoodPeriod(const Standard_Real Prec,
              Ga.Solve (DEDT.Opposite(), DSDT);// resolution du syst. 
            }//if
          else {
-#if DEB
+#ifdef OCCT_DEBUG
            cout << "DEDX = " << DEDX << endl;
            cout << "DEDT = " << DEDT << endl;
 #endif
@@ -834,7 +838,7 @@ static void InGoodPeriod(const Standard_Real Prec,
          Standard_Real A = R(2);
          Standard_Real Aprim = DSDT(2);  
 
-#ifdef DEB       
+#ifdef OCCT_DEBUG        
          gp_Mat M2 (Cos(A), -Sin(A),0,  // rotation autour de T
                     Sin(A), Cos(A),0,
                     0,0,1);      
@@ -867,7 +871,7 @@ static void InGoodPeriod(const Standard_Real Prec,
        }//if_Result
 
       else {
-#if DEB
+#ifdef OCCT_DEBUG
        cout << "LocationGuide::D1 : No Result !!"<<endl;
        TraceRevol(Param, U, myLaw, mySec, myCurve, Trans);
 #endif
@@ -1118,7 +1122,7 @@ Standard_Boolean GeomFill_LocationGuide::D2(const Standard_Real Param,
 
        }//if_result
       else {
-#if DEB
+#ifdef OCCT_DEBUG
        cout << "LocationGuide::D2 : No Result !!" <<endl;
        TraceRevol(Param, U, myLaw, mySec, myCurve, Trans);
 #endif