0024763: Convertation of the generic classes to the non-generic. Part 6
authordln <dln@opencascade.com>
Tue, 25 Mar 2014 07:55:53 +0000 (11:55 +0400)
committerapn <apn@opencascade.com>
Fri, 4 Apr 2014 08:57:37 +0000 (12:57 +0400)
Next generic classes:

 "Contap_ArcFunction",
 "Contap_ContourGen",
 "Contap_HContToolGen",
 "Contap_HCurve2dToolGen",
 "Contap_Line",
 "Contap_Point",
 "Contap_SurfFunction",
 "Contap_SurfProps"

from "Contap" package were converted to the non-generic classes. Names of several classes were changed:

 "Contap_Contour",
 "Contap_HContTool",
 "Contap_HCurve2dTool",
 "Contap_Line",
 "Contap_Point"

 Also all instantiations of the "internal" classes of this classes were moved to the "Contap.cdl". And sources of the "Contap_ContourGen" class were merged to one .cxx file.

30 files changed:
src/Contap/Contap.cdl
src/Contap/Contap_ArcFunction.cdl
src/Contap/Contap_ArcFunction.cxx [moved from src/Contap/Contap_ArcFunction.gxx with 63% similarity]
src/Contap/Contap_ArcFunction.lxx
src/Contap/Contap_Contour.cdl [moved from src/Contap/Contap_ContourGen.cdl with 53% similarity]
src/Contap/Contap_Contour.cxx [new file with mode: 0644]
src/Contap/Contap_Contour.lxx [moved from src/Contap/Contap_ContourGen.lxx with 75% similarity]
src/Contap/Contap_ContourGen.gxx [deleted file]
src/Contap/Contap_ContourGen_1.gxx [deleted file]
src/Contap/Contap_ContourGen_2.gxx [deleted file]
src/Contap/Contap_ContourGen_3.gxx [deleted file]
src/Contap/Contap_HContTool.cdl [moved from src/Contap/Contap_HContToolGen.cdl with 78% similarity]
src/Contap/Contap_HContTool.cxx [moved from src/Contap/Contap_HContToolGen.gxx with 68% similarity]
src/Contap/Contap_HCurve2dTool.cdl [moved from src/Contap/Contap_HCurve2dToolGen.cdl with 67% similarity]
src/Contap/Contap_HCurve2dTool.cxx [moved from src/Contap/Contap_HCurve2dToolGen.gxx with 55% similarity]
src/Contap/Contap_HCurve2dTool.lxx [moved from src/Contap/Contap_HCurve2dToolGen.lxx with 64% similarity]
src/Contap/Contap_Line.cdl
src/Contap/Contap_Line.cxx [moved from src/Contap/Contap_Line.gxx with 81% similarity]
src/Contap/Contap_Line.lxx
src/Contap/Contap_Point.cdl
src/Contap/Contap_Point.cxx [moved from src/Contap/Contap_Point.gxx with 70% similarity]
src/Contap/Contap_Point.lxx
src/Contap/Contap_SurfFunction.cdl
src/Contap/Contap_SurfFunction.cxx [moved from src/Contap/Contap_SurfFunction.gxx with 55% similarity]
src/Contap/Contap_SurfFunction.lxx
src/Contap/Contap_SurfProps.cdl
src/Contap/Contap_SurfProps.cxx [moved from src/Contap/Contap_SurfProps.gxx with 52% similarity]
src/Contap/FILES [deleted file]
src/HLRTopoBRep/HLRTopoBRep_DSFiller.cdl
src/HLRTopoBRep/HLRTopoBRep_DSFiller.cxx

index f56cbe7..3c4eeeb 100644 (file)
 
 package Contap
 
-       ---Purpose: 
+    ---Purpose: 
 
 uses Standard,StdFail,MMgt, GeomAbs, TopAbs, TCollection, gp, TColgp,
      math, IntSurf, IntStart, IntWalk,
      Geom2d, TColStd, Geom, Adaptor3d,  Adaptor2d
 
+
 is
-    
-    generic class Point;
 
-    generic class Line;
 
-    generic class SurfFunction;
-    
-    generic class ArcFunction;
-    
-    generic class SurfProps;
+    class Point;
+
+    class Line;
+
+    class SurfFunction;
+
+    class ArcFunction;
+
+    class SurfProps;
+
+    class Contour;
 
-    generic class ContourGen, ThePoint,TheSequenceOfPoint,TheHSequenceOfPoint,
-                              TheLine, TheSequenceOfLine,
-                             TheSurfProps, TheSurfFunction, TheArcFunction,
-                              TheSearch, TheIWalking, TheSearchInside;
-                             ---TheLineConstructor;
+    class TheSequenceOfPoint instantiates Sequence from TCollection (Point from Contap);
 
-    class ContAna;                
+    class TheHSequenceOfPoint instantiates HSequence from TCollection
+        (Point              from Contap,
+         TheSequenceOfPoint from Contap);
+
+    class TheSequenceOfLine instantiates Sequence from TCollection(Line from Contap);
+
+    class TheSearch instantiates SearchOnBoundaries from IntStart
+        (HVertex      from Adaptor3d,
+         HCurve2d     from Adaptor2d,
+         HCurve2dTool from Contap,
+         HContTool    from Contap,
+         TopolTool    from Adaptor3d,
+         ArcFunction  from Contap);
+
+    class TheIWalking instantiates IWalking from IntWalk
+        (PathPoint               from IntSurf,
+         PathPointTool           from IntSurf,
+         SequenceOfPathPoint     from IntSurf,
+         InteriorPoint           from IntSurf,
+         InteriorPointTool       from IntSurf,
+         SequenceOfInteriorPoint from IntSurf,
+         HSurface                from Adaptor3d,
+         HSurfaceTool            from Adaptor3d,
+         SurfFunction            from Contap);
+
+    class TheSearchInside instantiates SearchInside from IntStart
+        (HSurface     from Adaptor3d,
+         HSurfaceTool from Adaptor3d,
+         TopolTool    from Adaptor3d,
+         HContTool    from Contap,
+         SurfFunction from Contap);
+
+         
+    class ContAna;
 
     enumeration TFunction is
-       ContourStd,
-       ContourPrs,
-       DraftStd,
-       DraftPrs
-    end TFunction;     
+        ContourStd,
+        ContourPrs,
+        DraftStd,
+        DraftPrs
+    end TFunction;
 
     enumeration IType is  -- a replacer dans IntSurf et fusionner avec IntPatch
     -- type of the line of contour
-
-       Lin,       -- pour conflit avec deferred class Line
-       Circle,
+        Lin,       -- pour conflit avec deferred class Line
+        Circle,
         Walking,
-       Restriction
+        Restriction
     end IType;
-       
-    generic class HContToolGen;
-    
-    generic class HCurve2dToolGen;
-    
-    class HCurve2dTool instantiates 
-       HCurve2dToolGen from Contap ( 
-           HCurve2d from Adaptor2d);
-
-    class HContTool instantiates 
-        HContToolGen from Contap (
-        HVertex       from Adaptor3d,
-        HCurve2d      from Adaptor2d,
-        HSurface      from Adaptor3d,
-        HCurve2dTool  from Contap,
-        HSurfaceTool  from Adaptor3d);
-        
-    class Contour instantiates ContourGen from Contap
-       (HVertex       from Adaptor3d,
-        HCurve2d      from Adaptor2d,
-        HSurface      from Adaptor3d,
-        HCurve2dTool  from Contap,
-        HSurfaceTool  from Adaptor3d,
-        HContTool     from Contap,
-        TopolTool     from Adaptor3d);
 
+    class HContTool;
+    
+    class HCurve2dTool;
 
 end Contap;
index 5c01443..9ebe7a2 100644 (file)
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-generic class ArcFunction from Contap 
-    (TheArc          as any;
-     TheSurface      as any;
-     TheArcTool      as any;
-     TheSurfaceTool  as any;
-     TheSurfProps    as any; -- as SurfProps from Contap(TheSurface,
-                             --                          TheSurfaceTool)
-     TheContTool     as any) -- as ContTool from Contap()
-
-
-inherits FunctionWithDerivative from math
+class ArcFunction from Contap inherits FunctionWithDerivative from math
 
 uses Pnt           from gp,
      Dir           from gp,
      SequenceOfPnt from TColgp,
      TFunction     from Contap, 
     --modified by NIZNHY-PKV Thu Mar 29 16:52:28 2001  f
-     Quadric       from IntSurf 
-    --modified by NIZNHY-PKV Thu Mar 29 16:52:31 2001  t
+     Quadric       from IntSurf,
+    --modified by NIZNHY-PKV Thu Mar 29 16:52:31 2001
+     HCurve2d      from Adaptor2d,
+     HSurface      from Adaptor3d,
+     HCurve2dTool  from Contap,
+     HSurfaceTool  from Adaptor3d,
+     SurfProps     from Contap,
+     HContTool     from Contap
 
 
 is
@@ -42,7 +38,7 @@ is
        returns ArcFunction from Contap;
 
 
-    Set(me: in out; S: TheSurface)
+    Set(me: in out; S: HSurface from Adaptor3d)
     
        is static;
 
@@ -70,7 +66,7 @@ is
        is static;
 
 
-    Set(me: in out; A: TheArc)
+    Set(me: in out; A: HCurve2d from Adaptor2d)
     
        ---C++: inline
        is static;
@@ -121,8 +117,8 @@ is
 
 fields
 
-    myArc    : TheArc;
-    mySurf   : TheSurface;
+    myArc    : HCurve2d from Adaptor2d;
+    mySurf   : HSurface from Adaptor3d;
     myMean   : Real          from Standard;
     myType   : TFunction     from Contap;
     myDir    : Dir           from gp;
similarity index 63%
rename from src/Contap/Contap_ArcFunction.gxx
rename to src/Contap/Contap_ArcFunction.cxx
index c444fb0..a798ac8 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <gp_Pnt2d.hxx>
-#include <gp_Vec2d.hxx>
+#include <Contap_ArcFunction.ixx>
+
+#include <Contap_HContTool.hxx>
+#include <Contap_SurfProps.hxx>
+#include <Contap_HCurve2dTool.hxx>
 
 Contap_ArcFunction::Contap_ArcFunction ():
-       myMean(1.),
-       myType(Contap_ContourStd),
-       myDir(0.,0.,1.)
+myMean(1.),
+myType(Contap_ContourStd),
+myDir(0.,0.,1.)
 {}
 
 
-void Contap_ArcFunction::Set(const TheSurface& S)
+void Contap_ArcFunction::Set(const Handle(Adaptor3d_HSurface)& S)
 {
   mySurf = S;
   Standard_Integer i;
-  Standard_Integer nbs = TheContTool::NbSamplePoints(S);
+  Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S);
   Standard_Real U,V;
-//  gp_Vec d1u,d1v;
+  //  gp_Vec d1u,d1v;
   gp_Vec norm;
   if (nbs > 0) {
     myMean = 0.;
     for (i = 1; i <= nbs; i++) {
-      TheContTool::SamplePoint(S,i,U,V);
-//      TheSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
-//      myMean = myMean + d1u.Crossed(d1v).Magnitude();
-      TheSurfProps::Normale(S,U,V,solpt,norm);
+      Contap_HContTool::SamplePoint(S,i,U,V);
+      //      Adaptor3d_HSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
+      //      myMean = myMean + d1u.Crossed(d1v).Magnitude();
+      Contap_SurfProps::Normale(S,U,V,solpt,norm);
       myMean = myMean + norm.Magnitude();
     }
     myMean = myMean / ((Standard_Real)nbs);
@@ -47,14 +50,14 @@ void Contap_ArcFunction::Set(const TheSurface& S)
 
 
 Standard_Boolean Contap_ArcFunction::Value (const Standard_Real U,
-                                           Standard_Real& F)
+                                            Standard_Real& F)
 {
   //gp_Vec d1u,d1v;
-  gp_Pnt2d pt2d(TheArcTool::Value(myArc,U));
-//  TheSurfaceTool::D1(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v);
-//  gp_Vec norm(d1u.Crossed(d1v));
+  gp_Pnt2d pt2d(Contap_HCurve2dTool::Value(myArc,U));
+  //  Adaptor3d_HSurfaceTool::D1(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v);
+  //  gp_Vec norm(d1u.Crossed(d1v));
   gp_Vec norm;
-  TheSurfProps::Normale(mySurf,pt2d.X(),pt2d.Y(),solpt,norm);
+  Contap_SurfProps::Normale(mySurf,pt2d.X(),pt2d.Y(),solpt,norm);
 
   switch (myType) {
   case Contap_ContourStd:
@@ -82,22 +85,22 @@ Standard_Boolean Contap_ArcFunction::Value (const Standard_Real U,
 
 
 Standard_Boolean Contap_ArcFunction::Derivative (const Standard_Real U,
-                                                Standard_Real& D)
+                                                 Standard_Real& D)
 {
   gp_Pnt2d pt2d;
   gp_Vec2d d2d;
   Standard_Real dfu =0.,dfv =0.;
-//  gp_Vec d1u,d1v,d2u,d2v,d2uv;
-  TheArcTool::D1(myArc,U,pt2d,d2d);
-//  TheSurfaceTool::D2(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v,d2u,d2v,d2uv);
+  //  gp_Vec d1u,d1v,d2u,d2v,d2uv;
+  Contap_HCurve2dTool::D1(myArc,U,pt2d,d2d);
+  //  Adaptor3d_HSurfaceTool::D2(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v,d2u,d2v,d2uv);
   gp_Vec norm,dnu,dnv;
-  TheSurfProps::NormAndDn(mySurf,pt2d.X(),pt2d.Y(),solpt,norm,dnu,dnv);
+  Contap_SurfProps::NormAndDn(mySurf,pt2d.X(),pt2d.Y(),solpt,norm,dnu,dnv);
 
   switch (myType) {
   case Contap_ContourStd:
     {
-//      dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
-//      dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
+      //      dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
+      //      dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
       dfu = (dnu.Dot(myDir))/myMean;
       dfv = (dnv.Dot(myDir))/myMean;
     }
@@ -105,21 +108,21 @@ Standard_Boolean Contap_ArcFunction::Derivative (const Standard_Real U,
   case Contap_ContourPrs:
     {
       gp_Vec Ep(myEye,solpt);
-//      dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
-//      dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
+      //      dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
+      //      dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
       dfu = (dnu.Dot(Ep))/myMean;
       dfv = (dnv.Dot(Ep))/myMean;
     }
     break;
   case Contap_DraftStd:
     {
-/*
+      /*
       gp_Vec norm(d1u.Crossed(d1v).Normalized());
       gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
       dfu = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
       dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
       dfv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
-*/
+      */
       norm.Normalized();
       dfu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
       dfv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
@@ -135,25 +138,25 @@ Standard_Boolean Contap_ArcFunction::Derivative (const Standard_Real U,
 }
 
 Standard_Boolean Contap_ArcFunction::Values (const Standard_Real U,
-                                            Standard_Real& F,
-                                            Standard_Real& D)
+                                             Standard_Real& F,
+                                             Standard_Real& D)
 {
   gp_Pnt2d pt2d;
   gp_Vec2d d2d;
   Standard_Real dfu =0.,dfv =0.;
-// gp_Vec d1u,d1v,d2u,d2v,d2uv;
-  TheArcTool::D1(myArc,U,pt2d,d2d);
-//  TheSurfaceTool::D2(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v,d2u,d2v,d2uv);
-//  gp_Vec norm(d1u.Crossed(d1v));
+  // gp_Vec d1u,d1v,d2u,d2v,d2uv;
+  Contap_HCurve2dTool::D1(myArc,U,pt2d,d2d);
+  //  Adaptor3d_HSurfaceTool::D2(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v,d2u,d2v,d2uv);
+  //  gp_Vec norm(d1u.Crossed(d1v));
   gp_Vec norm,dnu,dnv;
-  TheSurfProps::NormAndDn(mySurf,pt2d.X(),pt2d.Y(),solpt,norm,dnu,dnv);
+  Contap_SurfProps::NormAndDn(mySurf,pt2d.X(),pt2d.Y(),solpt,norm,dnu,dnv);
 
   switch (myType) {
   case Contap_ContourStd:
     {
       F   = (norm.Dot(myDir))/myMean;
-//      dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
-//      dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
+      //      dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
+      //      dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
       dfu = (dnu.Dot(myDir))/myMean;
       dfv = (dnv.Dot(myDir))/myMean;
     }
@@ -162,8 +165,8 @@ Standard_Boolean Contap_ArcFunction::Values (const Standard_Real U,
     {
       gp_Vec Ep(myEye,solpt);
       F   = (norm.Dot(Ep))/myMean;
-//      dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
-//      dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
+      //      dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
+      //      dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
       dfu = (dnu.Dot(Ep))/myMean;
       dfv = (dnv.Dot(Ep))/myMean;
     }
@@ -172,12 +175,12 @@ Standard_Boolean Contap_ArcFunction::Values (const Standard_Real U,
     {
       F = (norm.Dot(myDir)-myCosAng*norm.Magnitude())/myMean;
       norm.Normalize();
-/*
+      /*
       gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
       dfu = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
       dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
       dfv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
-*/
+      */
       dfu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
       dfv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
     }
@@ -200,9 +203,9 @@ Standard_Integer Contap_ArcFunction::GetStateNumber ()
 
 Standard_Integer Contap_ArcFunction::NbSamples () const
 {
-  return Max(Max(TheContTool::NbSamplesU(mySurf,0.,0.),
-                TheContTool::NbSamplesV(mySurf,0.,0.)),
-            TheContTool::NbSamplesOnArc(myArc));
+  return Max(Max(Contap_HContTool::NbSamplesU(mySurf,0.,0.),
+    Contap_HContTool::NbSamplesV(mySurf,0.,0.)),
+    Contap_HContTool::NbSamplesOnArc(myArc));
 }
 
 //modified by NIZNHY-PKV Thu Mar 29 16:53:07 2001f
@@ -210,7 +213,7 @@ Standard_Integer Contap_ArcFunction::NbSamples () const
 //function : Quadric
 //purpose  : returns empty Quadric
 //=======================================================================
-  const IntSurf_Quadric& Contap_ArcFunction::Quadric() const 
+const IntSurf_Quadric& Contap_ArcFunction::Quadric() const 
 { 
   return(myQuad);
 }
index b3b38ea..7a9057d 100644 (file)
@@ -42,7 +42,7 @@ inline void Contap_ArcFunction::Set(const gp_Pnt& Eye)
   myEye  = Eye;
 }
 
-inline void Contap_ArcFunction::Set(const TheArc& A)
+inline void Contap_ArcFunction::Set(const Handle(Adaptor2d_HCurve2d)& A)
 {
   myArc = A;
   seqpt.Clear();
similarity index 53%
rename from src/Contap/Contap_ContourGen.cdl
rename to src/Contap/Contap_Contour.cdl
index 4603012..919632b 100644 (file)
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-generic class ContourGen from Contap
-    (TheVertex      as any;
-     TheArc         as any;
-     TheSurface     as any;
-     TheArcTool     as any;
-     TheSurfaceTool as any;
-     TheContTool    as any;  -- as ContTool    from Contap(TheVertex,TheArc,
-                             --                            TheSurface)
-     TheTopolTool   as Transient)
-
+class Contour from Contap
 
 uses PathPoint               from IntSurf,
      PathPointTool           from IntSurf,
@@ -32,130 +23,70 @@ uses PathPoint               from IntSurf,
      InteriorPointTool       from IntSurf,
      SequenceOfInteriorPoint from IntSurf,
      Pnt                     from gp,
-     Vec                     from gp
-     
+     Vec                     from gp,
+     Point                   from Contap,
+     Line                    from Contap,
+     SurfFunction            from Contap,
+     ArcFunction             from Contap,
+     TheSequenceOfLine       from Contap,
+     TheSearch               from Contap,
+     TheSearchInside         from Contap,
+     HSurface                from Adaptor3d,
+     TopolTool               from Adaptor3d
+
 
 raises NotDone           from StdFail,
        OutOfRange        from Standard,
        ConstructionError from Standard
 
-    class ThePoint instantiates Point from Contap
-       (TheVertex,
-        TheArc);
-    
-    class TheSequenceOfPoint instantiates Sequence from TCollection
-       (ThePoint); 
-       
-    class TheHSequenceOfPoint instantiates HSequence from TCollection
-       (ThePoint,TheSequenceOfPoint);
-
-
-    class TheLine instantiates Line from Contap
-       (TheVertex,
-        TheArc,
-        ThePoint,
-        TheHSequenceOfPoint);
-        
-
-    class TheSequenceOfLine instantiates Sequence from TCollection
-       (TheLine);
-
-
-    class TheSurfProps instantiates SurfProps from Contap
-       (TheSurface,
-        TheSurfaceTool);
-
-
-    class TheSurfFunction instantiates SurfFunction from Contap
-       (TheSurface,
-        TheSurfaceTool,
-        TheSurfProps from Contap,
-         TheContTool);
-
-    class TheArcFunction instantiates ArcFunction from Contap
-       (TheArc,
-        TheSurface,
-        TheArcTool,
-        TheSurfaceTool,
-        TheSurfProps from Contap,
-         TheContTool);
-
-
-    class TheSearch instantiates SearchOnBoundaries from IntStart
-       (TheVertex,
-        TheArc,
-        TheArcTool,
-         TheContTool,
-         TheTopolTool,
-        TheArcFunction from Contap);
-
-
-    class TheIWalking instantiates IWalking from IntWalk
-       (PathPoint               from IntSurf,
-         PathPointTool           from IntSurf,
-        SequenceOfPathPoint     from IntSurf,
-         InteriorPoint           from IntSurf,
-        InteriorPointTool       from IntSurf,
-         SequenceOfInteriorPoint from IntSurf,
-        TheSurface,
-         TheSurfaceTool,
-        TheSurfFunction         from Contap);
-
-
-    class TheSearchInside instantiates SearchInside from IntStart
-        (TheSurface,
-         TheSurfaceTool,
-        TheTopolTool,
-        TheContTool,
-         TheSurfFunction from Contap);
 
 is
 
     Create
     
-       returns ContourGen from Contap;
+       returns Contour from Contap;
 
 
     Create(Direction: Vec from gp)
     
-       returns ContourGen from Contap;
+       returns Contour from Contap;
 
 
     Create(Direction: Vec from gp; Angle: Real from Standard)
     
-       returns ContourGen from Contap;
+       returns Contour from Contap;
 
 
     Create(Eye: Pnt from gp)
     
-       returns ContourGen from Contap;
+       returns Contour from Contap;
 
 
-    Create(Surf: TheSurface; Domain: TheTopolTool; 
+    Create(Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d; 
            Direction: Vec from gp)
 
        ---Purpose: Creates the contour in a given direction.
 
-       returns ContourGen from Contap;
+       returns Contour from Contap;
 
 
-    Create(Surf: TheSurface; Domain: TheTopolTool; 
+    Create(Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d; 
            Direction: Vec from gp; Angle: Real from Standard)
 
        ---Purpose: Creates the contour in a given direction.
 
-       returns ContourGen from Contap;
+       returns Contour from Contap;
 
 
-    Create(Surf: TheSurface; Domain: TheTopolTool; 
+    Create(Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d; 
            Eye: Pnt from gp)
 
        ---Purpose: Creates the contour for a perspective view.
 
-       returns ContourGen from Contap;
+       returns Contour from Contap;
 
 
-    Perform(me: in out; Surf: TheSurface; Domain: TheTopolTool)
+    Perform(me: in out; Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d)
 
        ---Purpose: Creates the contour in a given direction.
 
@@ -163,7 +94,7 @@ is
        is static;
 
 
-    Perform(me: in out; Surf: TheSurface; Domain: TheTopolTool; 
+    Perform(me: in out; Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d; 
                         Direction: Vec from gp)
 
        ---Purpose: Creates the contour in a given direction.
@@ -171,7 +102,7 @@ is
        is static;
 
 
-    Perform(me: in out; Surf: TheSurface; Domain: TheTopolTool; 
+    Perform(me: in out; Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d; 
                         Direction: Vec from gp; Angle: Real from Standard)
 
        ---Purpose: Creates the contour in a given direction.
@@ -179,7 +110,7 @@ is
        is static;
 
 
-    Perform(me: in out; Surf: TheSurface; Domain: TheTopolTool; 
+    Perform(me: in out; Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d; 
                         Eye: Pnt from gp)
 
        ---Purpose: Creates the contour for a perspective view.
@@ -234,7 +165,7 @@ is
        
     Line(me; Index: Integer from Standard)
     
-       returns TheLine from Contap
+       returns Line from Contap
        ---C++: return const& 
        ---C++: inline
 
@@ -245,7 +176,7 @@ is
 
 
     SurfaceFunction(me : in out)
-    returns TheSurfFunction
+    returns SurfFunction
        ---Purpose: Returns    a     reference   on     the   internal
        --          SurfaceFunction.  This is used to compute tangents
        --          on the lines.
@@ -254,12 +185,12 @@ is
     is static;
 
 
-    Perform(me: in out; Domain: TheTopolTool)
+    Perform(me: in out; Domain: TopolTool from Adaptor3d)
                           
        is static private;
 
 
-    PerformAna(me: in out; Domain: TheTopolTool)
+    PerformAna(me: in out; Domain: TopolTool from Adaptor3d)
                           
        is static private;
 
@@ -270,8 +201,8 @@ fields
     slin     : TheSequenceOfLine from Contap;
     solrst   : TheSearch         from Contap;
     solins   : TheSearchInside   from Contap;
-    mySFunc  : TheSurfFunction   from Contap;
-    myAFunc  : TheArcFunction    from Contap;
+    mySFunc  : SurfFunction      from Contap;
+    myAFunc  : ArcFunction       from Contap;
     modeset  : Boolean           from Standard;
 
-end ContourGen;
+end Contour;
diff --git a/src/Contap/Contap_Contour.cxx b/src/Contap/Contap_Contour.cxx
new file mode 100644 (file)
index 0000000..74f2124
--- /dev/null
@@ -0,0 +1,2146 @@
+// Created on: 1993-02-05
+// Created by: Jacques GOUSSARD
+// Copyright (c) 1993-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Contap_Contour.ixx>
+
+#include <ElCLib.hxx>
+#include <ElSLib.hxx>
+
+#include <math_FunctionSetRoot.hxx>
+
+#include <IntSurf.hxx>
+#include <IntSurf_InteriorPoint.hxx>
+#include <IntSurf_SequenceOfPathPoint.hxx>
+
+#include <TopTrans_CurveTransition.hxx>
+
+#include <TColStd_Array1OfInteger.hxx>
+
+#include <BndLib_AddSurface.hxx>
+#include <Bnd_Box.hxx>
+
+#include <Adaptor3d_HSurfaceTool.hxx>
+
+#include <Contap_ContAna.hxx>
+#include <Contap_HContTool.hxx>
+#include <Contap_HCurve2dTool.hxx>
+#include <Contap_SurfProps.hxx>
+#include <Contap_TheIWalking.hxx>
+#include <Contap_TheSegmentOfTheSearch.hxx>
+#include <Contap_ThePathPointOfTheSearch.hxx>
+
+#define Tolpetit 1.e-10  // pour dist au carre
+
+#define tole 5.e-6
+
+Contap_Contour::Contap_Contour () : 
+done(Standard_False),modeset(Standard_False)
+{}
+
+Contap_Contour::Contap_Contour (const gp_Vec& Direction) :
+
+done(Standard_False),modeset(Standard_True)
+{
+  mySFunc.Set(Direction);
+  myAFunc.Set(Direction);
+}
+
+
+Contap_Contour::Contap_Contour (const gp_Vec& Direction,
+                                const Standard_Real Angle) :
+
+done(Standard_False),modeset(Standard_True)
+{
+  mySFunc.Set(Direction,Angle);
+  myAFunc.Set(Direction,Angle);
+}
+
+Contap_Contour::Contap_Contour (const gp_Pnt& Eye) :
+
+done(Standard_False),modeset(Standard_True)
+{
+  mySFunc.Set(Eye);
+  myAFunc.Set(Eye);
+}
+
+
+Contap_Contour::Contap_Contour (const Handle(Adaptor3d_HSurface)& Surf,
+                                const Handle(Adaptor3d_TopolTool)& Domain,
+                                const gp_Vec& Direction) :
+
+done(Standard_False),modeset(Standard_True)
+{
+  Perform(Surf,Domain,Direction);
+}
+
+
+Contap_Contour::Contap_Contour (const Handle(Adaptor3d_HSurface)& Surf,
+                                const Handle(Adaptor3d_TopolTool)& Domain,
+                                const gp_Vec& Direction,
+                                const Standard_Real Angle) :
+
+done(Standard_False),modeset(Standard_True)
+{
+  Perform(Surf,Domain,Direction,Angle);
+}
+
+
+Contap_Contour::Contap_Contour (const Handle(Adaptor3d_HSurface)& Surf,
+                                const Handle(Adaptor3d_TopolTool)& Domain,
+                                const gp_Pnt& Eye) :
+
+done(Standard_False),modeset(Standard_True)
+{
+  Perform(Surf,Domain,Eye);
+}
+
+
+void Contap_Contour::Init (const gp_Vec& Direction)
+
+{
+  done = Standard_False;
+  modeset = Standard_True;
+  mySFunc.Set(Direction);
+  myAFunc.Set(Direction);
+}
+
+
+void Contap_Contour::Init(const gp_Vec& Direction,
+                          const Standard_Real Angle)
+{
+  done = Standard_False;
+  modeset = Standard_True;
+  mySFunc.Set(Direction,Angle);
+  myAFunc.Set(Direction,Angle);
+}
+
+void Contap_Contour::Init (const gp_Pnt& Eye)
+{
+  done = Standard_False;
+  modeset = Standard_True;
+  mySFunc.Set(Eye);
+  myAFunc.Set(Eye);
+}
+
+
+void Contap_Contour::Perform (const Handle(Adaptor3d_HSurface)& Surf,
+                              const Handle(Adaptor3d_TopolTool)& Domain)
+{
+  if (!modeset) {Standard_ConstructionError::Raise();}
+  mySFunc.Set(Surf);
+  myAFunc.Set(Surf);
+
+  GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(Surf);
+  switch (typS) {
+  case GeomAbs_Plane:
+  case GeomAbs_Sphere:
+  case GeomAbs_Cylinder:
+  case GeomAbs_Cone:
+    {
+      PerformAna(Domain); //Surf,Domain,Direction,0.,gp_Pnt(0.,0.,0.),1);
+    }
+    break;
+
+  default:
+    {
+      Perform(Domain); //Surf,Domain,Direction,0.,gp_Pnt(0.,0.,0.),1);
+    }
+    break;
+  }
+
+}
+
+
+void Contap_Contour::Perform (const Handle(Adaptor3d_HSurface)& Surf,
+                              const Handle(Adaptor3d_TopolTool)& Domain,
+                              const gp_Vec& Direction)
+
+{
+  Init(Direction);
+  Perform(Surf,Domain);
+}
+
+void Contap_Contour::Perform (const Handle(Adaptor3d_HSurface)& Surf,
+                              const Handle(Adaptor3d_TopolTool)& Domain,
+                              const gp_Vec& Direction,
+                              const Standard_Real Angle)
+
+{
+  Init(Direction,Angle);
+  Perform(Surf,Domain);
+}
+
+
+void Contap_Contour::Perform (const Handle(Adaptor3d_HSurface)& Surf,
+                              const Handle(Adaptor3d_TopolTool)& Domain,
+                              const gp_Pnt& Eye)
+
+{
+  Init(Eye);
+  Perform(Surf,Domain);
+}
+
+static  IntSurf_TypeTrans ComputeTransitionOnLine
+(Contap_SurfFunction&,
+ const Standard_Real,
+ const Standard_Real,
+ const gp_Vec&);
+
+
+static IntSurf_TypeTrans ComputeTransitionOngpCircle
+(Contap_SurfFunction&,
+ const gp_Circ&);
+
+
+static IntSurf_TypeTrans ComputeTransitionOngpLine
+(Contap_SurfFunction&,
+ const gp_Lin&);
+
+
+static void ComputeInternalPoints
+(Contap_Line& Line,
+ Contap_SurfFunction&,
+ const Standard_Real ureso,
+ const Standard_Real vreso);
+
+
+static void ComputeInternalPointsOnRstr
+(Contap_Line&,
+ const Standard_Real,
+ const Standard_Real,
+ Contap_SurfFunction&);
+
+static void ProcessSegments (const Contap_TheSearch&,
+                             Contap_TheSequenceOfLine&,
+                             const Standard_Real,
+                             Contap_SurfFunction&,
+                             const Handle(Adaptor3d_TopolTool)&);
+
+//-- --------------------------------------------------------------------------------
+//-- Recherche des portions utiles sur les lignes 
+
+
+static void Recadre(const Handle(Adaptor3d_HSurface)& myHS1,
+                    Standard_Real& u1,
+                    Standard_Real& v1) { 
+                      Standard_Real f,l,lmf;
+                      GeomAbs_SurfaceType typs1 = myHS1->GetType();
+
+                      Standard_Boolean myHS1IsUPeriodic,myHS1IsVPeriodic;
+                      switch (typs1) { 
+  case GeomAbs_Cylinder:
+  case GeomAbs_Cone:
+  case GeomAbs_Sphere: 
+    { 
+      myHS1IsUPeriodic = Standard_True;
+      myHS1IsVPeriodic = Standard_False;
+      break;
+    }
+  case GeomAbs_Torus:
+    {
+      myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_True;
+      break;
+    }
+  default:
+    {
+      myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_False;
+      break;
+    }
+                      }
+                      if(myHS1IsUPeriodic) {
+                        lmf = M_PI+M_PI; //-- myHS1->UPeriod();
+                        f = myHS1->FirstUParameter();
+                        l = myHS1->LastUParameter();
+                        while(u1 < f) { u1+=lmf; } 
+                        while(u1 > l) { u1-=lmf; }
+                      }
+                      if(myHS1IsVPeriodic) {
+                        lmf = M_PI+M_PI; //-- myHS1->VPeriod(); 
+                        f = myHS1->FirstVParameter();
+                        l = myHS1->LastVParameter();
+                        while(v1 < f) { v1+=lmf; } 
+                        while(v1 > l) { v1-=lmf; }
+                      }
+}
+
+
+static void LineConstructor(Contap_TheSequenceOfLine& slin,
+                            const Handle(Adaptor3d_TopolTool)& Domain,
+                            Contap_Line& L,
+                            const Handle(Adaptor3d_HSurface)& Surf) { 
+
+                              //-- ------------------------------------------------------------
+                              //-- on decoupe la ligne en portions  entre 2 vertex 
+                              Standard_Real Tol = Precision::PConfusion();
+                              Contap_IType typl = L.TypeContour();
+                              //-- cout<<"\n ----------- Ligne Constructor "<<endl;
+                              if(typl == Contap_Walking) { 
+                                Standard_Real u1,v1,u2,v2;
+                                Standard_Integer nbvtx = L.NbVertex();
+                                //-- cout<<" WLine -> "<<nbvtx<<" vtx"<<endl;
+                                for(Standard_Integer i=1;i<nbvtx;i++) { 
+                                  Standard_Integer firstp = (Standard_Integer) L.Vertex(i).ParameterOnLine();
+                                  Standard_Integer lastp =  (Standard_Integer) L.Vertex(i+1).ParameterOnLine();
+                                  if(firstp!=lastp) {  
+                                    Standard_Integer pmid = (firstp+lastp)/2; //-- entiers
+                                    const IntSurf_PntOn2S& Pmid = L.Point(pmid);
+                                    Pmid.Parameters(u1,v1,u2,v2);
+                                    Recadre(Surf,u2,v2);
+                                    TopAbs_State in2 = Domain->Classify(gp_Pnt2d(u2,v2),Tol);
+                                    if(in2 == TopAbs_OUT) { 
+                                    }
+                                    else { 
+                                      //-- cout<<"ContapWLine      : firtsp="<<firstp<<" lastp="<<lastp<<" Vtx:"<<i<<","<<i+1<<endl;
+                                      Handle(IntSurf_LineOn2S) LineOn2S = new IntSurf_LineOn2S();
+                                      Contap_Line Line;
+                                      for(Standard_Integer j=firstp; j<=lastp; j++) { 
+                                        LineOn2S->Add(L.Point(j));
+                                      }
+                                      Line.SetLineOn2S(LineOn2S);
+                                      Contap_Point pvtx = L.Vertex(i);
+                                      pvtx.SetParameter(1);
+                                      Line.Add(pvtx);
+
+                                      pvtx = L.Vertex(i+1);
+                                      pvtx.SetParameter(lastp-firstp+1);
+                                      Line.Add(pvtx);
+                                      Line.SetTransitionOnS(L.TransitionOnS());
+                                      slin.Append(Line);
+                                    }
+                                  }
+                                }
+                              }
+                              else if(typl==Contap_Lin) { 
+                                Standard_Real u2,v2;// u1,v1;
+                                Standard_Integer nbvtx = L.NbVertex();
+                                //-- cout<<" Lin -> "<<nbvtx<<" vtx"<<endl;
+                                for(Standard_Integer i=1;i<nbvtx;i++) { 
+                                  Standard_Real firstp = L.Vertex(i).ParameterOnLine();
+                                  Standard_Real lastp =  L.Vertex(i+1).ParameterOnLine();
+                                  if(firstp!=lastp) {  
+                                    Standard_Real pmid = (firstp+lastp)*0.5;
+                                    gp_Pnt Pmid =  ElCLib::Value(pmid,L.Line());
+                                    if(Adaptor3d_HSurfaceTool::GetType(Surf)==GeomAbs_Cylinder) { 
+                                      ElSLib::Parameters(Adaptor3d_HSurfaceTool::Cylinder(Surf),Pmid,u2,v2);
+                                    }
+                                    else if(Adaptor3d_HSurfaceTool::GetType(Surf)==GeomAbs_Cone) { 
+                                      ElSLib::Parameters(Adaptor3d_HSurfaceTool::Cone(Surf),Pmid,u2,v2);
+                                    }
+                                    else { 
+                                      //-- cout<<" Pb ds Contap_ContourGen_2.gxx (type)"<<endl;
+                                    }
+
+                                    Recadre(Surf,u2,v2);
+                                    TopAbs_State in2 = Domain->Classify(gp_Pnt2d(u2,v2),Tol);
+                                    if(in2 == TopAbs_OUT) { 
+                                    }
+                                    else { 
+                                      //-- cout<<"Contap Lin      : firtsp="<<firstp<<" lastp="<<lastp<<" Vtx:"<<i<<","<<i+1<<endl;
+                                      Contap_Line Line;
+                                      Line.SetValue(L.Line());
+                                      Contap_Point pvtx = L.Vertex(i);
+                                      Line.Add(pvtx);
+
+                                      pvtx = L.Vertex(i+1);
+                                      Line.Add(pvtx);
+                                      Line.SetTransitionOnS(L.TransitionOnS());
+                                      slin.Append(Line);
+                                    }
+                                  }
+                                }
+                              }
+                              else if(typl==Contap_Circle) { 
+                                Standard_Real u2,v2; //u1,v1,
+                                Standard_Integer nbvtx = L.NbVertex();
+                                //-- cout<<" Circ -> "<<nbvtx<<" vtx"<<endl;
+                                Standard_Boolean novtx = Standard_True;
+                                if(nbvtx) novtx=Standard_False;
+                                for(Standard_Integer i=1;i<nbvtx  || novtx;i++) { 
+                                  Standard_Real firstp=0,lastp=M_PI+M_PI;
+                                  if(novtx == Standard_False) { 
+                                    firstp = L.Vertex(i).ParameterOnLine();
+                                    lastp =  L.Vertex(i+1).ParameterOnLine();
+                                  }
+                                  if(Abs(firstp-lastp)>0.000000001) {  
+                                    Standard_Real pmid = (firstp+lastp)*0.5;
+                                    gp_Pnt Pmid =  ElCLib::Value(pmid,L.Circle());
+                                    if(Adaptor3d_HSurfaceTool::GetType(Surf)==GeomAbs_Cylinder) { 
+                                      ElSLib::Parameters(Adaptor3d_HSurfaceTool::Cylinder(Surf),Pmid,u2,v2);
+                                    }
+                                    else if(Adaptor3d_HSurfaceTool::GetType(Surf)==GeomAbs_Cone) { 
+                                      ElSLib::Parameters(Adaptor3d_HSurfaceTool::Cone(Surf),Pmid,u2,v2);
+                                    }
+                                    else if(Adaptor3d_HSurfaceTool::GetType(Surf)==GeomAbs_Sphere) { 
+                                      ElSLib::Parameters(Adaptor3d_HSurfaceTool::Sphere(Surf),Pmid,u2,v2);
+                                    }
+                                    else { 
+                                      //-- cout<<" Pb ds Contap_ContourGen_2.gxx (typep)"<<endl;
+                                    }
+
+                                    Recadre(Surf,u2,v2);
+                                    TopAbs_State in2 = Domain->Classify(gp_Pnt2d(u2,v2),Tol);
+                                    if(in2 == TopAbs_OUT) { 
+                                    }
+                                    else { 
+                                      //-- cout<<"Contap Circle     : firtsp="<<firstp<<" lastp="<<lastp<<" Vtx:"<<i<<","<<i+1<<endl;
+                                      Contap_Line Line;
+                                      Line.SetValue(L.Circle());
+                                      if(novtx == Standard_False) { 
+                                        Contap_Point pvtx = L.Vertex(i);
+                                        Line.Add(pvtx);
+                                        pvtx = L.Vertex(i+1);
+                                        Line.Add(pvtx);
+                                      }
+                                      Line.SetTransitionOnS(L.TransitionOnS());
+                                      slin.Append(Line);
+                                    }
+                                  }
+                                  novtx = Standard_False;
+                                }
+                                if(nbvtx)  {
+                                  Standard_Real firstp = L.Vertex(nbvtx).ParameterOnLine();
+                                  Standard_Real lastp =  L.Vertex(1).ParameterOnLine() + M_PI+M_PI;
+                                  if(Abs(firstp-lastp)>0.0000000001) {  
+                                    Standard_Real pmid = (firstp+lastp)*0.5;
+                                    gp_Pnt Pmid =  ElCLib::Value(pmid,L.Circle());
+                                    if(Adaptor3d_HSurfaceTool::GetType(Surf)==GeomAbs_Cylinder) { 
+                                      ElSLib::Parameters(Adaptor3d_HSurfaceTool::Cylinder(Surf),Pmid,u2,v2);
+                                    }
+                                    else if(Adaptor3d_HSurfaceTool::GetType(Surf)==GeomAbs_Cone) { 
+                                      ElSLib::Parameters(Adaptor3d_HSurfaceTool::Cone(Surf),Pmid,u2,v2);
+                                    }
+                                    else if(Adaptor3d_HSurfaceTool::GetType(Surf)==GeomAbs_Sphere) { 
+                                      ElSLib::Parameters(Adaptor3d_HSurfaceTool::Sphere(Surf),Pmid,u2,v2);
+                                    }
+                                    else { 
+                                      //-- cout<<" Pb ds Contap_ContourGen_2.gxx (typep)"<<endl;
+                                    }
+
+                                    Recadre(Surf,u2,v2);
+                                    TopAbs_State in2 = Domain->Classify(gp_Pnt2d(u2,v2),Tol);
+                                    if(in2 == TopAbs_OUT) { 
+                                    }
+                                    else { 
+                                      //-- cout<<"Contap Circle  *Compl* : firtsp="<<firstp<<" lastp="<<lastp<<" Vtx:"<<i<<","<<i+1<<endl;
+                                      Contap_Line Line;
+                                      Line.SetValue(L.Circle());
+                                      Contap_Point pvtx = L.Vertex(nbvtx);
+                                      Line.Add(pvtx);
+
+                                      pvtx = L.Vertex(1);  pvtx.SetParameter(pvtx.ParameterOnLine()+M_PI+M_PI);
+                                      Line.Add(pvtx);
+                                      Line.SetTransitionOnS(L.TransitionOnS());
+                                      slin.Append(Line);
+                                    }
+                                  }      
+                                }
+                              }
+                              else { 
+                                //-- cout<<" ni WLine ni Lin ni Circ "<<endl;
+                                slin.Append(L);
+                              }
+                              //-- 
+}
+
+//-- --------------------------------------------------------------------------------
+
+
+
+static void KeepInsidePoints(const Contap_TheSearchInside& solins,
+                             const Contap_TheSearch& solrst,
+                             Contap_SurfFunction& Func,
+                             IntSurf_SequenceOfInteriorPoint& seqpins)
+
+{
+  Standard_Integer Nba = solrst.NbSegments();
+  if (Nba <= 0) return;
+  Standard_Integer Nbp,indp,inda;
+  Standard_Real U,V,paramproj;
+  gp_Pnt2d toproj,Ptproj;
+  Standard_Boolean projok,tokeep;
+  const Handle(Adaptor3d_HSurface)& Surf = Func.Surface();
+
+  Nbp = solins.NbPoints();
+  for (indp=1; indp <= Nbp; indp++) {
+    tokeep = Standard_True;
+    const IntSurf_InteriorPoint& pti = solins.Value(indp);
+    pti.Parameters(U,V);
+    toproj = gp_Pnt2d(U,V);
+    for (inda = 1; inda <= Nba; inda++) {
+      const Handle(Adaptor2d_HCurve2d)& thearc = solrst.Segment(inda).Curve();
+      projok = Contap_HContTool::Project(thearc,toproj,paramproj,Ptproj);
+      if (projok) {
+        gp_Pnt pprojete = Adaptor3d_HSurfaceTool::Value(Surf,Ptproj.X(),Ptproj.Y());
+        if (pti.Value().Distance(pprojete) <= Precision::Confusion()) {
+          tokeep = Standard_False;
+          break;
+        }
+      }
+    }
+    if (tokeep) {
+      seqpins.Append(pti);
+    }
+  }
+}
+
+
+static void ComputeTangency (const Contap_TheSearch& solrst,
+                             const Handle(Adaptor3d_TopolTool)& Domain,
+                             Contap_SurfFunction& Func,
+                             IntSurf_SequenceOfPathPoint& seqpdep,
+                             TColStd_Array1OfInteger& Destination)
+{
+
+  Standard_Integer i,k;
+  Standard_Integer NbPoints = solrst.NbPoints();
+  Standard_Integer seqlength = 0;
+
+  Standard_Real theparam,test;
+  Standard_Boolean fairpt;
+  TopAbs_Orientation arcorien,vtxorien;
+  Standard_Boolean ispassing;
+
+  math_Vector X(1, 2);
+  math_Vector F(1, 1);
+  math_Matrix D(1, 1, 1, 2); 
+
+  gp_Vec   normale, vectg, tg3drst,v1,v2;
+  gp_Dir2d dirtg;
+  gp_Vec2d tg2drst;
+  gp_Pnt2d pt2d;
+
+  IntSurf_PathPoint PPoint;
+  const Handle(Adaptor3d_HSurface)& Surf = Func.Surface();
+
+  for (i=1; i<= NbPoints; i++) {
+
+    if (Destination(i) == 0) {
+
+      const Contap_ThePathPointOfTheSearch& PStart = solrst.Point(i);
+      const Handle(Adaptor2d_HCurve2d)& thearc = PStart.Arc();
+      theparam = PStart.Parameter();
+      gp_Pnt2d Ptoproj=Contap_HCurve2dTool::Value(thearc,theparam);
+      //-- lbr le 15 mai 97 
+      //-- On elimine les points qui sont egalement present sur une restriction solution
+      Standard_Boolean SurUneRestrictionSolution = Standard_False;
+      for(Standard_Integer restriction=1;
+        SurUneRestrictionSolution==Standard_False && restriction<=solrst.NbSegments(); 
+        restriction++) { 
+          const Handle(Adaptor2d_HCurve2d)& thearcsol = solrst.Segment(restriction).Curve();
+          Standard_Real  paramproj;
+          gp_Pnt2d       pproj;
+          Standard_Boolean projok = Contap_HContTool::Project(thearcsol,Ptoproj,paramproj,pproj);
+          if(projok) { 
+            //gp_Pnt pprojete = Adaptor3d_HSurfaceTool::Value(Surf,Ptoproj.X(),Ptoproj.Y());
+            //IFV - begin
+            gp_Pnt pprojete = Adaptor3d_HSurfaceTool::Value(Surf,pproj.X(),pproj.Y());
+            //IFV - end
+            if ((PStart.Value()).Distance(pprojete) <= Precision::Confusion()) {
+              SurUneRestrictionSolution = Standard_True;
+            }
+          }
+      }
+      if(SurUneRestrictionSolution == Standard_False) { 
+        arcorien = Domain->Orientation(thearc);
+        ispassing = (arcorien == TopAbs_INTERNAL ||
+          arcorien == TopAbs_EXTERNAL);
+
+        Contap_HCurve2dTool::D1(thearc,theparam,pt2d,tg2drst);
+        X(1) = pt2d.X();
+        X(2) = pt2d.Y();
+        PPoint.SetValue(PStart.Value(),X(1),X(2));
+
+        Func.Values(X,F,D);
+        if (Func.IsTangent()) {
+          PPoint.SetTangency(Standard_True);
+          Destination(i) = seqlength+1;
+          if (!PStart.IsNew()) {
+            const Handle(Adaptor3d_HVertex)& vtx = PStart.Vertex();
+            for (k=i+1; k<=NbPoints; k++) {
+              if (Destination(k) ==0) {
+                const Contap_ThePathPointOfTheSearch& PStart2 = solrst.Point(k);
+                if (!PStart2.IsNew()) {
+                  const Handle(Adaptor3d_HVertex)& vtx2 = PStart2.Vertex();
+                  if (Domain->Identical(vtx,vtx2)) {
+                    const Handle(Adaptor2d_HCurve2d)& thearc2   = PStart2.Arc();
+                    theparam = PStart2.Parameter();
+                    arcorien = Domain->Orientation(thearc2);
+                    ispassing = ispassing && (arcorien == TopAbs_INTERNAL ||
+                      arcorien == TopAbs_EXTERNAL);
+
+                    pt2d = Contap_HCurve2dTool::Value(thearc2,theparam);
+                    X(1) = pt2d.X();
+                    X(2) = pt2d.Y();
+                    PPoint.AddUV(X(1),X(2));
+                    Destination(k) = seqlength+1;
+                  }
+                }
+              }
+            }
+          }
+          PPoint.SetPassing(ispassing);
+          seqpdep.Append(PPoint);
+          seqlength++;
+        }
+        else { // on a un point de depart potentiel
+
+          vectg = Func.Direction3d();
+          dirtg = Func.Direction2d();
+
+          gp_Pnt ptbid;
+          //   Adaptor3d_HSurfaceTool::D1(Surf,X(1),X(2),ptbid,v1,v2);
+          Contap_SurfProps::DerivAndNorm(Surf,X(1),X(2),ptbid,v1,v2,normale);
+          tg3drst = tg2drst.X()*v1 + tg2drst.Y()*v2;
+          //   normale = v1.Crossed(v2);
+          if(normale.SquareMagnitude() < RealEpsilon()) { 
+            //-- cout<<"\n*** Contap_ContourGen_2.gxx  Normale Nulle en U:"<<X(1)<<" V:"<<X(2)<<endl;
+          }
+          else { 
+            test = vectg.Dot(normale.Crossed(tg3drst));
+
+            if (PStart.IsNew()) {
+              Standard_Real tbis = vectg.Normalized().Dot(tg3drst.Normalized());
+              if (Abs(tbis) < 1.-tole) {
+
+                if ((test < 0. && arcorien == TopAbs_FORWARD) ||
+                  (test > 0. && arcorien == TopAbs_REVERSED)) {
+                    vectg.Reverse();
+                    dirtg.Reverse();
+                }
+                PPoint.SetDirections(vectg,dirtg);
+              }
+              else { // on garde le point comme point d`arret (tangent)
+                PPoint.SetTangency(Standard_True);
+              }
+              PPoint.SetPassing(ispassing);
+              Destination(i) = seqlength+1;
+              seqpdep.Append(PPoint);
+              seqlength++;
+            }
+            else { // traiter la transition complexe
+              gp_Dir bidnorm(1.,1.,1.);
+
+              Standard_Boolean tobeverified = Standard_False;
+              TopAbs_Orientation LocTrans;
+              TopTrans_CurveTransition comptrans;
+              comptrans.Reset(vectg,bidnorm,0.);
+              if (arcorien != TopAbs_INTERNAL &&
+                arcorien != TopAbs_EXTERNAL) {
+                  // pour essai
+                  const Handle(Adaptor3d_HVertex)& vtx = PStart.Vertex();
+                  vtxorien = Domain->Orientation(vtx);
+                  test = test/(vectg.Magnitude());
+                  test = test/((normale.Crossed(tg3drst)).Magnitude());
+
+                  if (Abs(test) <= tole) {
+                    tobeverified = Standard_True;
+                    LocTrans = TopAbs_EXTERNAL; // et pourquoi pas INTERNAL
+                  }
+                  else {
+                    if ((test > 0. && arcorien == TopAbs_FORWARD) ||
+                      (test < 0. && arcorien == TopAbs_REVERSED)){
+                        LocTrans = TopAbs_FORWARD;
+                    }
+                    else {
+                      LocTrans = TopAbs_REVERSED;
+                    }
+                    if (arcorien == TopAbs_REVERSED) {tg3drst.Reverse();} // pas deja fait ???
+                  }
+
+                  comptrans.Compare(tole,tg3drst,bidnorm,0.,LocTrans,vtxorien);
+              }
+              Destination(i) = seqlength+1;
+              for (k= i+1; k<=NbPoints; k++) {
+                if (Destination(k) == 0) {
+                  const Contap_ThePathPointOfTheSearch& PStart2 = solrst.Point(k);
+                  if (!PStart2.IsNew()) {
+                    const Handle(Adaptor3d_HVertex)& vtx2 = PStart2.Vertex();
+                    if (Domain->Identical(PStart.Vertex(),vtx2)) {
+                      const Handle(Adaptor2d_HCurve2d)& thearc2 = PStart2.Arc();
+                      theparam = PStart2.Parameter();
+                      arcorien = Domain->Orientation(thearc2);
+
+                      Contap_HCurve2dTool::D1(thearc2,theparam,pt2d,tg2drst);
+                      X(1) = pt2d.X();
+                      X(2) = pt2d.Y();
+                      PPoint.AddUV(X(1),X(2));
+
+                      if (arcorien != TopAbs_INTERNAL &&
+                        arcorien != TopAbs_EXTERNAL) {
+                          ispassing = Standard_False;
+                          tg3drst = tg2drst.X()*v1 + tg2drst.Y()*v2;
+                          test = vectg.Dot(normale.Crossed(tg3drst));
+                          test = test/(vectg.Magnitude());
+                          test = test /((normale.Crossed(tg3drst)).Magnitude());
+
+                          vtxorien = Domain->Orientation(vtx2);
+                          if (Abs(test) <= tole) {
+                            tobeverified = Standard_True;
+                            LocTrans = TopAbs_EXTERNAL; // et pourquoi pas INTERNAL
+                          }
+                          else {
+                            if ((test > 0. && arcorien == TopAbs_FORWARD) ||
+                              (test < 0. && arcorien == TopAbs_REVERSED)){
+                                LocTrans = TopAbs_FORWARD;
+                            }
+                            else {
+                              LocTrans = TopAbs_REVERSED;
+                            }
+                            if (arcorien == TopAbs_REVERSED) {tg3drst.Reverse();} //deja fait????
+                          }
+
+                          comptrans.Compare(tole,tg3drst,bidnorm,0.,LocTrans,vtxorien);
+                      }
+                      Destination(k) = seqlength+1;
+                    }
+                  }
+                }
+              }
+              fairpt = Standard_True;
+              if (!ispassing) {
+                TopAbs_State Before = comptrans.StateBefore();
+                TopAbs_State After  = comptrans.StateAfter();
+                if ((Before == TopAbs_UNKNOWN)||(After == TopAbs_UNKNOWN)) {
+                  fairpt = Standard_False;
+                }
+                else if (Before == TopAbs_IN) {
+                  if (After == TopAbs_IN) {
+                    ispassing = Standard_True;
+                  }
+                  else {
+                    vectg.Reverse();
+                    dirtg.Reverse();
+                  }
+                }
+                else {
+                  if (After !=TopAbs_IN) {
+                    fairpt = Standard_False;
+                  }
+                }
+              }
+
+              // evite de partir le long d une restriction solution
+
+              if (fairpt && tobeverified) {
+                for (k=i; k <=NbPoints ; k++) {
+                  if (Destination(k)==seqlength + 1) {
+                    theparam = solrst.Point(k).Parameter();
+                    const Handle(Adaptor2d_HCurve2d)& thearc2 = solrst.Point(k).Arc();
+                    arcorien = Domain->Orientation(thearc2);
+
+                    if (arcorien == TopAbs_FORWARD ||
+                      arcorien == TopAbs_REVERSED) {
+                        Contap_HCurve2dTool::D1(thearc2,theparam,pt2d,tg2drst);
+                        tg3drst = tg2drst.X()*v1 + tg2drst.Y()*v2;
+                        vtxorien = Domain->Orientation(solrst.Point(k).Vertex());
+                        if ((arcorien == TopAbs_FORWARD && 
+                          vtxorien == TopAbs_REVERSED)    ||
+                          (arcorien == TopAbs_REVERSED &&
+                          vtxorien == TopAbs_FORWARD)) {
+                            tg3drst.Reverse();
+                        }
+                        test = vectg.Normalized().Dot(tg3drst.Normalized());
+                        if (test >= 1. - tole) {
+                          fairpt = Standard_False;
+                          break;
+                        }
+                    }
+                  }
+                }
+              }
+
+              if (fairpt) {
+                PPoint.SetDirections(vectg,dirtg);
+                PPoint.SetPassing(ispassing);
+                seqpdep.Append(PPoint);
+                seqlength++;
+              }
+              else { // il faut remettre en "ordre" si on ne garde pas le point.
+                for (k=i; k <=NbPoints ; k++) {
+                  if (Destination(k)==seqlength + 1) {
+                    Destination(k) = -Destination(k);
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+
+IntSurf_TypeTrans ComputeTransitionOnLine(Contap_SurfFunction& SFunc,
+                                          const Standard_Real u,
+                                          const Standard_Real v,
+                                          const gp_Vec& tgline)
+{
+  gp_Vec d1u,d1v;
+  gp_Pnt pntbid;
+  //gp_Vec tglineuv;
+
+  Adaptor3d_HSurfaceTool::D1(SFunc.Surface(),u,v,pntbid,d1u,d1v);
+
+  //------------------------------------------------------
+  //--   Calcul de la tangente dans l espace uv        ---
+  //------------------------------------------------------
+
+  Standard_Real det,d1uT,d1vT,normu2,normv2,d1ud1v,alpha,beta;
+  d1uT = d1u.Dot(tgline);
+  d1vT = d1v.Dot(tgline);
+  normu2 = d1u.Dot(d1u);
+  normv2 = d1v.Dot(d1v);
+  d1ud1v = d1u.Dot(d1v);
+  det = normu2 * normv2 - d1ud1v * d1ud1v;
+  if(det<RealEpsilon()) { 
+    //-- On ne doit pas passer ici !!
+    //-- cout<<" Probleme !!!"<<endl ;
+    return IntSurf_Undecided;
+  }
+
+  alpha = (d1uT * normv2 - d1vT * d1ud1v)/det;
+  beta  = (normu2 * d1vT - d1ud1v * d1uT)/det;
+  //-----------------------------------------------------
+  //--  Calcul du Gradient de la fonction Utilisee     --
+  //--  pour le contour apparent                       --
+  //-----------------------------------------------------
+
+  Standard_Real v1,v2;
+  math_Vector X(1,2);
+  math_Matrix Df(1,1,1,2);
+  X(1) = u;
+  X(2) = v;
+  SFunc.Derivatives(X,Df);
+  v1 = Df(1,1);
+  v2 = Df(1,2);
+
+  //-----------------------------------------------------
+  //-- On calcule si la fonction                       --
+  //--        F(.) = Normale . Dir_Regard              --
+  //-- Croit Losrque l on se deplace sur la Gauche     --
+  //--  de la direction de deplacement sur la ligne.   --
+  //-----------------------------------------------------
+
+  det = -v1*beta + v2*alpha;
+
+  if(det<RealEpsilon()) { // revoir le test jag 940620
+    return IntSurf_Undecided;
+  }
+  if(det>0.0) { 
+    return(IntSurf_Out);
+  }
+  return(IntSurf_In);
+}
+
+
+void ProcessSegments (const Contap_TheSearch& solrst,
+                      Contap_TheSequenceOfLine& slin,
+                      const Standard_Real TolArc,
+                      Contap_SurfFunction& SFunc,
+                      const Handle(Adaptor3d_TopolTool)& Domain)
+
+{     
+  Standard_Integer i,j,k;
+  Standard_Integer nbedg = solrst.NbSegments();
+  Standard_Integer Nblines,Nbpts;
+
+  Handle(Adaptor2d_HCurve2d) arcRef;
+  Contap_Point ptvtx;
+
+  Contap_ThePathPointOfTheSearch PStartf,PStartl;
+
+  Standard_Boolean dofirst,dolast,procf,procl;
+  Standard_Real paramf =0.,paraml =0.,U;
+  Contap_Line theline;
+
+  gp_Vec tgline;//,norm1,norm2;
+  gp_Pnt valpt;
+
+  gp_Vec d1u,d1v;
+  gp_Pnt2d p2d;
+  gp_Vec2d d2d;
+
+
+  for (i = 1; i <= nbedg; i++) {
+
+    const Contap_TheSegmentOfTheSearch& thesegsol = solrst.Segment(i);
+    theline.SetValue(thesegsol.Curve());
+
+    // Traitement des points debut/fin du segment solution.
+
+    dofirst = Standard_False;
+    dolast  = Standard_False;
+    procf = Standard_False;
+    procl = Standard_False;
+
+    if (thesegsol.HasFirstPoint()) {
+      dofirst = Standard_True;
+      PStartf = thesegsol.FirstPoint();
+      paramf = PStartf.Parameter();
+    }
+    if (thesegsol.HasLastPoint()) {
+      dolast = Standard_True;
+      PStartl = thesegsol.LastPoint();
+      paraml = PStartl.Parameter();
+    }
+
+    // determination de la transition
+    if (dofirst && dolast) {
+      U = (paramf+paraml)/2.;
+    }
+    else if (dofirst) {
+      U = paramf + 1.0;
+    }
+    else if (dolast) {
+      U = paraml - 1.0;
+    }
+    else {
+      U = 0.0;
+    }
+
+    Contap_HCurve2dTool::D1(thesegsol.Curve(),U,p2d,d2d);
+    Adaptor3d_HSurfaceTool::D1(SFunc.Surface(),p2d.X(),p2d.Y(),valpt,d1u,d1v);
+    tgline.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
+    IntSurf_TypeTrans  tral = 
+      ComputeTransitionOnLine(SFunc,p2d.X(),p2d.Y(),tgline);
+
+    theline.SetTransitionOnS(tral);
+
+
+    if (dofirst || dolast) {
+      Nblines = slin.Length();
+      for (j=1; j<=Nblines; j++) {
+        Nbpts = slin(j).NbVertex();
+        for (k=1; k<=Nbpts;k++) {
+          ptvtx = slin(j).Vertex(k);
+          if (dofirst) {
+            if (ptvtx.Value().Distance(PStartf.Value()) <=TolArc) {
+              slin(j).Vertex(k).SetMultiple();
+              ptvtx.SetMultiple();
+              ptvtx.SetParameter(paramf);
+              theline.Add(ptvtx);
+              procf=Standard_True;
+            }
+          }
+          if (dolast) {
+            if (ptvtx.Value().Distance(PStartl.Value()) <=TolArc) {
+              slin(j).Vertex(k).SetMultiple();
+              ptvtx.SetMultiple();
+              ptvtx.SetParameter(paraml);
+              theline.Add(ptvtx);
+              procl=Standard_True;
+            }
+          }
+        }
+        // Si on a traite le pt debut et/ou fin, on ne doit pas recommencer si
+        // il (ils) correspond(ent) a un point multiple.
+
+        if (procf) {
+          dofirst = Standard_False;
+        }
+        if (procl) {
+          dolast  = Standard_False;
+        }
+      }
+    }
+
+    // Si on n a pas trouve le point debut et./ou fin sur une des lignes
+    // d intersection, il faut quand-meme le placer sur la restriction solution
+
+    if (dofirst) {
+
+      p2d = Contap_HCurve2dTool::Value(thesegsol.Curve(),paramf);
+      ptvtx.SetValue(PStartf.Value(),p2d.X(),p2d.Y());
+      ptvtx.SetParameter(paramf);
+      if (! PStartf.IsNew()) {
+        ptvtx.SetVertex(PStartf.Vertex());
+      }
+      theline.Add(ptvtx);
+    }
+    if (dolast) {
+      p2d = Contap_HCurve2dTool::Value(thesegsol.Curve(),paraml);
+      ptvtx.SetValue(PStartl.Value(),p2d.X(),p2d.Y());
+      ptvtx.SetParameter(paraml);
+      if (! PStartl.IsNew()) {
+        ptvtx.SetVertex(PStartl.Vertex());
+      }
+      theline.Add(ptvtx);
+    }
+
+    // il faut chercher le points internal sur les restrictions solutions.
+    if (thesegsol.HasFirstPoint() && thesegsol.HasLastPoint()) {
+      ComputeInternalPointsOnRstr(theline,paramf,paraml,SFunc);
+    }
+    LineConstructor(slin,Domain,theline,SFunc.Surface()); //-- lbr 
+    //-- slin.Append(theline);
+    theline.Clear();
+  }
+}
+
+void ComputeInternalPointsOnRstr
+(Contap_Line& Line,
+ const Standard_Real Paramf,
+ const Standard_Real Paraml,
+ Contap_SurfFunction& SFunc)
+{
+  // On recherche les points ou la tangente a la ligne de contour et
+  // la direction sont alignees.
+  // 1ere etape : recherche de changement de signe.
+  // 2eme etape : localisation de la solution par dichotomie
+
+
+  Standard_Integer indexinf,indexsup,i;
+  gp_Vec tgt, vecref, vectest, vtestb, vecregard,d1u,d1v;
+  gp_Pnt pcour;
+  gp_Pnt2d p2d;
+  gp_Vec2d d2d;
+  Standard_Boolean found,ok = Standard_False,toutvu,solution;
+  Standard_Real paramp = 0.,paraminf,paramsup,toler;
+
+  if (Line.TypeContour() != Contap_Restriction) {
+    return;
+  }
+
+  const Handle_Adaptor2d_HCurve2d& thearc = Line.Arc();
+
+  const Handle(Adaptor3d_HSurface)& Surf = SFunc.Surface();
+  Contap_TFunction TypeFunc(SFunc.FunctionType());
+
+  Standard_Integer Nbpnts = Contap_HContTool::NbSamplesOnArc(thearc);
+  indexinf = 1;
+  vecregard = SFunc.Direction();
+  toler = Contap_HCurve2dTool::Resolution(thearc,Precision::Confusion());
+  found = Standard_False;
+
+  do {
+    paraminf = ((Nbpnts-indexinf)*Paramf + (indexinf-1)*Paraml)/(Nbpnts-1);
+    Contap_HCurve2dTool::D1(thearc,paraminf,p2d,d2d);
+    Adaptor3d_HSurfaceTool::D1(Surf,p2d.X(),p2d.Y(),pcour,d1u,d1v);
+    tgt.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
+
+    if (tgt.Magnitude() > gp::Resolution()) {
+      if (TypeFunc == Contap_ContourPrs || TypeFunc==Contap_DraftPrs) {
+        vecregard.SetXYZ(pcour.XYZ()-SFunc.Eye().XYZ());
+      }
+      vecref = vecregard.Crossed(tgt);
+
+      if (vecref.Magnitude() <= gp::Resolution()) {
+        indexinf++;
+      }
+      else {
+        found = Standard_True;
+      }
+    }
+    else {
+      indexinf++;
+    }
+  } while ((indexinf <= Nbpnts) && (!found));
+
+
+  indexsup = indexinf +1;
+  toutvu = (indexsup > Nbpnts);
+  while (!toutvu) {
+    paramsup = ((Nbpnts-indexsup)*Paramf + (indexsup-1)*Paraml)/(Nbpnts-1);
+    Contap_HCurve2dTool::D1(thearc,paramsup,p2d,d2d);
+    Adaptor3d_HSurfaceTool::D1(Surf,p2d.X(),p2d.Y(),pcour,d1u,d1v);
+    tgt.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
+
+    if (tgt.Magnitude() > gp::Resolution()) {
+      if (TypeFunc == Contap_ContourPrs || TypeFunc==Contap_DraftPrs) {
+        vecregard.SetXYZ(pcour.XYZ()-SFunc.Eye().XYZ());
+      }
+      vectest = vecregard.Crossed(tgt);
+    }
+    else {
+      vectest = gp_Vec(0.,0.,0.);
+    }
+    if (vectest.Magnitude() <= gp::Resolution()) {
+      // On cherche un vrai changement de signe
+      indexsup++;
+    }
+    else {
+      if (vectest.Dot(vecref) < 0.) {
+        // Essayer de converger
+        // cout << "Changement de signe detecte" << endl;
+        solution = Standard_False;
+        while (!solution) {
+          paramp = (paraminf+paramsup)/2.;
+          Contap_HCurve2dTool::D1(thearc,paramp,p2d,d2d);
+          Adaptor3d_HSurfaceTool::D1(Surf,p2d.X(),p2d.Y(),pcour,d1u,d1v);
+          tgt.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
+
+          if (tgt.Magnitude() > gp::Resolution()) {
+            if (TypeFunc == Contap_ContourPrs || TypeFunc==Contap_DraftPrs) {
+              vecregard.SetXYZ(pcour.XYZ()-SFunc.Eye().XYZ());
+            }
+            vtestb = vecregard.Crossed(tgt);
+          }
+          else {
+            vtestb = gp_Vec(0.,0.,0.);
+          }
+
+          if ((vtestb.Magnitude() <= gp::Resolution())||
+            (Abs(paramp-paraminf) <= toler) ||
+            (Abs(paramp-paramsup) <= toler)) {
+              // on est a la solution
+              solution = Standard_True;
+              ok = Standard_True;
+          }
+          else if (vtestb.Dot(vecref) < 0.) {
+            paramsup = paramp;
+          }
+          else {
+            paraminf = paramp;
+          }
+
+        }
+
+        if (ok) {
+          // On verifie que le point trouve ne correspond pas a un ou des
+          // vertex deja existant(s). On teste sur le parametre paramp.
+          for (i=1; i<=Line.NbVertex(); i++) {
+            Contap_Point& thevtx = Line.Vertex(i);
+            if (Abs(thevtx.ParameterOnLine()-paramp) <= toler) {
+              thevtx.SetInternal();
+              ok = Standard_False; // on a correspondance
+            }
+          }
+          if (ok) { // il faut alors rajouter le point
+            Contap_Point internalp(pcour,p2d.X(),p2d.Y());
+            internalp.SetParameter(paramp);
+            internalp.SetInternal();
+            Line.Add(internalp);
+          }
+        }
+        paramsup = ((Nbpnts-indexsup)*Paramf + (indexsup-1)*Paraml)/(Nbpnts-1);
+      }
+      vecref = vectest;
+      indexinf = indexsup;
+      indexsup++;
+      paraminf = paramsup;
+    }
+    toutvu = (indexsup > Nbpnts);
+  }
+}
+
+
+void ComputeInternalPoints
+(Contap_Line& Line,
+ Contap_SurfFunction& SFunc,
+ const Standard_Real ureso,
+ const Standard_Real vreso)
+
+{
+  // On recherche les points ou la tangente a la ligne de contour et
+  // la direction sont alignees.
+  // 1ere etape : recheche de changement de signe.
+  // 2eme etape : localisation de la solution par simili dichotomie
+
+
+  Standard_Integer indexinf,indexsup,index;
+  gp_Vec tgt, vecref, vectest, vtestb, vecregard;
+  //gp_Pnt pprec,pcour;
+  Standard_Boolean found,ok = Standard_False,toutvu,solution;
+  Standard_Real paramp = 0.,U,V;
+
+  math_Vector XInf(1,2),XSup(1,2),X(1,2),F(1,1);
+  math_Matrix DF(1,1,1,2);
+  math_Vector toler(1,2),infb(1,2),supb(1,2);
+
+  if (Line.TypeContour() != Contap_Walking) {
+    return;
+  }
+
+  Standard_Integer Nbpnts = Line.NbPnts();
+  const Handle(Adaptor3d_HSurface)& Surf = SFunc.Surface();
+  Contap_TFunction TypeFunc(SFunc.FunctionType());
+
+  toler(1) = ureso; //-- Trop long !!! Adaptor3d_HSurfaceTool::UResolution(Surf,SFunc.Tolerance());
+  toler(2) = vreso; //---Beaucoup trop long !!! Adaptor3d_HSurfaceTool::VResolution(Surf,SFunc.Tolerance());
+  infb(1) = Adaptor3d_HSurfaceTool::FirstUParameter(Surf);
+  infb(2) = Adaptor3d_HSurfaceTool::FirstVParameter(Surf);
+  supb(1) = Adaptor3d_HSurfaceTool::LastUParameter(Surf);
+  supb(2) = Adaptor3d_HSurfaceTool::LastVParameter(Surf);
+
+  math_FunctionSetRoot rsnld(SFunc,toler,30);
+
+  indexinf = 1;
+  vecregard = SFunc.Direction();
+
+  found = Standard_False;
+  do {
+    Line.Point(indexinf).ParametersOnS2(XInf(1),XInf(2));
+    SFunc.Values(XInf,F,DF);
+    if (!SFunc.IsTangent()) {
+      tgt = SFunc.Direction3d();
+      if (TypeFunc == Contap_ContourPrs || TypeFunc == Contap_DraftPrs) {
+        vecregard.SetXYZ(Line.Point(indexinf).Value().XYZ()-SFunc.Eye().XYZ());
+      }
+      vecref = vecregard.Crossed(tgt);
+
+      if (vecref.Magnitude() <= gp::Resolution()) {
+        indexinf++;
+      }
+      else {
+        found = Standard_True;
+      }
+    }
+    else {
+      indexinf++;
+    }
+  } while ((indexinf <= Nbpnts) && (!found));
+
+
+  indexsup = indexinf +1;
+  toutvu = (indexsup > Nbpnts);
+  while (!toutvu) {
+    Line.Point(indexsup).ParametersOnS2(XSup(1),XSup(2));
+    SFunc.Values(XSup,F,DF);
+    if (!SFunc.IsTangent()) {
+      tgt = SFunc.Direction3d();
+
+      if (TypeFunc == Contap_ContourPrs || TypeFunc == Contap_DraftPrs) {
+        vecregard.SetXYZ(Line.Point(indexsup).Value().XYZ()-SFunc.Eye().XYZ());
+      }
+      vectest = vecregard.Crossed(tgt);
+    }
+    else {
+      vectest = gp_Vec(0.,0.,0.);
+    }
+    if (vectest.Magnitude() <= gp::Resolution()) {
+      // On cherche un vrai changement de signe
+      indexsup++;
+    }
+    else {
+      if (vectest.Dot(vecref) < 0.) {
+        // Essayer de converger
+        // cout << "Changement de signe detecte" << endl;
+        solution = Standard_False;
+        while (!solution) {
+          X(1) = (XInf(1) + XSup(1)) /2.;
+          X(2) = (XInf(2) + XSup(2)) /2.;
+          rsnld.Perform(SFunc,X,infb,supb);
+
+          if (!rsnld.IsDone()) {
+            cout << "Echec recherche internal points" << endl;
+            solution = Standard_True;
+            ok = Standard_False;
+          }
+          else {
+
+            rsnld.Root(X);
+            SFunc.Values(X,F,DF);
+            if (Abs(F(1)) <= SFunc.Tolerance()) {
+
+              if (!SFunc.IsTangent()) {
+                tgt = SFunc.Direction3d();
+                if (TypeFunc == Contap_ContourPrs || 
+                  TypeFunc == Contap_DraftPrs) {
+                    vecregard.SetXYZ(SFunc.Point().XYZ()-SFunc.Eye().XYZ());
+                }
+                vtestb = vecregard.Crossed(tgt);
+              }
+              else {
+                vtestb = gp_Vec(0.,0.,0.);
+              }
+              if ((vtestb.Magnitude() <= gp::Resolution())||
+                (Abs(X(1)-XInf(1)) <= toler(1) 
+                && Abs(X(2)-XInf(2)) <= toler(2)) ||
+                (Abs(X(1)-XSup(1)) <= toler(1)
+                && Abs(X(2)-XSup(2)) <= toler(2))) {
+                  // on est a la solution
+                  solution = Standard_True;
+                  ok = Standard_True;
+              }
+              else if (vtestb.Dot(vecref) < 0.) {
+                XSup = X;
+              }
+              else {
+                XInf = X;
+              }
+            }
+            else { // on n est pas sur une solution
+              cout << "Echec recherche internal points" << endl;
+              solution = Standard_True;
+              ok = Standard_False;
+            }
+          }
+        }
+
+        if (ok) {
+          Standard_Boolean newpoint = Standard_False;
+          Line.Point(indexinf).ParametersOnS2(U,V);
+          gp_Vec2d vinf(X(1)-U,X(2)-V);
+          if (Abs(vinf.X()) <= toler(1) && Abs(vinf.Y()) <= toler(2)) {
+            paramp = indexinf;
+          }
+          else {
+            for (index = indexinf+1; index <= indexsup; index++) {
+              Line.Point(index).ParametersOnS2(U,V);
+              gp_Vec2d vsup(X(1)-U,X(2)-V);
+              if (Abs(vsup.X()) <= toler(1) && Abs(vsup.Y()) <= toler(2)) {
+                paramp = index;
+                break;
+              }
+              else if (vinf.Dot(vsup) < 0.) {
+                // on est entre les 2 points
+                paramp = index;
+                IntSurf_PntOn2S pt2s;
+                pt2s.SetValue(SFunc.Point(),Standard_False,X(1),X(2));
+                Line.LineOn2S()->InsertBefore(index,pt2s);
+
+                //-- Il faut decaler les parametres des vertex situes entre 
+                //-- index et NbPnts ###################################
+                for(Standard_Integer v=1; v<=Line.NbVertex(); v++) { 
+                  Contap_Point& Vertex = Line.Vertex(v);
+                  if(Vertex.ParameterOnLine() >= index) { 
+                    Vertex.SetParameter(Vertex.ParameterOnLine()+1); 
+                  }
+                }
+
+                Nbpnts = Nbpnts+1;
+                indexsup = indexsup+1;
+                newpoint = Standard_True;
+                break;
+              }
+              else {
+                vinf = vsup;
+              }
+            }
+          }
+
+          Standard_Integer v;
+          if (!newpoint) {
+            // on est sur un point de cheminement. On regarde alors
+            // la correspondance avec un vertex existant.
+            newpoint = Standard_True;
+            for (v=1; v<= Line.NbVertex(); v++) {
+              Contap_Point& Vertex = Line.Vertex(v);
+              if(Vertex.ParameterOnLine() == paramp) {
+                Vertex.SetInternal();
+                newpoint = Standard_False;
+              }
+            }
+          }
+
+          if (newpoint && paramp >1. && paramp < Nbpnts) {
+            // on doit creer un nouveau vertex.
+            Contap_Point internalp(SFunc.Point(),X(1),X(2));
+            internalp.SetParameter(paramp);
+            internalp.SetInternal();
+            Line.Add(internalp);
+          }
+        }
+        Line.Point(indexsup).ParametersOnS2(XSup(1),XSup(2));
+      }
+      vecref = vectest;
+      indexinf = indexsup;
+      indexsup++;
+      XInf = XSup;
+    }
+    toutvu = (indexsup > Nbpnts);
+  }
+}
+
+
+void Contap_Contour::Perform 
+(const Handle(Adaptor3d_TopolTool)& Domain) {
+
+  done = Standard_False;
+  slin.Clear();
+
+  Standard_Integer i,j,k,Nbvt1,Nbvt2,ivt1,ivt2;
+  Standard_Integer NbPointRst,NbPointIns;
+  Standard_Integer Nblines, Nbpts, indfirst, indlast;
+  Standard_Real U,V;
+  gp_Pnt2d pt2d;
+  gp_Vec2d d2d;
+  gp_Pnt ptonsurf;
+  gp_Vec d1u,d1v,normale,tgtrst,tgline;
+  Standard_Real currentparam;
+  IntSurf_Transition TLine,TArc;
+
+  Contap_Line theline;
+  Contap_Point ptdeb,ptfin;
+  Contap_ThePathPointOfTheSearch PStartf,PStartl;
+
+  //  Standard_Real TolArc = 1.e-5;
+  Standard_Real TolArc = Precision::Confusion();
+
+  const Handle(Adaptor3d_HSurface)& Surf = mySFunc.Surface();
+
+  Standard_Real EpsU = Adaptor3d_HSurfaceTool::UResolution(Surf,Precision::Confusion());
+  Standard_Real EpsV = Adaptor3d_HSurfaceTool::VResolution(Surf,Precision::Confusion());
+  Standard_Real Preci  = Min(EpsU,EpsV);
+  //  Standard_Real Fleche = 5.e-1;
+  //  Standard_Real Pas    = 5.e-2;
+  Standard_Real Fleche = 0.01;
+  Standard_Real Pas    = 0.005; 
+  //   lbr: Il y avait Pas 0.2 -> Manque des Inters sur restr ; devrait faire un mini de 5 pts par lignes
+  //-- le 23 janvier 98 0.05 -> 0.01
+
+
+  //-- ******************************************************************************** Janvier 98
+  Bnd_Box B1; Standard_Boolean Box1OK = Standard_True;
+
+  Standard_Real Uinf = Surf->FirstUParameter(); 
+  Standard_Real Vinf = Surf->FirstVParameter();
+  Standard_Real Usup = Surf->LastUParameter();
+  Standard_Real Vsup = Surf->LastVParameter();
+
+  Standard_Boolean Uinfinfinite = Precision::IsNegativeInfinite(Uinf);
+  Standard_Boolean Usupinfinite = Precision::IsPositiveInfinite(Usup);
+  Standard_Boolean Vinfinfinite = Precision::IsNegativeInfinite(Vinf);
+  Standard_Boolean Vsupinfinite = Precision::IsPositiveInfinite(Vsup);
+
+  if( Uinfinfinite || Usupinfinite || Vinfinfinite || Vsupinfinite) { 
+    Box1OK = Standard_False;
+  }
+  else { 
+    BndLib_AddSurface::Add(Surf->Surface(),1e-8,B1);
+  }
+  Standard_Real x0,y0,z0,x1,y1,z1,dx,dy,dz;
+  if(Box1OK) { 
+    B1.Get(x0,y0,z0,x1,y1,z1);
+    dx=x1-x0;
+    dy=y1-y0;
+    dz=z1-z0;
+  } 
+  else { 
+    dx=dy=dz=1.0;
+  }
+  if(dx<dy) dx=dy;
+  if(dx<dz) dx=dz;
+  if(dx>10000.0) dx=10000.0;
+  Fleche*=dx;
+  TolArc*=dx;
+  //-- ********************************************************************************
+
+
+  //gp_Pnt valpt;
+
+  //jag 940616  SFunc.Set(1.e-8); // tolerance sur la fonction
+  mySFunc.Set(Precision::Confusion()); // tolerance sur la fonction
+
+  Standard_Boolean RecheckOnRegularity = Standard_True;
+  solrst.Perform(myAFunc,Domain,TolArc,TolArc,RecheckOnRegularity);
+
+  if (!solrst.IsDone()) {
+    return;
+  }
+
+  NbPointRst = solrst.NbPoints();
+  IntSurf_SequenceOfPathPoint seqpdep;
+  TColStd_Array1OfInteger Destination(1,NbPointRst+1);
+  Destination.Init(0);
+  if (NbPointRst != 0) {
+    ComputeTangency(solrst,Domain,mySFunc,seqpdep,Destination);
+  }
+
+  //jag 940616  solins.Perform(SFunc,Surf,Domain,1.e-6); // 1.e-6 : tolerance dans l espace.
+  solins.Perform(mySFunc,Surf,Domain,Precision::Confusion());
+
+  NbPointIns = solins.NbPoints();
+  IntSurf_SequenceOfInteriorPoint seqpins;
+
+  if (NbPointIns != 0) {
+    Standard_Boolean bKeepAllPoints = Standard_False;
+    //IFV begin
+    if(solrst.NbSegments() <= 0) {
+      if(mySFunc.FunctionType() == Contap_ContourStd) {
+        const Handle(Adaptor3d_HSurface)& Surf = mySFunc.Surface();
+        if(Adaptor3d_HSurfaceTool::GetType(Surf) == GeomAbs_Torus) {
+          gp_Torus aTor = Adaptor3d_HSurfaceTool::Torus(Surf);
+          gp_Dir aTorDir = aTor.Axis().Direction();
+          gp_Dir aProjDir = mySFunc.Direction();
+
+          if(aTorDir.Dot(aProjDir) < Precision::Confusion()) {
+            bKeepAllPoints = Standard_True;
+          }
+        }
+      }
+    }
+
+    if(bKeepAllPoints) {
+      Standard_Integer Nbp = solins.NbPoints(), indp;
+      for (indp=1; indp <= Nbp; indp++) {
+        const IntSurf_InteriorPoint& pti = solins.Value(indp);
+        seqpins.Append(pti);
+      }
+    }
+    //IFV - end
+    else {
+      KeepInsidePoints(solins,solrst,mySFunc,seqpins);
+    }
+  }
+
+  if (seqpdep.Length() != 0 || seqpins.Length() != 0) {
+
+    Contap_TheIWalking iwalk(Preci,Fleche,Pas);
+    iwalk.Perform(seqpdep,seqpins,mySFunc ,Surf);
+    if(!iwalk.IsDone()) {
+      return;
+    }
+
+    Nblines = iwalk.NbLines();
+    for (j=1; j<=Nblines; j++) {
+      IntSurf_TypeTrans TypeTransOnS = IntSurf_Undecided;
+      const Handle(Contap_TheIWLineOfTheIWalking)& iwline = iwalk.Value(j);
+      Nbpts = iwline->NbPoints();
+      theline.SetLineOn2S(iwline->Line());
+
+      // jag 941018 On calcule une seule fois la transition
+
+      tgline = iwline->TangentVector(k);
+      iwline->Line()->Value(k).ParametersOnS2(U,V); 
+      TypeTransOnS = ComputeTransitionOnLine(mySFunc,U,V,tgline);
+      theline.SetTransitionOnS(TypeTransOnS);
+
+      //---------------------------------------------------------------------
+      //-- On ajoute a la liste des vertex les 1er et dernier points de la  -
+      //-- ligne de cheminement si ceux-ci ne sont pas presents             -
+      //---------------------------------------------------------------------
+
+      if (iwline->HasFirstPoint()) {
+        indfirst = iwline->FirstPointIndex();
+        const IntSurf_PathPoint& PPoint = seqpdep(indfirst);
+        Standard_Integer themult = PPoint.Multiplicity();
+        for (i=NbPointRst; i>=1; i--) {
+          if (Destination(i) == indfirst) {
+            PPoint.Parameters(themult,U,V);
+            ptdeb.SetValue(PPoint.Value(),U,V);
+            ptdeb.SetParameter(1.0);
+
+            const Contap_ThePathPointOfTheSearch& PStart = solrst.Point(i);
+            const Handle(Adaptor2d_HCurve2d)& currentarc = PStart.Arc();
+            currentparam = PStart.Parameter();
+            if (!iwline->IsTangentAtBegining()) {
+
+              Contap_HCurve2dTool::D1(currentarc,currentparam,pt2d,d2d);
+              Contap_SurfProps::DerivAndNorm(Surf,pt2d.X(),pt2d.Y(),
+                ptonsurf,d1u,d1v,normale);
+              tgtrst = d2d.X()*d1u;
+              tgtrst.Add(d2d.Y()*d1v);
+
+              IntSurf::MakeTransition(PPoint.Direction3d(),tgtrst,normale,
+                TLine,TArc);
+
+            }
+            else {// a voir. En effet, on a cheminer. Si on est sur un point 
+              // debut, on sait qu'on rentre dans la matiere
+              TLine.SetValue();
+              TArc.SetValue();
+            }
+
+            ptdeb.SetArc(currentarc,currentparam,TLine,TArc);
+
+            if (!solrst.Point(i).IsNew()) {
+              ptdeb.SetVertex(PStart.Vertex());
+            }
+            theline.Add(ptdeb);
+            themult--;
+          }
+        }
+      }
+      else { 
+        iwline->Value(1).ParametersOnS2(U,V);
+        ptdeb.SetValue(theline.Point(1).Value(),U,V);
+        ptdeb.SetParameter(1.0);
+        theline.Add(ptdeb);
+      }
+
+      if (iwline->HasLastPoint()) {
+        indlast = iwline->LastPointIndex();
+        const IntSurf_PathPoint& PPoint = seqpdep(indlast);
+        Standard_Integer themult = PPoint.Multiplicity();
+        for (i=NbPointRst; i>=1; i--) {
+          if (Destination(i) == indlast) {
+            PPoint.Parameters(themult,U,V);
+            ptfin.SetValue(PPoint.Value(),U,V);
+            ptfin.SetParameter((Standard_Real)(Nbpts));
+            const Contap_ThePathPointOfTheSearch& PStart = solrst.Point(i);
+            const Handle(Adaptor2d_HCurve2d)& currentarc = PStart.Arc();
+            currentparam = PStart.Parameter();
+
+            if (!iwline->IsTangentAtEnd()) {
+
+              Contap_HCurve2dTool::D1(currentarc,currentparam,pt2d,d2d);
+
+              Contap_SurfProps::DerivAndNorm(Surf,pt2d.X(),pt2d.Y(),
+                ptonsurf,d1u,d1v,normale);
+              tgtrst = d2d.X()*d1u;
+              tgtrst.Add(d2d.Y()*d1v);
+              IntSurf::MakeTransition(PPoint.Direction3d().Reversed(),
+                tgtrst,normale,TLine,TArc);
+            }
+            else {
+              TLine.SetValue();
+              TArc.SetValue();
+            }
+
+            ptfin.SetArc(currentarc,currentparam,TLine,TArc);
+
+            if (!solrst.Point(i).IsNew()) {
+              ptfin.SetVertex(PStart.Vertex());
+            }
+            theline.Add(ptfin);
+            themult--;
+          }
+        }
+      }
+      else { 
+        iwline->Value(Nbpts).ParametersOnS2(U,V);
+        ptfin.SetValue(theline.Point(Nbpts).Value(),U,V);
+        ptfin.SetParameter((Standard_Real)(Nbpts));
+        theline.Add(ptfin);
+      }
+
+      ComputeInternalPoints(theline,mySFunc,EpsU,EpsV);
+      LineConstructor(slin,Domain,theline,Surf); //-- lbr
+      //-- slin.Append(theline);
+      theline.ResetSeqOfVertex();
+    }
+
+
+    Nblines = slin.Length();
+    for (j=1; j<=Nblines-1; j++) {
+      const Contap_Line& theli = slin(j);
+      Nbvt1 = theli.NbVertex();
+      for (ivt1=1; ivt1<=Nbvt1; ivt1++) {
+        if (!theli.Vertex(ivt1).IsOnArc()) {
+          const gp_Pnt& pttg1 = theli.Vertex(ivt1).Value();
+
+          for (k=j+1; k<=Nblines;k++) {
+            const Contap_Line& theli2 = slin(k);
+            Nbvt2 = theli2.NbVertex();
+            for (ivt2=1; ivt2<=Nbvt2; ivt2++) {
+              if (!theli2.Vertex(ivt2).IsOnArc()) {
+                const gp_Pnt& pttg2 = theli2.Vertex(ivt2).Value();
+
+                if (pttg1.Distance(pttg2) <= TolArc) {
+                  theli.Vertex(ivt1).SetMultiple();
+                  theli2.Vertex(ivt2).SetMultiple();
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  // jag 940620 On ajoute le traitement des restrictions solutions.
+
+  if (solrst.NbSegments() !=0) {
+    ProcessSegments(solrst,slin,TolArc,mySFunc,Domain);
+  }
+
+
+  // Ajout crad pour depanner CMA en attendant mieux
+  if (solrst.NbSegments() !=0) {
+
+    Nblines = slin.Length();
+    for (j=1; j<=Nblines; j++) {
+      const Contap_Line& theli = slin(j);
+      if (theli.TypeContour() == Contap_Walking) {
+        Nbvt1 = theli.NbVertex();
+        for (ivt1=1; ivt1<=Nbvt1; ivt1++) {
+          Contap_Point& ptvt = theli.Vertex(ivt1);
+          if (!ptvt.IsOnArc() && !ptvt.IsMultiple()) {
+            Standard_Real Up,Vp;
+            ptvt.Parameters(Up,Vp);
+            gp_Pnt2d toproj(Up,Vp);
+            Standard_Boolean projok;
+            for (k=1; k<=Nblines;k++) {
+              if (slin(k).TypeContour() == Contap_Restriction) {
+                const Handle(Adaptor2d_HCurve2d)& thearc = slin(k).Arc();
+                Standard_Real paramproj;
+                gp_Pnt2d Ptproj;
+                projok = Contap_HContTool::Project(thearc,toproj,paramproj,Ptproj);
+
+                if (projok) {
+                  Standard_Real dist = Ptproj.Distance(gp_Pnt2d(Up,Vp));
+                  if (dist <= Preci) {
+                    // Calcul de la transition
+
+                    Contap_HCurve2dTool::D1(thearc,paramproj,Ptproj,d2d);
+                    //             Adaptor3d_HSurfaceTool::D1(Surf,Ptproj.X(),Ptproj.Y(),
+                    //                                ptonsurf,d1u,d1v);
+                    //             normale = d1u.Crossed(d1v);
+
+                    Contap_SurfProps::DerivAndNorm
+                      (Surf,Ptproj.X(),Ptproj.Y(),ptonsurf,d1u,d1v,normale);
+
+                    tgtrst = d2d.X()*d1u;
+                    tgtrst.Add(d2d.Y()*d1v);
+                    Standard_Integer Paraml =
+                      (Standard_Integer) ptvt.ParameterOnLine();
+
+                    if (Paraml == theli.NbPnts()) {
+                      tgline = gp_Vec(theli.Point(Paraml-1).Value(),
+                        ptvt.Value());
+                    }
+                    else {
+                      tgline = gp_Vec(ptvt.Value(),
+                        theli.Point(Paraml+1).Value());
+                    }
+                    IntSurf::MakeTransition(tgline,tgtrst,normale,
+                      TLine,TArc);
+                    ptvt.SetArc(thearc,paramproj,TLine,TArc);
+                    ptvt.SetMultiple();
+                    ptdeb.SetValue(ptonsurf,Ptproj.X(),Ptproj.Y());
+                    ptdeb.SetParameter(paramproj);
+                    ptdeb.SetMultiple();
+                    slin(k).Add(ptdeb);
+                    break;
+                  }
+                  else {
+                    projok = Standard_False;
+                  }
+                }
+              }
+              else {
+                projok = Standard_False;
+              }
+              if (projok) {
+                break;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  done = Standard_True;
+}
+
+static Standard_Boolean FindLine(Contap_Line& Line,
+                                 const Handle(Adaptor3d_HSurface)& Surf,
+                                 const gp_Pnt2d& Pt2d,
+                                 gp_Pnt& Ptref,
+                                 Standard_Real& Paramin,
+                                 gp_Vec& Tgmin,
+                                 gp_Vec& Norm)
+{
+  //  Standard_Integer i;
+  gp_Pnt pt,ptmin;
+  gp_Vec tg;
+  Standard_Real para,dist;
+  Standard_Real dismin = RealLast();
+
+  Contap_SurfProps::Normale(Surf,Pt2d.X(),Pt2d.Y(),Ptref,Norm);
+
+  if (Line.TypeContour() == Contap_Lin) {
+    gp_Lin lin(Line.Line());
+    para = ElCLib::Parameter(lin,Ptref);
+    ElCLib::D1(para,lin,pt,tg);
+    dist = pt.Distance(Ptref) + Abs(Norm.Dot(lin.Direction()));
+  }
+  else { // Contap__Circle
+    gp_Circ cir(Line.Circle());
+    para = ElCLib::Parameter(cir,Ptref);
+    ElCLib::D1(para,cir,pt,tg);
+    dist = pt.Distance(Ptref)+Abs(Norm.Dot(tg/cir.Radius()));
+  }
+  if (dist < dismin) {
+    dismin = dist;
+    Paramin = para;
+    ptmin = pt;
+    Tgmin = tg;
+  }
+  if (ptmin.SquareDistance(Ptref) <= Tolpetit) {
+    return Standard_True;
+  }
+  else {
+    return Standard_False;
+  }
+}
+
+
+static void PutPointsOnLine (const Contap_TheSearch& solrst,
+                             const Handle(Adaptor3d_HSurface)& Surf,
+                             Contap_TheSequenceOfLine& slin)
+
+{
+  Standard_Integer i,l;//,index; 
+  Standard_Integer NbPoints = solrst.NbPoints();
+
+  Standard_Real theparam;
+
+  IntSurf_Transition TLine,TArc;
+  Standard_Boolean goon;
+
+  gp_Pnt2d pt2d;
+  gp_Vec2d d2d;
+
+  gp_Pnt ptonsurf;
+  gp_Vec vectg,normale,tgtrst;
+  Standard_Real paramlin = 0.0;
+
+
+  Standard_Integer nbLin = slin.Length();
+  for(l=1;l<=nbLin;l++) { 
+    Contap_Line& Line=slin.ChangeValue(l);
+    for (i=1; i<= NbPoints; i++) {
+
+      const Contap_ThePathPointOfTheSearch& PStart = solrst.Point(i);
+      const Handle(Adaptor2d_HCurve2d)& thearc = PStart.Arc();
+      theparam = PStart.Parameter();
+
+      Contap_HCurve2dTool::D1(thearc,theparam,pt2d,d2d);
+      goon = FindLine(Line,Surf,pt2d,ptonsurf,paramlin,vectg,normale);
+
+      Contap_Point PPoint;
+
+      if (goon) {
+        gp_Vec d1u,d1v;
+        gp_Pnt bidpt;
+        Adaptor3d_HSurfaceTool::D1(Surf,pt2d.X(),pt2d.Y(),bidpt,d1u,d1v);
+        PPoint.SetValue(ptonsurf,pt2d.X(),pt2d.Y());
+        if (normale.Magnitude() < RealEpsilon()) {
+          TLine.SetValue();
+          TArc.SetValue();
+        }
+        else {
+          // Petit test qui devrait permettre de bien traiter les pointes
+          // des cones, et les sommets d`une sphere. Il faudrait peut-etre
+          // rajouter une methode dans SurfProps
+
+          if (Abs(d2d.Y()) <= Precision::Confusion()) {
+            tgtrst = d1v.Crossed(normale);
+            if(d2d.X() < 0.0) 
+              tgtrst.Reverse();
+          }
+          else {
+            tgtrst.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
+          }
+          IntSurf::MakeTransition(vectg,tgtrst,normale,TLine,TArc);
+        }
+
+        PPoint.SetArc(thearc,theparam, TLine, TArc);
+        PPoint.SetParameter(paramlin);
+        if (!PStart.IsNew()) {
+          PPoint.SetVertex(PStart.Vertex());
+        }
+        Line.Add(PPoint);
+      }
+    }
+  }
+}
+
+
+//----------------------------------------------------------------------------------
+//-- Orientation des contours Apparents quand ceux-ci sont des lignes ou des cercles
+//-- On prend un point de la ligne ou du cercle ---> P 
+//-- On projete ce point sur la surface P ---> u,v
+//-- et on evalue la transition au point u,v
+//----------------------------------------------------------------------------------
+
+IntSurf_TypeTrans ComputeTransitionOngpLine
+(Contap_SurfFunction& SFunc,
+ const gp_Lin& L)
+{ 
+  const Handle(Adaptor3d_HSurface)& Surf=SFunc.Surface();
+  GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(Surf);
+  gp_Pnt P;
+  gp_Vec T;
+  ElCLib::D1(0.0,L,P,T);
+  Standard_Real u = 0.,v = 0.;
+  switch (typS) {
+  case GeomAbs_Cylinder: {
+    ElSLib::Parameters(Adaptor3d_HSurfaceTool::Cylinder(Surf),P,u,v);
+    break;
+                         }
+  case GeomAbs_Cone: {
+    ElSLib::Parameters(Adaptor3d_HSurfaceTool::Cone(Surf),P,u,v);
+    break;
+                     }
+  case GeomAbs_Sphere: { 
+    ElSLib::Parameters(Adaptor3d_HSurfaceTool::Sphere(Surf),P,u,v);
+    break;
+                       }
+  default:
+    break;
+  }
+  return(ComputeTransitionOnLine(SFunc,u,v,T));
+}
+
+
+IntSurf_TypeTrans ComputeTransitionOngpCircle
+(Contap_SurfFunction& SFunc,
+ const gp_Circ& C)
+{ 
+  const Handle(Adaptor3d_HSurface)& Surf=SFunc.Surface();
+  GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(Surf);
+  gp_Pnt P;
+  gp_Vec T;
+  ElCLib::D1(0.0,C,P,T);
+  Standard_Real u = 0.,v = 0.;
+  switch (typS) {
+  case GeomAbs_Cylinder: {
+    ElSLib::Parameters(Adaptor3d_HSurfaceTool::Cylinder(Surf),P,u,v);
+    break;
+                         }
+  case GeomAbs_Cone: {
+    ElSLib::Parameters(Adaptor3d_HSurfaceTool::Cone(Surf),P,u,v);
+    break;
+                     }
+  case GeomAbs_Sphere: { 
+    ElSLib::Parameters(Adaptor3d_HSurfaceTool::Sphere(Surf),P,u,v);
+    break;
+                       }
+  default:
+    break;
+  }
+  return(ComputeTransitionOnLine(SFunc,u,v,T));
+}
+
+
+void Contap_Contour::PerformAna(const Handle(Adaptor3d_TopolTool)& Domain)
+{
+
+  done = Standard_False;
+  slin.Clear();
+
+  Standard_Real TolArc = 1.e-5;
+
+  Standard_Integer nbCont, nbPointRst, i;
+  //gp_Circ cirsol;
+  //gp_Lin linsol;
+  Contap_ContAna contana;
+  Contap_Line theline;
+  const Handle(Adaptor3d_HSurface)& Surf = mySFunc.Surface();
+  Contap_TFunction TypeFunc(mySFunc.FunctionType());
+  Standard_Boolean PerformSolRst = Standard_True;
+
+  GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(Surf);
+
+  switch (typS) {
+  case GeomAbs_Plane: 
+    {
+      gp_Pln pl(Adaptor3d_HSurfaceTool::Plane(Surf));
+      switch (TypeFunc) {
+  case Contap_ContourStd:
+    {
+      gp_Dir Dirpln(pl.Axis().Direction());
+      if (Abs(mySFunc.Direction().Dot(Dirpln)) > Precision::Angular()) {
+        // Aucun point du plan n`est solution, en particulier aucun point
+        // sur restriction.
+        PerformSolRst = Standard_False;
+      }
+    }
+    break;
+  case Contap_ContourPrs:
+    {
+      gp_Pnt Eye(mySFunc.Eye());
+      if (pl.Distance(Eye) > Precision::Confusion()) {
+        // Aucun point du plan n`est solution, en particulier aucun point
+        // sur restriction.
+        PerformSolRst = Standard_False;
+      }            
+    }
+    break;
+  case Contap_DraftStd:
+    {
+      gp_Dir Dirpln(pl.Axis().Direction());
+      Standard_Real Sina = Sin(mySFunc.Angle());
+      if (Abs(mySFunc.Direction().Dot(Dirpln)+ Sina) > //voir SurfFunction
+        Precision::Angular()) {
+
+          PerformSolRst = Standard_False;
+      }
+    }
+    break;
+  case Contap_DraftPrs:
+  default:
+    {
+    }
+      }
+    }
+    break;
+
+  case GeomAbs_Sphere:
+    {
+      switch (TypeFunc) {
+  case Contap_ContourStd:
+    {
+      contana.Perform(Adaptor3d_HSurfaceTool::Sphere(Surf),mySFunc.Direction());
+    }
+    break;
+  case Contap_ContourPrs:
+    {
+      contana.Perform(Adaptor3d_HSurfaceTool::Sphere(Surf),mySFunc.Eye());
+    }
+    break;
+  case Contap_DraftStd:
+    {
+      contana.Perform(Adaptor3d_HSurfaceTool::Sphere(Surf),
+        mySFunc.Direction(),mySFunc.Angle());
+    }
+    break;
+  case Contap_DraftPrs:
+  default:
+    {
+    }
+      }
+    }
+    break;
+
+  case GeomAbs_Cylinder:
+    {
+      switch (TypeFunc) {
+  case Contap_ContourStd:
+    {
+      contana.Perform(Adaptor3d_HSurfaceTool::Cylinder(Surf),mySFunc.Direction());
+    }
+    break;
+  case Contap_ContourPrs:
+    {
+      contana.Perform(Adaptor3d_HSurfaceTool::Cylinder(Surf),mySFunc.Eye());
+    }
+    break;
+  case Contap_DraftStd:
+    {
+      contana.Perform(Adaptor3d_HSurfaceTool::Cylinder(Surf),
+        mySFunc.Direction(),mySFunc.Angle());
+    }
+    break;
+  case Contap_DraftPrs:
+  default:
+    {
+    }
+      }
+    }
+    break;
+
+  case GeomAbs_Cone:
+    {
+      switch (TypeFunc) {
+  case Contap_ContourStd:
+    {
+      contana.Perform(Adaptor3d_HSurfaceTool::Cone(Surf),mySFunc.Direction());
+    }
+    break;
+  case Contap_ContourPrs:
+    {
+      contana.Perform(Adaptor3d_HSurfaceTool::Cone(Surf),mySFunc.Eye());
+    }
+    break;
+  case Contap_DraftStd:
+    {
+      contana.Perform(Adaptor3d_HSurfaceTool::Cone(Surf),
+        mySFunc.Direction(),mySFunc.Angle());
+    }
+    break;
+  case Contap_DraftPrs:
+  default:
+    {
+    }
+      }
+  default:
+    break;
+    }
+    break;
+  }
+
+  if (typS != GeomAbs_Plane) {
+
+    if (!contana.IsDone()) {
+      return;
+    }
+
+    nbCont = contana.NbContours();
+
+    if (contana.NbContours() == 0) {
+      done = Standard_True;
+      return;
+    }
+
+    GeomAbs_CurveType typL = contana.TypeContour();
+    if (typL == GeomAbs_Circle) {
+      theline.SetValue(contana.Circle());
+      IntSurf_TypeTrans TransCircle;
+      TransCircle = ComputeTransitionOngpCircle(mySFunc,contana.Circle());
+      theline.SetTransitionOnS(TransCircle);
+      slin.Append(theline);
+    }
+    else if (typL == GeomAbs_Line) {
+      for (i=1; i<=nbCont; i++) {
+        theline.SetValue(contana.Line(i));
+        IntSurf_TypeTrans TransLine;
+        TransLine = ComputeTransitionOngpLine(mySFunc,contana.Line(i));
+        theline.SetTransitionOnS(TransLine);
+        slin.Append(theline);
+        theline.Clear();
+      }
+
+      /*
+      if (typS == GeomAbs_Cone) {
+      Standard_Real u,v;
+      gp_Cone thecone(Adaptor3d_HSurfaceTool::Cone(Surf));
+      ElSLib::Parameters(thecone,thecone.Apex(),u,v);
+      Contap_Point vtxapex(thecone.Apex(),u,v);
+      vtxapex.SetInternal();
+      vtxapex.SetMultiple();
+      for (i=1; i<=nbCont i++) {
+      slin.ChangeValue(i).Add(vtxapex);
+      }
+      }
+      */
+    }
+  }
+
+  if(PerformSolRst) { 
+
+    solrst.Perform(myAFunc,Domain,TolArc,TolArc);
+    if (!solrst.IsDone()) {
+      return;
+    }
+    nbPointRst = solrst.NbPoints();
+
+    if (nbPointRst != 0) {
+      PutPointsOnLine(solrst,Surf,slin);
+    }
+
+    if (solrst.NbSegments() !=0) {
+      ProcessSegments(solrst,slin,TolArc,mySFunc,Domain);
+    }
+
+
+    //-- lbr 
+    //Standard_Boolean oneremov;
+    Standard_Integer nblinto = slin.Length();
+    TColStd_SequenceOfInteger SeqToDestroy;
+
+    //-- cout<<" Construct Contour_3   nblin = "<<nblinto<<endl;
+    for(i=1; i<= nblinto ; i++) { 
+      //-- cout<<" nbvtx : "<<slin.Value(i).NbVertex()<<endl;
+      //--if(slin.Value(i).NbVertex() > 1) { 
+      if(slin.Value(i).TypeContour() != Contap_Restriction) { 
+        LineConstructor(slin,Domain,slin.ChangeValue(i),Surf);
+        SeqToDestroy.Append(i);
+      }
+      //-- }
+    }
+    for(i=SeqToDestroy.Length(); i>=1; i--) { 
+      slin.Remove(SeqToDestroy.Value(i));
+    } 
+  }
+
+  done = Standard_True;
+}
+
similarity index 75%
rename from src/Contap/Contap_ContourGen.lxx
rename to src/Contap/Contap_Contour.lxx
index 8e41d2d..7ba89c0 100644 (file)
 
 #include <StdFail_NotDone.hxx>
 
-inline Standard_Boolean Contap_ContourGen::IsDone () const
+inline Standard_Boolean Contap_Contour::IsDone () const
 {
   return done;
 }
 
-inline Standard_Boolean Contap_ContourGen::IsEmpty () const
+inline Standard_Boolean Contap_Contour::IsEmpty () const
 {
   return NbLines()==0;
 }
 
-inline Standard_Integer Contap_ContourGen::NbLines () const
+inline Standard_Integer Contap_Contour::NbLines () const
 {
   if (!done) {StdFail_NotDone::Raise();}
   return slin.Length();
 }
 
-inline const Contap_TheLine & 
-Contap_ContourGen::Line (const Standard_Integer Index) const
+inline const Contap_Line & 
+Contap_Contour::Line (const Standard_Integer Index) const
 {
   if (!done) {StdFail_NotDone::Raise();}
   return slin(Index);
 }
 
-inline Contap_TheSurfFunction & 
-Contap_ContourGen::SurfaceFunction ()
+inline Contap_SurfFunction & 
+Contap_Contour::SurfaceFunction ()
 {
   if (!done) {StdFail_NotDone::Raise();}
   return mySFunc;
diff --git a/src/Contap/Contap_ContourGen.gxx b/src/Contap/Contap_ContourGen.gxx
deleted file mode 100644 (file)
index 17b437c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Created on: 1993-02-05
-// Created by: Jacques GOUSSARD
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <ElCLib.hxx>
-
-#include <gp_Pln.hxx>
-#include <gp_Sphere.hxx>
-#include <gp_Cylinder.hxx>
-#include <gp_Cone.hxx>
-#include <gp_Lin.hxx>
-#include <gp_Circ.hxx>
-#include <Contap_ContAna.hxx>
-#include <math_FunctionSetRoot.hxx>
-#include <IntSurf.hxx>
-
-#include <Contap_ContourGen_1.gxx>
-#include <Contap_ContourGen_2.gxx>
-#include <Contap_ContourGen_3.gxx>
diff --git a/src/Contap/Contap_ContourGen_1.gxx b/src/Contap/Contap_ContourGen_1.gxx
deleted file mode 100644 (file)
index 657121e..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-// Created on: 1993-02-05
-// Created by: Jacques GOUSSARD
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard_ConstructionError.hxx>
-
-
-Contap_ContourGen::Contap_ContourGen () : 
-       done(Standard_False),modeset(Standard_False)
-{}
-
-Contap_ContourGen::Contap_ContourGen (const gp_Vec& Direction) :
-
-       done(Standard_False),modeset(Standard_True)
-{
-  mySFunc.Set(Direction);
-  myAFunc.Set(Direction);
-}
-
-
-Contap_ContourGen::Contap_ContourGen (const gp_Vec& Direction,
-                               const Standard_Real Angle) :
-
-       done(Standard_False),modeset(Standard_True)
-{
-  mySFunc.Set(Direction,Angle);
-  myAFunc.Set(Direction,Angle);
-}
-
-Contap_ContourGen::Contap_ContourGen (const gp_Pnt& Eye) :
-
-       done(Standard_False),modeset(Standard_True)
-{
-  mySFunc.Set(Eye);
-  myAFunc.Set(Eye);
-}
-
-
-Contap_ContourGen::Contap_ContourGen (const TheSurface& Surf,
-                               const Handle(TheTopolTool)& Domain,
-                               const gp_Vec& Direction) :
-
-       done(Standard_False),modeset(Standard_True)
-{
-  Perform(Surf,Domain,Direction);
-}
-
-
-Contap_ContourGen::Contap_ContourGen (const TheSurface& Surf,
-                               const Handle(TheTopolTool)& Domain,
-                               const gp_Vec& Direction,
-                               const Standard_Real Angle) :
-
-       done(Standard_False),modeset(Standard_True)
-{
-  Perform(Surf,Domain,Direction,Angle);
-}
-
-
-Contap_ContourGen::Contap_ContourGen (const TheSurface& Surf,
-                               const Handle(TheTopolTool)& Domain,
-                               const gp_Pnt& Eye) :
-
-       done(Standard_False),modeset(Standard_True)
-{
-  Perform(Surf,Domain,Eye);
-}
-
-
-void Contap_ContourGen::Init (const gp_Vec& Direction)
-
-{
-  done = Standard_False;
-  modeset = Standard_True;
-  mySFunc.Set(Direction);
-  myAFunc.Set(Direction);
-}
-
-
-void Contap_ContourGen::Init(const gp_Vec& Direction,
-                         const Standard_Real Angle)
-{
-  done = Standard_False;
-  modeset = Standard_True;
-  mySFunc.Set(Direction,Angle);
-  myAFunc.Set(Direction,Angle);
-}
-
-void Contap_ContourGen::Init (const gp_Pnt& Eye)
-{
-  done = Standard_False;
-  modeset = Standard_True;
-  mySFunc.Set(Eye);
-  myAFunc.Set(Eye);
-}
-
-
-void Contap_ContourGen::Perform (const TheSurface& Surf,
-                             const Handle(TheTopolTool)& Domain)
-{
-  if (!modeset) {Standard_ConstructionError::Raise();}
-  mySFunc.Set(Surf);
-  myAFunc.Set(Surf);
-
-  GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(Surf);
-  switch (typS) {
-  case GeomAbs_Plane:
-  case GeomAbs_Sphere:
-  case GeomAbs_Cylinder:
-  case GeomAbs_Cone:
-    {
-      PerformAna(Domain); //Surf,Domain,Direction,0.,gp_Pnt(0.,0.,0.),1);
-    }
-    break;
-
-  default:
-    {
-      Perform(Domain); //Surf,Domain,Direction,0.,gp_Pnt(0.,0.,0.),1);
-    }
-    break;
-  }
-
-}
-                             
-
-void Contap_ContourGen::Perform (const TheSurface& Surf,
-                             const Handle(TheTopolTool)& Domain,
-                             const gp_Vec& Direction)
-
-{
-  Init(Direction);
-  Perform(Surf,Domain);
-}
-
-void Contap_ContourGen::Perform (const TheSurface& Surf,
-                             const Handle(TheTopolTool)& Domain,
-                             const gp_Vec& Direction,
-                             const Standard_Real Angle)
-
-{
-  Init(Direction,Angle);
-  Perform(Surf,Domain);
-}
-
-
-void Contap_ContourGen::Perform (const TheSurface& Surf,
-                             const Handle(TheTopolTool)& Domain,
-                             const gp_Pnt& Eye)
-
-{
-  Init(Eye);
-  Perform(Surf,Domain);
-}
-
-
diff --git a/src/Contap/Contap_ContourGen_2.gxx b/src/Contap/Contap_ContourGen_2.gxx
deleted file mode 100644 (file)
index 1168dc4..0000000
+++ /dev/null
@@ -1,1577 +0,0 @@
-// Created on: 1993-02-05
-// Created by: Jacques GOUSSARD
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <math_Vector.hxx>
-#include <math_Matrix.hxx>
-#include <TopTrans_CurveTransition.hxx>
-#include <TopAbs_State.hxx>
-#include <TopAbs_Orientation.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <gp_Pnt2d.hxx>
-#include <gp.hxx>
-#include <IntSurf_InteriorPoint.hxx>
-
-#include <IntSurf_TypeTrans.hxx>
-
-#include <Precision.hxx>
-
-#include <BndLib_AddSurface.hxx>
-#include <Bnd_Box.hxx>
-
-
-#include <ElSLib.hxx>
-
-#define tole 5.e-6
-
-
-
-
-
-static  IntSurf_TypeTrans ComputeTransitionOnLine
-  (Contap_TheSurfFunction&,
-   const Standard_Real,
-   const Standard_Real,
-   const gp_Vec&);
-
-
-static IntSurf_TypeTrans ComputeTransitionOngpCircle
-  (Contap_TheSurfFunction&,
-   const gp_Circ&);
-
-
-static IntSurf_TypeTrans ComputeTransitionOngpLine
-  (Contap_TheSurfFunction&,
-   const gp_Lin&);
-
-
-static void ComputeInternalPoints
-  (Contap_TheLine& Line,
-   Contap_TheSurfFunction&,
-   const Standard_Real ureso,
-   const Standard_Real vreso);
-
-
-static void ComputeInternalPointsOnRstr
-  (Contap_TheLine&,
-   const Standard_Real,
-   const Standard_Real,
-   Contap_TheSurfFunction&);
-
-static void ProcessSegments (const Contap_TheSearch&,
-                            Contap_TheSequenceOfLine&,
-                            const Standard_Real,
-                            Contap_TheSurfFunction&,
-                            const Handle(TheTopolTool)&);
-
-//-- --------------------------------------------------------------------------------
-//-- Recherche des portions utiles sur les lignes 
-
-
-static void Recadre(const TheSurface& myHS1,
-                   Standard_Real& u1,
-                   Standard_Real& v1) { 
-  Standard_Real f,l,lmf;
-  GeomAbs_SurfaceType typs1 = myHS1->GetType();
-
-  Standard_Boolean myHS1IsUPeriodic,myHS1IsVPeriodic;
-  switch (typs1) { 
-  case GeomAbs_Cylinder:
-  case GeomAbs_Cone:
-  case GeomAbs_Sphere: 
-    { 
-      myHS1IsUPeriodic = Standard_True;
-      myHS1IsVPeriodic = Standard_False;
-      break;
-    }
-  case GeomAbs_Torus:
-    {
-      myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_True;
-      break;
-    }
-  default:
-     {
-       myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_False;
-       break;
-     }
-  }
-  if(myHS1IsUPeriodic) {
-    lmf = M_PI+M_PI; //-- myHS1->UPeriod();
-    f = myHS1->FirstUParameter();
-    l = myHS1->LastUParameter();
-    while(u1 < f) { u1+=lmf; } 
-    while(u1 > l) { u1-=lmf; }
-  }
-  if(myHS1IsVPeriodic) {
-    lmf = M_PI+M_PI; //-- myHS1->VPeriod(); 
-    f = myHS1->FirstVParameter();
-    l = myHS1->LastVParameter();
-    while(v1 < f) { v1+=lmf; } 
-    while(v1 > l) { v1-=lmf; }
-  }
-}
-
-
-static void LineConstructor(Contap_TheSequenceOfLine& slin,
-                           const Handle(TheTopolTool)& Domain,
-                           Contap_TheLine& L,
-                           const TheSurface& Surf) { 
-  
-  //-- ------------------------------------------------------------
-  //-- on decoupe la ligne en portions  entre 2 vertex 
-  Standard_Real Tol = Precision::PConfusion();
-  Contap_IType typl = L.TypeContour();
-  //-- cout<<"\n ----------- Ligne Constructor "<<endl;
-  if(typl == Contap_Walking) { 
-    Standard_Real u1,v1,u2,v2;
-    Standard_Integer nbvtx = L.NbVertex();
-    //-- cout<<" WLine -> "<<nbvtx<<" vtx"<<endl;
-    for(Standard_Integer i=1;i<nbvtx;i++) { 
-      Standard_Integer firstp = (Standard_Integer) L.Vertex(i).ParameterOnLine();
-      Standard_Integer lastp =  (Standard_Integer) L.Vertex(i+1).ParameterOnLine();
-      if(firstp!=lastp) {  
-       Standard_Integer pmid = (firstp+lastp)/2; //-- entiers
-       const IntSurf_PntOn2S& Pmid = L.Point(pmid);
-       Pmid.Parameters(u1,v1,u2,v2);
-       Recadre(Surf,u2,v2);
-       TopAbs_State in2 = Domain->Classify(gp_Pnt2d(u2,v2),Tol);
-       if(in2 == TopAbs_OUT) { 
-       }
-       else { 
-         //-- cout<<"ContapWLine      : firtsp="<<firstp<<" lastp="<<lastp<<" Vtx:"<<i<<","<<i+1<<endl;
-         Handle(IntSurf_LineOn2S) LineOn2S = new IntSurf_LineOn2S();
-         Contap_TheLine Line;
-         for(Standard_Integer j=firstp; j<=lastp; j++) { 
-           LineOn2S->Add(L.Point(j));
-         }
-         Line.SetLineOn2S(LineOn2S);
-         Contap_ThePoint pvtx = L.Vertex(i);
-         pvtx.SetParameter(1);
-         Line.Add(pvtx);
-
-         pvtx = L.Vertex(i+1);
-         pvtx.SetParameter(lastp-firstp+1);
-         Line.Add(pvtx);
-         Line.SetTransitionOnS(L.TransitionOnS());
-         slin.Append(Line);
-       }
-      }
-    }
-  }
-  else if(typl==Contap_Lin) { 
-    Standard_Real u2,v2;// u1,v1;
-    Standard_Integer nbvtx = L.NbVertex();
-    //-- cout<<" Lin -> "<<nbvtx<<" vtx"<<endl;
-    for(Standard_Integer i=1;i<nbvtx;i++) { 
-      Standard_Real firstp = L.Vertex(i).ParameterOnLine();
-      Standard_Real lastp =  L.Vertex(i+1).ParameterOnLine();
-      if(firstp!=lastp) {  
-       Standard_Real pmid = (firstp+lastp)*0.5;
-       gp_Pnt Pmid =  ElCLib::Value(pmid,L.Line());
-       if(TheSurfaceTool::GetType(Surf)==GeomAbs_Cylinder) { 
-         ElSLib::Parameters(TheSurfaceTool::Cylinder(Surf),Pmid,u2,v2);
-       }
-       else if(TheSurfaceTool::GetType(Surf)==GeomAbs_Cone) { 
-         ElSLib::Parameters(TheSurfaceTool::Cone(Surf),Pmid,u2,v2);
-       }
-       else { 
-         //-- cout<<" Pb ds Contap_ContourGen_2.gxx (type)"<<endl;
-       }
-
-       Recadre(Surf,u2,v2);
-       TopAbs_State in2 = Domain->Classify(gp_Pnt2d(u2,v2),Tol);
-       if(in2 == TopAbs_OUT) { 
-       }
-       else { 
-         //-- cout<<"Contap Lin      : firtsp="<<firstp<<" lastp="<<lastp<<" Vtx:"<<i<<","<<i+1<<endl;
-         Contap_TheLine Line;
-         Line.SetValue(L.Line());
-         Contap_ThePoint pvtx = L.Vertex(i);
-         Line.Add(pvtx);
-
-         pvtx = L.Vertex(i+1);
-         Line.Add(pvtx);
-         Line.SetTransitionOnS(L.TransitionOnS());
-         slin.Append(Line);
-       }
-      }
-    }
-  }
-  else if(typl==Contap_Circle) { 
-    Standard_Real u2,v2; //u1,v1,
-    Standard_Integer nbvtx = L.NbVertex();
-    //-- cout<<" Circ -> "<<nbvtx<<" vtx"<<endl;
-    Standard_Boolean novtx = Standard_True;
-    if(nbvtx) novtx=Standard_False;
-    for(Standard_Integer i=1;i<nbvtx  || novtx;i++) { 
-      Standard_Real firstp=0,lastp=M_PI+M_PI;
-      if(novtx == Standard_False) { 
-       firstp = L.Vertex(i).ParameterOnLine();
-       lastp =  L.Vertex(i+1).ParameterOnLine();
-      }
-      if(Abs(firstp-lastp)>0.000000001) {  
-       Standard_Real pmid = (firstp+lastp)*0.5;
-       gp_Pnt Pmid =  ElCLib::Value(pmid,L.Circle());
-       if(TheSurfaceTool::GetType(Surf)==GeomAbs_Cylinder) { 
-         ElSLib::Parameters(TheSurfaceTool::Cylinder(Surf),Pmid,u2,v2);
-       }
-       else if(TheSurfaceTool::GetType(Surf)==GeomAbs_Cone) { 
-         ElSLib::Parameters(TheSurfaceTool::Cone(Surf),Pmid,u2,v2);
-       }
-       else if(TheSurfaceTool::GetType(Surf)==GeomAbs_Sphere) { 
-         ElSLib::Parameters(TheSurfaceTool::Sphere(Surf),Pmid,u2,v2);
-       }
-       else { 
-         //-- cout<<" Pb ds Contap_ContourGen_2.gxx (typep)"<<endl;
-       }
-
-       Recadre(Surf,u2,v2);
-       TopAbs_State in2 = Domain->Classify(gp_Pnt2d(u2,v2),Tol);
-       if(in2 == TopAbs_OUT) { 
-       }
-       else { 
-         //-- cout<<"Contap Circle     : firtsp="<<firstp<<" lastp="<<lastp<<" Vtx:"<<i<<","<<i+1<<endl;
-         Contap_TheLine Line;
-         Line.SetValue(L.Circle());
-         if(novtx == Standard_False) { 
-           Contap_ThePoint pvtx = L.Vertex(i);
-           Line.Add(pvtx);
-           pvtx = L.Vertex(i+1);
-           Line.Add(pvtx);
-         }
-         Line.SetTransitionOnS(L.TransitionOnS());
-         slin.Append(Line);
-       }
-      }
-      novtx = Standard_False;
-    }
-    if(nbvtx)  {
-      Standard_Real firstp = L.Vertex(nbvtx).ParameterOnLine();
-      Standard_Real lastp =  L.Vertex(1).ParameterOnLine() + M_PI+M_PI;
-      if(Abs(firstp-lastp)>0.0000000001) {  
-       Standard_Real pmid = (firstp+lastp)*0.5;
-       gp_Pnt Pmid =  ElCLib::Value(pmid,L.Circle());
-       if(TheSurfaceTool::GetType(Surf)==GeomAbs_Cylinder) { 
-         ElSLib::Parameters(TheSurfaceTool::Cylinder(Surf),Pmid,u2,v2);
-       }
-       else if(TheSurfaceTool::GetType(Surf)==GeomAbs_Cone) { 
-         ElSLib::Parameters(TheSurfaceTool::Cone(Surf),Pmid,u2,v2);
-       }
-       else if(TheSurfaceTool::GetType(Surf)==GeomAbs_Sphere) { 
-         ElSLib::Parameters(TheSurfaceTool::Sphere(Surf),Pmid,u2,v2);
-       }
-       else { 
-         //-- cout<<" Pb ds Contap_ContourGen_2.gxx (typep)"<<endl;
-       }
-
-       Recadre(Surf,u2,v2);
-       TopAbs_State in2 = Domain->Classify(gp_Pnt2d(u2,v2),Tol);
-       if(in2 == TopAbs_OUT) { 
-       }
-       else { 
-         //-- cout<<"Contap Circle  *Compl* : firtsp="<<firstp<<" lastp="<<lastp<<" Vtx:"<<i<<","<<i+1<<endl;
-         Contap_TheLine Line;
-         Line.SetValue(L.Circle());
-         Contap_ThePoint pvtx = L.Vertex(nbvtx);
-         Line.Add(pvtx);
-
-         pvtx = L.Vertex(1);  pvtx.SetParameter(pvtx.ParameterOnLine()+M_PI+M_PI);
-         Line.Add(pvtx);
-         Line.SetTransitionOnS(L.TransitionOnS());
-         slin.Append(Line);
-       }
-      }      
-    }
-  }
-  else { 
-    //-- cout<<" ni WLine ni Lin ni Circ "<<endl;
-    slin.Append(L);
-  }
-  //-- 
-}
-
-//-- --------------------------------------------------------------------------------
-
-
-
-static void KeepInsidePoints(const Contap_TheSearchInside& solins,
-                            const Contap_TheSearch& solrst,
-                            Contap_TheSurfFunction& Func,
-                            IntSurf_SequenceOfInteriorPoint& seqpins)
-
-{
-  Standard_Integer Nba = solrst.NbSegments();
-  if (Nba <= 0) return;
-  Standard_Integer Nbp,indp,inda;
-  Standard_Real U,V,paramproj;
-  gp_Pnt2d toproj,Ptproj;
-  Standard_Boolean projok,tokeep;
-  const TheSurface& Surf = Func.Surface();
-
-  Nbp = solins.NbPoints();
-  for (indp=1; indp <= Nbp; indp++) {
-    tokeep = Standard_True;
-    const IntSurf_InteriorPoint& pti = solins.Value(indp);
-    pti.Parameters(U,V);
-    toproj = gp_Pnt2d(U,V);
-    for (inda = 1; inda <= Nba; inda++) {
-      const TheArc& thearc = solrst.Segment(inda).Curve();
-      projok = TheContTool::Project(thearc,toproj,paramproj,Ptproj);
-      if (projok) {
-       gp_Pnt pprojete = TheSurfaceTool::Value(Surf,Ptproj.X(),Ptproj.Y());
-       if (pti.Value().Distance(pprojete) <= Precision::Confusion()) {
-         tokeep = Standard_False;
-         break;
-       }
-      }
-    }
-    if (tokeep) {
-      seqpins.Append(pti);
-    }
-  }
-}
-
-
-static void ComputeTangency (const Contap_TheSearch& solrst,
-                            const Handle(TheTopolTool)& Domain,
-                            Contap_TheSurfFunction& Func,
-                            IntSurf_SequenceOfPathPoint& seqpdep,
-                            TColStd_Array1OfInteger& Destination)
-{
-
-  Standard_Integer i,k;
-  Standard_Integer NbPoints = solrst.NbPoints();
-  Standard_Integer seqlength = 0;
-
-  Standard_Real theparam,test;
-  Standard_Boolean fairpt;
-  TopAbs_Orientation arcorien,vtxorien;
-  Standard_Boolean ispassing;
-  
-  math_Vector X(1, 2);
-  math_Vector F(1, 1);
-  math_Matrix D(1, 1, 1, 2); 
-  
-  gp_Vec   normale, vectg, tg3drst,v1,v2;
-  gp_Dir2d dirtg;
-  gp_Vec2d tg2drst;
-  gp_Pnt2d pt2d;
-  
-  IntSurf_PathPoint PPoint;
-  const TheSurface& Surf = Func.Surface();
-  
-  for (i=1; i<= NbPoints; i++) {
-    
-    if (Destination(i) == 0) {
-      
-      const Contap_ThePathPointOfTheSearch& PStart = solrst.Point(i);
-      const TheArc& thearc = PStart.Arc();
-      theparam = PStart.Parameter();
-      gp_Pnt2d Ptoproj=TheArcTool::Value(thearc,theparam);
-      //-- lbr le 15 mai 97 
-      //-- On elimine les points qui sont egalement present sur une restriction solution
-      Standard_Boolean SurUneRestrictionSolution = Standard_False;
-      for(Standard_Integer restriction=1;
-         SurUneRestrictionSolution==Standard_False && restriction<=solrst.NbSegments(); 
-         restriction++) { 
-       const TheArc& thearcsol = solrst.Segment(restriction).Curve();
-       Standard_Real  paramproj;
-       gp_Pnt2d       pproj;
-       Standard_Boolean projok = TheContTool::Project(thearcsol,Ptoproj,paramproj,pproj);
-       if(projok) { 
-         //gp_Pnt pprojete = TheSurfaceTool::Value(Surf,Ptoproj.X(),Ptoproj.Y());
-         //IFV - begin
-         gp_Pnt pprojete = TheSurfaceTool::Value(Surf,pproj.X(),pproj.Y());
-         //IFV - end
-         if ((PStart.Value()).Distance(pprojete) <= Precision::Confusion()) {
-           SurUneRestrictionSolution = Standard_True;
-         }
-       }
-      }
-      if(SurUneRestrictionSolution == Standard_False) { 
-       arcorien = Domain->Orientation(thearc);
-       ispassing = (arcorien == TopAbs_INTERNAL ||
-                    arcorien == TopAbs_EXTERNAL);
-       
-       TheArcTool::D1(thearc,theparam,pt2d,tg2drst);
-       X(1) = pt2d.X();
-       X(2) = pt2d.Y();
-       PPoint.SetValue(PStart.Value(),X(1),X(2));
-       
-       Func.Values(X,F,D);
-       if (Func.IsTangent()) {
-         PPoint.SetTangency(Standard_True);
-         Destination(i) = seqlength+1;
-         if (!PStart.IsNew()) {
-           const TheVertex& vtx = PStart.Vertex();
-           for (k=i+1; k<=NbPoints; k++) {
-             if (Destination(k) ==0) {
-               const Contap_ThePathPointOfTheSearch& PStart2 = solrst.Point(k);
-               if (!PStart2.IsNew()) {
-                 const TheVertex& vtx2 = PStart2.Vertex();
-                 if (Domain->Identical(vtx,vtx2)) {
-                   const TheArc& thearc2   = PStart2.Arc();
-                   theparam = PStart2.Parameter();
-                   arcorien = Domain->Orientation(thearc2);
-                   ispassing = ispassing && (arcorien == TopAbs_INTERNAL ||
-                                             arcorien == TopAbs_EXTERNAL);
-                   
-                   pt2d = TheArcTool::Value(thearc2,theparam);
-                   X(1) = pt2d.X();
-                   X(2) = pt2d.Y();
-                   PPoint.AddUV(X(1),X(2));
-                   Destination(k) = seqlength+1;
-                 }
-               }
-             }
-           }
-         }
-         PPoint.SetPassing(ispassing);
-         seqpdep.Append(PPoint);
-         seqlength++;
-       }
-       else { // on a un point de depart potentiel
-         
-         vectg = Func.Direction3d();
-         dirtg = Func.Direction2d();
-         
-         gp_Pnt ptbid;
-         //    TheSurfaceTool::D1(Surf,X(1),X(2),ptbid,v1,v2);
-         Contap_TheSurfProps::DerivAndNorm(Surf,X(1),X(2),ptbid,v1,v2,normale);
-         tg3drst = tg2drst.X()*v1 + tg2drst.Y()*v2;
-         //    normale = v1.Crossed(v2);
-         if(normale.SquareMagnitude() < RealEpsilon()) { 
-           //-- cout<<"\n*** Contap_ContourGen_2.gxx  Normale Nulle en U:"<<X(1)<<" V:"<<X(2)<<endl;
-         }
-         else { 
-           test = vectg.Dot(normale.Crossed(tg3drst));
-           
-           if (PStart.IsNew()) {
-             Standard_Real tbis = vectg.Normalized().Dot(tg3drst.Normalized());
-             if (Abs(tbis) < 1.-tole) {
-               
-               if ((test < 0. && arcorien == TopAbs_FORWARD) ||
-                   (test > 0. && arcorien == TopAbs_REVERSED)) {
-                 vectg.Reverse();
-                 dirtg.Reverse();
-               }
-               PPoint.SetDirections(vectg,dirtg);
-             }
-             else { // on garde le point comme point d`arret (tangent)
-               PPoint.SetTangency(Standard_True);
-             }
-             PPoint.SetPassing(ispassing);
-             Destination(i) = seqlength+1;
-             seqpdep.Append(PPoint);
-             seqlength++;
-           }
-           else { // traiter la transition complexe
-             gp_Dir bidnorm(1.,1.,1.);
-             
-             Standard_Boolean tobeverified = Standard_False;
-             TopAbs_Orientation LocTrans;
-             TopTrans_CurveTransition comptrans;
-             comptrans.Reset(vectg,bidnorm,0.);
-             if (arcorien != TopAbs_INTERNAL &&
-                 arcorien != TopAbs_EXTERNAL) {
-               // pour essai
-               const TheVertex& vtx = PStart.Vertex();
-               vtxorien = Domain->Orientation(vtx);
-               test = test/(vectg.Magnitude());
-               test = test/((normale.Crossed(tg3drst)).Magnitude());
-               
-               if (Abs(test) <= tole) {
-                 tobeverified = Standard_True;
-                 LocTrans = TopAbs_EXTERNAL; // et pourquoi pas INTERNAL
-               }
-               else {
-                 if ((test > 0. && arcorien == TopAbs_FORWARD) ||
-                     (test < 0. && arcorien == TopAbs_REVERSED)){
-                   LocTrans = TopAbs_FORWARD;
-                 }
-                 else {
-                   LocTrans = TopAbs_REVERSED;
-                 }
-                 if (arcorien == TopAbs_REVERSED) {tg3drst.Reverse();} // pas deja fait ???
-               }
-               
-               comptrans.Compare(tole,tg3drst,bidnorm,0.,LocTrans,vtxorien);
-             }
-             Destination(i) = seqlength+1;
-             for (k= i+1; k<=NbPoints; k++) {
-               if (Destination(k) == 0) {
-                 const Contap_ThePathPointOfTheSearch& PStart2 = solrst.Point(k);
-                 if (!PStart2.IsNew()) {
-                   const TheVertex& vtx2 = PStart2.Vertex();
-                   if (Domain->Identical(PStart.Vertex(),vtx2)) {
-                     const TheArc& thearc2 = PStart2.Arc();
-                     theparam = PStart2.Parameter();
-                     arcorien = Domain->Orientation(thearc2);
-                     
-                     TheArcTool::D1(thearc2,theparam,pt2d,tg2drst);
-                     X(1) = pt2d.X();
-                     X(2) = pt2d.Y();
-                     PPoint.AddUV(X(1),X(2));
-                     
-                     if (arcorien != TopAbs_INTERNAL &&
-                         arcorien != TopAbs_EXTERNAL) {
-                       ispassing = Standard_False;
-                       tg3drst = tg2drst.X()*v1 + tg2drst.Y()*v2;
-                       test = vectg.Dot(normale.Crossed(tg3drst));
-                       test = test/(vectg.Magnitude());
-                       test = test /((normale.Crossed(tg3drst)).Magnitude());
-                       
-                       vtxorien = Domain->Orientation(vtx2);
-                       if (Abs(test) <= tole) {
-                         tobeverified = Standard_True;
-                         LocTrans = TopAbs_EXTERNAL; // et pourquoi pas INTERNAL
-                       }
-                       else {
-                         if ((test > 0. && arcorien == TopAbs_FORWARD) ||
-                             (test < 0. && arcorien == TopAbs_REVERSED)){
-                           LocTrans = TopAbs_FORWARD;
-                         }
-                         else {
-                           LocTrans = TopAbs_REVERSED;
-                         }
-                         if (arcorien == TopAbs_REVERSED) {tg3drst.Reverse();} //deja fait????
-                       }
-                       
-                       comptrans.Compare(tole,tg3drst,bidnorm,0.,LocTrans,vtxorien);
-                     }
-                     Destination(k) = seqlength+1;
-                   }
-                 }
-               }
-             }
-             fairpt = Standard_True;
-             if (!ispassing) {
-               TopAbs_State Before = comptrans.StateBefore();
-               TopAbs_State After  = comptrans.StateAfter();
-               if ((Before == TopAbs_UNKNOWN)||(After == TopAbs_UNKNOWN)) {
-                 fairpt = Standard_False;
-               }
-               else if (Before == TopAbs_IN) {
-                 if (After == TopAbs_IN) {
-                   ispassing = Standard_True;
-                 }
-                 else {
-                   vectg.Reverse();
-                   dirtg.Reverse();
-                 }
-               }
-               else {
-                 if (After !=TopAbs_IN) {
-                   fairpt = Standard_False;
-                 }
-               }
-             }
-             
-             // evite de partir le long d une restriction solution
-             
-             if (fairpt && tobeverified) {
-               for (k=i; k <=NbPoints ; k++) {
-                 if (Destination(k)==seqlength + 1) {
-                   theparam = solrst.Point(k).Parameter();
-                   const TheArc& thearc2 = solrst.Point(k).Arc();
-                   arcorien = Domain->Orientation(thearc2);
-                   
-                   if (arcorien == TopAbs_FORWARD ||
-                       arcorien == TopAbs_REVERSED) {
-                     TheArcTool::D1(thearc2,theparam,pt2d,tg2drst);
-                     tg3drst = tg2drst.X()*v1 + tg2drst.Y()*v2;
-                     vtxorien = Domain->Orientation(solrst.Point(k).Vertex());
-                     if ((arcorien == TopAbs_FORWARD && 
-                          vtxorien == TopAbs_REVERSED)    ||
-                         (arcorien == TopAbs_REVERSED &&
-                          vtxorien == TopAbs_FORWARD)) {
-                       tg3drst.Reverse();
-                     }
-                     test = vectg.Normalized().Dot(tg3drst.Normalized());
-                     if (test >= 1. - tole) {
-                       fairpt = Standard_False;
-                       break;
-                     }
-                   }
-                 }
-               }
-             }
-             
-             if (fairpt) {
-               PPoint.SetDirections(vectg,dirtg);
-               PPoint.SetPassing(ispassing);
-               seqpdep.Append(PPoint);
-               seqlength++;
-             }
-             else { // il faut remettre en "ordre" si on ne garde pas le point.
-               for (k=i; k <=NbPoints ; k++) {
-                 if (Destination(k)==seqlength + 1) {
-                   Destination(k) = -Destination(k);
-                 }
-               }
-             }
-           }
-         }
-       }
-      }
-    }
-  }
-}
-
-
-IntSurf_TypeTrans ComputeTransitionOnLine(Contap_TheSurfFunction& SFunc,
-                                         const Standard_Real u,
-                                         const Standard_Real v,
-                                         const gp_Vec& tgline)
-{
-  gp_Vec d1u,d1v;
-  gp_Pnt pntbid;
-  //gp_Vec tglineuv;
-
-  TheSurfaceTool::D1(SFunc.Surface(),u,v,pntbid,d1u,d1v);
-
-  //------------------------------------------------------
-  //--   Calcul de la tangente dans l espace uv        ---
-  //------------------------------------------------------
-
-  Standard_Real det,d1uT,d1vT,normu2,normv2,d1ud1v,alpha,beta;
-  d1uT = d1u.Dot(tgline);
-  d1vT = d1v.Dot(tgline);
-  normu2 = d1u.Dot(d1u);
-  normv2 = d1v.Dot(d1v);
-  d1ud1v = d1u.Dot(d1v);
-  det = normu2 * normv2 - d1ud1v * d1ud1v;
-  if(det<RealEpsilon()) { 
-    //-- On ne doit pas passer ici !!
-    //-- cout<<" Probleme !!!"<<endl ;
-    return IntSurf_Undecided;
-  }
-
-  alpha = (d1uT * normv2 - d1vT * d1ud1v)/det;
-  beta  = (normu2 * d1vT - d1ud1v * d1uT)/det;
-  //-----------------------------------------------------
-  //--  Calcul du Gradient de la fonction Utilisee     --
-  //--  pour le contour apparent                       --
-  //-----------------------------------------------------
-
-  Standard_Real v1,v2;
-  math_Vector X(1,2);
-  math_Matrix Df(1,1,1,2);
-  X(1) = u;
-  X(2) = v;
-  SFunc.Derivatives(X,Df);
-  v1 = Df(1,1);
-  v2 = Df(1,2);
-
-  //-----------------------------------------------------
-  //-- On calcule si la fonction                       --
-  //--        F(.) = Normale . Dir_Regard              --
-  //-- Croit Losrque l on se deplace sur la Gauche     --
-  //--  de la direction de deplacement sur la ligne.   --
-  //-----------------------------------------------------
-
-  det = -v1*beta + v2*alpha;
-
-  if(det<RealEpsilon()) { // revoir le test jag 940620
-    return IntSurf_Undecided;
-  }
-  if(det>0.0) { 
-    return(IntSurf_Out);
-  }
-  return(IntSurf_In);
-}
-
-
-void ProcessSegments (const Contap_TheSearch& solrst,
-                     Contap_TheSequenceOfLine& slin,
-                     const Standard_Real TolArc,
-                     Contap_TheSurfFunction& SFunc,
-                     const Handle(TheTopolTool)& Domain)
-
-{     
-  Standard_Integer i,j,k;
-  Standard_Integer nbedg = solrst.NbSegments();
-  Standard_Integer Nblines,Nbpts;
-
-  TheArc arcRef;
-  Contap_ThePoint ptvtx;
-
-  Contap_ThePathPointOfTheSearch PStartf,PStartl;
-
-  Standard_Boolean dofirst,dolast,procf,procl;
-  Standard_Real paramf =0.,paraml =0.,U;
-  Contap_TheLine theline;
-
-  gp_Vec tgline;//,norm1,norm2;
-  gp_Pnt valpt;
-
-  gp_Vec d1u,d1v;
-  gp_Pnt2d p2d;
-  gp_Vec2d d2d;
-
-
-  for (i = 1; i <= nbedg; i++) {
-    
-    const Contap_TheSegmentOfTheSearch& thesegsol = solrst.Segment(i);
-    theline.SetValue(thesegsol.Curve());
-
-// Traitement des points debut/fin du segment solution.
-
-    dofirst = Standard_False;
-    dolast  = Standard_False;
-    procf = Standard_False;
-    procl = Standard_False;
-
-    if (thesegsol.HasFirstPoint()) {
-      dofirst = Standard_True;
-      PStartf = thesegsol.FirstPoint();
-      paramf = PStartf.Parameter();
-    }
-    if (thesegsol.HasLastPoint()) {
-      dolast = Standard_True;
-      PStartl = thesegsol.LastPoint();
-      paraml = PStartl.Parameter();
-    }
-
-    // determination de la transition
-    if (dofirst && dolast) {
-      U = (paramf+paraml)/2.;
-    }
-    else if (dofirst) {
-      U = paramf + 1.0;
-    }
-    else if (dolast) {
-      U = paraml - 1.0;
-    }
-    else {
-      U = 0.0;
-    }
-
-    TheArcTool::D1(thesegsol.Curve(),U,p2d,d2d);
-    TheSurfaceTool::D1(SFunc.Surface(),p2d.X(),p2d.Y(),valpt,d1u,d1v);
-    tgline.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
-    IntSurf_TypeTrans  tral = 
-      ComputeTransitionOnLine(SFunc,p2d.X(),p2d.Y(),tgline);
-
-    theline.SetTransitionOnS(tral);
-
-
-    if (dofirst || dolast) {
-      Nblines = slin.Length();
-      for (j=1; j<=Nblines; j++) {
-       Nbpts = slin(j).NbVertex();
-       for (k=1; k<=Nbpts;k++) {
-         ptvtx = slin(j).Vertex(k);
-         if (dofirst) {
-           if (ptvtx.Value().Distance(PStartf.Value()) <=TolArc) {
-             slin(j).Vertex(k).SetMultiple();
-             ptvtx.SetMultiple();
-             ptvtx.SetParameter(paramf);
-             theline.Add(ptvtx);
-             procf=Standard_True;
-           }
-         }
-         if (dolast) {
-           if (ptvtx.Value().Distance(PStartl.Value()) <=TolArc) {
-             slin(j).Vertex(k).SetMultiple();
-             ptvtx.SetMultiple();
-             ptvtx.SetParameter(paraml);
-             theline.Add(ptvtx);
-             procl=Standard_True;
-           }
-         }
-       }
-// Si on a traite le pt debut et/ou fin, on ne doit pas recommencer si
-// il (ils) correspond(ent) a un point multiple.
-
-       if (procf) {
-         dofirst = Standard_False;
-       }
-       if (procl) {
-         dolast  = Standard_False;
-       }
-      }
-    }
-    
-// Si on n a pas trouve le point debut et./ou fin sur une des lignes
-// d intersection, il faut quand-meme le placer sur la restriction solution
-
-    if (dofirst) {
-
-      p2d = TheArcTool::Value(thesegsol.Curve(),paramf);
-      ptvtx.SetValue(PStartf.Value(),p2d.X(),p2d.Y());
-      ptvtx.SetParameter(paramf);
-      if (! PStartf.IsNew()) {
-       ptvtx.SetVertex(PStartf.Vertex());
-      }
-      theline.Add(ptvtx);
-    }
-    if (dolast) {
-      p2d = TheArcTool::Value(thesegsol.Curve(),paraml);
-      ptvtx.SetValue(PStartl.Value(),p2d.X(),p2d.Y());
-      ptvtx.SetParameter(paraml);
-      if (! PStartl.IsNew()) {
-       ptvtx.SetVertex(PStartl.Vertex());
-      }
-      theline.Add(ptvtx);
-    }
-
-    // il faut chercher le points internal sur les restrictions solutions.
-    if (thesegsol.HasFirstPoint() && thesegsol.HasLastPoint()) {
-      ComputeInternalPointsOnRstr(theline,paramf,paraml,SFunc);
-    }
-    LineConstructor(slin,Domain,theline,SFunc.Surface()); //-- lbr 
-    //-- slin.Append(theline);
-    theline.Clear();
-  }
-}
-
-void ComputeInternalPointsOnRstr
-  (Contap_TheLine& Line,
-   const Standard_Real Paramf,
-   const Standard_Real Paraml,
-   Contap_TheSurfFunction& SFunc)
-{
-  // On recherche les points ou la tangente a la ligne de contour et
-  // la direction sont alignees.
-  // 1ere etape : recherche de changement de signe.
-  // 2eme etape : localisation de la solution par dichotomie
-
-
-  Standard_Integer indexinf,indexsup,i;
-  gp_Vec tgt, vecref, vectest, vtestb, vecregard,d1u,d1v;
-  gp_Pnt pcour;
-  gp_Pnt2d p2d;
-  gp_Vec2d d2d;
-  Standard_Boolean found,ok = Standard_False,toutvu,solution;
-  Standard_Real paramp = 0.,paraminf,paramsup,toler;
-
-  if (Line.TypeContour() != Contap_Restriction) {
-    return;
-  }
-
-  const TheArc& thearc = Line.Arc();
-
-  const TheSurface& Surf = SFunc.Surface();
-  Contap_TFunction TypeFunc(SFunc.FunctionType());
-
-  Standard_Integer Nbpnts = TheContTool::NbSamplesOnArc(thearc);
-  indexinf = 1;
-  vecregard = SFunc.Direction();
-  toler = TheArcTool::Resolution(thearc,Precision::Confusion());
-  found = Standard_False;
-
-  do {
-    paraminf = ((Nbpnts-indexinf)*Paramf + (indexinf-1)*Paraml)/(Nbpnts-1);
-    TheArcTool::D1(thearc,paraminf,p2d,d2d);
-    TheSurfaceTool::D1(Surf,p2d.X(),p2d.Y(),pcour,d1u,d1v);
-    tgt.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
-
-    if (tgt.Magnitude() > gp::Resolution()) {
-      if (TypeFunc == Contap_ContourPrs || TypeFunc==Contap_DraftPrs) {
-       vecregard.SetXYZ(pcour.XYZ()-SFunc.Eye().XYZ());
-      }
-      vecref = vecregard.Crossed(tgt);
-      
-      if (vecref.Magnitude() <= gp::Resolution()) {
-       indexinf++;
-      }
-      else {
-       found = Standard_True;
-      }
-    }
-    else {
-      indexinf++;
-    }
-  } while ((indexinf <= Nbpnts) && (!found));
-
-
-  indexsup = indexinf +1;
-  toutvu = (indexsup > Nbpnts);
-  while (!toutvu) {
-    paramsup = ((Nbpnts-indexsup)*Paramf + (indexsup-1)*Paraml)/(Nbpnts-1);
-    TheArcTool::D1(thearc,paramsup,p2d,d2d);
-    TheSurfaceTool::D1(Surf,p2d.X(),p2d.Y(),pcour,d1u,d1v);
-    tgt.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
-
-    if (tgt.Magnitude() > gp::Resolution()) {
-      if (TypeFunc == Contap_ContourPrs || TypeFunc==Contap_DraftPrs) {
-       vecregard.SetXYZ(pcour.XYZ()-SFunc.Eye().XYZ());
-      }
-      vectest = vecregard.Crossed(tgt);
-    }
-    else {
-      vectest = gp_Vec(0.,0.,0.);
-    }
-    if (vectest.Magnitude() <= gp::Resolution()) {
-      // On cherche un vrai changement de signe
-      indexsup++;
-    }
-    else {
-      if (vectest.Dot(vecref) < 0.) {
-       // Essayer de converger
-       // cout << "Changement de signe detecte" << endl;
-       solution = Standard_False;
-       while (!solution) {
-         paramp = (paraminf+paramsup)/2.;
-         TheArcTool::D1(thearc,paramp,p2d,d2d);
-         TheSurfaceTool::D1(Surf,p2d.X(),p2d.Y(),pcour,d1u,d1v);
-         tgt.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
-
-         if (tgt.Magnitude() > gp::Resolution()) {
-           if (TypeFunc == Contap_ContourPrs || TypeFunc==Contap_DraftPrs) {
-             vecregard.SetXYZ(pcour.XYZ()-SFunc.Eye().XYZ());
-           }
-           vtestb = vecregard.Crossed(tgt);
-         }
-         else {
-           vtestb = gp_Vec(0.,0.,0.);
-         }
-         
-         if ((vtestb.Magnitude() <= gp::Resolution())||
-             (Abs(paramp-paraminf) <= toler) ||
-             (Abs(paramp-paramsup) <= toler)) {
-           // on est a la solution
-           solution = Standard_True;
-           ok = Standard_True;
-         }
-         else if (vtestb.Dot(vecref) < 0.) {
-           paramsup = paramp;
-         }
-         else {
-           paraminf = paramp;
-         }
-
-       }
-
-       if (ok) {
-         // On verifie que le point trouve ne correspond pas a un ou des
-         // vertex deja existant(s). On teste sur le parametre paramp.
-         for (i=1; i<=Line.NbVertex(); i++) {
-           Contap_ThePoint& thevtx = Line.Vertex(i);
-           if (Abs(thevtx.ParameterOnLine()-paramp) <= toler) {
-             thevtx.SetInternal();
-             ok = Standard_False; // on a correspondance
-           }
-         }
-         if (ok) { // il faut alors rajouter le point
-           Contap_ThePoint internalp(pcour,p2d.X(),p2d.Y());
-           internalp.SetParameter(paramp);
-           internalp.SetInternal();
-           Line.Add(internalp);
-         }
-       }
-       paramsup = ((Nbpnts-indexsup)*Paramf + (indexsup-1)*Paraml)/(Nbpnts-1);
-      }
-      vecref = vectest;
-      indexinf = indexsup;
-      indexsup++;
-      paraminf = paramsup;
-    }
-    toutvu = (indexsup > Nbpnts);
-  }
-}
-
-
-void ComputeInternalPoints
-  (Contap_TheLine& Line,
-   Contap_TheSurfFunction& SFunc,
-   const Standard_Real ureso,
-   const Standard_Real vreso)
-
-{
-  // On recherche les points ou la tangente a la ligne de contour et
-  // la direction sont alignees.
-  // 1ere etape : recheche de changement de signe.
-  // 2eme etape : localisation de la solution par simili dichotomie
-
-
-  Standard_Integer indexinf,indexsup,index;
-  gp_Vec tgt, vecref, vectest, vtestb, vecregard;
-  //gp_Pnt pprec,pcour;
-  Standard_Boolean found,ok = Standard_False,toutvu,solution;
-  Standard_Real paramp = 0.,U,V;
-
-  math_Vector XInf(1,2),XSup(1,2),X(1,2),F(1,1);
-  math_Matrix DF(1,1,1,2);
-  math_Vector toler(1,2),infb(1,2),supb(1,2);
-
-  if (Line.TypeContour() != Contap_Walking) {
-    return;
-  }
-
-  Standard_Integer Nbpnts = Line.NbPnts();
-  const TheSurface& Surf = SFunc.Surface();
-  Contap_TFunction TypeFunc(SFunc.FunctionType());
-
-  toler(1) = ureso; //-- Trop long !!! TheSurfaceTool::UResolution(Surf,SFunc.Tolerance());
-  toler(2) = vreso; //---Beaucoup trop long !!! TheSurfaceTool::VResolution(Surf,SFunc.Tolerance());
-  infb(1) = TheSurfaceTool::FirstUParameter(Surf);
-  infb(2) = TheSurfaceTool::FirstVParameter(Surf);
-  supb(1) = TheSurfaceTool::LastUParameter(Surf);
-  supb(2) = TheSurfaceTool::LastVParameter(Surf);
-
-  math_FunctionSetRoot rsnld(SFunc,toler,30);
-
-  indexinf = 1;
-  vecregard = SFunc.Direction();
-
-  found = Standard_False;
-  do {
-    Line.Point(indexinf).ParametersOnS2(XInf(1),XInf(2));
-    SFunc.Values(XInf,F,DF);
-    if (!SFunc.IsTangent()) {
-      tgt = SFunc.Direction3d();
-      if (TypeFunc == Contap_ContourPrs || TypeFunc == Contap_DraftPrs) {
-       vecregard.SetXYZ(Line.Point(indexinf).Value().XYZ()-SFunc.Eye().XYZ());
-      }
-      vecref = vecregard.Crossed(tgt);
-      
-      if (vecref.Magnitude() <= gp::Resolution()) {
-       indexinf++;
-      }
-      else {
-       found = Standard_True;
-      }
-    }
-    else {
-      indexinf++;
-    }
-  } while ((indexinf <= Nbpnts) && (!found));
-
-
-  indexsup = indexinf +1;
-  toutvu = (indexsup > Nbpnts);
-  while (!toutvu) {
-    Line.Point(indexsup).ParametersOnS2(XSup(1),XSup(2));
-    SFunc.Values(XSup,F,DF);
-    if (!SFunc.IsTangent()) {
-      tgt = SFunc.Direction3d();
-
-      if (TypeFunc == Contap_ContourPrs || TypeFunc == Contap_DraftPrs) {
-       vecregard.SetXYZ(Line.Point(indexsup).Value().XYZ()-SFunc.Eye().XYZ());
-      }
-      vectest = vecregard.Crossed(tgt);
-    }
-    else {
-      vectest = gp_Vec(0.,0.,0.);
-    }
-    if (vectest.Magnitude() <= gp::Resolution()) {
-      // On cherche un vrai changement de signe
-      indexsup++;
-    }
-    else {
-      if (vectest.Dot(vecref) < 0.) {
-       // Essayer de converger
-       // cout << "Changement de signe detecte" << endl;
-       solution = Standard_False;
-       while (!solution) {
-         X(1) = (XInf(1) + XSup(1)) /2.;
-         X(2) = (XInf(2) + XSup(2)) /2.;
-         rsnld.Perform(SFunc,X,infb,supb);
-         
-         if (!rsnld.IsDone()) {
-           cout << "Echec recherche internal points" << endl;
-           solution = Standard_True;
-           ok = Standard_False;
-         }
-         else {
-         
-           rsnld.Root(X);
-           SFunc.Values(X,F,DF);
-           if (Abs(F(1)) <= SFunc.Tolerance()) {
-
-             if (!SFunc.IsTangent()) {
-               tgt = SFunc.Direction3d();
-               if (TypeFunc == Contap_ContourPrs || 
-                   TypeFunc == Contap_DraftPrs) {
-                 vecregard.SetXYZ(SFunc.Point().XYZ()-SFunc.Eye().XYZ());
-               }
-               vtestb = vecregard.Crossed(tgt);
-             }
-             else {
-               vtestb = gp_Vec(0.,0.,0.);
-             }
-             if ((vtestb.Magnitude() <= gp::Resolution())||
-               (Abs(X(1)-XInf(1)) <= toler(1) 
-                && Abs(X(2)-XInf(2)) <= toler(2)) ||
-               (Abs(X(1)-XSup(1)) <= toler(1)
-                && Abs(X(2)-XSup(2)) <= toler(2))) {
-             // on est a la solution
-               solution = Standard_True;
-               ok = Standard_True;
-             }
-             else if (vtestb.Dot(vecref) < 0.) {
-               XSup = X;
-             }
-             else {
-               XInf = X;
-             }
-           }
-           else { // on n est pas sur une solution
-             cout << "Echec recherche internal points" << endl;
-             solution = Standard_True;
-             ok = Standard_False;
-           }
-         }
-       }
-
-       if (ok) {
-         Standard_Boolean newpoint = Standard_False;
-         Line.Point(indexinf).ParametersOnS2(U,V);
-         gp_Vec2d vinf(X(1)-U,X(2)-V);
-         if (Abs(vinf.X()) <= toler(1) && Abs(vinf.Y()) <= toler(2)) {
-           paramp = indexinf;
-         }
-         else {
-           for (index = indexinf+1; index <= indexsup; index++) {
-             Line.Point(index).ParametersOnS2(U,V);
-             gp_Vec2d vsup(X(1)-U,X(2)-V);
-             if (Abs(vsup.X()) <= toler(1) && Abs(vsup.Y()) <= toler(2)) {
-               paramp = index;
-               break;
-             }
-             else if (vinf.Dot(vsup) < 0.) {
-               // on est entre les 2 points
-               paramp = index;
-               IntSurf_PntOn2S pt2s;
-               pt2s.SetValue(SFunc.Point(),Standard_False,X(1),X(2));
-               Line.LineOn2S()->InsertBefore(index,pt2s);
-
-               //-- Il faut decaler les parametres des vertex situes entre 
-               //-- index et NbPnts ###################################
-               for(Standard_Integer v=1; v<=Line.NbVertex(); v++) { 
-                 Contap_ThePoint& Vertex = Line.Vertex(v);
-                 if(Vertex.ParameterOnLine() >= index) { 
-                   Vertex.SetParameter(Vertex.ParameterOnLine()+1); 
-                 }
-               }
-
-               Nbpnts = Nbpnts+1;
-               indexsup = indexsup+1;
-               newpoint = Standard_True;
-               break;
-             }
-             else {
-               vinf = vsup;
-             }
-           }
-         }
-
-         Standard_Integer v;
-         if (!newpoint) {
-           // on est sur un point de cheminement. On regarde alors
-           // la correspondance avec un vertex existant.
-           newpoint = Standard_True;
-           for (v=1; v<= Line.NbVertex(); v++) {
-             Contap_ThePoint& Vertex = Line.Vertex(v);
-             if(Vertex.ParameterOnLine() == paramp) {
-               Vertex.SetInternal();
-               newpoint = Standard_False;
-             }
-           }
-         }
-
-         if (newpoint && paramp >1. && paramp < Nbpnts) {
-           // on doit creer un nouveau vertex.
-           Contap_ThePoint internalp(SFunc.Point(),X(1),X(2));
-           internalp.SetParameter(paramp);
-           internalp.SetInternal();
-           Line.Add(internalp);
-          }
-       }
-       Line.Point(indexsup).ParametersOnS2(XSup(1),XSup(2));
-      }
-      vecref = vectest;
-      indexinf = indexsup;
-      indexsup++;
-      XInf = XSup;
-    }
-    toutvu = (indexsup > Nbpnts);
-  }
-}
-
-
-void Contap_ContourGen::Perform 
-     (const Handle(TheTopolTool)& Domain) {
-
-  done = Standard_False;
-  slin.Clear();
-
-  Standard_Integer i,j,k,Nbvt1,Nbvt2,ivt1,ivt2;
-  Standard_Integer NbPointRst,NbPointIns;
-  Standard_Integer Nblines, Nbpts, indfirst, indlast;
-  Standard_Real U,V;
-  gp_Pnt2d pt2d;
-  gp_Vec2d d2d;
-  gp_Pnt ptonsurf;
-  gp_Vec d1u,d1v,normale,tgtrst,tgline;
-  Standard_Real currentparam;
-  IntSurf_Transition TLine,TArc;
-
-  Contap_TheLine theline;
-  Contap_ThePoint ptdeb,ptfin;
-  Contap_ThePathPointOfTheSearch PStartf,PStartl;
-
-//  Standard_Real TolArc = 1.e-5;
-  Standard_Real TolArc = Precision::Confusion();
-
-  const TheSurface& Surf = mySFunc.Surface();
-
-  Standard_Real EpsU = TheSurfaceTool::UResolution(Surf,Precision::Confusion());
-  Standard_Real EpsV = TheSurfaceTool::VResolution(Surf,Precision::Confusion());
-  Standard_Real Preci  = Min(EpsU,EpsV);
-//  Standard_Real Fleche = 5.e-1;
-//  Standard_Real Pas    = 5.e-2;
-  Standard_Real Fleche = 0.01;
-  Standard_Real Pas    = 0.005; 
-  //   lbr: Il y avait Pas 0.2 -> Manque des Inters sur restr ; devrait faire un mini de 5 pts par lignes
-  //-- le 23 janvier 98 0.05 -> 0.01
-
-
-  //-- ******************************************************************************** Janvier 98
-  Bnd_Box B1; Standard_Boolean Box1OK = Standard_True;
-  
-  Standard_Real Uinf = Surf->FirstUParameter(); 
-  Standard_Real Vinf = Surf->FirstVParameter();
-  Standard_Real Usup = Surf->LastUParameter();
-  Standard_Real Vsup = Surf->LastVParameter();
-
-  Standard_Boolean Uinfinfinite = Precision::IsNegativeInfinite(Uinf);
-  Standard_Boolean Usupinfinite = Precision::IsPositiveInfinite(Usup);
-  Standard_Boolean Vinfinfinite = Precision::IsNegativeInfinite(Vinf);
-  Standard_Boolean Vsupinfinite = Precision::IsPositiveInfinite(Vsup);
-  
-  if( Uinfinfinite || Usupinfinite || Vinfinfinite || Vsupinfinite) { 
-    Box1OK = Standard_False;
-  }
-  else { 
-    BndLib_AddSurface::Add(Surf->Surface(),1e-8,B1);
-  }
-  Standard_Real x0,y0,z0,x1,y1,z1,dx,dy,dz;
-  if(Box1OK) { 
-    B1.Get(x0,y0,z0,x1,y1,z1);
-    dx=x1-x0;
-    dy=y1-y0;
-    dz=z1-z0;
-  } 
-  else { 
-    dx=dy=dz=1.0;
-  }
-  if(dx<dy) dx=dy;
-  if(dx<dz) dx=dz;
-  if(dx>10000.0) dx=10000.0;
-  Fleche*=dx;
-  TolArc*=dx;
-  //-- ********************************************************************************
-
-
-  //gp_Pnt valpt;
-
-//jag 940616  SFunc.Set(1.e-8); // tolerance sur la fonction
-  mySFunc.Set(Precision::Confusion()); // tolerance sur la fonction
-
-  Standard_Boolean RecheckOnRegularity = Standard_True;
-  solrst.Perform(myAFunc,Domain,TolArc,TolArc,RecheckOnRegularity);
-
-  if (!solrst.IsDone()) {
-    return;
-  }
-
-  NbPointRst = solrst.NbPoints();
-  IntSurf_SequenceOfPathPoint seqpdep;
-  TColStd_Array1OfInteger Destination(1,NbPointRst+1);
-  Destination.Init(0);
-  if (NbPointRst != 0) {
-    ComputeTangency(solrst,Domain,mySFunc,seqpdep,Destination);
-  }
-  
-  //jag 940616  solins.Perform(SFunc,Surf,Domain,1.e-6); // 1.e-6 : tolerance dans l espace.
-  solins.Perform(mySFunc,Surf,Domain,Precision::Confusion());
-  
-  NbPointIns = solins.NbPoints();
-  IntSurf_SequenceOfInteriorPoint seqpins;
-
-  if (NbPointIns != 0) {
-    Standard_Boolean bKeepAllPoints = Standard_False;
-    //IFV begin
-    if(solrst.NbSegments() <= 0) {
-      if(mySFunc.FunctionType() == Contap_ContourStd) {
-       const TheSurface& Surf = mySFunc.Surface();
-       if(TheSurfaceTool::GetType(Surf) == GeomAbs_Torus) {
-         gp_Torus aTor = TheSurfaceTool::Torus(Surf);
-         gp_Dir aTorDir = aTor.Axis().Direction();
-         gp_Dir aProjDir = mySFunc.Direction();
-
-         if(aTorDir.Dot(aProjDir) < Precision::Confusion()) {
-           bKeepAllPoints = Standard_True;
-         }
-       }
-      }
-    }
-       
-    if(bKeepAllPoints) {
-      Standard_Integer Nbp = solins.NbPoints(), indp;
-      for (indp=1; indp <= Nbp; indp++) {
-       const IntSurf_InteriorPoint& pti = solins.Value(indp);
-       seqpins.Append(pti);
-      }
-    }
-    //IFV - end
-    else {
-      KeepInsidePoints(solins,solrst,mySFunc,seqpins);
-    }
-  }
-
-  if (seqpdep.Length() != 0 || seqpins.Length() != 0) {
-
-    Contap_TheIWalking iwalk(Preci,Fleche,Pas);
-    iwalk.Perform(seqpdep,seqpins,mySFunc ,Surf);
-    if(!iwalk.IsDone()) {
-      return;
-    }
-    
-    Nblines = iwalk.NbLines();
-    for (j=1; j<=Nblines; j++) {
-      IntSurf_TypeTrans TypeTransOnS = IntSurf_Undecided;
-      const Handle(Contap_TheIWLineOfTheIWalking)& iwline = iwalk.Value(j);
-      Nbpts = iwline->NbPoints();
-      theline.SetLineOn2S(iwline->Line());
-
-      // jag 941018 On calcule une seule fois la transition
-
-      tgline = iwline->TangentVector(k);
-      iwline->Line()->Value(k).ParametersOnS2(U,V); 
-      TypeTransOnS = ComputeTransitionOnLine(mySFunc,U,V,tgline);
-      theline.SetTransitionOnS(TypeTransOnS);
-           
-      //---------------------------------------------------------------------
-      //-- On ajoute a la liste des vertex les 1er et dernier points de la  -
-      //-- ligne de cheminement si ceux-ci ne sont pas presents             -
-      //---------------------------------------------------------------------
-      
-      if (iwline->HasFirstPoint()) {
-       indfirst = iwline->FirstPointIndex();
-       const IntSurf_PathPoint& PPoint = seqpdep(indfirst);
-       Standard_Integer themult = PPoint.Multiplicity();
-       for (i=NbPointRst; i>=1; i--) {
-         if (Destination(i) == indfirst) {
-           PPoint.Parameters(themult,U,V);
-           ptdeb.SetValue(PPoint.Value(),U,V);
-           ptdeb.SetParameter(1.0);
-
-           const Contap_ThePathPointOfTheSearch& PStart = solrst.Point(i);
-           const TheArc& currentarc = PStart.Arc();
-           currentparam = PStart.Parameter();
-           if (!iwline->IsTangentAtBegining()) {
-
-             TheArcTool::D1(currentarc,currentparam,pt2d,d2d);
-             Contap_TheSurfProps::DerivAndNorm(Surf,pt2d.X(),pt2d.Y(),
-                                               ptonsurf,d1u,d1v,normale);
-             tgtrst = d2d.X()*d1u;
-             tgtrst.Add(d2d.Y()*d1v);
-
-             IntSurf::MakeTransition(PPoint.Direction3d(),tgtrst,normale,
-                                     TLine,TArc);
-
-           }
-           else {// a voir. En effet, on a cheminer. Si on est sur un point 
-                 // debut, on sait qu'on rentre dans la matiere
-             TLine.SetValue();
-             TArc.SetValue();
-           }
-
-           ptdeb.SetArc(currentarc,currentparam,TLine,TArc);
-           
-           if (!solrst.Point(i).IsNew()) {
-             ptdeb.SetVertex(PStart.Vertex());
-           }
-           theline.Add(ptdeb);
-           themult--;
-         }
-       }
-      }
-      else { 
-       iwline->Value(1).ParametersOnS2(U,V);
-       ptdeb.SetValue(theline.Point(1).Value(),U,V);
-       ptdeb.SetParameter(1.0);
-       theline.Add(ptdeb);
-      }
-      
-      if (iwline->HasLastPoint()) {
-       indlast = iwline->LastPointIndex();
-       const IntSurf_PathPoint& PPoint = seqpdep(indlast);
-       Standard_Integer themult = PPoint.Multiplicity();
-       for (i=NbPointRst; i>=1; i--) {
-         if (Destination(i) == indlast) {
-           PPoint.Parameters(themult,U,V);
-           ptfin.SetValue(PPoint.Value(),U,V);
-           ptfin.SetParameter((Standard_Real)(Nbpts));
-           const Contap_ThePathPointOfTheSearch& PStart = solrst.Point(i);
-           const TheArc& currentarc = PStart.Arc();
-           currentparam = PStart.Parameter();
-           
-           if (!iwline->IsTangentAtEnd()) {
-
-             TheArcTool::D1(currentarc,currentparam,pt2d,d2d);
-
-             Contap_TheSurfProps::DerivAndNorm(Surf,pt2d.X(),pt2d.Y(),
-                                               ptonsurf,d1u,d1v,normale);
-             tgtrst = d2d.X()*d1u;
-             tgtrst.Add(d2d.Y()*d1v);
-             IntSurf::MakeTransition(PPoint.Direction3d().Reversed(),
-                                     tgtrst,normale,TLine,TArc);
-           }
-           else {
-             TLine.SetValue();
-             TArc.SetValue();
-           }
-
-           ptfin.SetArc(currentarc,currentparam,TLine,TArc);
-           
-           if (!solrst.Point(i).IsNew()) {
-             ptfin.SetVertex(PStart.Vertex());
-           }
-           theline.Add(ptfin);
-           themult--;
-         }
-       }
-      }
-      else { 
-       iwline->Value(Nbpts).ParametersOnS2(U,V);
-       ptfin.SetValue(theline.Point(Nbpts).Value(),U,V);
-       ptfin.SetParameter((Standard_Real)(Nbpts));
-       theline.Add(ptfin);
-      }
-
-      ComputeInternalPoints(theline,mySFunc,EpsU,EpsV);
-      LineConstructor(slin,Domain,theline,Surf); //-- lbr
-      //-- slin.Append(theline);
-      theline.ResetSeqOfVertex();
-    }
-    
-
-    Nblines = slin.Length();
-    for (j=1; j<=Nblines-1; j++) {
-      const Contap_TheLine& theli = slin(j);
-      Nbvt1 = theli.NbVertex();
-      for (ivt1=1; ivt1<=Nbvt1; ivt1++) {
-       if (!theli.Vertex(ivt1).IsOnArc()) {
-         const gp_Pnt& pttg1 = theli.Vertex(ivt1).Value();
-         
-         for (k=j+1; k<=Nblines;k++) {
-           const Contap_TheLine& theli2 = slin(k);
-           Nbvt2 = theli2.NbVertex();
-           for (ivt2=1; ivt2<=Nbvt2; ivt2++) {
-             if (!theli2.Vertex(ivt2).IsOnArc()) {
-               const gp_Pnt& pttg2 = theli2.Vertex(ivt2).Value();
-               
-               if (pttg1.Distance(pttg2) <= TolArc) {
-                 theli.Vertex(ivt1).SetMultiple();
-                 theli2.Vertex(ivt2).SetMultiple();
-               }
-             }
-           }
-         }
-       }
-      }
-    }
-  }
-  
-  // jag 940620 On ajoute le traitement des restrictions solutions.
-
-  if (solrst.NbSegments() !=0) {
-    ProcessSegments(solrst,slin,TolArc,mySFunc,Domain);
-  }
-
-
-  // Ajout crad pour depanner CMA en attendant mieux
-  if (solrst.NbSegments() !=0) {
-  
-    Nblines = slin.Length();
-    for (j=1; j<=Nblines; j++) {
-      const Contap_TheLine& theli = slin(j);
-      if (theli.TypeContour() == Contap_Walking) {
-       Nbvt1 = theli.NbVertex();
-       for (ivt1=1; ivt1<=Nbvt1; ivt1++) {
-         Contap_ThePoint& ptvt = theli.Vertex(ivt1);
-         if (!ptvt.IsOnArc() && !ptvt.IsMultiple()) {
-           Standard_Real Up,Vp;
-           ptvt.Parameters(Up,Vp);
-           gp_Pnt2d toproj(Up,Vp);
-           Standard_Boolean projok;
-           for (k=1; k<=Nblines;k++) {
-             if (slin(k).TypeContour() == Contap_Restriction) {
-               const TheArc& thearc = slin(k).Arc();
-               Standard_Real paramproj;
-               gp_Pnt2d Ptproj;
-               projok = TheContTool::Project(thearc,toproj,paramproj,Ptproj);
-               
-               if (projok) {
-                 Standard_Real dist = Ptproj.Distance(gp_Pnt2d(Up,Vp));
-                 if (dist <= Preci) {
-                   // Calcul de la transition
-                   
-                   TheArcTool::D1(thearc,paramproj,Ptproj,d2d);
-//                 TheSurfaceTool::D1(Surf,Ptproj.X(),Ptproj.Y(),
-//                                    ptonsurf,d1u,d1v);
-//                 normale = d1u.Crossed(d1v);
-
-                   Contap_TheSurfProps::DerivAndNorm
-                     (Surf,Ptproj.X(),Ptproj.Y(),ptonsurf,d1u,d1v,normale);
-
-                   tgtrst = d2d.X()*d1u;
-                   tgtrst.Add(d2d.Y()*d1v);
-                     Standard_Integer Paraml =
-                       (Standard_Integer) ptvt.ParameterOnLine();
-                   
-                   if (Paraml == theli.NbPnts()) {
-                     tgline = gp_Vec(theli.Point(Paraml-1).Value(),
-                                     ptvt.Value());
-                   }
-                   else {
-                     tgline = gp_Vec(ptvt.Value(),
-                                     theli.Point(Paraml+1).Value());
-                   }
-                   IntSurf::MakeTransition(tgline,tgtrst,normale,
-                                           TLine,TArc);
-                   ptvt.SetArc(thearc,paramproj,TLine,TArc);
-                   ptvt.SetMultiple();
-                   ptdeb.SetValue(ptonsurf,Ptproj.X(),Ptproj.Y());
-                   ptdeb.SetParameter(paramproj);
-                   ptdeb.SetMultiple();
-                   slin(k).Add(ptdeb);
-                   break;
-                 }
-                 else {
-                   projok = Standard_False;
-                 }
-               }
-             }
-             else {
-               projok = Standard_False;
-             }
-             if (projok) {
-               break;
-             }
-           }
-         }
-       }
-      }
-    }
-  }
-  done = Standard_True;
-}
-
diff --git a/src/Contap/Contap_ContourGen_3.gxx b/src/Contap/Contap_ContourGen_3.gxx
deleted file mode 100644 (file)
index a6f98f7..0000000
+++ /dev/null
@@ -1,442 +0,0 @@
-// Created on: 1993-02-05
-// Created by: Jacques GOUSSARD
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#define Tolpetit 1.e-10  // pour dist au carre
-#include <ElSLib.hxx>
-
-
-#include <TColStd_SequenceOfInteger.hxx>
-
-static Standard_Boolean FindLine(Contap_TheLine& Line,
-                                const TheSurface& Surf,
-                                const gp_Pnt2d& Pt2d,
-                                gp_Pnt& Ptref,
-                                Standard_Real& Paramin,
-                                gp_Vec& Tgmin,
-                                gp_Vec& Norm)
-{
-//  Standard_Integer i;
-  gp_Pnt pt,ptmin;
-  gp_Vec tg;
-  Standard_Real para,dist;
-  Standard_Real dismin = RealLast();
-
-  Contap_TheSurfProps::Normale(Surf,Pt2d.X(),Pt2d.Y(),Ptref,Norm);
-
-  if (Line.TypeContour() == Contap_Lin) {
-    gp_Lin lin(Line.Line());
-    para = ElCLib::Parameter(lin,Ptref);
-    ElCLib::D1(para,lin,pt,tg);
-    dist = pt.Distance(Ptref) + Abs(Norm.Dot(lin.Direction()));
-  }
-  else { // Contap__Circle
-    gp_Circ cir(Line.Circle());
-    para = ElCLib::Parameter(cir,Ptref);
-    ElCLib::D1(para,cir,pt,tg);
-    dist = pt.Distance(Ptref)+Abs(Norm.Dot(tg/cir.Radius()));
-  }
-  if (dist < dismin) {
-    dismin = dist;
-    Paramin = para;
-    ptmin = pt;
-    Tgmin = tg;
-  }
-  if (ptmin.SquareDistance(Ptref) <= Tolpetit) {
-    return Standard_True;
-  }
-  else {
-    return Standard_False;
-  }
-}
-
-
-static void PutPointsOnLine (const Contap_TheSearch& solrst,
-                            const TheSurface& Surf,
-                            Contap_TheSequenceOfLine& slin)
-
-{
-  Standard_Integer i,l;//,index; 
-  Standard_Integer NbPoints = solrst.NbPoints();
-
-  Standard_Real theparam;
-
-  IntSurf_Transition TLine,TArc;
-  Standard_Boolean goon;
-  
-  gp_Pnt2d pt2d;
-  gp_Vec2d d2d;
-
-  gp_Pnt ptonsurf;
-  gp_Vec vectg,normale,tgtrst;
-  Standard_Real paramlin = 0.0;
-
-  
-  Standard_Integer nbLin = slin.Length();
-  for(l=1;l<=nbLin;l++) { 
-    Contap_TheLine& Line=slin.ChangeValue(l);
-    for (i=1; i<= NbPoints; i++) {
-      
-      const Contap_ThePathPointOfTheSearch& PStart = solrst.Point(i);
-      const TheArc& thearc = PStart.Arc();
-      theparam = PStart.Parameter();
-      
-      TheArcTool::D1(thearc,theparam,pt2d,d2d);
-      goon = FindLine(Line,Surf,pt2d,ptonsurf,paramlin,vectg,normale);
-      
-      Contap_ThePoint PPoint;
-
-      if (goon) {
-       gp_Vec d1u,d1v;
-       gp_Pnt bidpt;
-       TheSurfaceTool::D1(Surf,pt2d.X(),pt2d.Y(),bidpt,d1u,d1v);
-       PPoint.SetValue(ptonsurf,pt2d.X(),pt2d.Y());
-       if (normale.Magnitude() < RealEpsilon()) {
-         TLine.SetValue();
-         TArc.SetValue();
-       }
-       else {
-         // Petit test qui devrait permettre de bien traiter les pointes
-         // des cones, et les sommets d`une sphere. Il faudrait peut-etre
-         // rajouter une methode dans SurfProps
-         
-         if (Abs(d2d.Y()) <= Precision::Confusion()) {
-           tgtrst = d1v.Crossed(normale);
-           if(d2d.X() < 0.0) 
-             tgtrst.Reverse();
-         }
-         else {
-           tgtrst.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
-         }
-         IntSurf::MakeTransition(vectg,tgtrst,normale,TLine,TArc);
-       }
-       
-       PPoint.SetArc(thearc,theparam, TLine, TArc);
-       PPoint.SetParameter(paramlin);
-       if (!PStart.IsNew()) {
-         PPoint.SetVertex(PStart.Vertex());
-       }
-       Line.Add(PPoint);
-      }
-    }
-  }
-}
-
-
-//----------------------------------------------------------------------------------
-//-- Orientation des contours Apparents quand ceux-ci sont des lignes ou des cercles
-//-- On prend un point de la ligne ou du cercle ---> P 
-//-- On projete ce point sur la surface P ---> u,v
-//-- et on evalue la transition au point u,v
-//----------------------------------------------------------------------------------
-
-IntSurf_TypeTrans ComputeTransitionOngpLine
-  (Contap_TheSurfFunction& SFunc,
-   const gp_Lin& L)
-{ 
-  const TheSurface& Surf=SFunc.Surface();
-  GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(Surf);
-  gp_Pnt P;
-  gp_Vec T;
-  ElCLib::D1(0.0,L,P,T);
-  Standard_Real u = 0.,v = 0.;
-  switch (typS) {
-  case GeomAbs_Cylinder: {
-    ElSLib::Parameters(TheSurfaceTool::Cylinder(Surf),P,u,v);
-      break;
-    }
-  case GeomAbs_Cone: {
-    ElSLib::Parameters(TheSurfaceTool::Cone(Surf),P,u,v);
-      break;
-    }
-  case GeomAbs_Sphere: { 
-    ElSLib::Parameters(TheSurfaceTool::Sphere(Surf),P,u,v);
-      break;
-    }
-  default:
-    break;
-  }
-  return(ComputeTransitionOnLine(SFunc,u,v,T));
-}
-
-
-IntSurf_TypeTrans ComputeTransitionOngpCircle
-  (Contap_TheSurfFunction& SFunc,
-   const gp_Circ& C)
-{ 
-  const TheSurface& Surf=SFunc.Surface();
-  GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(Surf);
-  gp_Pnt P;
-  gp_Vec T;
-  ElCLib::D1(0.0,C,P,T);
-  Standard_Real u = 0.,v = 0.;
-  switch (typS) {
-  case GeomAbs_Cylinder: {
-    ElSLib::Parameters(TheSurfaceTool::Cylinder(Surf),P,u,v);
-      break;
-    }
-  case GeomAbs_Cone: {
-    ElSLib::Parameters(TheSurfaceTool::Cone(Surf),P,u,v);
-      break;
-    }
-  case GeomAbs_Sphere: { 
-    ElSLib::Parameters(TheSurfaceTool::Sphere(Surf),P,u,v);
-      break;
-    }
-  default:
-    break;
-  }
-  return(ComputeTransitionOnLine(SFunc,u,v,T));
-}
-
-
-void Contap_ContourGen::PerformAna(const Handle(TheTopolTool)& Domain)
-{
-
-  done = Standard_False;
-  slin.Clear();
-
-  Standard_Real TolArc = 1.e-5;
-
-  Standard_Integer nbCont, nbPointRst, i;
-  //gp_Circ cirsol;
-  //gp_Lin linsol;
-  Contap_ContAna contana;
-  Contap_TheLine theline;
-  const TheSurface& Surf = mySFunc.Surface();
-  Contap_TFunction TypeFunc(mySFunc.FunctionType());
-  Standard_Boolean PerformSolRst = Standard_True;
-
-  GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(Surf);
-
-  switch (typS) {
-  case GeomAbs_Plane: 
-    {
-      gp_Pln pl(TheSurfaceTool::Plane(Surf));
-      switch (TypeFunc) {
-      case Contap_ContourStd:
-       {
-         gp_Dir Dirpln(pl.Axis().Direction());
-         if (Abs(mySFunc.Direction().Dot(Dirpln)) > Precision::Angular()) {
-           // Aucun point du plan n`est solution, en particulier aucun point
-           // sur restriction.
-           PerformSolRst = Standard_False;
-         }
-       }
-       break;
-      case Contap_ContourPrs:
-       {
-         gp_Pnt Eye(mySFunc.Eye());
-         if (pl.Distance(Eye) > Precision::Confusion()) {
-           // Aucun point du plan n`est solution, en particulier aucun point
-           // sur restriction.
-           PerformSolRst = Standard_False;
-         }         
-       }
-       break;
-      case Contap_DraftStd:
-       {
-         gp_Dir Dirpln(pl.Axis().Direction());
-         Standard_Real Sina = Sin(mySFunc.Angle());
-         if (Abs(mySFunc.Direction().Dot(Dirpln)+ Sina) > //voir SurfFunction
-             Precision::Angular()) {
-         
-           PerformSolRst = Standard_False;
-         }
-       }
-       break;
-      case Contap_DraftPrs:
-      default:
-       {
-       }
-      }
-    }
-    break;
-
-  case GeomAbs_Sphere:
-    {
-      switch (TypeFunc) {
-      case Contap_ContourStd:
-       {
-         contana.Perform(TheSurfaceTool::Sphere(Surf),mySFunc.Direction());
-       }
-       break;
-      case Contap_ContourPrs:
-       {
-         contana.Perform(TheSurfaceTool::Sphere(Surf),mySFunc.Eye());
-       }
-       break;
-      case Contap_DraftStd:
-       {
-         contana.Perform(TheSurfaceTool::Sphere(Surf),
-                         mySFunc.Direction(),mySFunc.Angle());
-       }
-       break;
-      case Contap_DraftPrs:
-      default:
-       {
-       }
-      }
-    }
-    break;
-
-  case GeomAbs_Cylinder:
-    {
-      switch (TypeFunc) {
-      case Contap_ContourStd:
-       {
-         contana.Perform(TheSurfaceTool::Cylinder(Surf),mySFunc.Direction());
-       }
-       break;
-      case Contap_ContourPrs:
-       {
-         contana.Perform(TheSurfaceTool::Cylinder(Surf),mySFunc.Eye());
-       }
-       break;
-      case Contap_DraftStd:
-       {
-         contana.Perform(TheSurfaceTool::Cylinder(Surf),
-                         mySFunc.Direction(),mySFunc.Angle());
-       }
-       break;
-      case Contap_DraftPrs:
-      default:
-       {
-       }
-      }
-    }
-    break;
-
-  case GeomAbs_Cone:
-    {
-      switch (TypeFunc) {
-      case Contap_ContourStd:
-       {
-         contana.Perform(TheSurfaceTool::Cone(Surf),mySFunc.Direction());
-       }
-       break;
-      case Contap_ContourPrs:
-       {
-         contana.Perform(TheSurfaceTool::Cone(Surf),mySFunc.Eye());
-       }
-       break;
-      case Contap_DraftStd:
-       {
-         contana.Perform(TheSurfaceTool::Cone(Surf),
-                         mySFunc.Direction(),mySFunc.Angle());
-       }
-       break;
-      case Contap_DraftPrs:
-      default:
-       {
-       }
-      }
-    default:
-      break;
-    }
-    break;
-  }
-  
-  if (typS != GeomAbs_Plane) {
-
-    if (!contana.IsDone()) {
-      return;
-    }
-
-    nbCont = contana.NbContours();
-
-    if (contana.NbContours() == 0) {
-      done = Standard_True;
-      return;
-    }
-
-    GeomAbs_CurveType typL = contana.TypeContour();
-    if (typL == GeomAbs_Circle) {
-      theline.SetValue(contana.Circle());
-      IntSurf_TypeTrans TransCircle;
-      TransCircle = ComputeTransitionOngpCircle(mySFunc,contana.Circle());
-      theline.SetTransitionOnS(TransCircle);
-      slin.Append(theline);
-    }
-    else if (typL == GeomAbs_Line) {
-      for (i=1; i<=nbCont; i++) {
-        theline.SetValue(contana.Line(i));
-       IntSurf_TypeTrans TransLine;
-       TransLine = ComputeTransitionOngpLine(mySFunc,contana.Line(i));
-       theline.SetTransitionOnS(TransLine);
-       slin.Append(theline);
-       theline.Clear();
-      }
-      
-/*
-      if (typS == GeomAbs_Cone) {
-        Standard_Real u,v;
-       gp_Cone thecone(TheSurfaceTool::Cone(Surf));
-       ElSLib::Parameters(thecone,thecone.Apex(),u,v);
-       Contap_ThePoint vtxapex(thecone.Apex(),u,v);
-       vtxapex.SetInternal();
-       vtxapex.SetMultiple();
-       for (i=1; i<=nbCont i++) {
-          slin.ChangeValue(i).Add(vtxapex);
-       }
-      }
-*/
-    }
-  }
-
-  if(PerformSolRst) { 
-    
-    solrst.Perform(myAFunc,Domain,TolArc,TolArc);
-    if (!solrst.IsDone()) {
-      return;
-    }
-    nbPointRst = solrst.NbPoints();
-    
-    if (nbPointRst != 0) {
-      PutPointsOnLine(solrst,Surf,slin);
-    }
-    
-    if (solrst.NbSegments() !=0) {
-      ProcessSegments(solrst,slin,TolArc,mySFunc,Domain);
-    }
-    
-    
-    //-- lbr 
-    //Standard_Boolean oneremov;
-    Standard_Integer nblinto = slin.Length();
-    TColStd_SequenceOfInteger SeqToDestroy;
-    
-    //-- cout<<" Construct Contour_3   nblin = "<<nblinto<<endl;
-    for(i=1; i<= nblinto ; i++) { 
-      //-- cout<<" nbvtx : "<<slin.Value(i).NbVertex()<<endl;
-      //--if(slin.Value(i).NbVertex() > 1) { 
-      if(slin.Value(i).TypeContour() != Contap_Restriction) { 
-       LineConstructor(slin,Domain,slin.ChangeValue(i),Surf);
-       SeqToDestroy.Append(i);
-      }
-      //-- }
-    }
-    for(i=SeqToDestroy.Length(); i>=1; i--) { 
-      slin.Remove(SeqToDestroy.Value(i));
-    } 
-  }
-
-  done = Standard_True;
-}
-
-
-
-
-
similarity index 78%
rename from src/Contap/Contap_HContToolGen.cdl
rename to src/Contap/Contap_HContTool.cdl
index e9c2ff6..b316374 100644 (file)
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-generic class HContToolGen from Contap  (
-     TheHVertex      as any;
-     TheHCurve2d     as any;
-     TheHSurface     as any;
-     TheHCurve2dTool as any;
-     TheHSurfaceTool as any)
+class HContTool from Contap
 
        ---Purpose: Tool for the intersection between 2 surfaces.
        --          Regroupe pour l instant les methodes hors Adaptor3d...
 
 
-
 uses 
-     Pnt2d    from gp,
-     Pnt      from gp
+     Pnt2d        from gp,
+     Pnt          from gp,
+     HVertex      from Adaptor3d,
+     HCurve2d     from Adaptor2d,
+     HSurface     from Adaptor3d,
+     HCurve2dTool from Contap,
+     HSurfaceTool from Adaptor3d
 
 is
 
-
-    NbSamplesU(myclass; S: TheHSurface; u1,u2: Real from Standard)
+    NbSamplesU(myclass; S: HSurface from Adaptor3d; u1,u2: Real from Standard)
         returns Integer from Standard;
 
-    NbSamplesV(myclass; S: TheHSurface; v1,v2: Real from Standard)
+    NbSamplesV(myclass; S: HSurface from Adaptor3d; v1,v2: Real from Standard)
         returns Integer from Standard;
 
 -- Methodes pour recherche des points interieurs
 
-    NbSamplePoints(myclass; S: TheHSurface)
+    NbSamplePoints(myclass; S: HSurface from Adaptor3d)
 
        returns Integer from Standard;
 
 
-    SamplePoint(myclass; S    : TheHSurface;
+    SamplePoint(myclass; S    : HSurface from Adaptor3d;
                         Index: Integer from Standard;
                          U,V: out Real from Standard);
 
 
 -- Methodes sur un arc de restriction
 
-    HasBeenSeen(myclass; C: TheHCurve2d)
+    HasBeenSeen(myclass; C: HCurve2d from Adaptor2d)
 
        ---Purpose: Returns True if all the intersection point and edges
        --          are known on the Arc.
@@ -63,7 +61,7 @@ is
 
        returns Boolean from Standard;
 
-    NbSamplesOnArc(myclass; A: TheHCurve2d)
+    NbSamplesOnArc(myclass; A: HCurve2d from Adaptor2d)
     
        ---Purpose: returns the number of points which is used to make 
        --          a sample on the arc. this number is a function of
@@ -72,7 +70,7 @@ is
         returns Integer from Standard;
 
 
-    Bounds(myclass; C: TheHCurve2d; 
+    Bounds(myclass; C: HCurve2d from Adaptor2d; 
                     Ufirst,Ulast: out Real from Standard);
 
        ---Purpose: Returns the parametric limits on the arc C.
@@ -81,7 +79,7 @@ is
        --          or a bounding box for an infinite arc.
 
 
-    Project(myclass; C: TheHCurve2d;
+    Project(myclass; C: HCurve2d from Adaptor2d;
                      P: Pnt2d from gp;
                      Paramproj: out Real from Standard;
                      Ptproj   : out Pnt2d from gp)
@@ -100,7 +98,7 @@ is
 -- Methods on a vertex
 
 
-    Tolerance(myclass; V: TheHVertex; C: TheHCurve2d)
+    Tolerance(myclass; V: HVertex from Adaptor3d; C: HCurve2d from Adaptor2d)
 
        ---Purpose: Returns the parametric tolerance used to consider
        --          that the vertex and another point meet, i-e
@@ -110,7 +108,7 @@ is
        returns Real from Standard;
 
 
-    Parameter(myclass; V: TheHVertex; C: TheHCurve2d)
+    Parameter(myclass; V: HVertex from Adaptor3d; C: HCurve2d from Adaptor2d)
     
        ---Purpose: Returns the parameter of the vertex V on the arc A.
 
@@ -119,14 +117,14 @@ is
 
 -- The following methods are used when HasBeenSeen returns Standard_True
 
-    NbPoints(myclass; C: TheHCurve2d)
+    NbPoints(myclass; C: HCurve2d from Adaptor2d)
     
        ---Purpose: Returns the number of intersection points on the arc A.
     
        returns Integer from Standard;
 
 
-    Value(myclass; C: TheHCurve2d; Index: Integer from Standard;
+    Value(myclass; C: HCurve2d from Adaptor2d; Index: Integer from Standard;
                    Pt: out Pnt from gp; Tol: out Real from Standard;
                    U: out Real from Standard);
 
@@ -135,7 +133,7 @@ is
        --          point of range Index.
 
 
-    IsVertex(myclass; C: TheHCurve2d;
+    IsVertex(myclass; C: HCurve2d from Adaptor2d;
                       Index: Integer from Standard)
     
        ---Purpose: Returns True if the intersection point of range Index
@@ -144,14 +142,14 @@ is
        returns Boolean from Standard;
 
 
-    Vertex(myclass; C: TheHCurve2d; Index: Integer from Standard;
-                    V: out TheHVertex);
+    Vertex(myclass; C: HCurve2d from Adaptor2d; Index: Integer from Standard;
+                    V: out HVertex from Adaptor3d);
 
        ---Purpose: When IsVertex returns True, this method returns the
        --          vertex on the arc A.
 
 
-    NbSegments(myclass; C: TheHCurve2d)
+    NbSegments(myclass; C: HCurve2d from Adaptor2d)
     
        ---Purpose: returns the number of part of A solution of the
        --          of intersection problem.
@@ -159,7 +157,7 @@ is
        returns Integer from Standard;
 
 
-    HasFirstPoint(myclass; C: TheHCurve2d; 
+    HasFirstPoint(myclass; C: HCurve2d from Adaptor2d; 
                            Index: Integer from Standard;
                            IndFirst: out Integer from Standard)
     
@@ -173,7 +171,7 @@ is
        returns Boolean from Standard;
 
 
-    HasLastPoint(myclass; C: TheHCurve2d;
+    HasLastPoint(myclass; C: HCurve2d from Adaptor2d;
                           Index: Integer from Standard;
                           IndLast: out Integer from Standard)
     
@@ -187,7 +185,7 @@ is
        returns Boolean from Standard;
 
 
-    IsAllSolution(myclass; C: TheHCurve2d)
+    IsAllSolution(myclass; C: HCurve2d from Adaptor2d)
     
        ---Purpose: Returns True when the whole restriction is solution
        --          of the intersection problem.
@@ -195,4 +193,4 @@ is
        returns Boolean from Standard;
 
 
-end HContToolGen;
+end HContTool;
similarity index 68%
rename from src/Contap/Contap_HContToolGen.gxx
rename to src/Contap/Contap_HContTool.cxx
index 0fd0df0..ab0498d 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <Contap_HContTool.ixx>
+
 #include <Extrema_EPCOfExtPC2d.hxx>
 #include <Extrema_POnCurv2d.hxx>
 
-#include <GeomAbs_SurfaceType.hxx>
-#include <Standard_OutOfRange.hxx>
-
-#include <Geom_BezierSurface.hxx>
-#include <Geom_BSplineSurface.hxx>
-#include <Geom2d_BezierCurve.hxx>
-#include <Geom2d_BSplineCurve.hxx>
-
-#include <Geom_BezierSurface.hxx>
-#include <Geom_BSplineSurface.hxx>
-#include <Geom2d_BezierCurve.hxx>
-#include <Geom2d_BSplineCurve.hxx>
-
 static Standard_Real uinf,vinf,usup,vsup;
 
-#include TheHSurface_hxx
-#include TheHCurve2d_hxx
-#include TheHVertex_hxx
-
-
-Standard_Integer Contap_HContToolGen::NbSamplesV
-  (const TheHSurface& S,
-   const Standard_Real ,
-   const Standard_Real )
+Standard_Integer Contap_HContTool::NbSamplesV
+(const Handle(Adaptor3d_HSurface)& S,
+ const Standard_Real ,
+ const Standard_Real )
 {
   Standard_Integer nbs;
   GeomAbs_SurfaceType typS = S->GetType();
@@ -61,7 +45,7 @@ Standard_Integer Contap_HContToolGen::NbSamplesV
       nbs = S->NbVKnots();
       nbs*= S->VDegree();
       if(nbs < 2) nbs=2;
-      
+
     }
     break;
   case GeomAbs_Cylinder:
@@ -74,7 +58,7 @@ Standard_Integer Contap_HContToolGen::NbSamplesV
       nbs = 15;
     }
     break;
-    
+
   default: 
     {
       nbs = 10;
@@ -84,10 +68,10 @@ Standard_Integer Contap_HContToolGen::NbSamplesV
   return(nbs);
 }
 
-Standard_Integer Contap_HContToolGen::NbSamplesU
-  (const TheHSurface& S,
-   const Standard_Real ,
-   const Standard_Real )
+Standard_Integer Contap_HContTool::NbSamplesU
+(const Handle(Adaptor3d_HSurface)& S,
+ const Standard_Real ,
+ const Standard_Real )
 {
   Standard_Integer nbs;
   GeomAbs_SurfaceType typS = S->GetType();
@@ -108,7 +92,7 @@ Standard_Integer Contap_HContToolGen::NbSamplesU
       nbs = S->NbUKnots();
       nbs*= S->UDegree();
       if(nbs < 2) nbs=2;
-      
+
     }
     break;
   case GeomAbs_Torus: 
@@ -125,7 +109,7 @@ Standard_Integer Contap_HContToolGen::NbSamplesU
       nbs = 10;
     }
     break;
-    
+
   default: 
     {
       nbs = 10;
@@ -135,8 +119,8 @@ Standard_Integer Contap_HContToolGen::NbSamplesU
   return(nbs);
 }
 
-Standard_Integer Contap_HContToolGen::NbSamplePoints
-  (const TheHSurface& S)
+Standard_Integer Contap_HContTool::NbSamplePoints
+(const Handle(Adaptor3d_HSurface)& S)
 {
   uinf = S->FirstUParameter();
   usup = S->LastUParameter();
@@ -147,8 +131,8 @@ Standard_Integer Contap_HContToolGen::NbSamplePoints
     Standard_Real temp = uinf;
     uinf = usup;
     usup = temp;
-    }
-    if (vsup < vinf) {
+  }
+  if (vsup < vinf) {
     Standard_Real temp = vinf;
     vinf = vsup;
     vsup = temp;
@@ -163,7 +147,7 @@ Standard_Integer Contap_HContToolGen::NbSamplePoints
   else if (usup == RealLast()) {
     usup = uinf + 2.e5;
   }
-  
+
   if (vinf == RealFirst() && vsup == RealLast()) {
     vinf = -1.e5;
     vsup =  1.e5;
@@ -183,10 +167,10 @@ Standard_Integer Contap_HContToolGen::NbSamplePoints
     return 5;
 }
 
-void Contap_HContToolGen::SamplePoint (const TheHSurface& S,
-                                    const Standard_Integer Index,
-                                    Standard_Real& U,
-                                    Standard_Real& V )
+void Contap_HContTool::SamplePoint (const Handle(Adaptor3d_HSurface)& S,
+                                    const Standard_Integer Index,
+                                    Standard_Real& U,
+                                    Standard_Real& V )
 {
   if(S->GetType() ==   GeomAbs_BSplineSurface) {
     Standard_Integer nbIntU = NbSamplesU(S,uinf,usup)/3;
@@ -194,17 +178,17 @@ void Contap_HContToolGen::SamplePoint (const TheHSurface& S,
     if(nbIntU * nbIntV >5) { 
       Standard_Integer indU = (Index-1)/nbIntU;                  //----   0 --> nbIntV
       Standard_Integer indV = (Index-1) - indU*nbIntU;           //----   0 --> nbIntU
-      
+
       U = uinf + ((usup-uinf)/((Standard_Real)(nbIntU+1)))*(Standard_Real)(indU+1);
       V = vinf + ((vsup-vinf)/((Standard_Real)(nbIntV+2)))*(Standard_Real)(indV+1);
-      
+
       //-- cout<<"Index :"<<Index<<"  uinf:"<<uinf<<"  usup:"<<usup<<"  vinf:"<<vinf<<" vsup:"<<vsup<<"  ";
       //-- cout<<"  ("<<indU<<"/"<<nbIntU<<" ->U:"<<U<<"  ";
       //-- cout<<"  ("<<indV<<"/"<<nbIntV<<" ->V:"<<V<<endl;
       return;
     }
   }
-  
+
   switch (Index) {
   case 1:
     U = 0.75*uinf + 0.25*usup; //0.25;
@@ -229,8 +213,8 @@ void Contap_HContToolGen::SamplePoint (const TheHSurface& S,
 }
 
 
-Standard_Integer Contap_HContToolGen::NbSamplesOnArc
-  (const TheHCurve2d& A) { 
+Standard_Integer Contap_HContTool::NbSamplesOnArc
+(const Handle(Adaptor2d_HCurve2d)& A) { 
 
   GeomAbs_CurveType CurveType  = A->GetType();
 
@@ -252,7 +236,7 @@ Standard_Integer Contap_HContToolGen::NbSamplesOnArc
     //-- Handle_Geom2d_BSplineCurve& BSC=A->BSpline();
     nbsOnC = 2 + A->NbKnots() * A->Degree();
     break;
-  }
+                             }
   default:
     nbsOnC = 10;
   } 
@@ -260,19 +244,19 @@ Standard_Integer Contap_HContToolGen::NbSamplesOnArc
 }
 
 
-void Contap_HContToolGen::Bounds(const TheHCurve2d& A,
-                              Standard_Real& Ufirst,
-                              Standard_Real& Ulast)
+void Contap_HContTool::Bounds(const Handle(Adaptor2d_HCurve2d)& A,
+                              Standard_Real& Ufirst,
+                              Standard_Real& Ulast)
 {
   Ufirst = A->FirstParameter();
   Ulast  = A->LastParameter();
 }
 
 
-Standard_Boolean Contap_HContToolGen::Project (const TheHCurve2d& C,
-                                                const gp_Pnt2d& P,
-                                                Standard_Real& Paramproj,
-                                                gp_Pnt2d& Ptproj)
+Standard_Boolean Contap_HContTool::Project (const Handle(Adaptor2d_HCurve2d)& C,
+                                            const gp_Pnt2d& P,
+                                            Standard_Real& Paramproj,
+                                            gp_Pnt2d& Ptproj)
 
 {
 
@@ -303,80 +287,80 @@ Standard_Boolean Contap_HContToolGen::Project (const TheHCurve2d& C,
 }
 
 
-Standard_Real Contap_HContToolGen::Tolerance (const TheHVertex& V,
-                                           const TheHCurve2d& C)
+Standard_Real Contap_HContTool::Tolerance (const Handle(Adaptor3d_HVertex)& V,
+                                           const Handle(Adaptor2d_HCurve2d)& C)
 {
-//  return BRepAdaptor2d_Curve2dTool::Resolution(C,BRep_Tool::Tolerance(V));
+  //  return BRepAdaptor2d_Curve2dTool::Resolution(C,BRep_Tool::Tolerance(V));
   return V->Resolution(C);
 }
 
-Standard_Real Contap_HContToolGen::Parameter (const TheHVertex& V,
-                                           const TheHCurve2d& C)
+Standard_Real Contap_HContTool::Parameter (const Handle(Adaptor3d_HVertex)& V,
+                                           const Handle(Adaptor2d_HCurve2d)& C)
 {
-//  return BRep_Tool::Parameter(V,C.Edge());
+  //  return BRep_Tool::Parameter(V,C.Edge());
   return V->Parameter(C);
 }
 
 
 
-Standard_Boolean Contap_HContToolGen::HasBeenSeen
-  (const TheHCurve2d&)
+Standard_Boolean Contap_HContTool::HasBeenSeen
+(const Handle(Adaptor2d_HCurve2d)&)
 {
   return Standard_False;
 }
 
-Standard_Integer Contap_HContToolGen::NbPoints(const TheHCurve2d&)
+Standard_Integer Contap_HContTool::NbPoints(const Handle(Adaptor2d_HCurve2d)&)
 {
   return 0;
 }
 
-void Contap_HContToolGen::Value(const TheHCurve2d&,
-                             const Standard_Integer,
-                             gp_Pnt&,
-                             Standard_Real&,
-                             Standard_Real&)
+void Contap_HContTool::Value(const Handle(Adaptor2d_HCurve2d)&,
+                             const Standard_Integer,
+                             gp_Pnt&,
+                             Standard_Real&,
+                             Standard_Real&)
 {
   Standard_OutOfRange::Raise();
 }
 
-Standard_Boolean Contap_HContToolGen::IsVertex(const TheHCurve2d&,
-                                            const Standard_Integer)
+Standard_Boolean Contap_HContTool::IsVertex(const Handle(Adaptor2d_HCurve2d)&,
+                                            const Standard_Integer)
 {
   return Standard_False;
 }
 
-void Contap_HContToolGen::Vertex(const TheHCurve2d&,
-                              const Standard_Integer,
-                              TheHVertex&)
+void Contap_HContTool::Vertex(const Handle(Adaptor2d_HCurve2d)&,
+                              const Standard_Integer,
+                              Handle(Adaptor3d_HVertex)&)
 {
   Standard_OutOfRange::Raise();
 }
 
-Standard_Integer Contap_HContToolGen::NbSegments(const TheHCurve2d&)
+Standard_Integer Contap_HContTool::NbSegments(const Handle(Adaptor2d_HCurve2d)&)
 {
   return 0;
 }
 
-Standard_Boolean Contap_HContToolGen::HasFirstPoint
-  (const TheHCurve2d&,
-   const Standard_Integer,
-   Standard_Integer&)
+Standard_Boolean Contap_HContTool::HasFirstPoint
+(const Handle(Adaptor2d_HCurve2d)&,
+ const Standard_Integer,
+ Standard_Integer&)
 {
   Standard_OutOfRange::Raise();
-    return Standard_False;
+  return Standard_False;
 }
 
-Standard_Boolean Contap_HContToolGen::HasLastPoint
-  (const TheHCurve2d&,
-   const Standard_Integer,
-   Standard_Integer&)
+Standard_Boolean Contap_HContTool::HasLastPoint
+(const Handle(Adaptor2d_HCurve2d)&,
+ const Standard_Integer,
+ Standard_Integer&)
 {
   Standard_OutOfRange::Raise();
-    return Standard_False;
+  return Standard_False;
 }
 
-Standard_Boolean Contap_HContToolGen::IsAllSolution
-  (const TheHCurve2d&)
+Standard_Boolean Contap_HContTool::IsAllSolution
+(const Handle(Adaptor2d_HCurve2d)&)
 
 {
   return Standard_False;
similarity index 67%
rename from src/Contap/Contap_HCurve2dToolGen.cdl
rename to src/Contap/Contap_HCurve2dTool.cdl
index 1f35644..e0f4df4 100644 (file)
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-generic class HCurve2dToolGen from Contap (
-     CurveGen  as any)
+class HCurve2dTool from Contap
 
 uses 
-     Array1OfReal    from TColStd,
-     Shape           from GeomAbs,
-     CurveType       from GeomAbs,
-     Vec2d             from gp,
-     Pnt2d             from gp,
-     Circ2d            from gp,
-     Elips2d           from gp,
-     Hypr2d            from gp,
-     Parab2d           from gp,
-     Lin2d             from gp,
-     BezierCurve     from Geom2d,
-     BSplineCurve    from Geom2d
+     Array1OfReal   from TColStd,
+     Shape          from GeomAbs,
+     CurveType      from GeomAbs,
+     Vec2d          from gp,
+     Pnt2d          from gp,
+     Circ2d         from gp,
+     Elips2d        from gp,
+     Hypr2d         from gp,
+     Parab2d        from gp,
+     Lin2d          from gp,
+     BezierCurve    from Geom2d,
+     BSplineCurve   from Geom2d,
+     HCurve2d       from Adaptor2d
      
 raises
     
@@ -43,12 +43,12 @@ is
     --     Global methods - Apply to the whole curve.
     --     
     
-    FirstParameter(myclass; C: CurveGen) returns Real
+    FirstParameter(myclass; C: HCurve2d from Adaptor2d) returns Real
        ---C++: inline
     ;
     
 
-    LastParameter(myclass; C: CurveGen) returns Real
+    LastParameter(myclass; C: HCurve2d from Adaptor2d) returns Real
        ---C++: inline    
     ;
 
@@ -72,18 +72,18 @@ is
     -- use the method Trim().
 
     
-    Continuity(myclass; C: CurveGen) returns Shape from GeomAbs
+    Continuity(myclass; C: HCurve2d from Adaptor2d) returns Shape from GeomAbs
        ---Purpose: 
        ---C++: inline
     ;
     
-    NbIntervals(myclass; C: CurveGen; S : Shape from GeomAbs) returns Integer
+    NbIntervals(myclass; C: HCurve2d from Adaptor2d; S : Shape from GeomAbs) returns Integer
        ---Purpose: Returns  the number  of  intervals for  continuity
        --          <S>. May be one if Continuity(myclass) >= <S>
        ---C++: inline
     ;
     
-    Intervals(myclass; C: CurveGen; T : in out Array1OfReal from TColStd; 
+    Intervals(myclass; C: HCurve2d from Adaptor2d; T : in out Array1OfReal from TColStd; 
                  S : Shape from GeomAbs)
        ---Purpose: Stores in <T> the  parameters bounding the intervals
        --          of continuity <S>.
@@ -95,31 +95,31 @@ is
     ---C++: inline
     ;
     
-    IsClosed(myclass; C: CurveGen) returns Boolean
+    IsClosed(myclass; C: HCurve2d from Adaptor2d) returns Boolean
     ---C++: inline    
     ;
      
-    IsPeriodic(myclass; C: CurveGen) returns Boolean
+    IsPeriodic(myclass; C: HCurve2d from Adaptor2d) returns Boolean
     ---C++: inline
     ;
     
-    Period(myclass; C: CurveGen) returns Real
+    Period(myclass; C: HCurve2d from Adaptor2d) returns Real
     raises
        DomainError from Standard -- if the curve is not periodic
     ---C++: inline     
     ;
      
-    Value(myclass; C: CurveGen; U : Real) returns Pnt2d from gp
+    Value(myclass; C: HCurve2d from Adaptor2d; U : Real) returns Pnt2d from gp
          --- Purpose : Computes the point of parameter U on the curve.
     ---C++: inline
     ;
     
-    D0 (myclass; C: CurveGen; U : Real; P : out Pnt2d from gp)
+    D0 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp)
          --- Purpose : Computes the point of parameter U on the curve.
     ---C++: inline
     ;
     
-    D1 (myclass; C: CurveGen; U : Real; P : out Pnt2d from gp ; V : out Vec2d from gp)
+    D1 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp ; V : out Vec2d from gp)
          --- Purpose : Computes the point of parameter U on the curve with its
          --  first derivative.
      raises 
@@ -129,7 +129,7 @@ is
     ---C++: inline
     ;
     
-    D2 (myclass; C: CurveGen; U : Real; P : out Pnt2d from gp; V1, V2 : out Vec2d from gp)
+    D2 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp; V1, V2 : out Vec2d from gp)
         --- Purpose :
         --  Returns the point P of parameter U, the first and second
         --  derivatives V1 and V2.
@@ -140,7 +140,7 @@ is
     ---C++: inline
      ;
 
-    D3 (myclass; C: CurveGen; U : Real; P : out Pnt2d from gp; V1, V2, V3 : out Vec2d from gp)
+    D3 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp; V1, V2, V3 : out Vec2d from gp)
         --- Purpose :
         --  Returns the point P of parameter U, the first, the second 
         --  and the third derivative.
@@ -151,7 +151,7 @@ is
     ---C++: inline
      ;
         
-    DN (myclass; C: CurveGen; U : Real; N : Integer)   returns Vec2d from gp
+    DN (myclass; C: HCurve2d from Adaptor2d; U : Real; N : Integer)   returns Vec2d from gp
         --- Purpose :
         --  The returned vector gives the value of the derivative for the 
         --  order of derivation N.
@@ -164,13 +164,13 @@ is
     ---C++: inline
      ;
 
-    Resolution(myclass; C: CurveGen; R3d : Real) returns Real
+    Resolution(myclass; C: HCurve2d from Adaptor2d; R3d : Real) returns Real
          ---Purpose :  Returns the parametric  resolution corresponding
          --         to the real space resolution <R3d>.
     ---C++: inline
     ;   
         
-    GetType(myclass; C: CurveGen) returns CurveType from GeomAbs
+    GetType(myclass; C: HCurve2d from Adaptor2d) returns CurveType from GeomAbs
        ---Purpose: Returns  the  type of the   curve  in the  current
        --          interval :   Line,   Circle,   Ellipse, Hyperbola,
        --          Parabola, BezierCurve, BSplineCurve, OtherCurve.
@@ -182,43 +182,43 @@ is
     --     the corresponding type.
     --     
 
-     Line(myclass; C: CurveGen) returns Lin2d from gp
+     Line(myclass; C: HCurve2d from Adaptor2d) returns Lin2d from gp
      raises 
        NoSuchObject from Standard
     ---C++: inline
      ;
      
-     Circle(myclass; C: CurveGen) returns Circ2d from gp
+     Circle(myclass; C: HCurve2d from Adaptor2d) returns Circ2d from gp
      raises 
        NoSuchObject from Standard
     ---C++: inline
      ;
      
-     Ellipse(myclass; C: CurveGen) returns Elips2d from gp
+     Ellipse(myclass; C: HCurve2d from Adaptor2d) returns Elips2d from gp
      raises 
        NoSuchObject from Standard
     ---C++: inline
      ;
      
-     Hyperbola(myclass; C: CurveGen) returns  Hypr2d from gp
+     Hyperbola(myclass; C: HCurve2d from Adaptor2d) returns  Hypr2d from gp
      raises 
        NoSuchObject from Standard
     ---C++: inline
      ;
      
-     Parabola(myclass; C: CurveGen) returns Parab2d from gp
+     Parabola(myclass; C: HCurve2d from Adaptor2d) returns Parab2d from gp
      raises 
        NoSuchObject from Standard
     ---C++: inline
      ;
      
-     Bezier(myclass; C: CurveGen) returns BezierCurve from Geom2d
+     Bezier(myclass; C: HCurve2d from Adaptor2d) returns BezierCurve from Geom2d
      raises 
        NoSuchObject from Standard
     ---C++: inline
      ;
     
-     BSpline(myclass; C: CurveGen) returns BSplineCurve from Geom2d
+     BSpline(myclass; C: HCurve2d from Adaptor2d) returns BSplineCurve from Geom2d
      raises 
        NoSuchObject from Standard
     ---C++: inline
@@ -228,7 +228,7 @@ is
 
 
 
-    NbSamples(myclass; C: CurveGen; U0,U1: Real from Standard) 
+    NbSamples(myclass; C: HCurve2d from Adaptor2d; U0,U1: Real from Standard) 
     returns Integer from Standard;
 
-end HCurve2dToolGen;
+end HCurve2dTool;
similarity index 55%
rename from src/Contap/Contap_HCurve2dToolGen.gxx
rename to src/Contap/Contap_HCurve2dTool.cxx
index b50de0c..300dcdb 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include CurveGen_hxx
-#include <GeomAbs_CurveType.hxx>
-#include <GeomAbs_Shape.hxx>
-#include <Geom2d_BezierCurve.hxx>
-#include <Geom2d_BSplineCurve.hxx>
-
-#include <TColStd_Array1OfReal.hxx>
+#include <Contap_HCurve2dTool.ixx>
 
 //============================================================
-Standard_Integer Contap_HCurve2dToolGen::NbSamples (const CurveGen& C,
-                                                    const Standard_Real U0,
-                                                    const Standard_Real U1)
+Standard_Integer Contap_HCurve2dTool::NbSamples (const Handle(Adaptor2d_HCurve2d)& C,
+                                                 const Standard_Real U0,
+                                                 const Standard_Real U1)
 {
   Standard_Real nbs = 10.0;
   switch (C->GetType())
   {
-    case GeomAbs_Line:
-      nbs = 2.;
-      break;
-    case GeomAbs_BezierCurve:
-      nbs = 3. + C->NbPoles();
-      break;
-    case GeomAbs_BSplineCurve:
-      nbs = C->NbKnots();
-      nbs*= C->Degree();
-      nbs*= C->LastParameter()- C->FirstParameter();
-      nbs/= U1-U0;
-      if(nbs < 2.0) nbs = 2.;
-      break;
-    default:
-      break;
+  case GeomAbs_Line:
+    nbs = 2.;
+    break;
+  case GeomAbs_BezierCurve:
+    nbs = 3. + C->NbPoles();
+    break;
+  case GeomAbs_BSplineCurve:
+    nbs = C->NbKnots();
+    nbs*= C->Degree();
+    nbs*= C->LastParameter()- C->FirstParameter();
+    nbs/= U1-U0;
+    if(nbs < 2.0) nbs = 2.;
+    break;
+  default:
+    break;
   }
   if (nbs>50.)
     nbs = 50.;
similarity index 64%
rename from src/Contap/Contap_HCurve2dToolGen.lxx
rename to src/Contap/Contap_HCurve2dTool.lxx
index 731f33f..a25cae3 100644 (file)
@@ -14,7 +14,7 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include CurveGen_hxx
+#include <Adaptor2d_HCurve2d.hxx>
 
 #include <GeomAbs_CurveType.hxx>
 #include <GeomAbs_Shape.hxx>
 #include <TColStd_Array1OfReal.hxx>
 
 //============================================================
-inline Standard_Real Contap_HCurve2dToolGen::FirstParameter (const CurveGen& C) {
+inline Standard_Real Contap_HCurve2dTool::FirstParameter (const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->FirstParameter());
 }
 //============================================================
-inline Standard_Real Contap_HCurve2dToolGen::LastParameter (const CurveGen& C) {
+inline Standard_Real Contap_HCurve2dTool::LastParameter (const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->LastParameter());
 }
 //============================================================
-inline GeomAbs_Shape Contap_HCurve2dToolGen::Continuity (const CurveGen& C) {
+inline GeomAbs_Shape Contap_HCurve2dTool::Continuity (const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->Continuity());
 }
 //============================================================
-inline Standard_Integer Contap_HCurve2dToolGen::NbIntervals(const CurveGen& C,const GeomAbs_Shape Sh) {
+inline Standard_Integer Contap_HCurve2dTool::NbIntervals(const Handle(Adaptor2d_HCurve2d)& C,const GeomAbs_Shape Sh) {
   return(C->NbIntervals(Sh));
 }
 //============================================================
-inline void Contap_HCurve2dToolGen::Intervals(const CurveGen& C,
+inline void Contap_HCurve2dTool::Intervals(const Handle(Adaptor2d_HCurve2d)& C,
                                                             TColStd_Array1OfReal& Tab,
                                                             const GeomAbs_Shape Sh) {
   C->Intervals(Tab,Sh);
 }
 //============================================================
-inline Standard_Boolean Contap_HCurve2dToolGen::IsClosed(const CurveGen& C) {
+inline Standard_Boolean Contap_HCurve2dTool::IsClosed(const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->IsClosed());
 }
 //============================================================
-inline Standard_Boolean Contap_HCurve2dToolGen::IsPeriodic(const CurveGen& C) {
+inline Standard_Boolean Contap_HCurve2dTool::IsPeriodic(const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->IsPeriodic());
 }
 //============================================================
-inline Standard_Real Contap_HCurve2dToolGen::Period(const CurveGen& C) {
+inline Standard_Real Contap_HCurve2dTool::Period(const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->Period());
 }
 //============================================================
-inline gp_Pnt2d Contap_HCurve2dToolGen::Value (const CurveGen& C,
+inline gp_Pnt2d Contap_HCurve2dTool::Value (const Handle(Adaptor2d_HCurve2d)& C,
                                                const Standard_Real U) {
   return(C->Value(U));
 }
 //============================================================
-inline void Contap_HCurve2dToolGen::D0(const CurveGen& C,
+inline void Contap_HCurve2dTool::D0(const Handle(Adaptor2d_HCurve2d)& C,
                                          const Standard_Real U,
                                          gp_Pnt2d& P) {
   C->D0(U,P);
 }
 //============================================================
-inline void Contap_HCurve2dToolGen::D1 (const CurveGen& C,
+inline void Contap_HCurve2dTool::D1 (const Handle(Adaptor2d_HCurve2d)& C,
                                           const Standard_Real U,
                                           gp_Pnt2d& P,
                                           gp_Vec2d& T) {
   C->D1(U,P,T);
 }
 //============================================================
-inline void Contap_HCurve2dToolGen::D2 (const CurveGen& C,
+inline void Contap_HCurve2dTool::D2 (const Handle(Adaptor2d_HCurve2d)& C,
                                           const Standard_Real U,
                                           gp_Pnt2d& P,
                                           gp_Vec2d& T,
@@ -94,7 +94,7 @@ inline void Contap_HCurve2dToolGen::D2 (const CurveGen& C,
   C->D2(U,P,T,N);
 }
 //============================================================
-inline void Contap_HCurve2dToolGen::D3 (const CurveGen& C,
+inline void Contap_HCurve2dTool::D3 (const Handle(Adaptor2d_HCurve2d)& C,
                                           const Standard_Real U,
                                           gp_Pnt2d& P,
                                           gp_Vec2d& V1,
@@ -104,47 +104,47 @@ inline void Contap_HCurve2dToolGen::D3 (const CurveGen& C,
   C->D3(U,P,V1,V2,V3);
 }
 //============================================================
-inline gp_Vec2d Contap_HCurve2dToolGen::DN (const CurveGen& C,
+inline gp_Vec2d Contap_HCurve2dTool::DN (const Handle(Adaptor2d_HCurve2d)& C,
                                             const Standard_Real U,
                                             const Standard_Integer N) { 
   
   return(C->DN(U,N));
 }
 //============================================================
-inline Standard_Real Contap_HCurve2dToolGen::Resolution(const CurveGen& C,
+inline Standard_Real Contap_HCurve2dTool::Resolution(const Handle(Adaptor2d_HCurve2d)& C,
                                                           const Standard_Real R3d) {
   return(C->Resolution(R3d));
 }
 //============================================================
-inline GeomAbs_CurveType Contap_HCurve2dToolGen::GetType(const CurveGen& C) {
+inline GeomAbs_CurveType Contap_HCurve2dTool::GetType(const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->GetType());
 }
 //============================================================
-inline gp_Lin2d Contap_HCurve2dToolGen::Line (const CurveGen& C) {
+inline gp_Lin2d Contap_HCurve2dTool::Line (const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->Line());
 }
 //============================================================
-inline gp_Circ2d Contap_HCurve2dToolGen::Circle (const CurveGen& C) {
+inline gp_Circ2d Contap_HCurve2dTool::Circle (const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->Circle());
 }
 //============================================================
-inline gp_Elips2d Contap_HCurve2dToolGen::Ellipse (const CurveGen& C) {
+inline gp_Elips2d Contap_HCurve2dTool::Ellipse (const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->Ellipse());
 }
 //============================================================
-inline gp_Parab2d Contap_HCurve2dToolGen::Parabola (const CurveGen& C) {
+inline gp_Parab2d Contap_HCurve2dTool::Parabola (const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->Parabola());
 }
 //============================================================
-inline gp_Hypr2d Contap_HCurve2dToolGen::Hyperbola (const CurveGen& C) {
+inline gp_Hypr2d Contap_HCurve2dTool::Hyperbola (const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->Hyperbola());
 }
 //============================================================
-inline Handle(Geom2d_BezierCurve) Contap_HCurve2dToolGen::Bezier (const CurveGen& C) {
+inline Handle(Geom2d_BezierCurve) Contap_HCurve2dTool::Bezier (const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->Bezier());
 }
 //============================================================
-inline Handle(Geom2d_BSplineCurve) Contap_HCurve2dToolGen::BSpline (const CurveGen& C) {
+inline Handle(Geom2d_BSplineCurve) Contap_HCurve2dTool::BSpline (const Handle(Adaptor2d_HCurve2d)& C) {
   return(C->BSpline());
 }
 //============================================================
index 98d4dd4..36b73eb 100644 (file)
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-generic class Line from Contap
-    (TheVertex           as any;
-     TheArc              as any;
-     ThePoint            as any;       --as Point from Contap(TheVertex,TheArc)
-     TheHSequenceOfPoint as Transient) --as HSequence from TCollection
-                                       --     (ThePoint)
+class Line from Contap
 
        ---Purpose: 
 
@@ -30,7 +25,11 @@ uses Pnt            from gp,
      Lin            from gp,
      Circ           from gp,
      Dir            from gp,
-     IType          from Contap -- duplique IntPatch_IType. Mettre ds  IntSurf
+     IType          from Contap, -- duplique IntPatch_IType. Mettre ds  IntSurf
+     HVertex        from Adaptor3d,
+     HCurve2d       from Adaptor2d,
+     Point          from Contap,
+     TheHSequenceOfPoint from Contap
 
 raises DomainError from Standard,
        OutOfRange  from Standard
@@ -76,12 +75,12 @@ is
        is static;
 
 
-    SetValue(me: in out; A: TheArc)
+    SetValue(me: in out; A: HCurve2d from Adaptor2d)
     
        is static;
 
 
-    Add(me: in out; P: ThePoint)
+    Add(me: in out; P: Point from Contap)
     
        is static;
 
@@ -96,7 +95,7 @@ is
 
     Vertex(me; Index: Integer from Standard)
     
-       returns ThePoint
+       returns Point from Contap
        ---C++: return &
        ---C++: inline
 
@@ -171,7 +170,7 @@ is
 
     Arc(me)
     
-       returns any TheArc
+       returns any HCurve2d from Adaptor2d
        ---C++: return const&
        
        raises DomainError from Standard
@@ -203,8 +202,8 @@ fields
 
     Trans   : TypeTrans            from IntSurf;
     curv    : LineOn2S             from IntSurf;
-    svtx    : TheHSequenceOfPoint;
-    thearc  : TheArc;
+    svtx    : TheHSequenceOfPoint  from Contap;
+    thearc  : HCurve2d             from Adaptor2d;
     typL    : IType                from Contap;
     pt      : Pnt                  from gp;
     dir1    : Dir                  from gp;
similarity index 81%
rename from src/Contap/Contap_Line.gxx
rename to src/Contap/Contap_Line.cxx
index 8e7e755..12953b4 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <Contap_Line.ixx>
+
 Contap_Line::Contap_Line () {
-  svtx = new TheHSequenceOfPoint ();
+  svtx = new Contap_TheHSequenceOfPoint ();
   Trans = IntSurf_Undecided;
 }
 
 void Contap_Line::ResetSeqOfVertex() {
-  svtx = new TheHSequenceOfPoint ();
+  svtx = new Contap_TheHSequenceOfPoint ();
 }
 
-void Contap_Line::Add(const ThePoint& P) {
+void Contap_Line::Add(const Contap_Point& P) {
   Standard_Integer n = svtx->Length();
   if(n==0) { 
     svtx->Append(P);
@@ -35,10 +37,10 @@ void Contap_Line::Add(const ThePoint& P) {
     }
     else { 
       for(Standard_Integer i=n-1;i>0;i--) { 
-       if(prm> svtx->Value(i).ParameterOnLine()) { 
-         svtx->InsertBefore(i+1,P);
-         return;
-       }
+        if(prm> svtx->Value(i).ParameterOnLine()) { 
+          svtx->InsertBefore(i+1,P);
+          return;
+        }
       }
       svtx->Prepend(P);
     }
@@ -48,7 +50,7 @@ void Contap_Line::Add(const ThePoint& P) {
 void Contap_Line::Clear () {
   if(!curv.IsNull()) 
     curv->Clear();
-  svtx = new TheHSequenceOfPoint ();
+  svtx = new Contap_TheHSequenceOfPoint ();
   typL = Contap_Walking;
 }
 
@@ -68,7 +70,7 @@ void Contap_Line::SetValue(const gp_Circ& C)
   typL = Contap_Circle;
 }
 
-void Contap_Line::SetValue(const TheArc& A)
+void Contap_Line::SetValue(const Handle(Adaptor2d_HCurve2d)& A)
 {
   thearc = A;
   typL = Contap_Restriction;
@@ -87,7 +89,7 @@ IntSurf_TypeTrans Contap_Line::TransitionOnS() const {
   return(Trans);
 }
 
-const TheArc& Contap_Line::Arc () const
+const Handle(Adaptor2d_HCurve2d)& Contap_Line::Arc () const
 {
   if (typL != Contap_Restriction) {Standard_DomainError::Raise();}
   return thearc;
index e7152d8..b087db8 100644 (file)
@@ -21,7 +21,8 @@
 #include <IntSurf_PntOn2S.hxx>
 #include <IntSurf_LineOn2S.hxx>
 
-#include TheHSequenceOfPoint_hxx
+#include <Contap_Point.hxx>
+#include <Contap_TheHSequenceOfPoint.hxx>
 
 inline const Handle(IntSurf_LineOn2S)& Contap_Line::LineOn2S () const
 {
@@ -38,7 +39,7 @@ inline Standard_Integer Contap_Line::NbVertex () const
   return svtx->Length();
 }
 
-inline ThePoint& Contap_Line::Vertex (const Standard_Integer Index) const
+inline Contap_Point& Contap_Line::Vertex (const Standard_Integer Index) const
 {
   return svtx->ChangeSequence()(Index);
 }
index 50bb1e7..b05810c 100644 (file)
@@ -14,9 +14,7 @@
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-generic class Point from Contap
-    (TheVertex as any;
-     TheArc    as any)
+class Point from Contap
 
 
        ---Purpose: Definition of a vertex on the contour line.
@@ -28,7 +26,9 @@ generic class Point from Contap
 
 
 uses Pnt        from gp,
-     Transition from IntSurf
+     Transition from IntSurf,
+     HVertex    from Adaptor3d,
+     HCurve2d   from Adaptor2d
      
      
 raises DomainError from Standard
@@ -68,7 +68,7 @@ is
        is static;
 
 
-    SetVertex(me: in out; V: TheVertex)
+    SetVertex(me: in out; V: HVertex from Adaptor3d)
 
        ---Purpose: Sets the values of a point which is a vertex on
        --          the initial facet of restriction of one
@@ -79,7 +79,7 @@ is
        is static;
 
 
-    SetArc(me: in out; A: TheArc; Param: Real from Standard;
+    SetArc(me: in out; A: HCurve2d from Adaptor2d; Param: Real from Standard;
                        TLine,TArc: Transition from IntSurf)
 
        ---Purpose: Sets the value of the arc and of the parameter on
@@ -151,7 +151,7 @@ is
        ---Purpose: Returns the arc of restriction containing the
        --          vertex.
 
-       returns any TheArc
+       returns any HCurve2d from Adaptor2d
        ---C++: return const&
        ---C++: inline
        
@@ -221,7 +221,7 @@ is
        --          IsVertex returns True.
        --          Otherwise, an exception is raised.
     
-       returns any TheVertex
+       returns any HVertex from Adaptor3d
        ---C++: return const&
        ---C++: inline
 
@@ -259,12 +259,12 @@ fields
     vparam     : Real        from Standard;
     paraline   : Real        from Standard;
     onarc      : Boolean     from Standard;
-    arc        : TheArc;
+    arc        : HCurve2d    from Adaptor2d;
     traline    : Transition  from IntSurf;
     traarc     : Transition  from IntSurf;
     prmarc     : Real        from Standard;
     isvtx      : Boolean     from Standard;
-    vtx        : TheVertex;
+    vtx        : HVertex     from Adaptor3d;
     ismult     : Boolean     from Standard;
     myInternal : Boolean     from Standard;
     
similarity index 70%
rename from src/Contap/Contap_Point.gxx
rename to src/Contap/Contap_Point.cxx
index 14ddd12..cfe54fa 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <Contap_Point.ixx>
+
 Contap_Point::Contap_Point ():
-       onarc(Standard_False),isvtx(Standard_False),ismult(Standard_False),
-       myInternal(Standard_False)
+  onarc(Standard_False),isvtx(Standard_False),ismult(Standard_False),
+  myInternal(Standard_False)
 {}
 
 Contap_Point::Contap_Point (const gp_Pnt& Pt,
-                           const Standard_Real U,
-                           const Standard_Real V):
-       pt(Pt),uparam(U),vparam(V),onarc(Standard_False),isvtx(Standard_False),
-       ismult(Standard_False),myInternal(Standard_False)
+                            const Standard_Real U,
+                            const Standard_Real V):
+pt(Pt),uparam(U),vparam(V),onarc(Standard_False),isvtx(Standard_False),
+ismult(Standard_False),myInternal(Standard_False)
 {}
index 6410a4d..8684a5a 100644 (file)
@@ -34,13 +34,13 @@ inline void Contap_Point::SetParameter (const Standard_Real Para) {
   paraline = Para;
 }
  
-inline void Contap_Point::SetVertex(const TheVertex& V) {
+inline void Contap_Point::SetVertex(const Handle(Adaptor3d_HVertex)& V) {
 
   isvtx = Standard_True;
   vtx   = V;
 }
 
-inline void Contap_Point::SetArc (const TheArc& A,
+inline void Contap_Point::SetArc (const Handle(Adaptor2d_HCurve2d)& A,
                                  const Standard_Real Param,
                                  const IntSurf_Transition& TLine,
                                  const IntSurf_Transition& TArc) {
@@ -94,7 +94,7 @@ inline Standard_Boolean Contap_Point::IsOnArc () const{
   return onarc;
 }
 
-inline const TheArc& Contap_Point::Arc () const {
+inline const Handle_Adaptor2d_HCurve2d& Contap_Point::Arc () const {
 
   if (!onarc) {Standard_DomainError::Raise();}
   return arc;
@@ -122,7 +122,7 @@ inline Standard_Boolean Contap_Point::IsVertex () const {
   return isvtx;
 }
 
-inline const TheVertex& Contap_Point::Vertex () const {
+inline const Handle_Adaptor3d_HVertex& Contap_Point::Vertex () const {
 
   if (!isvtx) {Standard_DomainError::Raise();}
   return vtx;
index bf8a8e7..ac5b450 100644 (file)
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-generic class SurfFunction from Contap 
-    (TheSurface as any;
-     TheSurfaceTool as any;
-     TheSurfProps   as any; -- as SurfProps from Contap(TheSurface,
-                            --                          TheSurfaceTool)
-     TheContTool    as any)
-
-inherits FunctionSetWithDerivatives from math                         
+class SurfFunction from Contap inherits FunctionSetWithDerivatives from math
     
        ---Purpose: This class describes the function on a parametric surface.
        --          the form of the function is F(u,v) = 0 where u and v are
        --          the parameteric coordinates of a point on the surface,
        --          to compute the contours of the surface.
 
-uses Vector    from math,
-     Matrix    from math,
-     Pnt       from gp,
-     Vec       from gp,
-     Dir       from gp,
-     Dir2d     from gp,
-     TFunction from Contap
+uses Vector       from math,
+     Matrix       from math,
+     Pnt          from gp,
+     Vec          from gp,
+     Dir          from gp,
+     Dir2d        from gp,
+     TFunction    from Contap,
+     HSurface     from Adaptor3d,
+     HSurfaceTool from Adaptor3d,
+     HContTool    from Contap
 
 
 raises UndefinedDerivative from StdFail
@@ -46,7 +42,7 @@ is
        returns SurfFunction from Contap;
 
 
-    Set(me: in out; S: TheSurface)
+    Set(me: in out; S: HSurface  from Adaptor3d)
 
        is static;
 
@@ -203,7 +199,7 @@ is
 
     Surface(me)
     
-       returns any TheSurface
+       returns any HSurface  from Adaptor3d
        ---C++: return const&
        ---C++: inline
        is static;
@@ -212,7 +208,7 @@ is
 
 fields
 
-    mySurf   : TheSurface;
+    mySurf   : HSurface  from Adaptor3d;
     myMean   : Real      from Standard;
     myType   : TFunction from Contap;
     myDir    : Dir       from gp;
similarity index 55%
rename from src/Contap/Contap_SurfFunction.gxx
rename to src/Contap/Contap_SurfFunction.cxx
index 6fdbd2e..4b9c417 100644 (file)
 
 // jag 940616 #define Tolpetit 1.e-16
 
+#include <Contap_SurfFunction.ixx>
 
-#include <gp.hxx>
-
+#include <Contap_SurfProps.hxx>
+#include <Contap_HContTool.hxx>
+#include <Adaptor3d_HSurfaceTool.hxx>
 
 Contap_SurfFunction::Contap_SurfFunction ():
-       myMean(1.),
-       myType(Contap_ContourStd),
-       myDir(0.,0.,1.),
-       myCosAng(0.), // PI/2 - Angle de depouille
-       tol(1.e-6),
-       computed(Standard_False),
-       derived(Standard_False)
+  myMean(1.),
+  myType(Contap_ContourStd),
+  myDir(0.,0.,1.),
+  myCosAng(0.), // PI/2 - Angle de depouille
+  tol(1.e-6),
+  computed(Standard_False),
+  derived(Standard_False)
 {}
 
-void Contap_SurfFunction::Set(const TheSurface& S)
+void Contap_SurfFunction::Set(const Handle(Adaptor3d_HSurface)& S)
 {
   mySurf = S;
   Standard_Integer i;
-  Standard_Integer nbs = TheContTool::NbSamplePoints(S);
+  Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S);
   Standard_Real U,V;
   gp_Vec norm;
   if (nbs > 0) {
     myMean = 0.;
     for (i = 1; i <= nbs; i++) {
-      TheContTool::SamplePoint(S,i,U,V);
-//      TheSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
-//      myMean = myMean + d1u.Crossed(d1v).Magnitude();
-      TheSurfProps::Normale(S,U,V,solpt,norm);
+      Contap_HContTool::SamplePoint(S,i,U,V);
+      //      Adaptor3d_HSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
+      //      myMean = myMean + d1u.Crossed(d1v).Magnitude();
+      Contap_SurfProps::Normale(S,U,V,solpt,norm);
       myMean = myMean + norm.Magnitude();
     }
     myMean = myMean / ((Standard_Real)nbs);
@@ -65,13 +67,13 @@ Standard_Integer Contap_SurfFunction::NbEquations () const
 
 
 Standard_Boolean Contap_SurfFunction::Value(const math_Vector& X,
-                                           math_Vector& F)
+                                            math_Vector& F)
 {
   Usol = X(1); Vsol = X(2);
-//  TheSurfaceTool::D1(mySurf,Usol,Vsol,solpt,d1u,d1v);
-//  gp_Vec norm(d1u.Crossed(d1v));
+  //  Adaptor3d_HSurfaceTool::D1(mySurf,Usol,Vsol,solpt,d1u,d1v);
+  //  gp_Vec norm(d1u.Crossed(d1v));
   gp_Vec norm;
-  TheSurfProps::Normale(mySurf,Usol,Vsol,solpt,norm);
+  Contap_SurfProps::Normale(mySurf,Usol,Vsol,solpt,norm);
   switch (myType) {
   case Contap_ContourStd:
     {
@@ -99,20 +101,20 @@ Standard_Boolean Contap_SurfFunction::Value(const math_Vector& X,
 
 
 Standard_Boolean Contap_SurfFunction::Derivatives(const math_Vector& X,
-                                                 math_Matrix& Grad)
+                                                  math_Matrix& Grad)
 {
-//  gp_Vec d2u,d2v,d2uv;
+  //  gp_Vec d2u,d2v,d2uv;
   Usol = X(1); Vsol = X(2);
-//  TheSurfaceTool::D2(mySurf,Usol,Vsol,solpt,d1u,d1v,d2u,d2v,d2uv);
+  //  Adaptor3d_HSurfaceTool::D2(mySurf,Usol,Vsol,solpt,d1u,d1v,d2u,d2v,d2uv);
 
   gp_Vec norm,dnu,dnv;
-  TheSurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
+  Contap_SurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
 
   switch (myType) {
   case Contap_ContourStd:
     {
-//      Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
-//      Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
+      //      Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
+      //      Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
       Grad(1,1) = (dnu.Dot(myDir))/myMean;
       Grad(1,2) = (dnv.Dot(myDir))/myMean;
     }
@@ -126,11 +128,11 @@ Standard_Boolean Contap_SurfFunction::Derivatives(const math_Vector& X,
     break;
   case Contap_DraftStd:
     {
-//      gp_Vec norm(d1u.Crossed(d1v).Normalized());
-//      gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
-//      Grad(1,1) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
-//      dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
-//      Grad(1,2) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
+      //      gp_Vec norm(d1u.Crossed(d1v).Normalized());
+      //      gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
+      //      Grad(1,1) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
+      //      dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
+      //      Grad(1,2) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
       norm.Normalize();
       Grad(1,1) = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
       Grad(1,2) = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
@@ -149,24 +151,24 @@ Standard_Boolean Contap_SurfFunction::Derivatives(const math_Vector& X,
 
 
 Standard_Boolean Contap_SurfFunction::Values (const math_Vector& X,
-                                             math_Vector& F,
-                                             math_Matrix& Grad)
+                                              math_Vector& F,
+                                              math_Matrix& Grad)
 {
-//  gp_Vec d2u,d2v,d2uv;
+  //  gp_Vec d2u,d2v,d2uv;
 
   Usol = X(1); Vsol = X(2);
-//  TheSurfaceTool::D2(mySurf,Usol,Vsol,solpt,d1u,d1v,d2u,d2v,d2uv);
-//  gp_Vec norm(d1u.Crossed(d1v));
+  //  Adaptor3d_HSurfaceTool::D2(mySurf,Usol,Vsol,solpt,d1u,d1v,d2u,d2v,d2uv);
+  //  gp_Vec norm(d1u.Crossed(d1v));
   gp_Vec norm,dnu,dnv;
-  TheSurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
+  Contap_SurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
 
   switch (myType) {
 
   case Contap_ContourStd:
     {
       F(1)      = (norm.Dot(myDir))/myMean;
-//      Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
-//      Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
+      //      Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
+      //      Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
       Grad(1,1) = (dnu.Dot(myDir))/myMean;
       Grad(1,2) = (dnv.Dot(myDir))/myMean;
     }
@@ -175,8 +177,8 @@ Standard_Boolean Contap_SurfFunction::Values (const math_Vector& X,
     {
       gp_Vec Ep(myEye,solpt);
       F(1)      = (norm.Dot(Ep))/myMean;
-//      Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
-//      Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
+      //      Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
+      //      Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
       Grad(1,1) = (dnu.Dot(Ep))/myMean;
       Grad(1,2) = (dnv.Dot(Ep))/myMean;
     }
@@ -185,12 +187,12 @@ Standard_Boolean Contap_SurfFunction::Values (const math_Vector& X,
     {
       F(1) = (norm.Dot(myDir)-myCosAng*norm.Magnitude())/myMean;
       norm.Normalize();
-/*
+      /*
       gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
       Grad(1,1) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
       dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
       Grad(1,2) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
-*/
+      */
       Grad(1,1) = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
       Grad(1,2) = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
     }
@@ -213,47 +215,47 @@ Standard_Boolean Contap_SurfFunction::IsTangent ()
   if (!computed) {
     computed = Standard_True;
     if(!derived) {
-//      gp_Vec d2u,d2v,d2uv;
-//      TheSurfaceTool::D2(mySurf, Usol, Vsol, solpt, d1u, d1v, d2u, d2v, d2uv);
+      //      gp_Vec d2u,d2v,d2uv;
+      //      Adaptor3d_HSurfaceTool::D2(mySurf, Usol, Vsol, solpt, d1u, d1v, d2u, d2v, d2uv);
       gp_Vec norm,dnu,dnv;
-      TheSurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
+      Contap_SurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
 
       switch (myType) {
       case Contap_ContourStd:
-       {
-//       Fpu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
-//       Fpv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
-         Fpu = (dnu.Dot(myDir))/myMean;
-         Fpv = (dnv.Dot(myDir))/myMean;
-       }
-       break;
+        {
+          //     Fpu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
+          //     Fpv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
+          Fpu = (dnu.Dot(myDir))/myMean;
+          Fpv = (dnv.Dot(myDir))/myMean;
+        }
+        break;
       case Contap_ContourPrs:
-       {
-         gp_Vec Ep(myEye,solpt);
-//       Fpu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
-//       Fpv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
-         Fpu = (dnu.Dot(Ep))/myMean;
-         Fpv = (dnv.Dot(Ep))/myMean;
-       }
-       break;
+        {
+          gp_Vec Ep(myEye,solpt);
+          //     Fpu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
+          //     Fpv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
+          Fpu = (dnu.Dot(Ep))/myMean;
+          Fpv = (dnv.Dot(Ep))/myMean;
+        }
+        break;
       case Contap_DraftStd:
-       {
-/*
-         gp_Vec norm(d1u.Crossed(d1v).Normalized());
-         gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
-         Fpu = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
-         dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
-         Fpv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
-*/
-         norm.Normalize();
-         Fpu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
-         Fpv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
-       }
-       break;
+        {
+          /*
+          gp_Vec norm(d1u.Crossed(d1v).Normalized());
+          gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
+          Fpu = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
+          dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
+          Fpv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
+          */
+          norm.Normalize();
+          Fpu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
+          Fpv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
+        }
+        break;
       case Contap_DraftPrs:
       default:
-       {
-       }
+        {
+        }
       }
       derived = Standard_True;
     }
@@ -266,15 +268,15 @@ Standard_Boolean Contap_SurfFunction::IsTangent ()
     else {
       d2d = gp_Dir2d(-Fpv,Fpu);
       gp_Vec d1u,d1v;
-      TheSurfaceTool::D1(mySurf, Usol, Vsol, solpt, d1u, d1v); // ajout jag 02.95
+      Adaptor3d_HSurfaceTool::D1(mySurf, Usol, Vsol, solpt, d1u, d1v); // ajout jag 02.95
 
       gp_XYZ d3dxyz(-Fpv*d1u.XYZ());
       d3dxyz.Add(Fpu*d1v.XYZ());
       d3d.SetXYZ(d3dxyz);
-    
+
       //jag 940616    if (d3d.Magnitude() <= Tolpetit) {
       if (d3d.Magnitude() <= tol) {
-       tangent = Standard_True;
+        tangent = Standard_True;
       }
     }
   }
index 9f2e61a..2e819ff 100644 (file)
@@ -80,7 +80,7 @@ inline const gp_Dir2d& Contap_SurfFunction::Direction2d()
   return d2d;
 }
 
-inline const TheSurface& Contap_SurfFunction::Surface() const
+inline const Handle_Adaptor3d_HSurface& Contap_SurfFunction::Surface() const
 {
   return mySurf;
 }
index ec90c0f..b032343 100644 (file)
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-generic class SurfProps from Contap 
-    (TheSurface     as any;
-     TheSurfaceTool as any)
+class SurfProps from Contap 
 
        ---Purpose: Internal tool used  to compute the  normal and its
        --          derivatives. 
 
-uses Pnt from gp,
-     Vec from gp
+uses Pnt          from gp,
+     Vec          from gp,
+     HSurface     from Adaptor3d,
+     HSurfaceTool from Adaptor3d
 
 is
 
-    Normale(myclass; S: TheSurface; U,V: Real from Standard;
+    Normale(myclass; S: HSurface from Adaptor3d; U,V: Real from Standard;
                      P: out Pnt from gp;
                     N: out Vec from gp);
 
@@ -35,7 +35,7 @@ is
 
 
 
-    DerivAndNorm(myclass; S: TheSurface; U,V: Real from Standard;
+    DerivAndNorm(myclass; S: HSurface from Adaptor3d; U,V: Real from Standard;
                           P      : out Pnt from gp;
                          d1u,d1v: out Vec from gp;
                          N      : out Vec from gp);
@@ -45,7 +45,7 @@ is
 
 
 
-    NormAndDn(myclass; S: TheSurface; U,V: Real from Standard;
+    NormAndDn(myclass; S: HSurface from Adaptor3d; U,V: Real from Standard;
                        P        : out Pnt from gp;
                       N,Dnu,Dnv: out Vec from gp);
 
similarity index 52%
rename from src/Contap/Contap_SurfProps.gxx
rename to src/Contap/Contap_SurfProps.cxx
index c8f6eb0..5af71c8 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <Contap_SurfProps.ixx>
+
 #include <ElSLib.hxx>
+#include <Adaptor3d_HSurfaceTool.hxx>
 
 //=======================================================================
 //function : Normale
 //purpose  : 
 //=======================================================================
 
-void Contap_SurfProps::Normale(const TheSurface& S, 
-                              const Standard_Real U, 
-                              const Standard_Real V,
-                              gp_Pnt& P,
-                              gp_Vec& Norm)
+void Contap_SurfProps::Normale(const Handle(Adaptor3d_HSurface)& S, 
+                               const Standard_Real U, 
+                               const Standard_Real V,
+                               gp_Pnt& P,
+                               gp_Vec& Norm)
 {
 
-  GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(S);
+  GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(S);
   switch (typS) {
   case GeomAbs_Plane:
     {
-      gp_Pln pl(TheSurfaceTool::Plane(S));
+      gp_Pln pl(Adaptor3d_HSurfaceTool::Plane(S));
       Norm = pl.Axis().Direction();
       P = ElSLib::Value(U,V,pl);
       if (!pl.Direct()) {
-       Norm.Reverse();
+        Norm.Reverse();
       }
     }
     break;
@@ -44,26 +47,26 @@ void Contap_SurfProps::Normale(const TheSurface& S,
 
   case GeomAbs_Sphere:
     {
-      gp_Sphere sp(TheSurfaceTool::Sphere(S));
+      gp_Sphere sp(Adaptor3d_HSurfaceTool::Sphere(S));
       P = ElSLib::Value(U,V,sp);
       Norm = gp_Vec(sp.Location(),P);
       if (sp.Direct()) {
-       Norm.Divide(sp.Radius());
+        Norm.Divide(sp.Radius());
       }
       else {
-       Norm.Divide(-sp.Radius());
+        Norm.Divide(-sp.Radius());
       }
     }
     break;
 
   case GeomAbs_Cylinder:
     {
-      gp_Cylinder cy(TheSurfaceTool::Cylinder(S));
+      gp_Cylinder cy(Adaptor3d_HSurfaceTool::Cylinder(S));
       P = ElSLib::Value(U,V,cy);
       Norm.SetLinearForm(Cos(U),cy.XAxis().Direction(),
-                        Sin(U),cy.YAxis().Direction());
+        Sin(U),cy.YAxis().Direction());
       if (!cy.Direct()) {
-       Norm.Reverse();
+        Norm.Reverse();
       }
     }
     break;
@@ -71,7 +74,7 @@ void Contap_SurfProps::Normale(const TheSurface& S,
 
   case GeomAbs_Cone:
     {
-      gp_Cone co(TheSurfaceTool::Cone(S));
+      gp_Cone co(Adaptor3d_HSurfaceTool::Cone(S));
       P = ElSLib::Value(U,V,co);
       Standard_Real Angle = co.SemiAngle();
       Standard_Real Sina = sin(Angle);
@@ -80,38 +83,38 @@ void Contap_SurfProps::Normale(const TheSurface& S,
 
       Standard_Real Vcalc = V;
       if (Abs(V*Sina + Rad) <= 1e-12) { // on est a l`apex
-       /*
-          Standard_Real Vfi = TheSurfaceTool::FirstVParameter(S);
-          if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
-          Vcalc = V - 1;
-          }
-          else {
-          Vcalc = V + 1.;
-          }
-          */
-       Norm.SetCoord(0,0,0);
-       return;
+        /*
+        Standard_Real Vfi = Adaptor3d_HSurfaceTool::FirstVParameter(S);
+        if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
+        Vcalc = V - 1;
+        }
+        else {
+        Vcalc = V + 1.;
+        }
+        */
+        Norm.SetCoord(0,0,0);
+        return;
       }
 
       if (Rad + Vcalc*Sina < 0.) {
-       Norm.SetLinearForm(Sina,       co.Axis().Direction(),
-                          Cosa*cos(U),co.XAxis().Direction(),
-                          Cosa*sin(U),co.YAxis().Direction());
+        Norm.SetLinearForm(Sina,       co.Axis().Direction(),
+          Cosa*cos(U),co.XAxis().Direction(),
+          Cosa*sin(U),co.YAxis().Direction());
       }
       else {
-       Norm.SetLinearForm(-Sina,       co.Axis().Direction(),
-                           Cosa*cos(U),co.XAxis().Direction(),
-                           Cosa*sin(U),co.YAxis().Direction());
+        Norm.SetLinearForm(-Sina,       co.Axis().Direction(),
+          Cosa*cos(U),co.XAxis().Direction(),
+          Cosa*sin(U),co.YAxis().Direction());
       }
       if (!co.Direct()) {
-       Norm.Reverse();
+        Norm.Reverse();
       }
     }
     break;
   default:
     {
       gp_Vec d1u,d1v;
-      TheSurfaceTool::D1(S,U,V,P,d1u,d1v);
+      Adaptor3d_HSurfaceTool::D1(S,U,V,P,d1u,d1v);
       Norm = d1u.Crossed(d1v);
     }
     break;
@@ -126,24 +129,24 @@ void Contap_SurfProps::Normale(const TheSurface& S,
 //purpose  : 
 //=======================================================================
 
-void Contap_SurfProps::DerivAndNorm(const TheSurface& S, 
-                                   const Standard_Real U, 
-                                   const Standard_Real V,
-                                   gp_Pnt& P,
-                                   gp_Vec& d1u,
-                                   gp_Vec& d1v,
-                                   gp_Vec& Norm)
+void Contap_SurfProps::DerivAndNorm(const Handle(Adaptor3d_HSurface)& S, 
+                                    const Standard_Real U, 
+                                    const Standard_Real V,
+                                    gp_Pnt& P,
+                                    gp_Vec& d1u,
+                                    gp_Vec& d1v,
+                                    gp_Vec& Norm)
 {
 
-  GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(S);
+  GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(S);
   switch (typS) {
   case GeomAbs_Plane:
     {
-      gp_Pln pl(TheSurfaceTool::Plane(S));
+      gp_Pln pl(Adaptor3d_HSurfaceTool::Plane(S));
       Norm = pl.Axis().Direction();
       ElSLib::D1(U,V,pl,P,d1u,d1v);
       if (!pl.Direct()) {
-       Norm.Reverse();
+        Norm.Reverse();
       }
     }
     break;
@@ -151,26 +154,26 @@ void Contap_SurfProps::DerivAndNorm(const TheSurface& S,
 
   case GeomAbs_Sphere:
     {
-      gp_Sphere sp(TheSurfaceTool::Sphere(S));
+      gp_Sphere sp(Adaptor3d_HSurfaceTool::Sphere(S));
       ElSLib::D1(U,V,sp,P,d1u,d1v);
       Norm = gp_Vec(sp.Location(),P);
       if (sp.Direct()) {
-       Norm.Divide(sp.Radius());
+        Norm.Divide(sp.Radius());
       }
       else {
-       Norm.Divide(-sp.Radius());
+        Norm.Divide(-sp.Radius());
       }
     }
     break;
 
   case GeomAbs_Cylinder:
     {
-      gp_Cylinder cy(TheSurfaceTool::Cylinder(S));
+      gp_Cylinder cy(Adaptor3d_HSurfaceTool::Cylinder(S));
       ElSLib::D1(U,V,cy,P,d1u,d1v);
       Norm.SetLinearForm(Cos(U),cy.XAxis().Direction(),
-                        Sin(U),cy.YAxis().Direction());
+        Sin(U),cy.YAxis().Direction());
       if (!cy.Direct()) {
-       Norm.Reverse();
+        Norm.Reverse();
       }
     }
     break;
@@ -178,7 +181,7 @@ void Contap_SurfProps::DerivAndNorm(const TheSurface& S,
 
   case GeomAbs_Cone:
     {
-      gp_Cone co(TheSurfaceTool::Cone(S));
+      gp_Cone co(Adaptor3d_HSurfaceTool::Cone(S));
       ElSLib::D1(U,V,co,P,d1u,d1v);
       Standard_Real Angle = co.SemiAngle();
       Standard_Real Sina = Sin(Angle);
@@ -187,33 +190,33 @@ void Contap_SurfProps::DerivAndNorm(const TheSurface& S,
 
       Standard_Real Vcalc = V;
       if (Abs(V*Sina + Rad) <= RealEpsilon()) { // on est a l`apex
-       Standard_Real Vfi = TheSurfaceTool::FirstVParameter(S);
-       if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
-         Vcalc = V - 1;
-       }
-       else {
-         Vcalc = V + 1.;
-       }
+        Standard_Real Vfi = Adaptor3d_HSurfaceTool::FirstVParameter(S);
+        if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
+          Vcalc = V - 1;
+        }
+        else {
+          Vcalc = V + 1.;
+        }
       }
 
       if (Rad + Vcalc*Sina < 0.) {
-       Norm.SetLinearForm(Sina,       co.Axis().Direction(),
-                          Cosa*Cos(U),co.XAxis().Direction(),
-                          Cosa*Sin(U),co.YAxis().Direction());
+        Norm.SetLinearForm(Sina,       co.Axis().Direction(),
+          Cosa*Cos(U),co.XAxis().Direction(),
+          Cosa*Sin(U),co.YAxis().Direction());
       }
       else {
-       Norm.SetLinearForm(-Sina,       co.Axis().Direction(),
-                           Cosa*Cos(U),co.XAxis().Direction(),
-                           Cosa*Sin(U),co.YAxis().Direction());
+        Norm.SetLinearForm(-Sina,       co.Axis().Direction(),
+          Cosa*Cos(U),co.XAxis().Direction(),
+          Cosa*Sin(U),co.YAxis().Direction());
       }
       if (!co.Direct()) {
-       Norm.Reverse();
+        Norm.Reverse();
       }
     }
     break;
   default:
     {
-      TheSurfaceTool::D1(S,U,V,P,d1u,d1v);
+      Adaptor3d_HSurfaceTool::D1(S,U,V,P,d1u,d1v);
       Norm = d1u.Crossed(d1v);
     }
     break;
@@ -226,24 +229,24 @@ void Contap_SurfProps::DerivAndNorm(const TheSurface& S,
 //purpose  : 
 //=======================================================================
 
-void Contap_SurfProps::NormAndDn(const TheSurface& S, 
-                                const Standard_Real U, 
-                                const Standard_Real V,
-                                gp_Pnt& P,
-                                gp_Vec& Norm,
-                                gp_Vec& Dnu,
-                                gp_Vec& Dnv)
+void Contap_SurfProps::NormAndDn(const Handle(Adaptor3d_HSurface)& S, 
+                                 const Standard_Real U, 
+                                 const Standard_Real V,
+                                 gp_Pnt& P,
+                                 gp_Vec& Norm,
+                                 gp_Vec& Dnu,
+                                 gp_Vec& Dnv)
 {
 
-  GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(S);
+  GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(S);
   switch (typS) {
   case GeomAbs_Plane:
     {
-      gp_Pln pl(TheSurfaceTool::Plane(S));
+      gp_Pln pl(Adaptor3d_HSurfaceTool::Plane(S));
       P = ElSLib::Value(U,V,pl);
       Norm = pl.Axis().Direction();
       if (!pl.Direct()) {
-       Norm.Reverse();
+        Norm.Reverse();
       }
       Dnu = Dnv = gp_Vec(0.,0.,0.);
     }
@@ -251,12 +254,12 @@ void Contap_SurfProps::NormAndDn(const TheSurface& S,
 
   case GeomAbs_Sphere:
     {
-      gp_Sphere sp(TheSurfaceTool::Sphere(S));
+      gp_Sphere sp(Adaptor3d_HSurfaceTool::Sphere(S));
       ElSLib::D1(U,V,sp,P,Dnu,Dnv);
       Norm = gp_Vec(sp.Location(),P);
       Standard_Real Rad = sp.Radius();
       if (!sp.Direct()) {
-       Rad = -Rad;
+        Rad = -Rad;
       }
       Norm.Divide(Rad);
       Dnu.Divide(Rad);
@@ -266,15 +269,15 @@ void Contap_SurfProps::NormAndDn(const TheSurface& S,
 
   case GeomAbs_Cylinder:
     {
-      gp_Cylinder cy(TheSurfaceTool::Cylinder(S));
+      gp_Cylinder cy(Adaptor3d_HSurfaceTool::Cylinder(S));
       P = ElSLib::Value(U,V,cy);
       Norm.SetLinearForm(Cos(U),cy.XAxis().Direction(),
-                        Sin(U),cy.YAxis().Direction());
+        Sin(U),cy.YAxis().Direction());
       Dnu.SetLinearForm(-Sin(U),cy.XAxis().Direction(),
-                        Cos(U),cy.YAxis().Direction());
+        Cos(U),cy.YAxis().Direction());
       if (!cy.Direct()) {
-       Norm.Reverse();
-       Dnu.Reverse();
+        Norm.Reverse();
+        Dnu.Reverse();
       }
       Dnv = gp_Vec(0.,0.,0.);
     }
@@ -283,7 +286,7 @@ void Contap_SurfProps::NormAndDn(const TheSurface& S,
   case GeomAbs_Cone:
     {
 
-      gp_Cone co(TheSurfaceTool::Cone(S));
+      gp_Cone co(Adaptor3d_HSurfaceTool::Cone(S));
       P = ElSLib::Value(U,V,co);
       Standard_Real Angle = co.SemiAngle();
       Standard_Real Sina = Sin(Angle);
@@ -291,39 +294,39 @@ void Contap_SurfProps::NormAndDn(const TheSurface& S,
       Standard_Real Rad = co.RefRadius(); 
       Standard_Real Vcalc = V;
       if (Abs(V*Sina + Rad) <= RealEpsilon()) { // on est a l`apex
-       Standard_Real Vfi = TheSurfaceTool::FirstVParameter(S);
-       if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
-         Vcalc = V - 1;
-       }
-       else {
-         Vcalc = V + 1.;
-       }
+        Standard_Real Vfi = Adaptor3d_HSurfaceTool::FirstVParameter(S);
+        if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
+          Vcalc = V - 1;
+        }
+        else {
+          Vcalc = V + 1.;
+        }
       }
 
       if (Rad + Vcalc*Sina < 0.) {
-       Norm.SetLinearForm(Sina,       co.Axis().Direction(),
-                          Cosa*Cos(U),co.XAxis().Direction(),
-                          Cosa*Sin(U),co.YAxis().Direction());
+        Norm.SetLinearForm(Sina,       co.Axis().Direction(),
+          Cosa*Cos(U),co.XAxis().Direction(),
+          Cosa*Sin(U),co.YAxis().Direction());
       }
       else {
-       Norm.SetLinearForm(-Sina,       co.Axis().Direction(),
-                           Cosa*Cos(U),co.XAxis().Direction(),
-                           Cosa*Sin(U),co.YAxis().Direction());
+        Norm.SetLinearForm(-Sina,       co.Axis().Direction(),
+          Cosa*Cos(U),co.XAxis().Direction(),
+          Cosa*Sin(U),co.YAxis().Direction());
       }
       Dnu.SetLinearForm(-Cosa*Sin(U),co.XAxis().Direction(),
-                        Cosa*Cos(U),co.YAxis().Direction());
+        Cosa*Cos(U),co.YAxis().Direction());
       if (!co.Direct()) {
-       Norm.Reverse();
-       Dnu.Reverse();
+        Norm.Reverse();
+        Dnu.Reverse();
       }
       Dnv = gp_Vec(0.,0.,0.);
     }
     break;
-  
+
   default: 
     {
       gp_Vec d1u,d1v,d2u,d2v,d2uv;
-      TheSurfaceTool::D2(S,U,V,P,d1u,d1v,d2u,d2v,d2uv);
+      Adaptor3d_HSurfaceTool::D2(S,U,V,P,d1u,d1v,d2u,d2v,d2uv);
       Norm = d1u.Crossed(d1v);
       Dnu = d2u.Crossed(d1v) + d1u.Crossed(d2uv);
       Dnv = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
diff --git a/src/Contap/FILES b/src/Contap/FILES
deleted file mode 100755 (executable)
index 54eb121..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-Contap_ContourGen_1.gxx
-Contap_ContourGen_2.gxx
-Contap_ContourGen_3.gxx
index 6006423..5f5a860 100644 (file)
@@ -26,7 +26,7 @@ uses
     Face              from TopoDS,
     Edge              from TopoDS,
     Vertex            from TopoDS,
-    ThePointOfContour from Contap,
+    Point             from Contap,
     Contour           from Contap,
     Data              from HLRTopoBRep,
     MapOfShapeTool    from BRepTopAdaptor
@@ -52,7 +52,7 @@ is
     is private;
     
     MakeVertex(myclass;
-              P   :        ThePointOfContour from Contap;
+              P   :        Point from Contap;
               tol :        Real              from Standard;
               DS  : in out Data              from HLRTopoBRep)
     returns Vertex from TopoDS
@@ -61,7 +61,7 @@ is
     is private;
     
     InsertVertex(myclass;
-                P   :        ThePointOfContour from Contap;
+                P   :        Point from Contap;
                  tol :        Real              from Standard;
                 E   :        Edge              from TopoDS;
                 DS  : in out Data              from HLRTopoBRep)
index 9a60fb6..61d430f 100644 (file)
@@ -44,7 +44,7 @@
 #include <BRepTopAdaptor_HVertex.hxx>
 #include <BRepTopAdaptor_TopolTool.hxx>
 #include <BRepTopAdaptor_Tool.hxx>
-#include <Contap_TheLineOfContour.hxx>
+#include <Contap_Line.hxx>
 #include <Extrema_LocateExtPC.hxx>
 #include <Standard_ProgramError.hxx>
 #include <Precision.hxx>
@@ -197,7 +197,7 @@ void  HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
   Standard_Integer CurLine;
   for (CurLine = 1; CurLine <= NbLines; CurLine++)
   {
-    const Contap_TheLineOfContour& Line = FO.Line(CurLine);
+    const Contap_Line& Line = FO.Line(CurLine);
     const Standard_Integer NbPoints = Line.NbVertex();
     Standard_Integer CurPoint;
     if (Line.TypeContour() == Contap_Restriction)
@@ -209,7 +209,7 @@ void  HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
       // insert the Internal points.
 
       for (CurPoint = 1; CurPoint <= NbPoints; CurPoint++) {
-        Contap_ThePointOfContour P = Line.Vertex(CurPoint);
+        Contap_Point P = Line.Vertex(CurPoint);
         if (P.IsInternal()) {
           if (P.Value().IsEqual(BRep_Tool::Pnt(VF),BRep_Tool::Tolerance(VF))) {
             if (P.Value().IsEqual(BRep_Tool::Pnt(VL),BRep_Tool::Tolerance(VL))) {
@@ -223,7 +223,7 @@ void  HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
     {
       for (CurPoint = 1; CurPoint <= NbPoints; CurPoint++) {
 
-        const Contap_ThePointOfContour PF = Line.Vertex(CurPoint);
+        const Contap_Point PF = Line.Vertex(CurPoint);
         if (PF.IsInternal() && CurPoint != 1)
           VF = VL;
         else
@@ -231,7 +231,7 @@ void  HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
         const Standard_Real parF = PF.ParameterOnLine();
 
         if (CurPoint < NbPoints) {
-          const Contap_ThePointOfContour PL = Line.Vertex(CurPoint+1);
+          const Contap_Point PL = Line.Vertex(CurPoint+1);
           VL = MakeVertex(PL,tol,DS);
           const Standard_Real parL = PL.ParameterOnLine();
 
@@ -284,7 +284,7 @@ void  HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
 /*
                else if(ipL-ipF < 6) { 
                  // compute the tangents
-                 Contap_TheSurfFunctionOfContour& SFunc =
+                 Contap_SurfFunction& SFunc =
                    FO.SurfaceFunction();
                  
                  Standard_Boolean isTg1,isTg2;
@@ -553,7 +553,7 @@ void  HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
 //=======================================================================
 
 TopoDS_Vertex
-HLRTopoBRep_DSFiller::MakeVertex (const Contap_ThePointOfContour& P,
+HLRTopoBRep_DSFiller::MakeVertex (const Contap_Point& P,
                                  const Standard_Real tol,
                                  HLRTopoBRep_Data& DS)
 {
@@ -611,7 +611,7 @@ HLRTopoBRep_DSFiller::MakeVertex (const Contap_ThePointOfContour& P,
 //=======================================================================
 
 void
-HLRTopoBRep_DSFiller::InsertVertex (const Contap_ThePointOfContour& P,
+HLRTopoBRep_DSFiller::InsertVertex (const Contap_Point& P,
                                    const Standard_Real tol,
                                    const TopoDS_Edge& E,
                                    HLRTopoBRep_Data& DS)