0024761: Convertation of the generic classes to the non-generic. Part 5
authordln <dln@opencascade.com>
Thu, 20 Mar 2014 04:19:13 +0000 (08:19 +0400)
committerapn <apn@opencascade.com>
Fri, 4 Apr 2014 08:57:39 +0000 (12:57 +0400)
1) Generic class "GccEnt_QualifiedCurv" from "GccEnt" package converted to the non-generic class and moved to the "Geom2dGcc" package. Name of this class was changed to "Geom2dGcc_QCurve".

2) Generic classes "HatchGen_ElementGen", "HatchGen_ElementsGen", "HatchGen_HatchingGen" and "HatchGen_Hatcher" from "HatchGen" package converted to the non-generic classes and moved to the "Geom2dHatch" package. Names of this classes were changed to "Geom2dHatch_Element", "Geom2dHatch_Elements", "Geom2dHatch_Hatching" and "Geom2dHatch_Hatcher". Also all instantiations of the "internal" classes of this classes were moved to the "Geom2dHatch.cdl".

3) Generic classes "Extrema_GExtCC", "Extrema_GExtCC2d", "Extrema_GLocateExtCC" and "Extrema_GLocateExtCC2d" from "Extrema" package converted to the non-generic classes. Names of this classes were changed to "Extrema_ExtCC", "Extrema_ExtCC2d", "Extrema_LocateExtCC" and "Extrema_LocateExtCC2d". Also all instantiations of the "internal" classes of this classes were moved to the "Extrema.cdl".

51 files changed:
src/Extrema/Extrema.cdl
src/Extrema/Extrema_ExtCC.cdl [new file with mode: 0644]
src/Extrema/Extrema_ExtCC.cxx [new file with mode: 0644]
src/Extrema/Extrema_ExtCC2d.cdl [new file with mode: 0644]
src/Extrema/Extrema_ExtCC2d.cxx [new file with mode: 0644]
src/Extrema/Extrema_GExtCC.cdl [deleted file]
src/Extrema/Extrema_GExtCC.gxx [deleted file]
src/Extrema/Extrema_GExtCC2d.cdl [deleted file]
src/Extrema/Extrema_GExtCC2d.gxx [deleted file]
src/Extrema/Extrema_GLocateExtCC.cdl [deleted file]
src/Extrema/Extrema_GLocateExtCC.gxx [deleted file]
src/Extrema/Extrema_GLocateExtCC2d.cdl [deleted file]
src/Extrema/Extrema_GLocateExtCC2d.gxx [deleted file]
src/Extrema/Extrema_LocateExtCC.cdl [new file with mode: 0644]
src/Extrema/Extrema_LocateExtCC.cxx [new file with mode: 0644]
src/Extrema/Extrema_LocateExtCC2d.cdl [new file with mode: 0644]
src/Extrema/Extrema_LocateExtCC2d.cxx [new file with mode: 0644]
src/GccEnt/GccEnt.cdl
src/GccEnt/GccEnt_QualifiedCurv.cdl [deleted file]
src/GccEnt/GccEnt_QualifiedCurv.gxx [deleted file]
src/Geom2dGcc/Geom2dGcc.cdl
src/Geom2dGcc/Geom2dGcc_Circ2d2TanOn.cxx
src/Geom2dGcc/Geom2dGcc_Circ2d2TanRad.cxx
src/Geom2dGcc/Geom2dGcc_Circ2d3Tan.cxx
src/Geom2dGcc/Geom2dGcc_Circ2dTanCen.cxx
src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRad.cxx
src/Geom2dGcc/Geom2dGcc_Lin2d2Tan.cxx
src/Geom2dGcc/Geom2dGcc_Lin2dTanObl.cxx
src/Geom2dGcc/Geom2dGcc_QCurve.cdl [new file with mode: 0644]
src/Geom2dGcc/Geom2dGcc_QCurve.cxx [new file with mode: 0644]
src/Geom2dHatch/Geom2dHatch.cdl
src/Geom2dHatch/Geom2dHatch_Element.cdl [new file with mode: 0644]
src/Geom2dHatch/Geom2dHatch_Element.cxx [new file with mode: 0644]
src/Geom2dHatch/Geom2dHatch_Elements.cdl [new file with mode: 0644]
src/Geom2dHatch/Geom2dHatch_Elements.cxx [new file with mode: 0644]
src/Geom2dHatch/Geom2dHatch_Hatcher.cdl [new file with mode: 0644]
src/Geom2dHatch/Geom2dHatch_Hatcher.cxx [new file with mode: 0644]
src/Geom2dHatch/Geom2dHatch_Hatcher.lxx [new file with mode: 0644]
src/Geom2dHatch/Geom2dHatch_Hatching.cdl [new file with mode: 0644]
src/Geom2dHatch/Geom2dHatch_Hatching.cxx [new file with mode: 0644]
src/HatchGen/HatchGen.cdl
src/HatchGen/HatchGen_ElementGen.cdl [deleted file]
src/HatchGen/HatchGen_ElementGen.gxx [deleted file]
src/HatchGen/HatchGen_ElementsGen.cdl [deleted file]
src/HatchGen/HatchGen_ElementsGen.gxx [deleted file]
src/HatchGen/HatchGen_Hatcher.cdl [deleted file]
src/HatchGen/HatchGen_Hatcher.gxx [deleted file]
src/HatchGen/HatchGen_Hatcher.lxx [deleted file]
src/HatchGen/HatchGen_HatchingGen.cdl [deleted file]
src/HatchGen/HatchGen_HatchingGen.gxx [deleted file]
src/QABugs/QABugs_17.cxx

index 52c270a..16cc793 100644 (file)
@@ -125,11 +125,96 @@ is
     
     --  Curve-Curve:                                  
     --  3d:
-    generic class GExtCC, CCache, ECC;
-    generic class GLocateExtCC, LCCache, ELCC, LocECC;
+    class ExtCC;
+    
+    class CCache instantiates CurveCache from Extrema
+        (Curve from Adaptor3d,
+         Pnt from gp,
+         HArray1OfPnt from TColgp);
+
+    class ECC instantiates GenExtCC from Extrema
+        (Curve from Adaptor3d,
+         CurveTool from Extrema,
+         Curve from Adaptor3d,
+         CurveTool from Extrema,
+         CCache from Extrema,
+         HArray1OfPnt from TColgp,
+         POnCurv from Extrema,
+         Pnt from gp,
+         Vec from gp);
+
+    class LocateExtCC;
+    
+    class LCCache instantiates CurveCache from Extrema 
+        (Curve from Adaptor3d,
+         Pnt from gp,
+         HArray1OfPnt from TColgp);
+
+    class ELCC    instantiates GenExtCC from Extrema
+        (Curve from Adaptor3d,
+         CurveTool from Extrema,
+         Curve from Adaptor3d,
+         CurveTool from Extrema,
+         LCCache from Extrema,
+         HArray1OfPnt from TColgp,
+         POnCurv from Extrema,
+         Pnt from gp,
+         Vec from gp);
+
+    class LocECC    instantiates GenLocateExtCC from Extrema
+        (Curve from Adaptor3d,
+         CurveTool from Extrema,
+         Curve from Adaptor3d,
+         CurveTool from Extrema,
+         POnCurv from Extrema,
+         Pnt from gp,
+         Vec from gp);
+
     -- 2d:
-    generic class GExtCC2d, CCache2d, ECC2d;
-    generic class GLocateExtCC2d, LCCache2d, ELCC2d, LocECC2d;
+    class ExtCC2d;
+
+    class CCache2d instantiates CurveCache from Extrema
+        (Curve2d from Adaptor2d,
+         Pnt2d from gp,
+         HArray1OfPnt2d from TColgp);
+
+    class ECC2d instantiates GenExtCC from Extrema
+        (Curve2d from Adaptor2d,
+         Curve2dTool from Extrema,
+         Curve2d from Adaptor2d,
+         Curve2dTool from Extrema,
+         CCache2d from Extrema,
+         HArray1OfPnt2d from TColgp,
+         POnCurv2d from Extrema,
+         Pnt2d from gp,
+         Vec2d from gp);
+    
+    class LocateExtCC2d;
+    
+    class LCCache2d instantiates CurveCache from Extrema
+        (Curve2d from Adaptor2d,
+         Pnt2d from gp,
+         HArray1OfPnt2d from TColgp);
+
+    class ELCC2d instantiates GenExtCC from Extrema
+        (Curve2d from Adaptor2d,
+         Curve2dTool from Extrema,
+         Curve2d from Adaptor2d,
+         Curve2dTool from Extrema,
+         LCCache2d from Extrema,
+         HArray1OfPnt2d from TColgp,
+         POnCurv2d from Extrema,
+         Pnt2d from gp,
+         Vec2d from gp);
+
+    class LocECC2d instantiates GenLocateExtCC from Extrema
+        (Curve2d from Adaptor2d,
+         Curve2dTool from Extrema,
+         Curve2d from Adaptor2d,
+         Curve2dTool from Extrema,
+         POnCurv2d from Extrema,
+         Pnt2d from gp,
+         Vec2d from gp);
     
     --  Curve-Surface:                                  
     class ExtCS;
@@ -226,20 +311,6 @@ is
         Vec               from gp,
         POnCurv           from Extrema,
         SequenceOfPOnCurv from Extrema);
-  
-
-    class ExtCC instantiates GExtCC from Extrema
-       (Curve             from Adaptor3d, 
-        CurveTool         from Extrema,
-        Curve             from Adaptor3d, 
-        CurveTool         from Extrema);
-
-    class LocateExtCC instantiates GLocateExtCC from Extrema
-       (Curve             from Adaptor3d, 
-        CurveTool         from Extrema,
-        Curve             from Adaptor3d, 
-        CurveTool         from Extrema);
-
 
          --- 2d instantiations:
     class ExtPC2d instantiates GExtPC from Extrema
@@ -260,21 +331,6 @@ is
         Vec2d               from gp,
         POnCurv2d           from Extrema,
         SequenceOfPOnCurv2d from Extrema);
-  
-
-    class ExtCC2d instantiates GExtCC2d from Extrema
-       (Curve2d             from Adaptor2d, 
-        Curve2dTool         from Extrema,
-        Curve2d             from Adaptor2d, 
-        Curve2dTool         from Extrema);
-
-    class LocateExtCC2d instantiates GLocateExtCC2d from Extrema
-       (Curve2d             from Adaptor2d, 
-        Curve2dTool         from Extrema,
-        Curve2d             from Adaptor2d, 
-        Curve2dTool         from Extrema);
-
-
 
 
 end Extrema;
diff --git a/src/Extrema/Extrema_ExtCC.cdl b/src/Extrema/Extrema_ExtCC.cdl
new file mode 100644 (file)
index 0000000..889e62d
--- /dev/null
@@ -0,0 +1,162 @@
+-- Created on: 1994-07-06
+-- Created by: Laurent PAINNOT
+-- Copyright (c) 1994-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.
+
+class ExtCC from Extrema
+
+    ---Purpose: It calculates all the distance between two curves.
+    --          These distances can be maximum or minimum.
+
+uses POnCurv           from Extrema,
+     SequenceOfPOnCurv from Extrema,
+     ExtElC            from Extrema,
+     Pnt               from gp,
+     HArray1OfPnt      from TColgp,
+     SequenceOfReal    from TColStd,
+     ListOfTransient   from TColStd,
+     Curve             from Adaptor3d,
+     CurveTool         from Extrema,
+     ECC               from Extrema
+
+
+raises  InfiniteSolutions from StdFail,
+        NotDone           from StdFail,
+        OutOfRange        from Standard
+
+
+is
+
+    Create (TolC1: Real = 1.0e-10; TolC2: Real = 1.0e-10) returns ExtCC;
+    
+
+    Create (C1: Curve from Adaptor3d;  C2: Curve from Adaptor3d;
+            TolC1: Real = 1.0e-10; TolC2: Real = 1.0e-10) returns ExtCC;
+       ---Purpose: It calculates all the distances.
+
+
+    Create (C1: Curve from Adaptor3d;
+           C2: Curve from Adaptor3d;
+           U1: Real  from Standard;
+           U2: Real  from Standard;
+           V1: Real  from Standard;
+           V2: Real  from Standard;
+            TolC1: Real = 1.0e-10;
+            TolC2: Real = 1.0e-10) returns ExtCC;
+       ---Purpose: It calculates all the distances.
+
+
+    SetCurve (me: in out; theRank: Integer; C: Curve from Adaptor3d);
+        ---Purpose:
+
+    SetCurve (me: in out; theRank: Integer; C: Curve from Adaptor3d; Uinf, Usup: Real);
+        ---Purpose:
+
+    SetRange (me: in out; theRank: Integer; Uinf, Usup: Real);
+        ---Purpose:
+
+    SetTolerance (me: in out; theRank: Integer; Tol: Real);
+        ---Purpose:
+
+    Perform(me: in out);
+    
+
+    IsDone (me) returns Boolean
+       ---Purpose: Returns True if the distances are found.
+       is static;
+
+    NbExt (me) returns Integer
+       ---Purpose: Returns the number of extremum distances.
+       raises  NotDone from StdFail,
+               -- if IsDone(me)=False.
+               InfiniteSolutions from StdFail
+               -- if IsParallel(me)= True.
+       is static;
+
+
+    IsParallel (me) returns Boolean
+       ---Purpose: Returns True if the two curves are parallel.
+       raises  NotDone from StdFail
+               -- if IsDone(me)=False.
+       is static;
+
+
+    SquareDistance (me; N: Integer =1) returns Real
+       ---Purpose: Returns the value of the Nth extremum square distance.
+       raises  NotDone from StdFail,
+               -- if IsDone(me)=False.
+               InfiniteSolutions from StdFail,
+               -- if IsParallel(me)= True and N > 1.
+               OutOfRange
+               -- if N < 1 or N > NbExt(me)
+       is static;
+
+    Points (me; N: Integer; P1,P2: out POnCurv)
+       ---Purpose: Returns the points of the Nth extremum distance.
+       --          P1 is on the first curve, P2 on the second one.
+       raises  NotDone from StdFail,
+               -- if IsDone(me)=False.
+               InfiniteSolutions from StdFail,
+               -- if IsParallel(me)= True.
+               OutOfRange
+               -- if N < 1 or N > NbExt(me)
+       is static;
+
+    TrimmedSquareDistances(me; dist11, distP12, distP21, distP22: out Real;
+                     P11, P12, P21, P22: out Pnt)
+       ---Purpose: if the curve is a trimmed curve,
+       --          dist11 is a square distance between the point on C1
+       --          of parameter FirstParameter and the point of 
+       --          parameter FirstParameter on C2.
+
+    is static;
+    
+    Results(me: in out; AlgExt: ExtElC from Extrema;
+           Ut11, Ut12, Ut21, Ut22: Real)
+
+    is static protected;       
+
+    Results(me: in out;AlgExt: ECC from Extrema;
+           Ut11, Ut12, Ut21, Ut22: Real)
+
+    is static protected;
+
+
+    
+
+fields
+    myECC:    ECC from Extrema;
+    myDone:   Boolean;
+    myIsPar:  Boolean;
+    mypoints: SequenceOfPOnCurv from Extrema;
+    mySqDist: SequenceOfReal    from TColStd;
+    mynbext:  Integer;
+    inverse:  Boolean;
+    myC:     Address from Standard [2];
+    myInf: Real [2];
+    mySup: Real [2];
+    myTol:  Real [2];
+    myCacheLists: ListOfTransient from TColStd [2]; -- lists of Handle(Extrema_CCache)
+    P1f:      Pnt;
+    P1l:      Pnt;
+    P2f:      Pnt;
+    P2l:      Pnt;
+    mydist11: Real;
+    mydist12: Real;
+    mydist21: Real;
+    mydist22: Real;
+    
+
+
+end ExtCC;
diff --git a/src/Extrema/Extrema_ExtCC.cxx b/src/Extrema/Extrema_ExtCC.cxx
new file mode 100644 (file)
index 0000000..cf0cae0
--- /dev/null
@@ -0,0 +1,885 @@
+// Created on: 1994-07-06
+// Created by: Laurent PAINNOT
+// Copyright (c) 1994-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.
+
+// Modified by MPS (june 96) : correction du trap dans le cas droite/Bezier 
+// Modified by MPS (mai 97) : PRO 7598 
+//                            tri des solutions pour eviter de rendre plusieurs
+//                            fois la meme solution 
+
+#include <Extrema_ExtCC.ixx>
+
+#include <StdFail_NotDone.hxx>
+#include <Extrema_ExtElC.hxx>
+#include <Standard_Failure.hxx>
+#include <GeomAbs_CurveType.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <Geom_Ellipse.hxx>
+#include <Geom_Circle.hxx>
+#include <Geom_Line.hxx>
+#include <Geom_Parabola.hxx>
+#include <Geom_Hyperbola.hxx>
+#include <Extrema_POnCurv.hxx>
+#include <Extrema_SequenceOfPOnCurv.hxx>
+#include <TColStd_SequenceOfReal.hxx>
+#include <TColStd_ListIteratorOfListOfTransient.hxx>
+#include <Standard_NotImplemented.hxx>
+#include <Precision.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <ElCLib.hxx>
+#include <Extrema_ExtPElC.hxx>
+#include <Standard_NullObject.hxx>
+
+#include <Adaptor3d_Curve.hxx>
+#include <Extrema_CurveTool.hxx>
+#include <Extrema_CCache.hxx>
+
+//=======================================================================
+//function : Extrema_ExtCC
+//purpose  : 
+//=======================================================================
+
+Extrema_ExtCC::Extrema_ExtCC (const Standard_Real TolC1,
+                                           const Standard_Real TolC2) :
+                                             myDone (Standard_False)
+{
+  myC[0] = 0; myC[1] = 0;
+  myTol[0] = TolC1; myTol[1] = TolC2;
+}
+
+//=======================================================================
+//function : Extrema_ExtCC
+//purpose  : 
+//=======================================================================
+
+Extrema_ExtCC::Extrema_ExtCC(const Adaptor3d_Curve& C1, 
+                              const Adaptor3d_Curve& C2,
+                              const Standard_Real      U1,
+                              const Standard_Real      U2,
+                              const Standard_Real      V1,
+                              const Standard_Real      V2,
+                              const Standard_Real      TolC1,
+                              const Standard_Real      TolC2) :
+                                myDone (Standard_False)
+{
+  SetCurve (1, C1, U1, U2);
+  SetCurve (2, C2, V1, V2);
+  SetTolerance (1, TolC1);
+  SetTolerance (2, TolC2);
+  Perform();
+}
+
+
+//=======================================================================
+//function : Extrema_ExtCC
+//purpose  : 
+//=======================================================================
+
+Extrema_ExtCC::Extrema_ExtCC(const Adaptor3d_Curve& C1, 
+                              const Adaptor3d_Curve& C2,
+                              const Standard_Real      TolC1,
+                              const Standard_Real      TolC2) :
+                     myDone (Standard_False)
+{
+  SetCurve (1, C1, C1.FirstParameter(), C1.LastParameter());
+  SetCurve (2, C2, C2.FirstParameter(), C2.LastParameter());
+  SetTolerance (1, TolC1);
+  SetTolerance (2, TolC2);
+  Perform();
+}
+
+//=======================================================================
+//function : SetCurve
+//purpose  : 
+//=======================================================================
+
+void Extrema_ExtCC::SetCurve (const Standard_Integer theRank, const Adaptor3d_Curve& C)
+{
+  Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_ExtCC::SetCurve()")
+  Standard_Integer anInd = theRank - 1;
+  myC[anInd] = (Standard_Address)&C;
+  
+  //clear the previous cache to rebuild it later in Perform()
+  myCacheLists[anInd].Clear();
+}
+
+//=======================================================================
+//function : SetCurve
+//purpose  : 
+//=======================================================================
+
+void Extrema_ExtCC::SetCurve (const Standard_Integer theRank, const Adaptor3d_Curve& C,
+                               const Standard_Real Uinf, const Standard_Real Usup)
+{
+  SetCurve (theRank, C);
+  SetRange (theRank, Uinf, Usup);
+}
+
+//=======================================================================
+//function : SetRange
+//purpose  : 
+//=======================================================================
+
+void Extrema_ExtCC::SetRange (const Standard_Integer theRank, 
+                               const Standard_Real Uinf, const Standard_Real Usup)
+{
+  Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_ExtCC::SetRange()")
+  Standard_Integer anInd = theRank - 1;
+  myInf[anInd] = Uinf;
+  mySup[anInd] = Usup;
+}
+
+//=======================================================================
+//function : SetTolerance
+//purpose  : 
+//=======================================================================
+
+void Extrema_ExtCC::SetTolerance (const Standard_Integer theRank, const Standard_Real theTol)
+{
+  Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_ExtCC::SetTolerance()")
+  Standard_Integer anInd = theRank - 1;
+  myTol[anInd] = theTol;
+}
+
+
+//=======================================================================
+//function : Perform
+//purpose  : 
+//=======================================================================
+
+void Extrema_ExtCC::Perform()
+{  
+  Standard_NullObject_Raise_if (!myC[0] || !myC[1], "Extrema_ExtCC::Perform()")
+  myDone = Standard_False;
+  mypoints.Clear();
+  mySqDist.Clear();
+  myIsPar = Standard_False;
+
+  GeomAbs_CurveType type1 = (*((Adaptor3d_Curve*)myC[0])).GetType();
+  GeomAbs_CurveType type2 = (*((Adaptor3d_Curve*)myC[1])).GetType();
+  Standard_Real U11, U12, U21, U22, Tol = Min(myTol[0], myTol[1]);
+  mynbext = 0;
+  inverse = Standard_False;
+
+  U11 = myInf[0];
+  U12 = mySup[0];
+  U21 = myInf[1];
+  U22 = mySup[1];
+
+  if (!Precision::IsInfinite(U11)) P1f = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]),  U11); 
+  if (!Precision::IsInfinite(U12)) P1l = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]),  U12);
+  if (!Precision::IsInfinite(U21)) P2f = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), U21);
+  if (!Precision::IsInfinite(U22)) P2l = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), U22);
+  
+
+  if (Precision::IsInfinite(U11) || Precision::IsInfinite(U21)) mydist11 = RealLast();
+  else mydist11 = P1f.SquareDistance(P2f);
+  if (Precision::IsInfinite(U11) || Precision::IsInfinite(U22)) mydist12 = RealLast();
+  else mydist12 = P1f.SquareDistance(P2l);
+  if (Precision::IsInfinite(U12) || Precision::IsInfinite(U21)) mydist21 = RealLast();
+  else mydist21 = P1l.SquareDistance(P2f);
+  if (Precision::IsInfinite(U12) || Precision::IsInfinite(U22)) mydist22 = RealLast();
+  else mydist22 = P1l.SquareDistance(P2l);
+
+  myECC.SetTolerance (Tol);
+
+  //Depending on the types of curves, the algorithm is chosen:
+  //- _ExtElC, when one of the curves is a line and the other is elementary,
+  //   or there are two circles;
+  //- _GenExtCC, in all other cases
+  if ( (type1 == GeomAbs_Line && type2 <= GeomAbs_Parabola) ||
+       (type2 == GeomAbs_Line && type1 <= GeomAbs_Parabola) ) {
+    //analytical case - one curve is always a line
+    Standard_Integer anInd1 = 0, anInd2 = 1;
+    GeomAbs_CurveType aType2 = type2;
+    inverse = (type1 > type2);
+    if (inverse) {
+      //algorithm uses inverse order of arguments
+      anInd1 = 1;
+      anInd2 = 0;
+      aType2 = type1;
+    }
+    switch (aType2) {
+    case GeomAbs_Line: {
+      Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Line(), Tol);
+      Results(Xtrem, U11, U12, U21, U22);
+      break;
+    }
+    case GeomAbs_Circle: {
+      Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Circle(), Tol);
+      Results(Xtrem, U11, U12, U21, U22);
+      break;
+    }
+    case GeomAbs_Ellipse: {
+      Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Ellipse());
+      Results(Xtrem, U11, U12, U21, U22);
+      break;
+    }
+    case GeomAbs_Hyperbola: {
+      Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Hyperbola());
+      Results(Xtrem, U11, U12, U21, U22);
+      break;
+    }
+    case GeomAbs_Parabola: {
+      Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Parabola());
+      Results(Xtrem, U11, U12, U21, U22);
+      break;
+    }
+    default: break;
+    }
+  } else if (type1 == GeomAbs_Circle && type2 == GeomAbs_Circle) {
+    //analytical case - two circles
+    Standard_Boolean bIsDone;
+    Extrema_ExtElC CCXtrem ((*((Adaptor3d_Curve*)myC[0])).Circle(), (*((Adaptor3d_Curve*)myC[1])).Circle());
+    bIsDone = CCXtrem.IsDone();
+    if(bIsDone) {
+      Results(CCXtrem, U11, U12, U21, U22);
+    }
+    else {
+      Standard_Integer i;
+      Standard_Integer aNbS = 32; //default number of sample points per interval (why 32?)
+      for (i = 0; i < 2; i++) {
+       TColStd_ListOfTransient& aCacheList = myCacheLists[i];
+       if (aCacheList.IsEmpty()) {
+         //no caches, build them
+         Adaptor3d_Curve& aC = *(Adaptor3d_Curve*)myC[i];
+          //single interval from myInf[i] to mySup[i]
+          Handle(Extrema_CCache) aCache = new Extrema_CCache(aC, myInf[i], mySup[i], aNbS, Standard_True);
+          aCacheList.Append (aCache);
+       }
+      }
+      Handle(Extrema_CCache) aCache1 = Handle(Extrema_CCache)::DownCast (myCacheLists[0].First());
+      myECC.SetCurveCache (1, aCache1);
+      Handle(Extrema_CCache) aCache2 = Handle(Extrema_CCache)::DownCast (myCacheLists[1].First());
+      myECC.SetCurveCache (2, aCache2);
+      myECC.Perform();
+      Results (myECC, U11, U12, U21, U22);
+    }
+  } else {
+    //common case - use _GenExtCC
+    //1. check and prepare caches
+
+    Standard_Integer i;
+    Standard_Integer aNbS[2] = {32, 32}, aNbInter[2] = {1, 1};
+    Standard_Real Coeff[2] = {1., 1.};
+    Standard_Real rf = 0., rl = 0., LL[2] = {-1., -1.};
+    Standard_Boolean KnotSampling[2] = {Standard_False, Standard_False};
+    for (i = 0; i < 2; i++) {
+      TColStd_ListOfTransient& aCacheList = myCacheLists[i];
+      if (aCacheList.IsEmpty()) {
+        //no caches, build them
+        Adaptor3d_Curve& aC = *(Adaptor3d_Curve*)myC[i];
+
+       Standard_Real du1 = 0., t = 0.;
+       gp_Pnt P1, P2;
+        GeomAbs_CurveType aType = aC.GetType();
+        switch (aType) {
+        case GeomAbs_BezierCurve:
+          aNbS[i] = aC.NbPoles() * 2;
+          break;
+        case GeomAbs_BSplineCurve:
+          if (aC.Degree() <= 3 &&
+              aC.NbKnots() > 2)
+            KnotSampling[i] = Standard_True;
+          
+          aNbS[i] = aC.NbPoles() * 2;
+          rf = (Extrema_CurveTool::BSpline(*((Adaptor3d_Curve*)myC[i])))->FirstParameter();
+          rl = (Extrema_CurveTool::BSpline(*((Adaptor3d_Curve*)myC[i])))->LastParameter();
+          aNbS[i] = (Standard_Integer) ( aNbS[i] * ((mySup[i] - myInf[i]) / (rl - rf)) + 1 );
+        case GeomAbs_OtherCurve:
+        case GeomAbs_Line:
+          //adjust number of sample points for Lines, B-Splines and Other curves
+          aNbInter[i] = aC.NbIntervals (GeomAbs_C2);
+          aNbS[i] = Max(aNbS[i] / aNbInter[i], 3);
+         LL[i] = 0.;
+         du1 = (mySup[i] - myInf[i]) / ((aNbS[i]-1)*aNbInter[i]);
+         P1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[i]), myInf[i]);
+         for(t = myInf[i] + du1; t <= mySup[i]; t += du1) {
+           P2 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[i]), t);
+           LL[i] += P1.Distance(P2);
+           P1 = P2;
+         }
+         LL[i] /= ((aNbS[i]-1)*aNbInter[i]);
+          break;
+        default: 
+         break;
+        }
+      }
+    }
+
+    if(LL[0] > 0. && LL[1] > 0.) {
+      if(LL[0] > 4.*LL[1]) {
+        Coeff[0] = LL[0]/LL[1]/2.;
+        if (aNbS[0] * Coeff[0] <= 10000.0)
+          aNbS[0]  = (Standard_Integer) ( aNbS[0] * Coeff[0] );
+      }
+      else if(LL[1] > 4.*LL[0]) {
+        Coeff[1] = LL[1]/LL[0]/2.;
+        if (aNbS[1] * Coeff[1] <= 10000.0)
+          aNbS[1]  = (Standard_Integer) (aNbS[1] * Coeff[1] );
+      }
+    }
+    //modified by NIZNHY-PKV Tue Apr 17 10:01:32 2012f
+    Standard_Integer aNbSTresh;
+    //
+    aNbSTresh=10000;
+    //
+    for (i = 0; i < 2; ++i) {
+      if (aNbS[i]>aNbSTresh) {
+       aNbS[i]=aNbSTresh;
+      }
+    }
+    //modified by NIZNHY-PKV Tue Apr 17 10:01:34 2012t
+    for (i = 0; i < 2; i++) {
+      TColStd_ListOfTransient& aCacheList = myCacheLists[i];
+      if (aCacheList.IsEmpty()) {
+        //no caches, build them
+        Adaptor3d_Curve& aC = *(Adaptor3d_Curve*)myC[i];
+
+        if (aC.GetType() >= GeomAbs_BSplineCurve)
+        {
+          //can be multiple intervals, one cache per one C2 interval
+          TColStd_Array1OfReal anArr (1, aNbInter[i] + 1);
+          aC.Intervals (anArr, GeomAbs_C2);
+          
+          if (KnotSampling[i])
+          {
+            Standard_Integer NbIntervCN = aC.NbIntervals(GeomAbs_CN);
+            TColStd_Array1OfReal IntervalsCN(1, NbIntervCN + 1);
+            aC.Intervals(IntervalsCN, GeomAbs_CN);
+
+            Standard_Integer j = 1, start_j = 1, k;
+            Standard_Real NextKnot;
+            for (k = 1; k <= aNbInter[i]; k++)
+            {
+              do
+              {
+                NextKnot = IntervalsCN(j+1);
+                j++;
+              }
+              while (NextKnot != anArr(k+1));
+
+              Handle(Extrema_CCache) aCache =
+                new Extrema_CCache(aC, anArr(k), anArr(k+1),
+                                    IntervalsCN, start_j, j, Coeff[i]);
+              aCacheList.Append (aCache);
+
+              start_j = j;
+            }
+          }
+          else
+          {
+            for (Standard_Integer k = 1; k <= aNbInter[i]; k++) {
+              Handle(Extrema_CCache) aCache =
+                new Extrema_CCache(aC, anArr(k), anArr(k+1), aNbS[i], Standard_True);
+              aCacheList.Append (aCache);
+            }
+          }
+        }
+        else
+        {
+          //single interval from myInf[i] to mySup[i]
+          Handle(Extrema_CCache) aCache = new Extrema_CCache (aC,
+            myInf[i], mySup[i], aNbS[i], Standard_True);
+          aCacheList.Append (aCache);
+        }
+      }
+    }
+
+    //2. process each cache from one list with each cache from the other
+    TColStd_ListIteratorOfListOfTransient anIt1 (myCacheLists[0]);
+    for (; anIt1.More(); anIt1.Next()) {
+      Handle(Extrema_CCache) aCache1 = Handle(Extrema_CCache)::DownCast (anIt1.Value());
+      myECC.SetCurveCache (1, aCache1);
+      TColStd_ListIteratorOfListOfTransient anIt2 (myCacheLists[1]);
+      for (; anIt2.More(); anIt2.Next()) {
+        Handle(Extrema_CCache) aCache2 = Handle(Extrema_CCache)::DownCast (anIt2.Value());
+        myECC.SetCurveCache (2, aCache2);
+        myECC.Perform();
+        Results(myECC, U11, U12, U21, U22);
+      }
+    }
+  }
+}
+
+
+//=======================================================================
+//function : IsDone
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Extrema_ExtCC::IsDone() const
+{
+  return myDone;
+}
+
+//=======================================================================
+//function : IsParallel
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Extrema_ExtCC::IsParallel() const
+{
+  return myIsPar;
+}
+
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+
+Standard_Real Extrema_ExtCC::SquareDistance(const Standard_Integer N) const 
+{
+  if(!myDone) StdFail_NotDone::Raise();
+  if ((N <= 0) || (N > mynbext)) Standard_OutOfRange::Raise();
+  return mySqDist.Value(N);
+}
+
+
+//=======================================================================
+//function : NbExt
+//purpose  : 
+//=======================================================================
+
+Standard_Integer Extrema_ExtCC::NbExt() const
+{
+  if(!myDone) StdFail_NotDone::Raise();
+  return mynbext;
+}
+
+
+//=======================================================================
+//function : Points
+//purpose  : 
+//=======================================================================
+
+void Extrema_ExtCC::Points(const Standard_Integer N, 
+                           Extrema_POnCurv& P1,
+                           Extrema_POnCurv& P2) const
+{
+  if(!myDone) StdFail_NotDone::Raise();
+  if ((N <= 0) || (N > mynbext)) Standard_OutOfRange::Raise();
+  P1 = mypoints.Value(2*N-1);
+  P2 = mypoints.Value(2*N);
+}
+
+
+
+//=======================================================================
+//function : TrimmedDistances
+//purpose  : 
+//=======================================================================
+
+void Extrema_ExtCC::TrimmedSquareDistances(Standard_Real& dist11,
+                                     Standard_Real& dist12,
+                                     Standard_Real& dist21,
+                                     Standard_Real& dist22,
+                                     gp_Pnt&        P11   ,
+                                     gp_Pnt&        P12   ,
+                                     gp_Pnt&        P21   ,
+                                     gp_Pnt&        P22    ) const {
+                                       
+  dist11 = mydist11;
+  dist12 = mydist12;
+  dist21 = mydist21;
+  dist22 = mydist22;
+  P11 = P1f;
+  P12 = P1l;
+  P21 = P2f;
+  P22 = P2l;
+}
+
+
+
+//=======================================================================
+//function : Results
+//purpose  : 
+//=======================================================================
+
+void Extrema_ExtCC::Results(const Extrema_ExtElC&  AlgExt,
+                            const Standard_Real    Ut11,
+                            const Standard_Real    Ut12,
+                            const Standard_Real    Ut21,
+                            const Standard_Real    Ut22)
+{
+  Standard_Integer i, NbExt;
+  Standard_Real Val, U, U2;
+  Extrema_POnCurv P1, P2;
+
+  myDone = AlgExt.IsDone();
+  if (myDone) {
+    myIsPar = AlgExt.IsParallel();
+    if (myIsPar) {
+      GeomAbs_CurveType type = Extrema_CurveTool::GetType(*((Adaptor3d_Curve*)myC[0]));
+      GeomAbs_CurveType type2 = Extrema_CurveTool::GetType(*((Adaptor3d_Curve*)myC[1]));
+      // Parallel case is only for line-line, circle-circle and circle-line!!!
+      // But really for trimmed curves extremas can not exist!
+      Extrema_POnCurv dummypoint(0., gp_Pnt(0.,0.,0.));
+      if(type != type2) {
+       mySqDist.Append(AlgExt.SquareDistance(1));
+       if(type == GeomAbs_Circle) {
+         gp_Pnt PonC1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), Ut11);
+         P1.SetValues(Ut11, PonC1);
+         Extrema_ExtPElC ExtPLin(PonC1, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[1])), Precision::Confusion(), Ut21, Ut22);
+         if(ExtPLin.IsDone()) {
+           mynbext = 1;
+           P2 = ExtPLin.Point(1);
+           mypoints.Append(P1);
+           mypoints.Append(P2);
+         }
+         else {
+           myIsPar = Standard_False;
+           mynbext = 0;
+           mypoints.Append(dummypoint);
+           mypoints.Append(dummypoint);
+         }
+       }
+       else {
+         gp_Pnt PonC2 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), Ut21);
+         P2.SetValues(Ut21, PonC2);
+         Extrema_ExtPElC ExtPLin(PonC2, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[0])), Precision::Confusion(), Ut11, Ut12);
+         if(ExtPLin.IsDone()) {
+           mynbext = 1;
+           P1 = ExtPLin.Point(1);
+           mypoints.Append(P1);
+           mypoints.Append(P2);
+         }
+         else {
+           myIsPar = Standard_False;
+           mynbext = 0;
+           mypoints.Append(dummypoint);
+           mypoints.Append(dummypoint);
+         }
+       }
+       return;
+      }
+         
+      if(type == GeomAbs_Line) {
+       Standard_Boolean infinite = Precision::IsInfinite(Ut11) &&
+                                   Precision::IsInfinite(Ut12) &&
+                                   Precision::IsInfinite(Ut21) &&
+                                   Precision::IsInfinite(Ut22);
+
+       if(infinite) {
+         mynbext = 1;
+         mySqDist.Append(AlgExt.SquareDistance(1));
+         gp_Pnt PonC1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), 0.); 
+         P1.SetValues(0., PonC1);
+         Extrema_ExtPElC ExtPLin(PonC1, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[1])), Precision::Confusion(), Ut21, Ut22);
+         if(ExtPLin.IsDone()) {
+           P2 = ExtPLin.Point(1);
+           mypoints.Append(P1);
+           mypoints.Append(P2);
+         }
+         else {
+           myIsPar = Standard_False;
+           mypoints.Append(dummypoint);
+           mypoints.Append(dummypoint);
+         }
+       }
+       else {
+         Standard_Boolean finish = Standard_False;
+         if(!Precision::IsInfinite(Ut11)) {
+           gp_Pnt PonC1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), Ut11);  
+           Extrema_ExtPElC ExtPLin(PonC1, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[1])), Precision::Confusion(), Ut21, Ut22);
+           if(ExtPLin.IsDone() && ExtPLin.NbExt() > 0) {
+             mynbext = 1;
+             mySqDist.Append(AlgExt.SquareDistance(1));
+             P1.SetValues(Ut11, PonC1);
+             P2 = ExtPLin.Point(1);
+             mypoints.Append(P1);
+             mypoints.Append(P2);
+             finish = Standard_True;
+           }
+         }
+         if(!finish) {
+           if(!Precision::IsInfinite(Ut12)) {
+             gp_Pnt PonC1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), Ut12);  
+             Extrema_ExtPElC ExtPLin(PonC1, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[1])), Precision::Confusion(), Ut21, Ut22);
+             if(ExtPLin.IsDone() && ExtPLin.NbExt() > 0) {
+               mynbext = 1;
+               mySqDist.Append(AlgExt.SquareDistance(1));
+               P1.SetValues(Ut12, PonC1);
+               P2 = ExtPLin.Point(1);
+               mypoints.Append(P1);
+               mypoints.Append(P2);
+               finish = Standard_True;
+             }
+           }
+         }
+         if(!finish) {
+           if(!Precision::IsInfinite(Ut21)) {
+             gp_Pnt PonC2 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), Ut21);  
+             Extrema_ExtPElC ExtPLin(PonC2, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[0])), Precision::Confusion(), Ut11, Ut12);
+             if(ExtPLin.IsDone() && ExtPLin.NbExt() > 0) {
+               mynbext = 1;
+               mySqDist.Append(AlgExt.SquareDistance(1));
+               P2.SetValues(Ut21, PonC2);
+               P1 = ExtPLin.Point(1);
+               mypoints.Append(P1);
+               mypoints.Append(P2);
+               finish = Standard_True;
+             }
+           }
+         }
+         if(!finish) {
+           if(!Precision::IsInfinite(Ut22)) {
+             gp_Pnt PonC2 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), Ut22);  
+             Extrema_ExtPElC ExtPLin(PonC2, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[0])), Precision::Confusion(), Ut11, Ut12);
+             if(ExtPLin.IsDone() && ExtPLin.NbExt() > 0) {
+               mynbext = 1;
+               mySqDist.Append(AlgExt.SquareDistance(1));
+               P2.SetValues(Ut22, PonC2);
+               P1 = ExtPLin.Point(1);
+               mypoints.Append(P1);
+               mypoints.Append(P2);
+               finish = Standard_True;
+             }
+           }
+         }
+         if(!finish) {
+           mynbext = 0;
+           myIsPar = Standard_False;
+           mySqDist.Append(AlgExt.SquareDistance(1));
+           mypoints.Append(dummypoint);
+           mypoints.Append(dummypoint);
+         }
+       }
+         
+      }
+      else {
+       Standard_Boolean finish = Standard_False;
+       gp_Pnt PonC1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), Ut11);  
+       P1.SetValues(Ut11, PonC1);
+       Extrema_ExtPElC ExtPCir(PonC1, Extrema_CurveTool::Circle(*((Adaptor3d_Curve*)myC[1])), Precision::Confusion(), Ut21, Ut22);
+       if(ExtPCir.IsDone() && ExtPCir.NbExt() > 0) {
+         for(i = 1; i <= ExtPCir.NbExt(); i++) {
+           mynbext++;
+           P2 = ExtPCir.Point(i);
+           mySqDist.Append(ExtPCir.SquareDistance(i));
+           mypoints.Append(P1);
+           mypoints.Append(P2);
+         }
+         if(mynbext == 2)  finish = Standard_True;
+       }
+       if(!finish) {
+         PonC1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), Ut12);  
+         ExtPCir.Perform(PonC1, Extrema_CurveTool::Circle(*((Adaptor3d_Curve*)myC[1])), Precision::Confusion(), Ut21, Ut22);
+         P1.SetValues(Ut12, PonC1);
+         if(ExtPCir.IsDone() && ExtPCir.NbExt() > 0) {
+           if(mynbext == 0) {
+             for(i = 1; i <= ExtPCir.NbExt(); i++) {
+               mynbext++;
+               P2 = ExtPCir.Point(i);
+               mySqDist.Append(ExtPCir.SquareDistance(i));
+               mypoints.Append(P1);
+               mypoints.Append(P2);
+             }
+           }
+           else {
+             for(i = 1; i <= ExtPCir.NbExt(); i++) {
+               Standard_Real dist = mySqDist(1);
+               if(Abs(dist - ExtPCir.SquareDistance(i)) > Precision::Confusion()) {
+                 mynbext++;
+                 P2 = ExtPCir.Point(i);
+                 mySqDist.Append(ExtPCir.SquareDistance(i));
+                 mypoints.Append(P1);
+                 mypoints.Append(P2);
+               }
+             }
+           }
+               
+           if(mynbext == 2)  finish = Standard_True;
+         }
+       }  
+       if(!finish) {
+         gp_Pnt PonC2 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), Ut21);  
+         ExtPCir.Perform(PonC2, Extrema_CurveTool::Circle(*((Adaptor3d_Curve*)myC[0])), Precision::Confusion(), Ut11, Ut12);
+         P2.SetValues(Ut21, PonC2);
+         if(ExtPCir.IsDone() && ExtPCir.NbExt() > 0) {
+           if(mynbext == 0) {
+             for(i = 1; i <= ExtPCir.NbExt(); i++) {
+               mynbext++;
+               P1 = ExtPCir.Point(i);
+               mySqDist.Append(ExtPCir.SquareDistance(i));
+               mypoints.Append(P1);
+               mypoints.Append(P2);
+             }
+           }
+           else {
+             for(i = 1; i <= ExtPCir.NbExt(); i++) {
+               Standard_Real dist = mySqDist(1);
+               if(Abs(dist - ExtPCir.SquareDistance(i)) > Precision::Confusion()) {
+                 mynbext++;
+                 P1 = ExtPCir.Point(i);
+                 mySqDist.Append(ExtPCir.SquareDistance(i));
+                 mypoints.Append(P1);
+                 mypoints.Append(P2);
+               }
+             }
+           }
+               
+           if(mynbext == 2)  finish = Standard_True;
+         }
+       }  
+       if(!finish) {
+         gp_Pnt PonC2 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), Ut22);  
+         ExtPCir.Perform(PonC2, Extrema_CurveTool::Circle(*((Adaptor3d_Curve*)myC[0])), Precision::Confusion(), Ut11, Ut12);
+         P2.SetValues(Ut22, PonC2);
+         if(ExtPCir.IsDone() && ExtPCir.NbExt() > 0) {
+           if(mynbext == 0) {
+             for(i = 1; i <= ExtPCir.NbExt(); i++) {
+               mynbext++;
+               P1 = ExtPCir.Point(i);
+               mySqDist.Append(ExtPCir.SquareDistance(i));
+               mypoints.Append(P1);
+               mypoints.Append(P2);
+             }
+           }
+           else {
+             for(i = 1; i <= ExtPCir.NbExt(); i++) {
+               Standard_Real dist = mySqDist(1);
+               if(Abs(dist - ExtPCir.SquareDistance(i)) > Precision::Confusion()) {
+                 mynbext++;
+                 P1 = ExtPCir.Point(i);
+                 mySqDist.Append(ExtPCir.SquareDistance(i));
+                 mypoints.Append(P1);
+                 mypoints.Append(P2);
+               }
+             }
+           }
+               
+           if(mynbext == 2)  finish = Standard_True;
+         }
+       }  
+       if(mynbext == 0) {
+         myIsPar = Standard_False;
+         mySqDist.Append(AlgExt.SquareDistance(1));
+         mypoints.Append(dummypoint);
+         mypoints.Append(dummypoint);
+         mySqDist.Append(AlgExt.SquareDistance(2));
+         mypoints.Append(dummypoint);
+         mypoints.Append(dummypoint);
+       }
+      }        
+    }
+    else {
+      NbExt = AlgExt.NbExt();
+      for (i = 1; i <= NbExt; i++) {
+       // Verification de la validite des parametres
+       AlgExt.Points(i, P1, P2);
+       if (!inverse) {
+         U = P1.Parameter();
+         U2 = P2.Parameter();
+       }
+       else {
+         U2 = P1.Parameter();
+         U = P2.Parameter();
+       }
+
+       if (Extrema_CurveTool::IsPeriodic(*((Adaptor3d_Curve*)myC[0]))) {
+         U = ElCLib::InPeriod(U, Ut11, Ut11+Extrema_CurveTool::Period(*((Adaptor3d_Curve*)myC[0])));
+       }
+       if (Extrema_CurveTool::IsPeriodic(*((Adaptor3d_Curve*)myC[1]))) {
+         U2 = ElCLib::InPeriod(U2, Ut21, Ut21+Extrema_CurveTool::Period(*((Adaptor3d_Curve*)myC[1])));
+       }
+
+       if ((U  >= Ut11 - RealEpsilon())  && 
+           (U  <= Ut12 + RealEpsilon())  &&
+           (U2 >= Ut21 - RealEpsilon())  &&
+           (U2 <= Ut22 + RealEpsilon())) {
+         mynbext++;
+         Val = AlgExt.SquareDistance(i);
+         mySqDist.Append(Val);
+         if (!inverse) {
+           P1.SetValues(U, P1.Value());
+           P2.SetValues(U2, P2.Value());
+           mypoints.Append(P1);
+           mypoints.Append(P2);
+         }
+         else {
+           P1.SetValues(U2, P1.Value());
+           P2.SetValues(U, P2.Value());
+           mypoints.Append(P2);
+           mypoints.Append(P1);
+         }
+       }
+      }
+    }
+  }
+
+}
+
+
+//=======================================================================
+//function : Results
+//purpose  : 
+//=======================================================================
+
+void Extrema_ExtCC::Results(const Extrema_ECC&   AlgExt,
+                            const Standard_Real  Ut11,
+                            const Standard_Real  Ut12,
+                            const Standard_Real  Ut21,
+                            const Standard_Real  Ut22)
+{
+  Standard_Integer i, j,NbExt;
+  Standard_Real Val, U, U2,Uj,U2j;
+  Extrema_POnCurv P1, P2,P1j,P2j;
+  Standard_Boolean IsExtrema;
+
+  myDone = AlgExt.IsDone();
+  if (myDone) {
+    NbExt = AlgExt.NbExt();
+    for (i = 1; i <= NbExt; i++) {
+      AlgExt.Points(i, P1, P2);
+      U = P1.Parameter();
+      U2 = P2.Parameter();
+      IsExtrema=Standard_True;
+      for  (j=1;j<=mynbext;j++)
+      { P1j=mypoints.Value(2*j-1);
+        P2j=mypoints.Value(2*j);
+        Uj=P1j.Parameter();
+        U2j=P2j.Parameter();
+        if ((Abs(Uj-U)<=myTol[0]) && (Abs(U2j-U2)<=myTol[1]))     
+        IsExtrema=Standard_False;}
+     
+      if (IsExtrema) 
+      {  
+//  Verification de la validite des parametres
+       if (Extrema_CurveTool::IsPeriodic(*((Adaptor3d_Curve*)myC[0]))) {
+         U = ElCLib::InPeriod(U, Ut11, Ut11+Extrema_CurveTool::Period(*((Adaptor3d_Curve*)myC[0])));
+       }
+       if (Extrema_CurveTool::IsPeriodic(*((Adaptor3d_Curve*)myC[1]))) {
+         U2 = ElCLib::InPeriod(U2, Ut21, Ut21+Extrema_CurveTool::Period(*((Adaptor3d_Curve*)myC[1])));
+       }
+
+         if ((U  >= Ut11 - RealEpsilon())  && 
+          (U  <= Ut12 + RealEpsilon())  &&
+          (U2 >= Ut21 - RealEpsilon())  &&
+          (U2 <= Ut22 + RealEpsilon()))   
+         { mynbext++;
+          Val = AlgExt.SquareDistance(i);
+          mySqDist.Append(Val);
+          P1.SetValues(U, P1.Value());
+          P2.SetValues(U2, P2.Value());
+          mypoints.Append(P1);
+          mypoints.Append(P2);
+         }
+      }
+    }
+  }  
+}
diff --git a/src/Extrema/Extrema_ExtCC2d.cdl b/src/Extrema/Extrema_ExtCC2d.cdl
new file mode 100644 (file)
index 0000000..f3ffa2e
--- /dev/null
@@ -0,0 +1,162 @@
+-- Created on: 1994-07-06
+-- Created by: Laurent PAINNOT
+-- Copyright (c) 1994-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.
+
+class ExtCC2d from Extrema
+
+    ---Purpose: It calculates all the distance between two curves.
+    --          These distances can be maximum or minimum.
+
+uses POnCurv2d           from Extrema,
+     SequenceOfPOnCurv2d from Extrema,
+     ExtElC2d            from Extrema,
+     Pnt2d               from gp,
+     HArray1OfPnt2d      from TColgp,
+     SequenceOfReal      from TColStd,
+     Curve2d             from Adaptor2d,
+     Curve2dTool         from Extrema,
+     CCache2d            from Extrema,
+     ECC2d               from Extrema
+
+
+raises  InfiniteSolutions from StdFail,
+        NotDone           from StdFail,
+        OutOfRange        from Standard
+
+is
+
+    Create returns ExtCC2d;
+    
+
+    Create (C1: Curve2d from Adaptor2d;  C2: Curve2d from Adaptor2d;
+            TolC1: Real = 1.0e-10; TolC2: Real = 1.0e-10) returns ExtCC2d;
+       ---Purpose: It calculates all the distances.
+
+
+    Create (C1: Curve2d from Adaptor2d;
+           C2: Curve2d from Adaptor2d;
+           U1: Real  from Standard;
+           U2: Real  from Standard;
+           V1: Real  from Standard;
+           V2: Real  from Standard;
+            TolC1: Real = 1.0e-10;
+            TolC2: Real = 1.0e-10) returns ExtCC2d;
+       ---Purpose: It calculates all the distances.
+
+
+    Initialize(me: in out; C2: Curve2d from Adaptor2d;
+              V1, V2: Real  from Standard; 
+              TolC1: Real = 1.0e-10;
+              TolC2: Real = 1.0e-10)
+       ---Purpose: initializes the fields.
+    is static;
+    
+    
+    Perform(me: in out; C1: Curve2d from Adaptor2d;
+           U1, U2: Real  from Standard)
+    is static;
+    
+
+    IsDone (me) returns Boolean
+       ---Purpose: Returns True if the distances are found.
+       is static;
+
+    NbExt (me) returns Integer
+       ---Purpose: Returns the number of extremum distances.
+       raises  NotDone from StdFail,
+               -- if IsDone(me)=False.
+               InfiniteSolutions from StdFail
+               -- if IsParallel(me)= True.
+       is static;
+
+
+    IsParallel (me) returns Boolean
+       ---Purpose: Returns True if the two curves are parallel.
+       raises  NotDone from StdFail
+               -- if IsDone(me)=False.
+       is static;
+
+
+    SquareDistance (me; N: Integer =1) returns Real
+       ---Purpose: Returns the value of the Nth extremum square distance.
+       raises  NotDone from StdFail,
+               -- if IsDone(me)=False.
+               InfiniteSolutions from StdFail,
+               -- if IsParallel(me)= True and N > 1.
+               OutOfRange
+               -- if N < 1 or N > NbExt(me)
+       is static;
+
+    Points (me; N: Integer; P1,P2: out POnCurv2d)
+       ---Purpose: Returns the points of the Nth extremum distance.
+       --          P1 is on the first curve, P2 on the second one.
+       raises  NotDone from StdFail,
+               -- if IsDone(me)=False.
+               InfiniteSolutions from StdFail,
+               -- if IsParallel(me)= True.
+               OutOfRange
+               -- if N < 1 or N > NbExt(me)
+       is static;
+
+    TrimmedSquareDistances(me; dist11, distP12, distP21, distP22: out Real;
+                     P11, P12, P21, P22: out Pnt2d)
+       ---Purpose: if the curve is a trimmed curve,
+       --          dist11 is a square distance between the point on C1
+       --          of parameter FirstParameter and the point of 
+       --          parameter FirstParameter on C2.
+
+    is static;
+    
+    Results(me: in out; AlgExt: ExtElC2d from Extrema;
+           Ut11, Ut12, Ut21, Ut22: Real;
+           Period1 : Real from Standard = 0.0;
+            Period2 : Real from Standard = 0.0)
+
+    is static protected;       
+
+--  modified by NIZHNY-EAP Thu Jan 27 16:53:25 2000 ___BEGIN___
+    Results(me: in out;AlgExt: ECC2d from Extrema; C : Curve2d from Adaptor2d;
+--  modified by NIZHNY-EAP Thu Jan 27 16:53:26 2000 ___END___
+           Ut11, Ut12, Ut21, Ut22: Real;
+           Period1 : Real from Standard = 0.0;
+            Period2 : Real from Standard = 0.0)
+
+    is static protected;
+
+
+fields
+    myDone:   Boolean;
+    myIsPar:  Boolean;
+    mypoints: SequenceOfPOnCurv2d from Extrema;
+    mySqDist:  SequenceOfReal      from TColStd;
+    mynbext:  Integer;
+    inverse:  Boolean;
+    myC:      Address from Standard;
+    myv1:     Real;
+    myv2:     Real;
+    mytolc1:  Real;
+    mytolc2:  Real;
+    P1f:      Pnt2d;
+    P1l:      Pnt2d;
+    P2f:      Pnt2d;
+    P2l:      Pnt2d;
+    mydist11: Real;
+    mydist12: Real;
+    mydist21: Real;
+    mydist22: Real;
+    
+
+
+end ExtCC2d;
diff --git a/src/Extrema/Extrema_ExtCC2d.cxx b/src/Extrema/Extrema_ExtCC2d.cxx
new file mode 100644 (file)
index 0000000..c754578
--- /dev/null
@@ -0,0 +1,577 @@
+// Created on: 1994-07-06
+// Created by: Laurent PAINNOT
+// Copyright (c) 1994-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 <Extrema_ExtCC2d.ixx>
+
+#include <Extrema_ExtElC2d.hxx>
+#include <StdFail_NotDone.hxx>
+#include <Extrema_ExtElC.hxx>
+#include <ElCLib.hxx>
+#include <Standard_Failure.hxx>
+#include <GeomAbs_CurveType.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+#include <Geom2d_Ellipse.hxx>
+#include <Geom2d_Circle.hxx>
+#include <Geom2d_Line.hxx>
+#include <Geom2d_Parabola.hxx>
+#include <Geom2d_Hyperbola.hxx>
+#include <Extrema_POnCurv2d.hxx>
+#include <Extrema_SequenceOfPOnCurv2d.hxx>
+#include <Standard_NotImplemented.hxx>
+#include <Precision.hxx>
+
+#include <Adaptor2d_Curve2d.hxx>
+#include <Extrema_Curve2dTool.hxx>
+
+
+//=======================================================================
+//function :  IsParallelDot
+//purpose  :  This function returns True if angle between <theV1> and 
+//<theV2> vectors or between <theV1> and <-theV2> vectors is less than 
+//AngTol.
+//=======================================================================
+static Standard_Boolean IsParallelDot(  gp_Vec2d theV1,
+                                        gp_Vec2d theV2,
+                                        Standard_Real AngTol)
+  {
+  return Abs(theV1.Dot(theV2)) >= 
+            theV1.Magnitude()*theV2.Magnitude()*cos(AngTol);
+  }
+
+Extrema_ExtCC2d::Extrema_ExtCC2d() {}
+
+
+Extrema_ExtCC2d::Extrema_ExtCC2d(const Adaptor2d_Curve2d&       C1, 
+                                  const Adaptor2d_Curve2d&       C2,
+                                  const Standard_Real TolC1, 
+                                  const Standard_Real TolC2)
+{
+  Initialize(C2, Extrema_Curve2dTool::FirstParameter(C2), Extrema_Curve2dTool::LastParameter(C2), TolC1, TolC2);
+  Perform(C1, Extrema_Curve2dTool::FirstParameter(C1), Extrema_Curve2dTool::LastParameter(C1));
+}
+
+Extrema_ExtCC2d::Extrema_ExtCC2d(const Adaptor2d_Curve2d&        C1, 
+                                  const Adaptor2d_Curve2d&        C2,
+                                  const Standard_Real  U1,
+                                  const Standard_Real  U2,
+                                  const Standard_Real  V1,
+                                  const Standard_Real  V2,
+                                  const Standard_Real  TolC1,
+                                  const Standard_Real  TolC2)
+{
+  Initialize(C2, V1, V2, TolC1, TolC2);
+  Perform(C1, U1, U2);
+}
+
+
+
+void Extrema_ExtCC2d::Initialize(const Adaptor2d_Curve2d&        C2,
+                                 const Standard_Real  V1,
+                                 const Standard_Real  V2,
+                                 const Standard_Real  TolC1,
+                                 const Standard_Real  TolC2)
+{
+  myC = (Standard_Address)&C2;
+  myv1 = V1;
+  myv2 = V2;
+  mytolc1 = TolC1;
+  mytolc2 = TolC2;
+}
+
+
+
+void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d&       C1,
+                               const Standard_Real U1,
+                               const Standard_Real U2)
+{
+  mypoints.Clear();
+  mySqDist.Clear();
+  Standard_Integer NbU = 32, NbV = 32;
+  GeomAbs_CurveType type1 = Extrema_Curve2dTool::GetType(C1), type2 = Extrema_Curve2dTool::GetType(*((Adaptor2d_Curve2d*)myC));
+  Standard_Real U11, U12, U21, U22, Tol = Min(mytolc1, mytolc2);
+//  Extrema_POnCurv2d P1, P2;
+  mynbext = 0;
+  inverse = Standard_False;
+  myIsPar = Standard_False;
+
+  U11 = U1;
+  U12 = U2;
+  U21 = myv1;
+  U22 = myv2;
+  P1f = Extrema_Curve2dTool::Value(C1, U11);
+  P1l = Extrema_Curve2dTool::Value(C1, U12);
+  P2f = Extrema_Curve2dTool::Value(*((Adaptor2d_Curve2d*)myC), U21);
+  P2l = Extrema_Curve2dTool::Value(*((Adaptor2d_Curve2d*)myC), U22);
+
+
+  switch(type1) {
+    //
+    //  La premiere courbe est un cercle:
+    //
+  case GeomAbs_Circle: {
+
+    switch(type2) {
+      case GeomAbs_Circle: {
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)));
+       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 2*M_PI);
+        }
+       break;
+      case GeomAbs_Ellipse: {
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)));
+       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 2*M_PI );
+        }
+       break;
+      case GeomAbs_Parabola: {
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
+       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0.);
+      }
+       break;
+      case GeomAbs_Hyperbola: {
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)));
+       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0. );
+      }
+       break;
+      case GeomAbs_BezierCurve:
+      case GeomAbs_OtherCurve:
+      case GeomAbs_BSplineCurve: {
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);
+       Standard_Real Period2 = 0.;
+       if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
+       Results(Xtrem, C1, U11, U12, U21, U22, 2*M_PI,Period2);
+        }
+       break;
+      case GeomAbs_Line: {
+       inverse = Standard_True;
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Circle(C1), Tol);
+       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0.);
+        }
+       break;
+      };  // switch(type2)
+    }
+    break;
+
+    //
+    // La premiere courbe est une ellipse:
+    //
+  case GeomAbs_Ellipse: {
+
+    switch(type2) {
+      case GeomAbs_Circle: {
+       inverse = Standard_True;
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Ellipse(C1));
+       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 2*M_PI);
+        }
+       break;
+      case GeomAbs_Ellipse: {
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(C1), Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);
+       Results(Xtrem, C1, U11, U12, U21, U22,2*M_PI, 2*M_PI);
+        }
+       break;
+      case GeomAbs_Parabola: {
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);
+       Results(Xtrem, C1, U11, U12, U21, U22, 2*M_PI, 0.);
+      }
+       break;
+      case GeomAbs_Hyperbola: {
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(C1), Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);
+       Results(Xtrem, C1, U11, U12, U21, U22, 2*M_PI, 0.);
+      }
+       break;
+      case GeomAbs_BezierCurve:
+      case GeomAbs_OtherCurve:
+      case GeomAbs_BSplineCurve: {
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);        
+       Standard_Real Period2 = 0.;
+       if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
+       Results(Xtrem, C1, U11, U12, U21, U22, 2*M_PI,Period2);
+        }
+       break;
+      case GeomAbs_Line: {
+        inverse = Standard_True;
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Ellipse(C1));
+       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0.);
+        }
+       break;
+      };  // switch(type2)
+    }
+    break;
+
+    //
+    // La premiere courbe est une parabole: 
+    //
+  case GeomAbs_Parabola: {
+
+    switch(type2) {
+      case GeomAbs_Circle: {
+       inverse = Standard_True;
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Parabola(C1));
+       Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
+        }
+       break;
+      case GeomAbs_Ellipse: {
+       //inverse = Standard_True;
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Parabola(C1));
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);
+       Results(Xtrem, C1, U11, U12, U21, U22, 0., 2*M_PI);
+        }
+       break;
+      case GeomAbs_Parabola: {
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Parabola(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);
+       Results(Xtrem, C1, U11, U12, U21, U22, 0., 0.);
+      }
+       break;
+      case GeomAbs_Hyperbola: {
+       //inverse = Standard_True;
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Parabola(C1));
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);
+       Results(Xtrem, C1, U11, U12, U21, U22, 0., 0.);
+      }
+       break;
+      case GeomAbs_BezierCurve:
+      case GeomAbs_OtherCurve:
+      case GeomAbs_BSplineCurve: {
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);
+       Standard_Real Period2 = 0.;
+       if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
+       Results(Xtrem, C1, U11, U12, U21, U22, 0., Period2);
+        }
+       break;
+      case GeomAbs_Line: {
+       inverse = Standard_True;
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Parabola(C1));
+       Results(Xtrem, U11, U12, U21, U22, 0., 0.);
+        }
+       break;
+      };  // switch(type2)
+    }
+    break;
+
+    //
+    // La premiere courbe est une hyperbole:
+    //
+  case GeomAbs_Hyperbola: {
+
+    switch(type2) {
+      case GeomAbs_Circle: {
+       inverse = Standard_True;
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Hyperbola(C1));
+       Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
+        }
+       break;
+      case GeomAbs_Ellipse: {
+       //inverse = Standard_True;
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Hyperbola(C1));
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);
+       Results(Xtrem, C1, U11, U12, U21, U22, 0., 2*M_PI );
+        }
+       break;
+      case GeomAbs_Parabola: {
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Hyperbola(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);
+       Results(Xtrem, C1, U11, U12, U21, U22, 0., 0.);
+      }
+       break;
+      case GeomAbs_Hyperbola: {
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Hyperbola(C1), Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);
+       Results(Xtrem, C1, U11, U12, U21, U22, 0., 0.);
+      }
+       break;
+      case GeomAbs_OtherCurve:
+      case GeomAbs_BezierCurve:
+      case GeomAbs_BSplineCurve: {
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC)
+                           , NbU, NbV, mytolc1, mytolc2);
+       Standard_Real Period2 = 0.;
+       if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
+       Results(Xtrem, C1, U11, U12, U21, U22, 0., Period2);
+        }
+       break;
+      case GeomAbs_Line: {
+       inverse = Standard_True;
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Hyperbola(C1));
+       Results(Xtrem, U11, U12, U21, U22, 0., 0.);
+        }
+       break;
+      };  // switch(type2)
+    }
+    break;
+
+    //
+    // La premiere courbe est une BezierCurve ou une BSplineCurve:
+    //
+  case GeomAbs_BezierCurve:
+  case GeomAbs_OtherCurve:
+  case GeomAbs_BSplineCurve: {
+    Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                       NbU, NbV, mytolc1, mytolc2);
+    Standard_Real Period1 = 0.;
+    if (Extrema_Curve2dTool::IsPeriodic(C1)) Period1 = Extrema_Curve2dTool::Period(C1);
+    Standard_Real Period2 = 0.;
+    if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
+    Results(Xtrem, C1, U11, U12, U21, U22, Period1, Period2);
+  }
+  break;
+
+    //
+    // La premiere courbe est une Line:
+    //
+  case GeomAbs_Line: {
+
+    switch(type2) {
+      case GeomAbs_Circle: {
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)), Tol);
+       Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
+        }
+       break;
+      case GeomAbs_Ellipse: {
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)));
+       Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
+        }
+       break;
+      case GeomAbs_Parabola: {
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
+       Results(Xtrem, U11, U12, U21, U22, 0., 0.);
+      }
+       break;
+      case GeomAbs_Hyperbola: {
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)));
+       Results(Xtrem, U11, U12, U21, U22, 0., 0.);
+      }
+       break;
+      case GeomAbs_BezierCurve:
+      case GeomAbs_OtherCurve:
+      case GeomAbs_BSplineCurve: {
+       Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC), 
+                           NbU, NbV, mytolc1, mytolc2);
+       Standard_Real Period2 = 0.;
+       if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
+       Results(Xtrem, C1, U11, U12, U21, U22, 0., Period2);
+        }
+       break;
+      case GeomAbs_Line: {
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Tol);
+       Results(Xtrem, U11, U12, U21, U22, 0., 0.);
+        } 
+       break;
+      };  // switch(type2)
+    }
+    break;
+
+  };
+    
+}
+
+
+Standard_Boolean Extrema_ExtCC2d::IsDone() const
+{
+  return myDone;
+}
+
+
+Standard_Real Extrema_ExtCC2d::SquareDistance(const Standard_Integer N) const 
+{
+  if(!myDone) StdFail_NotDone::Raise();
+  if ((N <= 0) || (N > mynbext)) Standard_OutOfRange::Raise();
+  return mySqDist.Value(N);
+}
+
+
+Standard_Integer Extrema_ExtCC2d::NbExt() const
+{
+  if(!myDone) StdFail_NotDone::Raise();
+  return mynbext;
+}
+
+
+void Extrema_ExtCC2d::Points(const Standard_Integer N, 
+                             Extrema_POnCurv2d& P1,
+                             Extrema_POnCurv2d& P2) const
+{
+  if(!myDone) StdFail_NotDone::Raise();
+  if ((N <= 0) || (N > mynbext)) Standard_OutOfRange::Raise();
+  P1 = mypoints.Value(2*N-1);
+  P2 = mypoints.Value(2*N);
+}
+
+
+
+void Extrema_ExtCC2d::TrimmedSquareDistances(Standard_Real& dist11,
+                                       Standard_Real& dist12,
+                                       Standard_Real& dist21,
+                                       Standard_Real& dist22,
+                                       gp_Pnt2d&      P11,
+                                       gp_Pnt2d&      P12,
+                                       gp_Pnt2d&      P21,
+                                       gp_Pnt2d&      P22) const 
+{
+  dist11 = mydist11;
+  dist12 = mydist12;
+  dist21 = mydist21;
+  dist22 = mydist22;
+  P11 = P1f;
+  P12 = P1l;
+  P21 = P2f;
+  P22 = P2l;
+}
+
+
+
+void Extrema_ExtCC2d::Results(const Extrema_ExtElC2d&  AlgExt,
+                              const Standard_Real      Ut11,
+                              const Standard_Real      Ut12,
+                              const Standard_Real      Ut21,
+                              const Standard_Real      Ut22,
+                              const Standard_Real      Period1,
+                              const Standard_Real      Period2)
+{
+  Standard_Integer i, NbExt;
+  Standard_Real Val, U, U2;
+  Extrema_POnCurv2d P1, P2;
+  
+  myDone = AlgExt.IsDone();
+  myIsPar = AlgExt.IsParallel();
+  if (myDone) {
+    if (!myIsPar) {
+      NbExt = AlgExt.NbExt();
+      for (i = 1; i <= NbExt; i++) {
+       // Verification de la validite des parametres pour le cas trimme:
+       AlgExt.Points(i, P1, P2);
+       if (!inverse) {
+         U = P1.Parameter();
+         if (Period1 != 0.0) U = ElCLib::InPeriod(U,Ut11,Ut11+Period1);
+         U2 = P2.Parameter();
+         if (Period2 != 0.0) U2 = ElCLib::InPeriod(U2,Ut21,Ut21+Period2);
+       }
+       else {
+         U2 = P1.Parameter();
+         if (Period2 != 0.0) U2 = ElCLib::InPeriod(U2,Ut21,Ut21+Period2);
+         U = P2.Parameter();
+         if (Period1 != 0.0) U = ElCLib::InPeriod(U,Ut11,Ut11+Period1);
+       }
+       if ((U  >= Ut11 - Precision::PConfusion())  && 
+           (U  <= Ut12 + Precision::PConfusion())  &&
+           (U2 >= Ut21 - Precision::PConfusion())  &&
+           (U2 <= Ut22 + Precision::PConfusion())) {
+         mynbext++;
+         Val = AlgExt.SquareDistance(i);
+         mySqDist.Append(Val);
+         if (!inverse) {
+           P1.SetValues(U, P1.Value());
+           P2.SetValues(U2, P2.Value());
+           mypoints.Append(P1);
+           mypoints.Append(P2);
+         }
+         else {
+           P1.SetValues(U2, P1.Value());
+           P2.SetValues(U, P2.Value());
+           mypoints.Append(P2);
+           mypoints.Append(P1);
+         }
+       }
+      }
+    }
+
+    mydist11 = P1f.SquareDistance(P2f);
+    mydist12 = P1f.SquareDistance(P2l);
+    mydist21 = P1l.SquareDistance(P2f);
+    mydist22 = P1l.SquareDistance(P2l);
+  }
+}
+
+
+void Extrema_ExtCC2d::Results(const Extrema_ECC2d& AlgExt,
+//  modified by NIZHNY-EAP Wed Feb 23 14:51:24 2000 ___BEGIN___
+                              const Adaptor2d_Curve2d&        C1,
+//  modified by NIZHNY-EAP Wed Feb 23 14:51:26 2000 ___END___
+                              const Standard_Real  Ut11,
+                              const Standard_Real  Ut12,
+                              const Standard_Real  Ut21,
+                              const Standard_Real  Ut22,
+                              const Standard_Real  Period1,
+                              const Standard_Real  Period2)
+{
+  Standard_Integer i, NbExt;
+  Standard_Real Val, U, U2;
+  Extrema_POnCurv2d P1, P2;
+  
+  myDone = AlgExt.IsDone();
+  if (myDone) {
+    if (!myIsPar) {
+      NbExt = AlgExt.NbExt();
+      for (i = 1; i <= NbExt; i++) {
+       // Verification de la validite des parametres pour le cas trimme:
+       AlgExt.Points(i, P1, P2);
+       U = P1.Parameter();
+       if (Period1 != 0.0) U = ElCLib::InPeriod(U,Ut11,Ut11+Period1);
+       U2 = P2.Parameter();
+       if (Period2 != 0.0) U2 = ElCLib::InPeriod(U2,Ut21,Ut21+Period2);
+
+       if ((U  >= Ut11 - Precision::PConfusion())  && 
+           (U  <= Ut12 + Precision::PConfusion())  &&
+           (U2 >= Ut21 - Precision::PConfusion())  &&
+           (U2 <= Ut22 + Precision::PConfusion())) {
+//  modified by NIZHNY-EAP Thu Jan 27 16:40:55 2000 ___BEGIN___
+         // to be sure that it's a real extrema
+         gp_Pnt2d p;
+         gp_Vec2d v1, v2;
+         Extrema_Curve2dTool::D1(C1,U,p, v1);
+         Extrema_Curve2dTool::D1(*((Adaptor2d_Curve2d*)myC),U2,p, v2);
+         if (IsParallelDot(v1, v2, Precision::Angular()))
+           {
+           mynbext++;
+           Val = AlgExt.SquareDistance(i);
+           P1.SetValues(U, P1.Value());
+           P2.SetValues(U2, P2.Value());
+           mySqDist.Append(Val);
+           mypoints.Append(P1);
+           mypoints.Append(P2);
+           }
+//  modified by NIZHNY-EAP Thu Jan 27 16:41:00 2000 ___END___
+       }
+      }
+    }
+
+    mydist11 = P1f.SquareDistance(P2f);
+    mydist12 = P1f.SquareDistance(P2l);
+    mydist21 = P1l.SquareDistance(P2f);
+    mydist22 = P1l.SquareDistance(P2l);
+  }
+}
+
+
+Standard_Boolean Extrema_ExtCC2d::IsParallel() const
+{
+  if (!myDone) StdFail_NotDone::Raise();
+  return myIsPar;
+}
diff --git a/src/Extrema/Extrema_GExtCC.cdl b/src/Extrema/Extrema_GExtCC.cdl
deleted file mode 100644 (file)
index 462ac4b..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
--- Created on: 1994-07-06
--- Created by: Laurent PAINNOT
--- Copyright (c) 1994-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.
-
-generic class GExtCC from Extrema (Curve1    as any;
-                                  Tool1     as any;
-                                  Curve2    as any;
-                                  Tool2     as any)
-
-       ---Purpose: It calculates all the distance between two curves.
-       --          These distances can be maximum or minimum.
-
-uses POnCurv           from Extrema,
-     SequenceOfPOnCurv from Extrema,
-     ExtElC            from Extrema,
-     Pnt               from gp,
-     HArray1OfPnt      from TColgp,
-     SequenceOfReal    from TColStd,
-     ListOfTransient   from TColStd
-
-
-raises  InfiniteSolutions from StdFail,
-       NotDone           from StdFail,
-       OutOfRange        from Standard
-       
-    class CCache instantiates CurveCache from Extrema (Curve1, Pnt from gp, HArray1OfPnt from TColgp);
-
-    class ECC instantiates GenExtCC from Extrema
-        (Curve1,
-         Tool1,
-         Curve2,
-         Tool2,
-         CCache,
-         HArray1OfPnt from TColgp,
-         POnCurv,
-         Pnt,
-         Vec);
-
-
-is
-
-    Create (TolC1: Real = 1.0e-10; TolC2: Real = 1.0e-10) returns GExtCC;
-    
-
-    Create (C1: Curve1;  C2: Curve2;
-            TolC1: Real = 1.0e-10; TolC2: Real = 1.0e-10) returns GExtCC;
-       ---Purpose: It calculates all the distances.
-
-
-    Create (C1: Curve1;
-           C2: Curve2;
-           U1: Real  from Standard;
-           U2: Real  from Standard;
-           V1: Real  from Standard;
-           V2: Real  from Standard;
-            TolC1: Real = 1.0e-10;
-            TolC2: Real = 1.0e-10) returns GExtCC;
-       ---Purpose: It calculates all the distances.
-
-
-    SetCurve (me: in out; theRank: Integer; C: Curve1);
-        ---Purpose:
-
-    SetCurve (me: in out; theRank: Integer; C: Curve1; Uinf, Usup: Real);
-        ---Purpose:
-
-    SetRange (me: in out; theRank: Integer; Uinf, Usup: Real);
-        ---Purpose:
-
-    SetTolerance (me: in out; theRank: Integer; Tol: Real);
-        ---Purpose:
-
-    Perform(me: in out);
-    
-
-    IsDone (me) returns Boolean
-       ---Purpose: Returns True if the distances are found.
-       is static;
-
-    NbExt (me) returns Integer
-       ---Purpose: Returns the number of extremum distances.
-       raises  NotDone from StdFail,
-               -- if IsDone(me)=False.
-               InfiniteSolutions from StdFail
-               -- if IsParallel(me)= True.
-       is static;
-
-
-    IsParallel (me) returns Boolean
-       ---Purpose: Returns True if the two curves are parallel.
-       raises  NotDone from StdFail
-               -- if IsDone(me)=False.
-       is static;
-
-
-    SquareDistance (me; N: Integer =1) returns Real
-       ---Purpose: Returns the value of the Nth extremum square distance.
-       raises  NotDone from StdFail,
-               -- if IsDone(me)=False.
-               InfiniteSolutions from StdFail,
-               -- if IsParallel(me)= True and N > 1.
-               OutOfRange
-               -- if N < 1 or N > NbExt(me)
-       is static;
-
-    Points (me; N: Integer; P1,P2: out POnCurv)
-       ---Purpose: Returns the points of the Nth extremum distance.
-       --          P1 is on the first curve, P2 on the second one.
-       raises  NotDone from StdFail,
-               -- if IsDone(me)=False.
-               InfiniteSolutions from StdFail,
-               -- if IsParallel(me)= True.
-               OutOfRange
-               -- if N < 1 or N > NbExt(me)
-       is static;
-
-    TrimmedSquareDistances(me; dist11, distP12, distP21, distP22: out Real;
-                     P11, P12, P21, P22: out Pnt)
-       ---Purpose: if the curve is a trimmed curve,
-       --          dist11 is a square distance between the point on C1
-       --          of parameter FirstParameter and the point of 
-       --          parameter FirstParameter on C2.
-
-    is static;
-    
-    Results(me: in out; AlgExt: ExtElC from Extrema;
-           Ut11, Ut12, Ut21, Ut22: Real)
-
-    is static protected;       
-
-    Results(me: in out;AlgExt: ECC;
-           Ut11, Ut12, Ut21, Ut22: Real)
-
-    is static protected;
-
-
-    
-
-fields
-    myECC:    ECC from Extrema;
-    myDone:   Boolean;
-    myIsPar:  Boolean;
-    mypoints: SequenceOfPOnCurv from Extrema;
-    mySqDist: SequenceOfReal    from TColStd;
-    mynbext:  Integer;
-    inverse:  Boolean;
-    myC:     Address from Standard [2];
-    myInf: Real [2];
-    mySup: Real [2];
-    myTol:  Real [2];
-    myCacheLists: ListOfTransient from TColStd [2]; -- lists of Handle(Extrema_CCache)
-    P1f:      Pnt;
-    P1l:      Pnt;
-    P2f:      Pnt;
-    P2l:      Pnt;
-    mydist11: Real;
-    mydist12: Real;
-    mydist21: Real;
-    mydist22: Real;
-    
-
-
-end GExtCC;
diff --git a/src/Extrema/Extrema_GExtCC.gxx b/src/Extrema/Extrema_GExtCC.gxx
deleted file mode 100644 (file)
index 6c71c66..0000000
+++ /dev/null
@@ -1,881 +0,0 @@
-// Created on: 1994-07-06
-// Created by: Laurent PAINNOT
-// Copyright (c) 1994-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.
-
-// Modified by MPS (june 96) : correction du trap dans le cas droite/Bezier 
-// Modified by MPS (mai 97) : PRO 7598 
-//                            tri des solutions pour eviter de rendre plusieurs
-//                            fois la meme solution 
-
-#include Extrema_ECC_hxx
-
-#include <StdFail_NotDone.hxx>
-#include <Extrema_ExtElC.hxx>
-#include <Standard_Failure.hxx>
-#include <GeomAbs_CurveType.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom_TrimmedCurve.hxx>
-#include <Geom_Ellipse.hxx>
-#include <Geom_Circle.hxx>
-#include <Geom_Line.hxx>
-#include <Geom_Parabola.hxx>
-#include <Geom_Hyperbola.hxx>
-#include <Extrema_POnCurv.hxx>
-#include <Extrema_SequenceOfPOnCurv.hxx>
-#include <TColStd_SequenceOfReal.hxx>
-#include <TColStd_ListIteratorOfListOfTransient.hxx>
-#include <Standard_NotImplemented.hxx>
-#include <Precision.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <ElCLib.hxx>
-#include <Extrema_ExtPElC.hxx>
-#include <Standard_NullObject.hxx>
-
-//=======================================================================
-//function : Extrema_GExtCC
-//purpose  : 
-//=======================================================================
-
-Extrema_GExtCC::Extrema_GExtCC (const Standard_Real TolC1,
-                                           const Standard_Real TolC2) :
-                                             myDone (Standard_False)
-{
-  myC[0] = 0; myC[1] = 0;
-  myTol[0] = TolC1; myTol[1] = TolC2;
-}
-
-//=======================================================================
-//function : Extrema_GExtCC
-//purpose  : 
-//=======================================================================
-
-Extrema_GExtCC::Extrema_GExtCC(const Curve1& C1, 
-                              const Curve2& C2,
-                              const Standard_Real      U1,
-                              const Standard_Real      U2,
-                              const Standard_Real      V1,
-                              const Standard_Real      V2,
-                              const Standard_Real      TolC1,
-                              const Standard_Real      TolC2) :
-                                myDone (Standard_False)
-{
-  SetCurve (1, C1, U1, U2);
-  SetCurve (2, C2, V1, V2);
-  SetTolerance (1, TolC1);
-  SetTolerance (2, TolC2);
-  Perform();
-}
-
-
-//=======================================================================
-//function : Extrema_GExtCC
-//purpose  : 
-//=======================================================================
-
-Extrema_GExtCC::Extrema_GExtCC(const Curve1& C1, 
-                              const Curve2& C2,
-                              const Standard_Real      TolC1,
-                              const Standard_Real      TolC2) :
-                     myDone (Standard_False)
-{
-  SetCurve (1, C1, C1.FirstParameter(), C1.LastParameter());
-  SetCurve (2, C2, C2.FirstParameter(), C2.LastParameter());
-  SetTolerance (1, TolC1);
-  SetTolerance (2, TolC2);
-  Perform();
-}
-
-//=======================================================================
-//function : SetCurve
-//purpose  : 
-//=======================================================================
-
-void Extrema_GExtCC::SetCurve (const Standard_Integer theRank, const Curve1& C)
-{
-  Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_GExtCC::SetCurve()")
-  Standard_Integer anInd = theRank - 1;
-  myC[anInd] = (Standard_Address)&C;
-  
-  //clear the previous cache to rebuild it later in Perform()
-  myCacheLists[anInd].Clear();
-}
-
-//=======================================================================
-//function : SetCurve
-//purpose  : 
-//=======================================================================
-
-void Extrema_GExtCC::SetCurve (const Standard_Integer theRank, const Curve1& C,
-                               const Standard_Real Uinf, const Standard_Real Usup)
-{
-  SetCurve (theRank, C);
-  SetRange (theRank, Uinf, Usup);
-}
-
-//=======================================================================
-//function : SetRange
-//purpose  : 
-//=======================================================================
-
-void Extrema_GExtCC::SetRange (const Standard_Integer theRank, 
-                               const Standard_Real Uinf, const Standard_Real Usup)
-{
-  Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_GExtCC::SetRange()")
-  Standard_Integer anInd = theRank - 1;
-  myInf[anInd] = Uinf;
-  mySup[anInd] = Usup;
-}
-
-//=======================================================================
-//function : SetTolerance
-//purpose  : 
-//=======================================================================
-
-void Extrema_GExtCC::SetTolerance (const Standard_Integer theRank, const Standard_Real theTol)
-{
-  Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_GExtCC::SetTolerance()")
-  Standard_Integer anInd = theRank - 1;
-  myTol[anInd] = theTol;
-}
-
-
-//=======================================================================
-//function : Perform
-//purpose  : 
-//=======================================================================
-
-void Extrema_GExtCC::Perform()
-{  
-  Standard_NullObject_Raise_if (!myC[0] || !myC[1], "Extrema_GExtCC::Perform()")
-  myDone = Standard_False;
-  mypoints.Clear();
-  mySqDist.Clear();
-  myIsPar = Standard_False;
-
-  GeomAbs_CurveType type1 = (*((Curve1*)myC[0])).GetType();
-  GeomAbs_CurveType type2 = (*((Curve2*)myC[1])).GetType();
-  Standard_Real U11, U12, U21, U22, Tol = Min(myTol[0], myTol[1]);
-  mynbext = 0;
-  inverse = Standard_False;
-
-  U11 = myInf[0];
-  U12 = mySup[0];
-  U21 = myInf[1];
-  U22 = mySup[1];
-
-  if (!Precision::IsInfinite(U11)) P1f = Tool1::Value(*((Curve1*)myC[0]),  U11); 
-  if (!Precision::IsInfinite(U12)) P1l = Tool1::Value(*((Curve1*)myC[0]),  U12);
-  if (!Precision::IsInfinite(U21)) P2f = Tool2::Value(*((Curve2*)myC[1]), U21);
-  if (!Precision::IsInfinite(U22)) P2l = Tool2::Value(*((Curve2*)myC[1]), U22);
-  
-
-  if (Precision::IsInfinite(U11) || Precision::IsInfinite(U21)) mydist11 = RealLast();
-  else mydist11 = P1f.SquareDistance(P2f);
-  if (Precision::IsInfinite(U11) || Precision::IsInfinite(U22)) mydist12 = RealLast();
-  else mydist12 = P1f.SquareDistance(P2l);
-  if (Precision::IsInfinite(U12) || Precision::IsInfinite(U21)) mydist21 = RealLast();
-  else mydist21 = P1l.SquareDistance(P2f);
-  if (Precision::IsInfinite(U12) || Precision::IsInfinite(U22)) mydist22 = RealLast();
-  else mydist22 = P1l.SquareDistance(P2l);
-
-  myECC.SetTolerance (Tol);
-
-  //Depending on the types of curves, the algorithm is chosen:
-  //- _ExtElC, when one of the curves is a line and the other is elementary,
-  //   or there are two circles;
-  //- _GenExtCC, in all other cases
-  if ( (type1 == GeomAbs_Line && type2 <= GeomAbs_Parabola) ||
-       (type2 == GeomAbs_Line && type1 <= GeomAbs_Parabola) ) {
-    //analytical case - one curve is always a line
-    Standard_Integer anInd1 = 0, anInd2 = 1;
-    GeomAbs_CurveType aType2 = type2;
-    inverse = (type1 > type2);
-    if (inverse) {
-      //algorithm uses inverse order of arguments
-      anInd1 = 1;
-      anInd2 = 0;
-      aType2 = type1;
-    }
-    switch (aType2) {
-    case GeomAbs_Line: {
-      Extrema_ExtElC Xtrem((*((Curve1*)myC[anInd1])).Line(), (*((Curve1*)myC[anInd2])).Line(), Tol);
-      Results(Xtrem, U11, U12, U21, U22);
-      break;
-    }
-    case GeomAbs_Circle: {
-      Extrema_ExtElC Xtrem((*((Curve1*)myC[anInd1])).Line(), (*((Curve1*)myC[anInd2])).Circle(), Tol);
-      Results(Xtrem, U11, U12, U21, U22);
-      break;
-    }
-    case GeomAbs_Ellipse: {
-      Extrema_ExtElC Xtrem((*((Curve1*)myC[anInd1])).Line(), (*((Curve1*)myC[anInd2])).Ellipse());
-      Results(Xtrem, U11, U12, U21, U22);
-      break;
-    }
-    case GeomAbs_Hyperbola: {
-      Extrema_ExtElC Xtrem((*((Curve1*)myC[anInd1])).Line(), (*((Curve1*)myC[anInd2])).Hyperbola());
-      Results(Xtrem, U11, U12, U21, U22);
-      break;
-    }
-    case GeomAbs_Parabola: {
-      Extrema_ExtElC Xtrem((*((Curve1*)myC[anInd1])).Line(), (*((Curve1*)myC[anInd2])).Parabola());
-      Results(Xtrem, U11, U12, U21, U22);
-      break;
-    }
-    default: break;
-    }
-  } else if (type1 == GeomAbs_Circle && type2 == GeomAbs_Circle) {
-    //analytical case - two circles
-    Standard_Boolean bIsDone;
-    Extrema_ExtElC CCXtrem ((*((Curve1*)myC[0])).Circle(), (*((Curve2*)myC[1])).Circle());
-    bIsDone = CCXtrem.IsDone();
-    if(bIsDone) {
-      Results(CCXtrem, U11, U12, U21, U22);
-    }
-    else {
-      Standard_Integer i;
-      Standard_Integer aNbS = 32; //default number of sample points per interval (why 32?)
-      for (i = 0; i < 2; i++) {
-       TColStd_ListOfTransient& aCacheList = myCacheLists[i];
-       if (aCacheList.IsEmpty()) {
-         //no caches, build them
-         Curve1& aC = *(Curve1*)myC[i];
-          //single interval from myInf[i] to mySup[i]
-          Handle(Extrema_CCache) aCache = new Extrema_CCache (aC, myInf[i], mySup[i], aNbS, Standard_True);
-          aCacheList.Append (aCache);
-       }
-      }
-      Handle(Extrema_CCache) aCache1 = Handle(Extrema_CCache)::DownCast (myCacheLists[0].First());
-      myECC.SetCurveCache (1, aCache1);
-      Handle(Extrema_CCache) aCache2 = Handle(Extrema_CCache)::DownCast (myCacheLists[1].First());
-      myECC.SetCurveCache (2, aCache2);
-      myECC.Perform();
-      Results (myECC, U11, U12, U21, U22);
-    }
-  } else {
-    //common case - use _GenExtCC
-    //1. check and prepare caches
-
-    Standard_Integer i;
-    Standard_Integer aNbS[2] = {32, 32}, aNbInter[2] = {1, 1};
-    Standard_Real Coeff[2] = {1., 1.};
-    Standard_Real rf = 0., rl = 0., LL[2] = {-1., -1.};
-    Standard_Boolean KnotSampling[2] = {Standard_False, Standard_False};
-    for (i = 0; i < 2; i++) {
-      TColStd_ListOfTransient& aCacheList = myCacheLists[i];
-      if (aCacheList.IsEmpty()) {
-        //no caches, build them
-        Curve1& aC = *(Curve1*)myC[i];
-
-       Standard_Real du1 = 0., t = 0.;
-       gp_Pnt P1, P2;
-        GeomAbs_CurveType aType = aC.GetType();
-        switch (aType) {
-        case GeomAbs_BezierCurve:
-          aNbS[i] = aC.NbPoles() * 2;
-          break;
-        case GeomAbs_BSplineCurve:
-          if (aC.Degree() <= 3 &&
-              aC.NbKnots() > 2)
-            KnotSampling[i] = Standard_True;
-          
-          aNbS[i] = aC.NbPoles() * 2;
-          rf = (Tool1::BSpline(*((Curve1*)myC[i])))->FirstParameter();
-          rl = (Tool1::BSpline(*((Curve1*)myC[i])))->LastParameter();
-          aNbS[i] = (Standard_Integer) ( aNbS[i] * ((mySup[i] - myInf[i]) / (rl - rf)) + 1 );
-        case GeomAbs_OtherCurve:
-        case GeomAbs_Line:
-          //adjust number of sample points for Lines, B-Splines and Other curves
-          aNbInter[i] = aC.NbIntervals (GeomAbs_C2);
-          aNbS[i] = Max(aNbS[i] / aNbInter[i], 3);
-         LL[i] = 0.;
-         du1 = (mySup[i] - myInf[i]) / ((aNbS[i]-1)*aNbInter[i]);
-         P1 = Tool1::Value(*((Curve1*)myC[i]), myInf[i]);
-         for(t = myInf[i] + du1; t <= mySup[i]; t += du1) {
-           P2 = Tool1::Value(*((Curve1*)myC[i]), t);
-           LL[i] += P1.Distance(P2);
-           P1 = P2;
-         }
-         LL[i] /= ((aNbS[i]-1)*aNbInter[i]);
-          break;
-        default: 
-         break;
-        }
-      }
-    }
-
-    if(LL[0] > 0. && LL[1] > 0.) {
-      if(LL[0] > 4.*LL[1]) {
-        Coeff[0] = LL[0]/LL[1]/2.;
-        if (aNbS[0] * Coeff[0] <= 10000.0)
-          aNbS[0]  = (Standard_Integer) ( aNbS[0] * Coeff[0] );
-      }
-      else if(LL[1] > 4.*LL[0]) {
-        Coeff[1] = LL[1]/LL[0]/2.;
-        if (aNbS[1] * Coeff[1] <= 10000.0)
-          aNbS[1]  = (Standard_Integer) (aNbS[1] * Coeff[1] );
-      }
-    }
-    //modified by NIZNHY-PKV Tue Apr 17 10:01:32 2012f
-    Standard_Integer aNbSTresh;
-    //
-    aNbSTresh=10000;
-    //
-    for (i = 0; i < 2; ++i) {
-      if (aNbS[i]>aNbSTresh) {
-       aNbS[i]=aNbSTresh;
-      }
-    }
-    //modified by NIZNHY-PKV Tue Apr 17 10:01:34 2012t
-    for (i = 0; i < 2; i++) {
-      TColStd_ListOfTransient& aCacheList = myCacheLists[i];
-      if (aCacheList.IsEmpty()) {
-        //no caches, build them
-        Curve1& aC = *(Curve1*)myC[i];
-
-        if (aC.GetType() >= GeomAbs_BSplineCurve)
-        {
-          //can be multiple intervals, one cache per one C2 interval
-          TColStd_Array1OfReal anArr (1, aNbInter[i] + 1);
-          aC.Intervals (anArr, GeomAbs_C2);
-          
-          if (KnotSampling[i])
-          {
-            Standard_Integer NbIntervCN = aC.NbIntervals(GeomAbs_CN);
-            TColStd_Array1OfReal IntervalsCN(1, NbIntervCN + 1);
-            aC.Intervals(IntervalsCN, GeomAbs_CN);
-
-            Standard_Integer j = 1, start_j = 1, k;
-            Standard_Real NextKnot;
-            for (k = 1; k <= aNbInter[i]; k++)
-            {
-              do
-              {
-                NextKnot = IntervalsCN(j+1);
-                j++;
-              }
-              while (NextKnot != anArr(k+1));
-
-              Handle(Extrema_CCache) aCache =
-                new Extrema_CCache (aC, anArr(k), anArr(k+1),
-                                    IntervalsCN, start_j, j, Coeff[i]);
-              aCacheList.Append (aCache);
-
-              start_j = j;
-            }
-          }
-          else
-          {
-            for (Standard_Integer k = 1; k <= aNbInter[i]; k++) {
-              Handle(Extrema_CCache) aCache =
-                new Extrema_CCache (aC, anArr(k), anArr(k+1), aNbS[i], Standard_True);
-              aCacheList.Append (aCache);
-            }
-          }
-        }
-        else
-        {
-          //single interval from myInf[i] to mySup[i]
-          Handle(Extrema_CCache) aCache = new Extrema_CCache (aC,
-            myInf[i], mySup[i], aNbS[i], Standard_True);
-          aCacheList.Append (aCache);
-        }
-      }
-    }
-
-    //2. process each cache from one list with each cache from the other
-    TColStd_ListIteratorOfListOfTransient anIt1 (myCacheLists[0]);
-    for (; anIt1.More(); anIt1.Next()) {
-      Handle(Extrema_CCache) aCache1 = Handle(Extrema_CCache)::DownCast (anIt1.Value());
-      myECC.SetCurveCache (1, aCache1);
-      TColStd_ListIteratorOfListOfTransient anIt2 (myCacheLists[1]);
-      for (; anIt2.More(); anIt2.Next()) {
-        Handle(Extrema_CCache) aCache2 = Handle(Extrema_CCache)::DownCast (anIt2.Value());
-        myECC.SetCurveCache (2, aCache2);
-        myECC.Perform();
-        Results(myECC, U11, U12, U21, U22);
-      }
-    }
-  }
-}
-
-
-//=======================================================================
-//function : IsDone
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean Extrema_GExtCC::IsDone() const
-{
-  return myDone;
-}
-
-//=======================================================================
-//function : IsParallel
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean Extrema_GExtCC::IsParallel() const
-{
-  return myIsPar;
-}
-
-
-//=======================================================================
-//function : Value
-//purpose  : 
-//=======================================================================
-
-Standard_Real Extrema_GExtCC::SquareDistance(const Standard_Integer N) const 
-{
-  if(!myDone) StdFail_NotDone::Raise();
-  if ((N <= 0) || (N > mynbext)) Standard_OutOfRange::Raise();
-  return mySqDist.Value(N);
-}
-
-
-//=======================================================================
-//function : NbExt
-//purpose  : 
-//=======================================================================
-
-Standard_Integer Extrema_GExtCC::NbExt() const
-{
-  if(!myDone) StdFail_NotDone::Raise();
-  return mynbext;
-}
-
-
-//=======================================================================
-//function : Points
-//purpose  : 
-//=======================================================================
-
-void Extrema_GExtCC::Points(const Standard_Integer N, 
-                           Extrema_POnCurv& P1,
-                           Extrema_POnCurv& P2) const
-{
-  if(!myDone) StdFail_NotDone::Raise();
-  if ((N <= 0) || (N > mynbext)) Standard_OutOfRange::Raise();
-  P1 = mypoints.Value(2*N-1);
-  P2 = mypoints.Value(2*N);
-}
-
-
-
-//=======================================================================
-//function : TrimmedDistances
-//purpose  : 
-//=======================================================================
-
-void Extrema_GExtCC::TrimmedSquareDistances(Standard_Real& dist11,
-                                     Standard_Real& dist12,
-                                     Standard_Real& dist21,
-                                     Standard_Real& dist22,
-                                     gp_Pnt&        P11   ,
-                                     gp_Pnt&        P12   ,
-                                     gp_Pnt&        P21   ,
-                                     gp_Pnt&        P22    ) const {
-                                       
-  dist11 = mydist11;
-  dist12 = mydist12;
-  dist21 = mydist21;
-  dist22 = mydist22;
-  P11 = P1f;
-  P12 = P1l;
-  P21 = P2f;
-  P22 = P2l;
-}
-
-
-
-//=======================================================================
-//function : Results
-//purpose  : 
-//=======================================================================
-
-void Extrema_GExtCC::Results(const Extrema_ExtElC&  AlgExt,
-                            const Standard_Real    Ut11,
-                            const Standard_Real    Ut12,
-                            const Standard_Real    Ut21,
-                            const Standard_Real    Ut22)
-{
-  Standard_Integer i, NbExt;
-  Standard_Real Val, U, U2;
-  Extrema_POnCurv P1, P2;
-
-  myDone = AlgExt.IsDone();
-  if (myDone) {
-    myIsPar = AlgExt.IsParallel();
-    if (myIsPar) {
-      GeomAbs_CurveType type = Tool1::GetType(*((Curve1*)myC[0]));
-      GeomAbs_CurveType type2 = Tool2::GetType(*((Curve2*)myC[1]));
-      // Parallel case is only for line-line, circle-circle and circle-line!!!
-      // But really for trimmed curves extremas can not exist!
-      Extrema_POnCurv dummypoint(0., gp_Pnt(0.,0.,0.));
-      if(type != type2) {
-       mySqDist.Append(AlgExt.SquareDistance(1));
-       if(type == GeomAbs_Circle) {
-         gp_Pnt PonC1 = Tool1::Value(*((Curve1*)myC[0]), Ut11);
-         P1.SetValues(Ut11, PonC1);
-         Extrema_ExtPElC ExtPLin(PonC1, Tool2::Line(*((Curve2*)myC[1])), Precision::Confusion(), Ut21, Ut22);
-         if(ExtPLin.IsDone()) {
-           mynbext = 1;
-           P2 = ExtPLin.Point(1);
-           mypoints.Append(P1);
-           mypoints.Append(P2);
-         }
-         else {
-           myIsPar = Standard_False;
-           mynbext = 0;
-           mypoints.Append(dummypoint);
-           mypoints.Append(dummypoint);
-         }
-       }
-       else {
-         gp_Pnt PonC2 = Tool2::Value(*((Curve2*)myC[1]), Ut21);
-         P2.SetValues(Ut21, PonC2);
-         Extrema_ExtPElC ExtPLin(PonC2, Tool1::Line(*((Curve1*)myC[0])), Precision::Confusion(), Ut11, Ut12);
-         if(ExtPLin.IsDone()) {
-           mynbext = 1;
-           P1 = ExtPLin.Point(1);
-           mypoints.Append(P1);
-           mypoints.Append(P2);
-         }
-         else {
-           myIsPar = Standard_False;
-           mynbext = 0;
-           mypoints.Append(dummypoint);
-           mypoints.Append(dummypoint);
-         }
-       }
-       return;
-      }
-         
-      if(type == GeomAbs_Line) {
-       Standard_Boolean infinite = Precision::IsInfinite(Ut11) &&
-                                   Precision::IsInfinite(Ut12) &&
-                                   Precision::IsInfinite(Ut21) &&
-                                   Precision::IsInfinite(Ut22);
-
-       if(infinite) {
-         mynbext = 1;
-         mySqDist.Append(AlgExt.SquareDistance(1));
-         gp_Pnt PonC1 = Tool1::Value(*((Curve1*)myC[0]), 0.); 
-         P1.SetValues(0., PonC1);
-         Extrema_ExtPElC ExtPLin(PonC1, Tool2::Line(*((Curve2*)myC[1])), Precision::Confusion(), Ut21, Ut22);
-         if(ExtPLin.IsDone()) {
-           P2 = ExtPLin.Point(1);
-           mypoints.Append(P1);
-           mypoints.Append(P2);
-         }
-         else {
-           myIsPar = Standard_False;
-           mypoints.Append(dummypoint);
-           mypoints.Append(dummypoint);
-         }
-       }
-       else {
-         Standard_Boolean finish = Standard_False;
-         if(!Precision::IsInfinite(Ut11)) {
-           gp_Pnt PonC1 = Tool1::Value(*((Curve1*)myC[0]), Ut11);  
-           Extrema_ExtPElC ExtPLin(PonC1, Tool2::Line(*((Curve2*)myC[1])), Precision::Confusion(), Ut21, Ut22);
-           if(ExtPLin.IsDone() && ExtPLin.NbExt() > 0) {
-             mynbext = 1;
-             mySqDist.Append(AlgExt.SquareDistance(1));
-             P1.SetValues(Ut11, PonC1);
-             P2 = ExtPLin.Point(1);
-             mypoints.Append(P1);
-             mypoints.Append(P2);
-             finish = Standard_True;
-           }
-         }
-         if(!finish) {
-           if(!Precision::IsInfinite(Ut12)) {
-             gp_Pnt PonC1 = Tool1::Value(*((Curve1*)myC[0]), Ut12);  
-             Extrema_ExtPElC ExtPLin(PonC1, Tool2::Line(*((Curve2*)myC[1])), Precision::Confusion(), Ut21, Ut22);
-             if(ExtPLin.IsDone() && ExtPLin.NbExt() > 0) {
-               mynbext = 1;
-               mySqDist.Append(AlgExt.SquareDistance(1));
-               P1.SetValues(Ut12, PonC1);
-               P2 = ExtPLin.Point(1);
-               mypoints.Append(P1);
-               mypoints.Append(P2);
-               finish = Standard_True;
-             }
-           }
-         }
-         if(!finish) {
-           if(!Precision::IsInfinite(Ut21)) {
-             gp_Pnt PonC2 = Tool2::Value(*((Curve2*)myC[1]), Ut21);  
-             Extrema_ExtPElC ExtPLin(PonC2, Tool1::Line(*((Curve1*)myC[0])), Precision::Confusion(), Ut11, Ut12);
-             if(ExtPLin.IsDone() && ExtPLin.NbExt() > 0) {
-               mynbext = 1;
-               mySqDist.Append(AlgExt.SquareDistance(1));
-               P2.SetValues(Ut21, PonC2);
-               P1 = ExtPLin.Point(1);
-               mypoints.Append(P1);
-               mypoints.Append(P2);
-               finish = Standard_True;
-             }
-           }
-         }
-         if(!finish) {
-           if(!Precision::IsInfinite(Ut22)) {
-             gp_Pnt PonC2 = Tool2::Value(*((Curve2*)myC[1]), Ut22);  
-             Extrema_ExtPElC ExtPLin(PonC2, Tool1::Line(*((Curve1*)myC[0])), Precision::Confusion(), Ut11, Ut12);
-             if(ExtPLin.IsDone() && ExtPLin.NbExt() > 0) {
-               mynbext = 1;
-               mySqDist.Append(AlgExt.SquareDistance(1));
-               P2.SetValues(Ut22, PonC2);
-               P1 = ExtPLin.Point(1);
-               mypoints.Append(P1);
-               mypoints.Append(P2);
-               finish = Standard_True;
-             }
-           }
-         }
-         if(!finish) {
-           mynbext = 0;
-           myIsPar = Standard_False;
-           mySqDist.Append(AlgExt.SquareDistance(1));
-           mypoints.Append(dummypoint);
-           mypoints.Append(dummypoint);
-         }
-       }
-         
-      }
-      else {
-       Standard_Boolean finish = Standard_False;
-       gp_Pnt PonC1 = Tool1::Value(*((Curve1*)myC[0]), Ut11);  
-       P1.SetValues(Ut11, PonC1);
-       Extrema_ExtPElC ExtPCir(PonC1, Tool2::Circle(*((Curve2*)myC[1])), Precision::Confusion(), Ut21, Ut22);
-       if(ExtPCir.IsDone() && ExtPCir.NbExt() > 0) {
-         for(i = 1; i <= ExtPCir.NbExt(); i++) {
-           mynbext++;
-           P2 = ExtPCir.Point(i);
-           mySqDist.Append(ExtPCir.SquareDistance(i));
-           mypoints.Append(P1);
-           mypoints.Append(P2);
-         }
-         if(mynbext == 2)  finish = Standard_True;
-       }
-       if(!finish) {
-         PonC1 = Tool1::Value(*((Curve1*)myC[0]), Ut12);  
-         ExtPCir.Perform(PonC1, Tool2::Circle(*((Curve2*)myC[1])), Precision::Confusion(), Ut21, Ut22);
-         P1.SetValues(Ut12, PonC1);
-         if(ExtPCir.IsDone() && ExtPCir.NbExt() > 0) {
-           if(mynbext == 0) {
-             for(i = 1; i <= ExtPCir.NbExt(); i++) {
-               mynbext++;
-               P2 = ExtPCir.Point(i);
-               mySqDist.Append(ExtPCir.SquareDistance(i));
-               mypoints.Append(P1);
-               mypoints.Append(P2);
-             }
-           }
-           else {
-             for(i = 1; i <= ExtPCir.NbExt(); i++) {
-               Standard_Real dist = mySqDist(1);
-               if(Abs(dist - ExtPCir.SquareDistance(i)) > Precision::Confusion()) {
-                 mynbext++;
-                 P2 = ExtPCir.Point(i);
-                 mySqDist.Append(ExtPCir.SquareDistance(i));
-                 mypoints.Append(P1);
-                 mypoints.Append(P2);
-               }
-             }
-           }
-               
-           if(mynbext == 2)  finish = Standard_True;
-         }
-       }  
-       if(!finish) {
-         gp_Pnt PonC2 = Tool2::Value(*((Curve2*)myC[1]), Ut21);  
-         ExtPCir.Perform(PonC2, Tool1::Circle(*((Curve1*)myC[0])), Precision::Confusion(), Ut11, Ut12);
-         P2.SetValues(Ut21, PonC2);
-         if(ExtPCir.IsDone() && ExtPCir.NbExt() > 0) {
-           if(mynbext == 0) {
-             for(i = 1; i <= ExtPCir.NbExt(); i++) {
-               mynbext++;
-               P1 = ExtPCir.Point(i);
-               mySqDist.Append(ExtPCir.SquareDistance(i));
-               mypoints.Append(P1);
-               mypoints.Append(P2);
-             }
-           }
-           else {
-             for(i = 1; i <= ExtPCir.NbExt(); i++) {
-               Standard_Real dist = mySqDist(1);
-               if(Abs(dist - ExtPCir.SquareDistance(i)) > Precision::Confusion()) {
-                 mynbext++;
-                 P1 = ExtPCir.Point(i);
-                 mySqDist.Append(ExtPCir.SquareDistance(i));
-                 mypoints.Append(P1);
-                 mypoints.Append(P2);
-               }
-             }
-           }
-               
-           if(mynbext == 2)  finish = Standard_True;
-         }
-       }  
-       if(!finish) {
-         gp_Pnt PonC2 = Tool2::Value(*((Curve2*)myC[1]), Ut22);  
-         ExtPCir.Perform(PonC2, Tool1::Circle(*((Curve1*)myC[0])), Precision::Confusion(), Ut11, Ut12);
-         P2.SetValues(Ut22, PonC2);
-         if(ExtPCir.IsDone() && ExtPCir.NbExt() > 0) {
-           if(mynbext == 0) {
-             for(i = 1; i <= ExtPCir.NbExt(); i++) {
-               mynbext++;
-               P1 = ExtPCir.Point(i);
-               mySqDist.Append(ExtPCir.SquareDistance(i));
-               mypoints.Append(P1);
-               mypoints.Append(P2);
-             }
-           }
-           else {
-             for(i = 1; i <= ExtPCir.NbExt(); i++) {
-               Standard_Real dist = mySqDist(1);
-               if(Abs(dist - ExtPCir.SquareDistance(i)) > Precision::Confusion()) {
-                 mynbext++;
-                 P1 = ExtPCir.Point(i);
-                 mySqDist.Append(ExtPCir.SquareDistance(i));
-                 mypoints.Append(P1);
-                 mypoints.Append(P2);
-               }
-             }
-           }
-               
-           if(mynbext == 2)  finish = Standard_True;
-         }
-       }  
-       if(mynbext == 0) {
-         myIsPar = Standard_False;
-         mySqDist.Append(AlgExt.SquareDistance(1));
-         mypoints.Append(dummypoint);
-         mypoints.Append(dummypoint);
-         mySqDist.Append(AlgExt.SquareDistance(2));
-         mypoints.Append(dummypoint);
-         mypoints.Append(dummypoint);
-       }
-      }        
-    }
-    else {
-      NbExt = AlgExt.NbExt();
-      for (i = 1; i <= NbExt; i++) {
-       // Verification de la validite des parametres
-       AlgExt.Points(i, P1, P2);
-       if (!inverse) {
-         U = P1.Parameter();
-         U2 = P2.Parameter();
-       }
-       else {
-         U2 = P1.Parameter();
-         U = P2.Parameter();
-       }
-
-       if (Tool1::IsPeriodic(*((Curve1*)myC[0]))) {
-         U = ElCLib::InPeriod(U, Ut11, Ut11+Tool1::Period(*((Curve1*)myC[0])));
-       }
-       if (Tool2::IsPeriodic(*((Curve2*)myC[1]))) {
-         U2 = ElCLib::InPeriod(U2, Ut21, Ut21+Tool2::Period(*((Curve2*)myC[1])));
-       }
-
-       if ((U  >= Ut11 - RealEpsilon())  && 
-           (U  <= Ut12 + RealEpsilon())  &&
-           (U2 >= Ut21 - RealEpsilon())  &&
-           (U2 <= Ut22 + RealEpsilon())) {
-         mynbext++;
-         Val = AlgExt.SquareDistance(i);
-         mySqDist.Append(Val);
-         if (!inverse) {
-           P1.SetValues(U, P1.Value());
-           P2.SetValues(U2, P2.Value());
-           mypoints.Append(P1);
-           mypoints.Append(P2);
-         }
-         else {
-           P1.SetValues(U2, P1.Value());
-           P2.SetValues(U, P2.Value());
-           mypoints.Append(P2);
-           mypoints.Append(P1);
-         }
-       }
-      }
-    }
-  }
-
-}
-
-
-//=======================================================================
-//function : Results
-//purpose  : 
-//=======================================================================
-
-void Extrema_GExtCC::Results(const Extrema_ECC&   AlgExt,
-                            const Standard_Real  Ut11,
-                            const Standard_Real  Ut12,
-                            const Standard_Real  Ut21,
-                            const Standard_Real  Ut22)
-{
-  Standard_Integer i, j,NbExt;
-  Standard_Real Val, U, U2,Uj,U2j;
-  Extrema_POnCurv P1, P2,P1j,P2j;
-  Standard_Boolean IsExtrema;
-
-  myDone = AlgExt.IsDone();
-  if (myDone) {
-    NbExt = AlgExt.NbExt();
-    for (i = 1; i <= NbExt; i++) {
-      AlgExt.Points(i, P1, P2);
-      U = P1.Parameter();
-      U2 = P2.Parameter();
-      IsExtrema=Standard_True;
-      for  (j=1;j<=mynbext;j++)
-      { P1j=mypoints.Value(2*j-1);
-        P2j=mypoints.Value(2*j);
-        Uj=P1j.Parameter();
-        U2j=P2j.Parameter();
-        if ((Abs(Uj-U)<=myTol[0]) && (Abs(U2j-U2)<=myTol[1]))     
-        IsExtrema=Standard_False;}
-     
-      if (IsExtrema) 
-      {  
-//  Verification de la validite des parametres
-       if (Tool1::IsPeriodic(*((Curve1*)myC[0]))) {
-         U = ElCLib::InPeriod(U, Ut11, Ut11+Tool1::Period(*((Curve1*)myC[0])));
-       }
-       if (Tool2::IsPeriodic(*((Curve2*)myC[1]))) {
-         U2 = ElCLib::InPeriod(U2, Ut21, Ut21+Tool2::Period(*((Curve2*)myC[1])));
-       }
-
-         if ((U  >= Ut11 - RealEpsilon())  && 
-          (U  <= Ut12 + RealEpsilon())  &&
-          (U2 >= Ut21 - RealEpsilon())  &&
-          (U2 <= Ut22 + RealEpsilon()))   
-         { mynbext++;
-          Val = AlgExt.SquareDistance(i);
-          mySqDist.Append(Val);
-          P1.SetValues(U, P1.Value());
-          P2.SetValues(U2, P2.Value());
-          mypoints.Append(P1);
-          mypoints.Append(P2);
-         }
-      }
-    }
-  }  
-}
diff --git a/src/Extrema/Extrema_GExtCC2d.cdl b/src/Extrema/Extrema_GExtCC2d.cdl
deleted file mode 100644 (file)
index f949093..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
--- Created on: 1994-07-06
--- Created by: Laurent PAINNOT
--- Copyright (c) 1994-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.
-
-generic class GExtCC2d from Extrema (Curve1    as any;
-                                    Tool1     as any;
-                                    Curve2    as any;
-                                    Tool2     as any)
-
-       ---Purpose: It calculates all the distance between two curves.
-       --          These distances can be maximum or minimum.
-
-uses POnCurv2d           from Extrema,
-     SequenceOfPOnCurv2d from Extrema,
-     ExtElC2d            from Extrema,
-     Pnt2d               from gp,
-     HArray1OfPnt2d      from TColgp,
-     SequenceOfReal      from TColStd
-
-
-raises  InfiniteSolutions from StdFail,
-       NotDone           from StdFail,
-       OutOfRange        from Standard
-       
-    class CCache2d instantiates CurveCache from Extrema (Curve1, Pnt2d from gp, HArray1OfPnt2d from TColgp);
-
-    class ECC2d    instantiates GenExtCC      from Extrema
-        (Curve1,
-         Tool1,
-         Curve2,
-         Tool2,
-         CCache2d,
-         HArray1OfPnt2d from TColgp,
-         POnCurv2d,
-         Pnt2d,
-         Vec2d);
-
-is
-
-    Create returns GExtCC2d;
-    
-
-    Create (C1: Curve1;  C2: Curve2;
-            TolC1: Real = 1.0e-10; TolC2: Real = 1.0e-10) returns GExtCC2d;
-       ---Purpose: It calculates all the distances.
-
-
-    Create (C1: Curve1;
-           C2: Curve2;
-           U1: Real  from Standard;
-           U2: Real  from Standard;
-           V1: Real  from Standard;
-           V2: Real  from Standard;
-            TolC1: Real = 1.0e-10;
-            TolC2: Real = 1.0e-10) returns GExtCC2d;
-       ---Purpose: It calculates all the distances.
-
-
-    Initialize(me: in out; C2: Curve2;
-              V1, V2: Real  from Standard; 
-              TolC1: Real = 1.0e-10;
-              TolC2: Real = 1.0e-10)
-       ---Purpose: initializes the fields.
-    is static;
-    
-    
-    Perform(me: in out; C1: Curve1;
-           U1, U2: Real  from Standard)
-    is static;
-    
-
-    IsDone (me) returns Boolean
-       ---Purpose: Returns True if the distances are found.
-       is static;
-
-    NbExt (me) returns Integer
-       ---Purpose: Returns the number of extremum distances.
-       raises  NotDone from StdFail,
-               -- if IsDone(me)=False.
-               InfiniteSolutions from StdFail
-               -- if IsParallel(me)= True.
-       is static;
-
-
-    IsParallel (me) returns Boolean
-       ---Purpose: Returns True if the two curves are parallel.
-       raises  NotDone from StdFail
-               -- if IsDone(me)=False.
-       is static;
-
-
-    SquareDistance (me; N: Integer =1) returns Real
-       ---Purpose: Returns the value of the Nth extremum square distance.
-       raises  NotDone from StdFail,
-               -- if IsDone(me)=False.
-               InfiniteSolutions from StdFail,
-               -- if IsParallel(me)= True and N > 1.
-               OutOfRange
-               -- if N < 1 or N > NbExt(me)
-       is static;
-
-    Points (me; N: Integer; P1,P2: out POnCurv2d)
-       ---Purpose: Returns the points of the Nth extremum distance.
-       --          P1 is on the first curve, P2 on the second one.
-       raises  NotDone from StdFail,
-               -- if IsDone(me)=False.
-               InfiniteSolutions from StdFail,
-               -- if IsParallel(me)= True.
-               OutOfRange
-               -- if N < 1 or N > NbExt(me)
-       is static;
-
-    TrimmedSquareDistances(me; dist11, distP12, distP21, distP22: out Real;
-                     P11, P12, P21, P22: out Pnt2d)
-       ---Purpose: if the curve is a trimmed curve,
-       --          dist11 is a square distance between the point on C1
-       --          of parameter FirstParameter and the point of 
-       --          parameter FirstParameter on C2.
-
-    is static;
-    
-    Results(me: in out; AlgExt: ExtElC2d from Extrema;
-           Ut11, Ut12, Ut21, Ut22: Real;
-           Period1 : Real from Standard = 0.0;
-            Period2 : Real from Standard = 0.0)
-
-    is static protected;       
-
---  modified by NIZHNY-EAP Thu Jan 27 16:53:25 2000 ___BEGIN___
-    Results(me: in out;AlgExt: ECC2d; C : Curve1;
---  modified by NIZHNY-EAP Thu Jan 27 16:53:26 2000 ___END___
-           Ut11, Ut12, Ut21, Ut22: Real;
-           Period1 : Real from Standard = 0.0;
-            Period2 : Real from Standard = 0.0)
-
-    is static protected;
-
-
-fields
-    myDone:   Boolean;
-    myIsPar:  Boolean;
-    mypoints: SequenceOfPOnCurv2d from Extrema;
-    mySqDist:  SequenceOfReal      from TColStd;
-    mynbext:  Integer;
-    inverse:  Boolean;
-    myC:      Address from Standard;
-    myv1:     Real;
-    myv2:     Real;
-    mytolc1:  Real;
-    mytolc2:  Real;
-    P1f:      Pnt2d;
-    P1l:      Pnt2d;
-    P2f:      Pnt2d;
-    P2l:      Pnt2d;
-    mydist11: Real;
-    mydist12: Real;
-    mydist21: Real;
-    mydist22: Real;
-    
-
-
-end GExtCC2d;
diff --git a/src/Extrema/Extrema_GExtCC2d.gxx b/src/Extrema/Extrema_GExtCC2d.gxx
deleted file mode 100644 (file)
index 2078a19..0000000
+++ /dev/null
@@ -1,573 +0,0 @@
-// Created on: 1994-07-06
-// Created by: Laurent PAINNOT
-// Copyright (c) 1994-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 Extrema_ECC2d_hxx
-#include <Extrema_ExtElC2d.hxx>
-#include <StdFail_NotDone.hxx>
-#include <Extrema_ExtElC.hxx>
-#include <ElCLib.hxx>
-#include <Standard_Failure.hxx>
-#include <GeomAbs_CurveType.hxx>
-#include <Geom2d_Curve.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
-#include <Geom2d_Ellipse.hxx>
-#include <Geom2d_Circle.hxx>
-#include <Geom2d_Line.hxx>
-#include <Geom2d_Parabola.hxx>
-#include <Geom2d_Hyperbola.hxx>
-#include <Extrema_POnCurv2d.hxx>
-#include <Extrema_SequenceOfPOnCurv2d.hxx>
-#include <Standard_NotImplemented.hxx>
-#include <Precision.hxx>
-
-
-//=======================================================================
-//function :  IsParallelDot
-//purpose  :  This function returns True if angle between <theV1> and 
-//<theV2> vectors or between <theV1> and <-theV2> vectors is less than 
-//AngTol.
-//=======================================================================
-static Standard_Boolean IsParallelDot(  gp_Vec2d theV1,
-                                        gp_Vec2d theV2,
-                                        Standard_Real AngTol)
-  {
-  return Abs(theV1.Dot(theV2)) >= 
-            theV1.Magnitude()*theV2.Magnitude()*cos(AngTol);
-  }
-
-Extrema_GExtCC2d::Extrema_GExtCC2d() {}
-
-
-Extrema_GExtCC2d::Extrema_GExtCC2d(const Curve1&       C1, 
-                                  const Curve2&       C2,
-                                  const Standard_Real TolC1, 
-                                  const Standard_Real TolC2)
-{
-  Initialize(C2, Tool2::FirstParameter(C2), Tool2::LastParameter(C2), TolC1, TolC2);
-  Perform(C1, Tool1::FirstParameter(C1), Tool1::LastParameter(C1));
-}
-
-Extrema_GExtCC2d::Extrema_GExtCC2d(const Curve1&        C1, 
-                                  const Curve2&        C2,
-                                  const Standard_Real  U1,
-                                  const Standard_Real  U2,
-                                  const Standard_Real  V1,
-                                  const Standard_Real  V2,
-                                  const Standard_Real  TolC1,
-                                  const Standard_Real  TolC2)
-{
-  Initialize(C2, V1, V2, TolC1, TolC2);
-  Perform(C1, U1, U2);
-}
-
-
-
-void Extrema_GExtCC2d::Initialize(const Curve2&        C2,
-                                 const Standard_Real  V1,
-                                 const Standard_Real  V2,
-                                 const Standard_Real  TolC1,
-                                 const Standard_Real  TolC2)
-{
-  myC = (Standard_Address)&C2;
-  myv1 = V1;
-  myv2 = V2;
-  mytolc1 = TolC1;
-  mytolc2 = TolC2;
-}
-
-
-
-void Extrema_GExtCC2d::Perform (const Curve1&       C1,
-                               const Standard_Real U1,
-                               const Standard_Real U2)
-{
-  mypoints.Clear();
-  mySqDist.Clear();
-  Standard_Integer NbU = 32, NbV = 32;
-  GeomAbs_CurveType type1 = Tool1::GetType(C1), type2 = Tool2::GetType(*((Curve2*)myC));
-  Standard_Real U11, U12, U21, U22, Tol = Min(mytolc1, mytolc2);
-//  Extrema_POnCurv2d P1, P2;
-  mynbext = 0;
-  inverse = Standard_False;
-  myIsPar = Standard_False;
-
-  U11 = U1;
-  U12 = U2;
-  U21 = myv1;
-  U22 = myv2;
-  P1f = Tool1::Value(C1, U11);
-  P1l = Tool1::Value(C1, U12);
-  P2f = Tool2::Value(*((Curve2*)myC), U21);
-  P2l = Tool2::Value(*((Curve2*)myC), U22);
-
-
-  switch(type1) {
-    //
-    //  La premiere courbe est un cercle:
-    //
-  case GeomAbs_Circle: {
-
-    switch(type2) {
-      case GeomAbs_Circle: {
-       Extrema_ExtElC2d Xtrem(Tool1::Circle(C1), Tool2::Circle(*((Curve2*)myC)));
-       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 2*M_PI);
-        }
-       break;
-      case GeomAbs_Ellipse: {
-       Extrema_ExtElC2d Xtrem(Tool1::Circle(C1), Tool2::Ellipse(*((Curve2*)myC)));
-       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 2*M_PI );
-        }
-       break;
-      case GeomAbs_Parabola: {
-       Extrema_ExtElC2d Xtrem(Tool1::Circle(C1), Tool2::Parabola(*((Curve2*)myC)));
-       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0.);
-      }
-       break;
-      case GeomAbs_Hyperbola: {
-       Extrema_ExtElC2d Xtrem(Tool1::Circle(C1), Tool2::Hyperbola(*((Curve2*)myC)));
-       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0. );
-      }
-       break;
-      case GeomAbs_BezierCurve:
-      case GeomAbs_OtherCurve:
-      case GeomAbs_BSplineCurve: {
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);
-       Standard_Real Period2 = 0.;
-       if (Tool2::IsPeriodic(*((Curve2*)myC))) Period2 = Tool2::Period(*((Curve2*)myC));
-       Results(Xtrem, C1, U11, U12, U21, U22, 2*M_PI,Period2);
-        }
-       break;
-      case GeomAbs_Line: {
-       inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Tool2::Line(*((Curve2*)myC)), Tool1::Circle(C1), Tol);
-       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0.);
-        }
-       break;
-      };  // switch(type2)
-    }
-    break;
-
-    //
-    // La premiere courbe est une ellipse:
-    //
-  case GeomAbs_Ellipse: {
-
-    switch(type2) {
-      case GeomAbs_Circle: {
-       inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Tool2::Circle(*((Curve2*)myC)), Tool1::Ellipse(C1));
-       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 2*M_PI);
-        }
-       break;
-      case GeomAbs_Ellipse: {
-       //Extrema_ExtElC2d Xtrem(Tool1::Ellipse(C1), Tool2::Ellipse(*((Curve2*)myC)));
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);
-       Results(Xtrem, C1, U11, U12, U21, U22,2*M_PI, 2*M_PI);
-        }
-       break;
-      case GeomAbs_Parabola: {
-       //Extrema_ExtElC2d Xtrem(Tool1::Ellipse(C1), Tool2::Parabola(*((Curve2*)myC)));
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);
-       Results(Xtrem, C1, U11, U12, U21, U22, 2*M_PI, 0.);
-      }
-       break;
-      case GeomAbs_Hyperbola: {
-       //Extrema_ExtElC2d Xtrem(Tool1::Ellipse(C1), Tool2::Hyperbola(*((Curve2*)myC)));
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);
-       Results(Xtrem, C1, U11, U12, U21, U22, 2*M_PI, 0.);
-      }
-       break;
-      case GeomAbs_BezierCurve:
-      case GeomAbs_OtherCurve:
-      case GeomAbs_BSplineCurve: {
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);        
-       Standard_Real Period2 = 0.;
-       if (Tool2::IsPeriodic(*((Curve2*)myC))) Period2 = Tool2::Period(*((Curve2*)myC));
-       Results(Xtrem, C1, U11, U12, U21, U22, 2*M_PI,Period2);
-        }
-       break;
-      case GeomAbs_Line: {
-        inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Tool2::Line(*((Curve2*)myC)), Tool1::Ellipse(C1));
-       Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0.);
-        }
-       break;
-      };  // switch(type2)
-    }
-    break;
-
-    //
-    // La premiere courbe est une parabole: 
-    //
-  case GeomAbs_Parabola: {
-
-    switch(type2) {
-      case GeomAbs_Circle: {
-       inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Tool2::Circle(*((Curve2*)myC)), Tool1::Parabola(C1));
-       Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
-        }
-       break;
-      case GeomAbs_Ellipse: {
-       //inverse = Standard_True;
-       //Extrema_ExtElC2d Xtrem(Tool2::Ellipse(*((Curve2*)myC)), Tool1::Parabola(C1));
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);
-       Results(Xtrem, C1, U11, U12, U21, U22, 0., 2*M_PI);
-        }
-       break;
-      case GeomAbs_Parabola: {
-       //Extrema_ExtElC2d Xtrem(Tool1::Parabola(C1), Tool2::Parabola(*((Curve2*)myC)));
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);
-       Results(Xtrem, C1, U11, U12, U21, U22, 0., 0.);
-      }
-       break;
-      case GeomAbs_Hyperbola: {
-       //inverse = Standard_True;
-       //Extrema_ExtElC2d Xtrem(Tool2::Hyperbola(*((Curve2*)myC)), Tool1::Parabola(C1));
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);
-       Results(Xtrem, C1, U11, U12, U21, U22, 0., 0.);
-      }
-       break;
-      case GeomAbs_BezierCurve:
-      case GeomAbs_OtherCurve:
-      case GeomAbs_BSplineCurve: {
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);
-       Standard_Real Period2 = 0.;
-       if (Tool2::IsPeriodic(*((Curve2*)myC))) Period2 = Tool2::Period(*((Curve2*)myC));
-       Results(Xtrem, C1, U11, U12, U21, U22, 0., Period2);
-        }
-       break;
-      case GeomAbs_Line: {
-       inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Tool2::Line(*((Curve2*)myC)), Tool1::Parabola(C1));
-       Results(Xtrem, U11, U12, U21, U22, 0., 0.);
-        }
-       break;
-      };  // switch(type2)
-    }
-    break;
-
-    //
-    // La premiere courbe est une hyperbole:
-    //
-  case GeomAbs_Hyperbola: {
-
-    switch(type2) {
-      case GeomAbs_Circle: {
-       inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Tool2::Circle(*((Curve2*)myC)), Tool1::Hyperbola(C1));
-       Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
-        }
-       break;
-      case GeomAbs_Ellipse: {
-       //inverse = Standard_True;
-       //Extrema_ExtElC2d Xtrem(Tool2::Ellipse(*((Curve2*)myC)), Tool1::Hyperbola(C1));
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);
-       Results(Xtrem, C1, U11, U12, U21, U22, 0., 2*M_PI );
-        }
-       break;
-      case GeomAbs_Parabola: {
-       //Extrema_ExtElC2d Xtrem(Tool1::Hyperbola(C1), Tool2::Parabola(*((Curve2*)myC)));
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);
-       Results(Xtrem, C1, U11, U12, U21, U22, 0., 0.);
-      }
-       break;
-      case GeomAbs_Hyperbola: {
-       //Extrema_ExtElC2d Xtrem(Tool1::Hyperbola(C1), Tool2::Hyperbola(*((Curve2*)myC)));
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);
-       Results(Xtrem, C1, U11, U12, U21, U22, 0., 0.);
-      }
-       break;
-      case GeomAbs_OtherCurve:
-      case GeomAbs_BezierCurve:
-      case GeomAbs_BSplineCurve: {
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC)
-                           , NbU, NbV, mytolc1, mytolc2);
-       Standard_Real Period2 = 0.;
-       if (Tool2::IsPeriodic(*((Curve2*)myC))) Period2 = Tool2::Period(*((Curve2*)myC));
-       Results(Xtrem, C1, U11, U12, U21, U22, 0., Period2);
-        }
-       break;
-      case GeomAbs_Line: {
-       inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Tool2::Line(*((Curve2*)myC)), Tool1::Hyperbola(C1));
-       Results(Xtrem, U11, U12, U21, U22, 0., 0.);
-        }
-       break;
-      };  // switch(type2)
-    }
-    break;
-
-    //
-    // La premiere courbe est une BezierCurve ou une BSplineCurve:
-    //
-  case GeomAbs_BezierCurve:
-  case GeomAbs_OtherCurve:
-  case GeomAbs_BSplineCurve: {
-    Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                       NbU, NbV, mytolc1, mytolc2);
-    Standard_Real Period1 = 0.;
-    if (Tool1::IsPeriodic(C1)) Period1 = Tool1::Period(C1);
-    Standard_Real Period2 = 0.;
-    if (Tool2::IsPeriodic(*((Curve2*)myC))) Period2 = Tool2::Period(*((Curve2*)myC));
-    Results(Xtrem, C1, U11, U12, U21, U22, Period1, Period2);
-  }
-  break;
-
-    //
-    // La premiere courbe est une Line:
-    //
-  case GeomAbs_Line: {
-
-    switch(type2) {
-      case GeomAbs_Circle: {
-       Extrema_ExtElC2d Xtrem(Tool1::Line(C1), Tool2::Circle(*((Curve2*)myC)), Tol);
-       Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
-        }
-       break;
-      case GeomAbs_Ellipse: {
-       Extrema_ExtElC2d Xtrem(Tool1::Line(C1), Tool2::Ellipse(*((Curve2*)myC)));
-       Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
-        }
-       break;
-      case GeomAbs_Parabola: {
-       Extrema_ExtElC2d Xtrem(Tool1::Line(C1), Tool2::Parabola(*((Curve2*)myC)));
-       Results(Xtrem, U11, U12, U21, U22, 0., 0.);
-      }
-       break;
-      case GeomAbs_Hyperbola: {
-       Extrema_ExtElC2d Xtrem(Tool1::Line(C1), Tool2::Hyperbola(*((Curve2*)myC)));
-       Results(Xtrem, U11, U12, U21, U22, 0., 0.);
-      }
-       break;
-      case GeomAbs_BezierCurve:
-      case GeomAbs_OtherCurve:
-      case GeomAbs_BSplineCurve: {
-       Extrema_ECC2d Xtrem(C1, *((Curve2*)myC), 
-                           NbU, NbV, mytolc1, mytolc2);
-       Standard_Real Period2 = 0.;
-       if (Tool2::IsPeriodic(*((Curve2*)myC))) Period2 = Tool2::Period(*((Curve2*)myC));
-       Results(Xtrem, C1, U11, U12, U21, U22, 0., Period2);
-        }
-       break;
-      case GeomAbs_Line: {
-       Extrema_ExtElC2d Xtrem(Tool1::Line(C1), Tool2::Line(*((Curve2*)myC)), Tol);
-       Results(Xtrem, U11, U12, U21, U22, 0., 0.);
-        } 
-       break;
-      };  // switch(type2)
-    }
-    break;
-
-  };
-    
-}
-
-
-Standard_Boolean Extrema_GExtCC2d::IsDone() const
-{
-  return myDone;
-}
-
-
-Standard_Real Extrema_GExtCC2d::SquareDistance(const Standard_Integer N) const 
-{
-  if(!myDone) StdFail_NotDone::Raise();
-  if ((N <= 0) || (N > mynbext)) Standard_OutOfRange::Raise();
-  return mySqDist.Value(N);
-}
-
-
-Standard_Integer Extrema_GExtCC2d::NbExt() const
-{
-  if(!myDone) StdFail_NotDone::Raise();
-  return mynbext;
-}
-
-
-void Extrema_GExtCC2d::Points(const Standard_Integer N, 
-                             Extrema_POnCurv2d& P1,
-                             Extrema_POnCurv2d& P2) const
-{
-  if(!myDone) StdFail_NotDone::Raise();
-  if ((N <= 0) || (N > mynbext)) Standard_OutOfRange::Raise();
-  P1 = mypoints.Value(2*N-1);
-  P2 = mypoints.Value(2*N);
-}
-
-
-
-void Extrema_GExtCC2d::TrimmedSquareDistances(Standard_Real& dist11,
-                                       Standard_Real& dist12,
-                                       Standard_Real& dist21,
-                                       Standard_Real& dist22,
-                                       gp_Pnt2d&      P11,
-                                       gp_Pnt2d&      P12,
-                                       gp_Pnt2d&      P21,
-                                       gp_Pnt2d&      P22) const 
-{
-  dist11 = mydist11;
-  dist12 = mydist12;
-  dist21 = mydist21;
-  dist22 = mydist22;
-  P11 = P1f;
-  P12 = P1l;
-  P21 = P2f;
-  P22 = P2l;
-}
-
-
-
-void Extrema_GExtCC2d::Results(const Extrema_ExtElC2d&  AlgExt,
-                              const Standard_Real      Ut11,
-                              const Standard_Real      Ut12,
-                              const Standard_Real      Ut21,
-                              const Standard_Real      Ut22,
-                              const Standard_Real      Period1,
-                              const Standard_Real      Period2)
-{
-  Standard_Integer i, NbExt;
-  Standard_Real Val, U, U2;
-  Extrema_POnCurv2d P1, P2;
-  
-  myDone = AlgExt.IsDone();
-  myIsPar = AlgExt.IsParallel();
-  if (myDone) {
-    if (!myIsPar) {
-      NbExt = AlgExt.NbExt();
-      for (i = 1; i <= NbExt; i++) {
-       // Verification de la validite des parametres pour le cas trimme:
-       AlgExt.Points(i, P1, P2);
-       if (!inverse) {
-         U = P1.Parameter();
-         if (Period1 != 0.0) U = ElCLib::InPeriod(U,Ut11,Ut11+Period1);
-         U2 = P2.Parameter();
-         if (Period2 != 0.0) U2 = ElCLib::InPeriod(U2,Ut21,Ut21+Period2);
-       }
-       else {
-         U2 = P1.Parameter();
-         if (Period2 != 0.0) U2 = ElCLib::InPeriod(U2,Ut21,Ut21+Period2);
-         U = P2.Parameter();
-         if (Period1 != 0.0) U = ElCLib::InPeriod(U,Ut11,Ut11+Period1);
-       }
-       if ((U  >= Ut11 - Precision::PConfusion())  && 
-           (U  <= Ut12 + Precision::PConfusion())  &&
-           (U2 >= Ut21 - Precision::PConfusion())  &&
-           (U2 <= Ut22 + Precision::PConfusion())) {
-         mynbext++;
-         Val = AlgExt.SquareDistance(i);
-         mySqDist.Append(Val);
-         if (!inverse) {
-           P1.SetValues(U, P1.Value());
-           P2.SetValues(U2, P2.Value());
-           mypoints.Append(P1);
-           mypoints.Append(P2);
-         }
-         else {
-           P1.SetValues(U2, P1.Value());
-           P2.SetValues(U, P2.Value());
-           mypoints.Append(P2);
-           mypoints.Append(P1);
-         }
-       }
-      }
-    }
-
-    mydist11 = P1f.SquareDistance(P2f);
-    mydist12 = P1f.SquareDistance(P2l);
-    mydist21 = P1l.SquareDistance(P2f);
-    mydist22 = P1l.SquareDistance(P2l);
-  }
-}
-
-
-void Extrema_GExtCC2d::Results(const Extrema_ECC2d& AlgExt,
-//  modified by NIZHNY-EAP Wed Feb 23 14:51:24 2000 ___BEGIN___
-                              const Curve1&        C1,
-//  modified by NIZHNY-EAP Wed Feb 23 14:51:26 2000 ___END___
-                              const Standard_Real  Ut11,
-                              const Standard_Real  Ut12,
-                              const Standard_Real  Ut21,
-                              const Standard_Real  Ut22,
-                              const Standard_Real  Period1,
-                              const Standard_Real  Period2)
-{
-  Standard_Integer i, NbExt;
-  Standard_Real Val, U, U2;
-  Extrema_POnCurv2d P1, P2;
-  
-  myDone = AlgExt.IsDone();
-  if (myDone) {
-    if (!myIsPar) {
-      NbExt = AlgExt.NbExt();
-      for (i = 1; i <= NbExt; i++) {
-       // Verification de la validite des parametres pour le cas trimme:
-       AlgExt.Points(i, P1, P2);
-       U = P1.Parameter();
-       if (Period1 != 0.0) U = ElCLib::InPeriod(U,Ut11,Ut11+Period1);
-       U2 = P2.Parameter();
-       if (Period2 != 0.0) U2 = ElCLib::InPeriod(U2,Ut21,Ut21+Period2);
-
-       if ((U  >= Ut11 - Precision::PConfusion())  && 
-           (U  <= Ut12 + Precision::PConfusion())  &&
-           (U2 >= Ut21 - Precision::PConfusion())  &&
-           (U2 <= Ut22 + Precision::PConfusion())) {
-//  modified by NIZHNY-EAP Thu Jan 27 16:40:55 2000 ___BEGIN___
-         // to be sure that it's a real extrema
-         gp_Pnt2d p;
-         gp_Vec2d v1, v2;
-         Tool1::D1(C1,U,p, v1);
-         Tool2::D1(*((Curve2*)myC),U2,p, v2);
-         if (IsParallelDot(v1, v2, Precision::Angular()))
-           {
-           mynbext++;
-           Val = AlgExt.SquareDistance(i);
-           P1.SetValues(U, P1.Value());
-           P2.SetValues(U2, P2.Value());
-           mySqDist.Append(Val);
-           mypoints.Append(P1);
-           mypoints.Append(P2);
-           }
-//  modified by NIZHNY-EAP Thu Jan 27 16:41:00 2000 ___END___
-       }
-      }
-    }
-
-    mydist11 = P1f.SquareDistance(P2f);
-    mydist12 = P1f.SquareDistance(P2l);
-    mydist21 = P1l.SquareDistance(P2f);
-    mydist22 = P1l.SquareDistance(P2l);
-  }
-}
-
-
-Standard_Boolean Extrema_GExtCC2d::IsParallel() const
-{
-  if (!myDone) StdFail_NotDone::Raise();
-  return myIsPar;
-}
diff --git a/src/Extrema/Extrema_GLocateExtCC.cdl b/src/Extrema/Extrema_GLocateExtCC.cdl
deleted file mode 100644 (file)
index 6ced85f..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
--- Created on: 1994-07-06
--- Created by: Laurent PAINNOT
--- Copyright (c) 1994-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.
-
-generic class GLocateExtCC from Extrema (Curve1    as any;
-                                        Tool1     as any;
-                                        Curve2    as any;
-                                        Tool2     as any)
-                                       
-       ---Purpose: It calculates the distance between two curves with
-       --          a close point; these distances can be maximum or 
-       --          minimum.
-
-uses   POnCurv from Extrema,
-       Pnt from gp,
-       HArray1OfPnt from TColgp
-
-raises  DomainError  from Standard,
-       NotDone      from StdFail
-
-
-    class LCCache instantiates CurveCache from Extrema (Curve1, Pnt from gp, HArray1OfPnt from TColgp);
-
-    class ELCC    instantiates GenExtCC      from Extrema
-        (Curve1,
-         Tool1,
-         Curve2,
-         Tool2,
-         LCCache,
-         HArray1OfPnt from TColgp,
-         POnCurv,
-         Pnt,
-         Vec);
-
-
-    class LocECC    instantiates GenLocateExtCC      from Extrema
-       (Curve1,
-        Tool1,
-        Curve2,
-        Tool2,
-         POnCurv,
-         Pnt,
-         Vec);
-
-
-is
-    Create (C1: Curve1; C2: Curve2; U0,V0: Real)
-       returns GLocateExtCC
-       ---Purpose: Calculates the distance with a close point. The
-       --          close point is defined by a parameter value on each 
-       --          curve.
-       --          The function F(u,v)=distance(C1(u),C2(v)) has an 
-       --          extremun when gradient(f)=0. The algorithm searchs
-       --          the zero near the close point.
-       raises  DomainError;
-               -- if U0 and V0 are outside the definition ranges of the 
-               -- curves.
-    
-    IsDone (me) returns Boolean
-       ---Purpose: Returns True if the distance is found.
-       is static;
-
-    SquareDistance (me) returns Real
-       ---Purpose: Returns the value of the extremum square distance.
-       raises  NotDone from StdFail
-               -- if IsDone(me)=False.
-       is static;
-
-    Point (me; P1,P2: out POnCurv)
-       ---Purpose: Returns the points of the extremum distance. 
-       --          P1 is on the first curve, P2 on the second one.
-       raises  NotDone from StdFail
-               -- if IsDone(me)=False.
-       is static;
-
-fields
-    myDone  : Boolean;
-    mySqDist: Real;
-    myPoint1: POnCurv;
-    myPoint2: POnCurv;
-
-end GLocateExtCC;
diff --git a/src/Extrema/Extrema_GLocateExtCC.gxx b/src/Extrema/Extrema_GLocateExtCC.gxx
deleted file mode 100644 (file)
index 8dd9fa3..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// Created on: 1994-07-06
-// Created by: Laurent PAINNOT
-// Copyright (c) 1994-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 Extrema_ELCC_hxx
-#include Extrema_LocECC_hxx
-#include <StdFail_NotDone.hxx>
-#include <Extrema_POnCurv.hxx>
-#include <Precision.hxx>
-
-Extrema_GLocateExtCC::Extrema_GLocateExtCC (const Curve1&       C1,
-                                           const Curve2&       C2,
-                                           const Standard_Real U0,
-                                           const Standard_Real V0)
-{
-  Standard_Real TolU = C1.Resolution(Precision::Confusion());
-  Standard_Real TolV = C2.Resolution(Precision::Confusion());
-  Extrema_POnCurv P1, P2;
-
-  // Non implemente pour l instant: l appel a Extrema_ELCC.
-
-
-  Extrema_LocECC Xtrem(C1, C2,
-                      U0, V0, TolU, TolV);     
-  // Exploitation
-
-  myDone = Xtrem.IsDone();
-  if (Xtrem.IsDone()) {
-    mySqDist = Xtrem.SquareDistance();
-    Xtrem.Point(P1, P2);
-    myPoint1 = P1;
-    myPoint2 = P2;
-  }
-
-}
-
-
-
-
-Standard_Boolean Extrema_GLocateExtCC::IsDone () const {
-
-  return myDone;
-}
-
-
-Standard_Real Extrema_GLocateExtCC::SquareDistance() const {
-
-  if (!myDone) { StdFail_NotDone::Raise(); }
-  return mySqDist;
-}
-
-
-
-void Extrema_GLocateExtCC::Point (Extrema_POnCurv& P1, Extrema_POnCurv& P2) const {
-
-  if (!myDone) { StdFail_NotDone::Raise(); }
-  P1 = myPoint1;
-  P2 = myPoint2;
-}
-
diff --git a/src/Extrema/Extrema_GLocateExtCC2d.cdl b/src/Extrema/Extrema_GLocateExtCC2d.cdl
deleted file mode 100644 (file)
index 00f5531..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
--- Created on: 1994-07-06
--- Created by: Laurent PAINNOT
--- Copyright (c) 1994-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.
-
-generic class GLocateExtCC2d from Extrema (Curve1    as any;
-                                          Tool1     as any;
-                                          Curve2    as any;
-                                          Tool2     as any)
-                                       
-       ---Purpose: It calculates the distance between two curves with
-       --          a close point; these distances can be maximum or 
-       --          minimum.
-
-uses   POnCurv2d from Extrema,
-       Pnt2d     from gp,
-       Vec2d     from gp,
-       HArray1OfPnt2d from TColgp
-
-raises  DomainError  from Standard,
-       NotDone      from StdFail
-
-
-    class LCCache2d instantiates CurveCache from Extrema (Curve1, Pnt2d from gp, HArray1OfPnt2d from TColgp);
-
-    class ELCC2d    instantiates GenExtCC      from Extrema
-        (Curve1,
-         Tool1,
-         Curve2,
-         Tool2,
-         LCCache2d,
-         HArray1OfPnt2d from TColgp,
-         POnCurv2d,
-         Pnt2d,
-         Vec2d);
-
-
-    class LocECC2d    instantiates GenLocateExtCC      from Extrema
-       (Curve1,
-        Tool1,
-        Curve2,
-        Tool2,
-         POnCurv2d,
-         Pnt2d,
-         Vec2d);
-
-
-is
-    Create (C1: Curve1; C2: Curve2; U0,V0: Real)
-       returns GLocateExtCC2d
-       ---Purpose: Calculates the distance with a close point. The
-       --          close point is defined by a parameter value on each 
-       --          curve.
-       --          The function F(u,v)=distance(C1(u),C2(v)) has an 
-       --          extremun when gradient(f)=0. The algorithm searchs
-       --          the zero near the close point.
-       raises  DomainError;
-               -- if U0 and V0 are outside the definition ranges of the 
-               -- curves.
-    
-    IsDone (me) returns Boolean
-       ---Purpose: Returns True if the distance is found.
-       is static;
-
-    SquareDistance (me) returns Real
-       ---Purpose: Returns the value of the extremum square distance.
-       raises  NotDone from StdFail
-               -- if IsDone(me)=False.
-       is static;
-
-    Point (me; P1,P2: out POnCurv2d)
-       ---Purpose: Returns the points of the extremum distance. 
-       --          P1 is on the first curve, P2 on the second one.
-       raises  NotDone from StdFail
-               -- if IsDone(me)=False.
-       is static;
-
-fields
-    myDone  : Boolean;
-    mySqDist: Real;
-    myPoint1: POnCurv2d;
-    myPoint2: POnCurv2d;
-
-end GLocateExtCC2d;
diff --git a/src/Extrema/Extrema_GLocateExtCC2d.gxx b/src/Extrema/Extrema_GLocateExtCC2d.gxx
deleted file mode 100644 (file)
index 4598ecd..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-// Created on: 1994-07-06
-// Created by: Laurent PAINNOT
-// Copyright (c) 1994-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 Extrema_ELCC2d_hxx
-#include Extrema_LocECC2d_hxx
-#include <GeomAbs_CurveType.hxx>
-#include <StdFail_NotDone.hxx>
-#include <Extrema_POnCurv2d.hxx>
-#include <Precision.hxx>
-
-
-//=======================================================================
-//function : Extrema_GLocateExtCC2d
-//purpose  : 
-//=======================================================================
-
-Extrema_GLocateExtCC2d::Extrema_GLocateExtCC2d (const Curve1&       C1,
-                                               const Curve2&       C2,
-                                               const Standard_Real U0,
-                                               const Standard_Real V0)
-{
-  Standard_Real TolU = Tool1::Resolution(C1, Precision::Confusion());
-  Standard_Real TolV = Tool2::Resolution(C2, Precision::Confusion());
-  Extrema_POnCurv2d P1, P2;
-
-  // Non implemente pour l instant: l appel a Geom2dExtrema_ExtCC.
-
-
-  Extrema_LocECC2d Xtrem(C1, C2, U0, V0, TolU, TolV);  
-  // Exploitation
-
-  myDone = Xtrem.IsDone();
-  if (Xtrem.IsDone()) {
-    mySqDist = Xtrem.SquareDistance();
-    Xtrem.Point(P1, P2);
-    myPoint1 = P1;
-    myPoint2 = P2;
-  }
-
-}
-
-
-
-
-//=======================================================================
-//function : IsDone
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean Extrema_GLocateExtCC2d::IsDone () const {
-
-  return myDone;
-}
-
-
-//=======================================================================
-//function : Value
-//purpose  : 
-//=======================================================================
-
-Standard_Real Extrema_GLocateExtCC2d::SquareDistance() const {
-
-  if (!myDone) { StdFail_NotDone::Raise(); }
-  return mySqDist;
-}
-
-
-
-//=======================================================================
-//function : Point
-//purpose  : 
-//=======================================================================
-
-void Extrema_GLocateExtCC2d::Point (Extrema_POnCurv2d& P1, 
-                                   Extrema_POnCurv2d& P2) const 
-{
-  if (!myDone) { StdFail_NotDone::Raise(); }
-  P1 = myPoint1;
-  P2 = myPoint2;
-}
diff --git a/src/Extrema/Extrema_LocateExtCC.cdl b/src/Extrema/Extrema_LocateExtCC.cdl
new file mode 100644 (file)
index 0000000..9efaa25
--- /dev/null
@@ -0,0 +1,68 @@
+-- Created on: 1994-07-06
+-- Created by: Laurent PAINNOT
+-- Copyright (c) 1994-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.
+
+class LocateExtCC from Extrema
+
+    ---Purpose: It calculates the distance between two curves with
+    --          a close point; these distances can be maximum or 
+    --          minimum.
+
+uses   POnCurv      from Extrema,
+       Pnt          from gp,
+       HArray1OfPnt from TColgp,
+       Curve        from Adaptor3d,
+       CurveTool    from Extrema
+
+raises  DomainError  from Standard,
+        NotDone      from StdFail
+
+is
+    Create (C1: Curve from Adaptor3d; C2: Curve from Adaptor3d; U0,V0: Real)
+       returns LocateExtCC
+       ---Purpose: Calculates the distance with a close point. The
+       --          close point is defined by a parameter value on each 
+       --          curve.
+       --          The function F(u,v)=distance(C1(u),C2(v)) has an 
+       --          extremun when gradient(f)=0. The algorithm searchs
+       --          the zero near the close point.
+       raises  DomainError;
+               -- if U0 and V0 are outside the definition ranges of the 
+               -- curves.
+    
+    IsDone (me) returns Boolean
+       ---Purpose: Returns True if the distance is found.
+       is static;
+
+    SquareDistance (me) returns Real
+       ---Purpose: Returns the value of the extremum square distance.
+       raises  NotDone from StdFail
+               -- if IsDone(me)=False.
+       is static;
+
+    Point (me; P1,P2: out POnCurv)
+       ---Purpose: Returns the points of the extremum distance. 
+       --          P1 is on the first curve, P2 on the second one.
+       raises  NotDone from StdFail
+               -- if IsDone(me)=False.
+       is static;
+
+fields
+    myDone  : Boolean;
+    mySqDist: Real;
+    myPoint1: POnCurv;
+    myPoint2: POnCurv;
+
+end LocateExtCC;
diff --git a/src/Extrema/Extrema_LocateExtCC.cxx b/src/Extrema/Extrema_LocateExtCC.cxx
new file mode 100644 (file)
index 0000000..b43a3be
--- /dev/null
@@ -0,0 +1,67 @@
+// Created on: 1994-07-06
+// Created by: Laurent PAINNOT
+// Copyright (c) 1994-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 <Extrema_LocateExtCC.ixx>
+
+#include <StdFail_NotDone.hxx>
+#include <Extrema_POnCurv.hxx>
+#include <Precision.hxx>
+
+#include <Adaptor3d_Curve.hxx>
+#include <Extrema_LocECC.hxx>
+
+Extrema_LocateExtCC::Extrema_LocateExtCC (const Adaptor3d_Curve& C1,
+                                          const Adaptor3d_Curve& C2,
+                                          const Standard_Real U0,
+                                          const Standard_Real V0)
+{
+  Standard_Real TolU = C1.Resolution(Precision::Confusion());
+  Standard_Real TolV = C2.Resolution(Precision::Confusion());
+  Extrema_POnCurv P1, P2;
+
+  // Non implemente pour l instant: l appel a Extrema_ELCC.
+
+  Extrema_LocECC Xtrem(C1, C2,
+    U0, V0, TolU, TolV);       
+  // Exploitation
+
+  myDone = Xtrem.IsDone();
+  if (Xtrem.IsDone()) {
+    mySqDist = Xtrem.SquareDistance();
+    Xtrem.Point(P1, P2);
+    myPoint1 = P1;
+    myPoint2 = P2;
+  }
+}
+
+Standard_Boolean Extrema_LocateExtCC::IsDone () const {
+
+  return myDone;
+}
+
+Standard_Real Extrema_LocateExtCC::SquareDistance() const {
+
+  if (!myDone) { StdFail_NotDone::Raise(); }
+  return mySqDist;
+}
+
+void Extrema_LocateExtCC::Point (Extrema_POnCurv& P1, Extrema_POnCurv& P2) const {
+
+  if (!myDone) { StdFail_NotDone::Raise(); }
+  P1 = myPoint1;
+  P2 = myPoint2;
+}
+
diff --git a/src/Extrema/Extrema_LocateExtCC2d.cdl b/src/Extrema/Extrema_LocateExtCC2d.cdl
new file mode 100644 (file)
index 0000000..2a4dbd4
--- /dev/null
@@ -0,0 +1,70 @@
+-- Created on: 1994-07-06
+-- Created by: Laurent PAINNOT
+-- Copyright (c) 1994-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.
+
+class LocateExtCC2d from Extrema
+
+    ---Purpose: It calculates the distance between two curves with
+    --          a close point; these distances can be maximum or 
+    --          minimum.
+
+uses   POnCurv2d   from Extrema,
+       Pnt2d       from gp,
+       Vec2d       from gp,
+       HArray1OfPnt2d from TColgp,
+       Curve2d     from Adaptor2d,
+       Curve2dTool from Extrema,
+       LCCache2d   from Extrema
+
+raises  DomainError  from Standard,
+        NotDone      from StdFail
+
+is
+    Create (C1: Curve2d from Adaptor2d; C2: Curve2d from Adaptor2d; U0,V0: Real)
+       returns LocateExtCC2d
+       ---Purpose: Calculates the distance with a close point. The
+       --          close point is defined by a parameter value on each 
+       --          curve.
+       --          The function F(u,v)=distance(C1(u),C2(v)) has an 
+       --          extremun when gradient(f)=0. The algorithm searchs
+       --          the zero near the close point.
+       raises  DomainError;
+               -- if U0 and V0 are outside the definition ranges of the 
+               -- curves.
+    
+    IsDone (me) returns Boolean
+       ---Purpose: Returns True if the distance is found.
+       is static;
+
+    SquareDistance (me) returns Real
+       ---Purpose: Returns the value of the extremum square distance.
+       raises  NotDone from StdFail
+               -- if IsDone(me)=False.
+       is static;
+
+    Point (me; P1,P2: out POnCurv2d)
+       ---Purpose: Returns the points of the extremum distance. 
+       --          P1 is on the first curve, P2 on the second one.
+       raises  NotDone from StdFail
+               -- if IsDone(me)=False.
+       is static;
+
+fields
+    myDone  : Boolean;
+    mySqDist: Real;
+    myPoint1: POnCurv2d;
+    myPoint2: POnCurv2d;
+
+end LocateExtCC2d;
diff --git a/src/Extrema/Extrema_LocateExtCC2d.cxx b/src/Extrema/Extrema_LocateExtCC2d.cxx
new file mode 100644 (file)
index 0000000..ac6ec81
--- /dev/null
@@ -0,0 +1,97 @@
+// Created on: 1994-07-06
+// Created by: Laurent PAINNOT
+// Copyright (c) 1994-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 <Extrema_LocateExtCC2d.hxx>
+
+#include <GeomAbs_CurveType.hxx>
+#include <StdFail_NotDone.hxx>
+#include <Extrema_POnCurv2d.hxx>
+#include <Precision.hxx>
+
+#include <Adaptor2d_Curve2d.hxx>
+#include <Extrema_Curve2dTool.hxx>
+#include <Extrema_LocECC2d.hxx>
+
+
+//=======================================================================
+//function : Extrema_LocateExtCC2d
+//purpose  : 
+//=======================================================================
+
+Extrema_LocateExtCC2d::Extrema_LocateExtCC2d (const Adaptor2d_Curve2d&       C1,
+                                              const Adaptor2d_Curve2d&       C2,
+                                              const Standard_Real U0,
+                                              const Standard_Real V0)
+{
+  Standard_Real TolU = Extrema_Curve2dTool::Resolution(C1, Precision::Confusion());
+  Standard_Real TolV = Extrema_Curve2dTool::Resolution(C2, Precision::Confusion());
+  Extrema_POnCurv2d P1, P2;
+
+  // Non implemente pour l instant: l appel a Geom2dExtrema_ExtCC.
+
+
+  Extrema_LocECC2d Xtrem(C1, C2, U0, V0, TolU, TolV);  
+  // Exploitation
+
+  myDone = Xtrem.IsDone();
+  if (Xtrem.IsDone()) {
+    mySqDist = Xtrem.SquareDistance();
+    Xtrem.Point(P1, P2);
+    myPoint1 = P1;
+    myPoint2 = P2;
+  }
+
+}
+
+
+
+
+//=======================================================================
+//function : IsDone
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Extrema_LocateExtCC2d::IsDone () const {
+
+  return myDone;
+}
+
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+
+Standard_Real Extrema_LocateExtCC2d::SquareDistance() const {
+
+  if (!myDone) { StdFail_NotDone::Raise(); }
+  return mySqDist;
+}
+
+
+
+//=======================================================================
+//function : Point
+//purpose  : 
+//=======================================================================
+
+void Extrema_LocateExtCC2d::Point (Extrema_POnCurv2d& P1, 
+                                   Extrema_POnCurv2d& P2) const 
+{
+  if (!myDone) { StdFail_NotDone::Raise(); }
+  P1 = myPoint1;
+  P2 = myPoint2;
+}
index 83a1d09..edf7ad7 100644 (file)
@@ -52,8 +52,6 @@ is
 
     class QualifiedCirc;
 
-    generic class QualifiedCurv;
-
     enumeration Position is 
        unqualified, enclosing, enclosed, outside, noqualifier;
        ---Purpose:
diff --git a/src/GccEnt/GccEnt_QualifiedCurv.cdl b/src/GccEnt/GccEnt_QualifiedCurv.cdl
deleted file mode 100644 (file)
index 29ea708..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
--- Created on: 1991-04-15
--- Created by: Philippe DAUTRY
--- Copyright (c) 1991-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.
-
-generic class QualifiedCurv from GccEnt (TheCurve as any)
-
-       ---Purpose: Creates a qualified 2d line.
-
-uses Position from GccEnt
-
-is
-
-Create(Curve     : TheCurve                ;
-       Qualifier : Position from GccEnt ) 
-returns QualifiedCurv from GccEnt;
--- is private;
-
-Qualified(me) returns TheCurve
-is static;
-
-Qualifier(me) returns Position from GccEnt
-is static;
-
-IsUnqualified(me) returns Boolean from Standard
-is static;
-       ---Purpose: Returns true if the solution is unqualified and false in the 
-       --          other cases.
-
-IsEnclosing(me) returns Boolean from Standard
-is static;
-       ---Purpose: Returns true if the solution is Enclosing the Curv and false in 
-       --          the other cases.
-
-IsEnclosed(me) returns Boolean from Standard
-is static;
-       ---Purpose: Returns true if the solution is Enclosed in the Curv and false in 
-       --          the other cases.
-
-IsOutside(me) returns Boolean from Standard
-is static;
-       ---Purpose: Returns true if the solution is Outside the Curv and false in 
-       --          the other cases.
-
-fields
-
-TheQualifier : Position from GccEnt;
-TheQualified : TheCurve;
-
--- friends
-
--- Unqualified(Obj : Curv2d) from GccEnt,
--- Enclosing  (Obj : Curv2d) from GccEnt,
--- Enclosed   (Obj : Curv2d) from GccEnt,
--- Outside    (Obj : Curv2d) from GccEnt
-
-end QualifiedCurv;
-
-
diff --git a/src/GccEnt/GccEnt_QualifiedCurv.gxx b/src/GccEnt/GccEnt_QualifiedCurv.gxx
deleted file mode 100644 (file)
index 25b5a41..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 1995-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.
-
-TheCurve GccEnt_QualifiedCurv::
-   Qualified () const { return TheQualified; }
-
-GccEnt_Position GccEnt_QualifiedCurv::
-   Qualifier () const { return TheQualifier; }
-
-Standard_Boolean GccEnt_QualifiedCurv::
-   IsUnqualified () const {
-     if (TheQualifier == GccEnt_unqualified ) { return Standard_True; }
-     else { return Standard_False; }
-   }
-
-Standard_Boolean GccEnt_QualifiedCurv::
-   IsEnclosing () const {
-     if (TheQualifier == GccEnt_enclosing) { return Standard_True; }
-     else { return Standard_False; }
-   }
-
-Standard_Boolean GccEnt_QualifiedCurv::
-   IsEnclosed () const {
-     if (TheQualifier == GccEnt_enclosed) { return Standard_True; }
-     else { return Standard_False; }
-   }
-
-Standard_Boolean GccEnt_QualifiedCurv::
-   IsOutside () const {
-     if (TheQualifier == GccEnt_outside) { return Standard_True; }
-     else { return Standard_False; }
-   }
-
-GccEnt_QualifiedCurv::
-   GccEnt_QualifiedCurv (const TheCurve&          Curve,
-                        const GccEnt_Position Qualifier) {
-   TheQualified = Curve;
-   TheQualifier = Qualifier;
- }
index 6011cf1..be1eb83 100644 (file)
@@ -67,68 +67,67 @@ class Lin2d2Tan;
 
 class Lin2dTanObl;
 
-class MyQCurve instantiates QualifiedCurv from GccEnt
-           (Curve  from Geom2dAdaptor);
+class QCurve;
 
 class MyCurveTool instantiates CurvePGTool from GccGeo
-           (Curve       from Geom2dAdaptor,
-            CurveTool   from Geom2dGcc    ,
-            OffsetCurve from Adaptor3d);
-           
+        (Curve       from Geom2dAdaptor,
+         CurveTool   from Geom2dGcc,
+         OffsetCurve from Adaptor3d);
+
 class MyCirc2d2TanOn instantiates Circ2d2TanOn from GccGeo
-           (Curve                          from Geom2dAdaptor,
-            CurveTool                      from Geom2dGcc,
-            MyQCurve                       from Geom2dGcc,
-             OffsetCurve                    from Adaptor3d,
-            HCurve                         from Geom2dAdaptor,
-            MyCurveTool                    from Geom2dGcc,
-            TheIntConicCurveOfGInter from Geom2dInt);
-            
+        (Curve                    from Geom2dAdaptor,
+         CurveTool                from Geom2dGcc,
+         QCurve                   from Geom2dGcc,
+         OffsetCurve              from Adaptor3d,
+         HCurve                   from Geom2dAdaptor,
+         MyCurveTool              from Geom2dGcc,
+         TheIntConicCurveOfGInter from Geom2dInt);
+
 class MyCirc2d2TanRad instantiates Circ2d2TanRad from GccGeo
-           (Curve                           from Geom2dAdaptor ,
-            CurveTool                       from Geom2dGcc,
-            MyQCurve                        from Geom2dGcc,
-             OffsetCurve                     from Adaptor3d, 
-            HCurve                         from Geom2dAdaptor,      
-            MyCurveTool                     from Geom2dGcc,
-            TheIntConicCurveOfGInter  from Geom2dInt,
-            GInter                    from Geom2dInt);
+        (Curve                    from Geom2dAdaptor,
+         CurveTool                from Geom2dGcc,
+         QCurve                   from Geom2dGcc,
+         OffsetCurve              from Adaptor3d, 
+         HCurve                   from Geom2dAdaptor,
+         MyCurveTool              from Geom2dGcc,
+         TheIntConicCurveOfGInter from Geom2dInt,
+         GInter                   from Geom2dInt);
 
 class MyCirc2dTanOnRad instantiates Circ2dTanOnRad from GccGeo
-           (Curve                           from Geom2dAdaptor ,
-            CurveTool                       from Geom2dGcc,
-            MyQCurve                        from Geom2dGcc,
-            OffsetCurve                     from Adaptor3d,
-            HCurve                         from Geom2dAdaptor,      
-            MyCurveTool                     from Geom2dGcc,
-            TheIntConicCurveOfGInter  from Geom2dInt,
-            GInter                    from Geom2dInt);
-
-class MyC2d3Tan instantiates Circ2d3Tan from GccIter        
-           (Curve          from Geom2dAdaptor,
-            CurveTool      from Geom2dGcc,
-            MyQCurve       from Geom2dGcc);
-            
-class MyCirc2dTanCen instantiates Circ2dTanCen from GccGeo          
-           (Curve          from Geom2dAdaptor,
-            CurveTool      from Geom2dGcc,
-            ExtPC2d          from Extrema,
-             MyQCurve       from Geom2dGcc);
-            
-class MyC2d2TanOn instantiates Circ2d2TanOn from GccIter            
-           (Curve          from Geom2dAdaptor,
-            CurveTool      from Geom2dGcc,
-            MyQCurve       from Geom2dGcc);
-
-class MyL2dTanObl instantiates Lin2dTanObl from GccIter             
-           (Curve          from Geom2dAdaptor,
-            CurveTool      from Geom2dGcc,
-            MyQCurve       from Geom2dGcc);
-            
+        (Curve                     from Geom2dAdaptor ,
+         CurveTool                 from Geom2dGcc,
+         QCurve                    from Geom2dGcc,
+         OffsetCurve               from Adaptor3d,
+         HCurve                    from Geom2dAdaptor,
+         MyCurveTool               from Geom2dGcc,
+         TheIntConicCurveOfGInter  from Geom2dInt,
+         GInter                    from Geom2dInt);
+
+class MyC2d3Tan instantiates Circ2d3Tan from GccIter
+        (Curve          from Geom2dAdaptor,
+         CurveTool      from Geom2dGcc,
+         QCurve         from Geom2dGcc);
+        
+class MyCirc2dTanCen instantiates Circ2dTanCen from GccGeo
+        (Curve          from Geom2dAdaptor,
+         CurveTool      from Geom2dGcc,
+         ExtPC2d        from Extrema,
+         QCurve         from Geom2dGcc);
+
+class MyC2d2TanOn instantiates Circ2d2TanOn from GccIter
+        (Curve          from Geom2dAdaptor,
+         CurveTool      from Geom2dGcc,
+         QCurve         from Geom2dGcc);
+
+class MyL2dTanObl instantiates Lin2dTanObl from GccIter
+        (Curve          from Geom2dAdaptor,
+         CurveTool      from Geom2dGcc,
+         QCurve         from Geom2dGcc);
+
 class MyL2d2Tan instantiates Lin2d2Tan from GccIter         
-           (Curve          from Geom2dAdaptor,
-            CurveTool      from Geom2dGcc,
-            MyQCurve       from Geom2dGcc);
+        (Curve          from Geom2dAdaptor,
+         CurveTool      from Geom2dGcc,
+         QCurve         from Geom2dGcc);
 
 Unqualified(Obj : Curve from Geom2dAdaptor) returns QualifiedCurve;
        ---Purpose: Constructs such a qualified curve that the relative
index 6e3a677..6ae5cdc 100644 (file)
@@ -19,7 +19,7 @@
 #include <GccAna_Circ2d2TanOn.hxx>
 #include <Geom2dGcc_MyCirc2d2TanOn.hxx>
 #include <Geom2dGcc_MyC2d2TanOn.hxx>
-#include <Geom2dGcc_MyQCurve.hxx>
+#include <Geom2dGcc_QCurve.hxx>
 #include <GccEnt_BadQualifier.hxx>
 #include <Geom2d_Circle.hxx>
 #include <Geom2d_Line.hxx>
@@ -273,8 +273,8 @@ Geom2dGcc_Circ2d2TanOn::
 //=============================================================================
 
   else {
-    Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
-    Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
+    Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
+    Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
     if ((Type3 == GeomAbs_Circle || Type3 == GeomAbs_Line)) {
       if (Type3 == GeomAbs_Circle) {
        Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
@@ -445,7 +445,7 @@ Geom2dGcc_Circ2d2TanOn::
 //=============================================================================
 
   else {
-    Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
+    Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
     if ((Type3 == GeomAbs_Circle || Type3 == GeomAbs_Line)) {
       if (Type3 == GeomAbs_Circle) {
        Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
index 71c5846..d8ba1e7 100644 (file)
@@ -18,7 +18,7 @@
 #include <Geom2dAdaptor_Curve.hxx>
 #include <GccAna_Circ2d2TanRad.hxx>
 #include <Geom2dGcc_MyCirc2d2TanRad.hxx>
-#include <Geom2dGcc_MyQCurve.hxx>
+#include <Geom2dGcc_QCurve.hxx>
 #include <GccEnt_BadQualifier.hxx>
 #include <Geom2d_Circle.hxx>
 #include <Geom2d_Line.hxx>
@@ -177,7 +177,7 @@ Geom2dGcc_Circ2d2TanRad::
        else {
          GccEnt_QualifiedLin Ql1 = GccEnt_QualifiedLin(l1,
                                                       Qualified1.Qualifier());
-         Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
+         Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
          Geom2dGcc_MyCirc2d2TanRad CircGeo(Ql1,Qc2,Radius,Tolerance);
          WellDone = CircGeo.IsDone();
          NbrSol = CircGeo.NbSolutions();
@@ -192,7 +192,7 @@ Geom2dGcc_Circ2d2TanRad::
        gp_Circ2d c1(CCC1->Circ2d());
        GccEnt_QualifiedCirc Qc1 = GccEnt_QualifiedCirc(c1,
                                                       Qualified1.Qualifier());
-       Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
+       Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
        Geom2dGcc_MyCirc2d2TanRad CircGeo(Qc1,Qc2,Radius,Tolerance);
        WellDone = CircGeo.IsDone();
        NbrSol = CircGeo.NbSolutions();
@@ -212,7 +212,7 @@ Geom2dGcc_Circ2d2TanRad::
        else {
          GccEnt_QualifiedLin Ql2 = GccEnt_QualifiedLin(l2,
                                                       Qualified2.Qualifier());
-         Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
+         Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
          Geom2dGcc_MyCirc2d2TanRad CircGeo(Ql2,Qc1,Radius,Tolerance);
          WellDone = CircGeo.IsDone();
          NbrSol = CircGeo.NbSolutions();
@@ -228,7 +228,7 @@ Geom2dGcc_Circ2d2TanRad::
        gp_Circ2d c2(CCC2->Circ2d());
        GccEnt_QualifiedCirc Qc2 = GccEnt_QualifiedCirc(c2,
                                                       Qualified2.Qualifier());
-       Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
+       Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
        Geom2dGcc_MyCirc2d2TanRad CircGeo(Qc2,Qc1,Radius,Tolerance);
        WellDone = CircGeo.IsDone();
        NbrSol = CircGeo.NbSolutions();
@@ -238,8 +238,8 @@ Geom2dGcc_Circ2d2TanRad::
        Results(CircGeo);
       }
       else {
-       Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
-       Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
+       Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
+       Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
        Geom2dGcc_MyCirc2d2TanRad CircGeo(Qc1,Qc2,Radius,Tolerance);
        WellDone = CircGeo.IsDone();
        NbrSol = CircGeo.NbSolutions();
@@ -311,7 +311,7 @@ Geom2dGcc_Circ2d2TanRad::
 //                            Appel a GccGeo.                                 +
 //=============================================================================
     else {
-      Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
+      Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
       Geom2dGcc_MyCirc2d2TanRad CircGeo(Qc1,Point->Pnt2d(),Radius,Tolerance);
       WellDone = CircGeo.IsDone();
       NbrSol = CircGeo.NbSolutions();
index 7cee671..356a400 100644 (file)
@@ -18,7 +18,7 @@
 #include <Geom2dAdaptor_Curve.hxx>
 #include <Geom2d_Line.hxx>
 #include <Geom2d_Circle.hxx>
-#include <Geom2dGcc_MyQCurve.hxx>
+#include <Geom2dGcc_QCurve.hxx>
 #include <Geom2dGcc_MyC2d3Tan.hxx>
 #include <GccEnt_QualifiedCirc.hxx>
 #include <GccEnt_QualifiedLin.hxx>
@@ -212,9 +212,9 @@ Geom2dGcc_Circ2d3Tan::
     }
   }
   else {
-    Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
-    Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
-    Geom2dGcc_MyQCurve Qc3(C3,Qualified3.Qualifier());
+    Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
+    Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
+    Geom2dGcc_QCurve Qc3(C3,Qualified3.Qualifier());
     Geom2dGcc_MyC2d3Tan Circ(Qc1,Qc2,Qc3,Param1,Param2,Param3,Tolerance);
     WellDone = Circ.IsDone();
     NbrSol = 1;
@@ -332,8 +332,8 @@ Geom2dGcc_Circ2d3Tan::
     }
   }
   else {
-    Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
-    Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
+    Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
+    Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
     Geom2dGcc_MyC2d3Tan Circ(Qc1,Qc2,Point->Pnt2d(),Param1,Param2,Tolerance);
     WellDone = Circ.IsDone();
     NbrSol = 1;
@@ -412,7 +412,7 @@ Geom2dGcc_Circ2d3Tan::
     }
   }
   else {
-    Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
+    Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
     Geom2dGcc_MyC2d3Tan Circ(Qc1,Point1->Pnt2d(),Point2->Pnt2d(),
                             Param1,Tolerance);
     WellDone = Circ.IsDone();
index 8813597..ceaec38 100644 (file)
@@ -18,7 +18,7 @@
 #include <Geom2dAdaptor_Curve.hxx>
 #include <GccAna_Circ2dTanCen.hxx>
 #include <Geom2dGcc_MyCirc2dTanCen.hxx>
-#include <Geom2dGcc_MyQCurve.hxx>
+#include <Geom2dGcc_QCurve.hxx>
 #include <GccEnt_BadQualifier.hxx>
 #include <Geom2d_Circle.hxx>
 #include <Geom2d_Line.hxx>
@@ -84,7 +84,7 @@ Geom2dGcc_Circ2dTanCen::
 //=============================================================================
 
   else {
-    Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
+    Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
     Geom2dGcc_MyCirc2dTanCen Circ(Qc1,pcenter,Tolerance);
     WellDone = Circ.IsDone();
     NbrSol = Circ.NbSolutions();
index 48dc2aa..9ce33a8 100644 (file)
@@ -18,7 +18,7 @@
 #include <Geom2dAdaptor_Curve.hxx>
 #include <GccAna_Circ2dTanOnRad.hxx>
 #include <Geom2dGcc_MyCirc2dTanOnRad.hxx>
-#include <Geom2dGcc_MyQCurve.hxx>
+#include <Geom2dGcc_QCurve.hxx>
 #include <GccEnt_BadQualifier.hxx>
 #include <Geom2d_Circle.hxx>
 #include <Geom2d_Line.hxx>
@@ -129,7 +129,7 @@ Geom2dGcc_Circ2dTanOnRad::
        Results(CircGeo);
       }
       else {
-       Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
+       Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
        Geom2dGcc_MyCirc2dTanOnRad CircGeo(Qc1,OnCurve,Radius,Tolerance);
        WellDone = CircGeo.IsDone();
        NbrSol = CircGeo.NbSolutions();
index 41f0170..a34b0e6 100644 (file)
@@ -15,7 +15,7 @@
 // commercial license or contractual agreement.
 
 #include <Geom2dGcc_Lin2d2Tan.ixx>
-#include <Geom2dGcc_MyQCurve.hxx>
+#include <Geom2dGcc_QCurve.hxx>
 #include <GccAna_Lin2d2Tan.hxx>
 #include <Geom2dGcc_MyL2d2Tan.hxx>
 #include <Geom2d_Circle.hxx>
@@ -74,13 +74,13 @@ Geom2dGcc_Lin2d2Tan::
     }
   }
   else {
-    Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
+    Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
     Standard_Real      a1FPar      = Geom2dGcc_CurveTool::FirstParameter(C1);
     Standard_Real      a1LPar      = Geom2dGcc_CurveTool::LastParameter(C1);
     Standard_Integer   aNbSamples1 = Geom2dGcc_CurveTool::NbSamples(C1);
     Standard_Real      aStep1      = (a1LPar - a1FPar)/aNbSamples1;
     Standard_Real      Param1      = a1FPar;
-    Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
+    Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
     Standard_Real      a2FPar      = Geom2dGcc_CurveTool::FirstParameter(C2);
     Standard_Real      a2LPar      = Geom2dGcc_CurveTool::LastParameter(C2);
     Standard_Integer   aNbSamples2 = Geom2dGcc_CurveTool::NbSamples(C2);
@@ -149,7 +149,7 @@ Geom2dGcc_Lin2d2Tan::
     }
   }
   else {
-    Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
+    Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
     Standard_Real      aFirstPar  = Geom2dGcc_CurveTool::FirstParameter(C1);
     Standard_Real      aLastPar   = Geom2dGcc_CurveTool::LastParameter(C1);
     Standard_Integer   aNbSamples = Geom2dGcc_CurveTool::NbSamples(C1);
@@ -224,8 +224,8 @@ Geom2dGcc_Lin2d2Tan::
     }
   }
   else {
-    Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
-    Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
+    Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
+    Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
     Geom2dGcc_MyL2d2Tan Lin(Qc1,Qc2,Param1,Param2,Tolang);
     WellDone = Lin.IsDone();
 //  Modified by Sergey KHROMOV - Thu Apr  5 17:51:59 2001 Begin
@@ -283,7 +283,7 @@ Geom2dGcc_Lin2d2Tan::
     }
   }
   else {
-    Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
+    Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
     Geom2dGcc_MyL2d2Tan Lin(Qc1,ThePoint,Param1,Tolang);
     WellDone = Lin.IsDone();
 //  Modified by Sergey KHROMOV - Thu Apr  5 17:53:01 2001 Begin
index 3155d3e..2f744e9 100644 (file)
@@ -15,7 +15,7 @@
 // commercial license or contractual agreement.
 
 #include <Geom2dGcc_Lin2dTanObl.ixx>
-#include <Geom2dGcc_MyQCurve.hxx>
+#include <Geom2dGcc_QCurve.hxx>
 #include <GccAna_Lin2dTanObl.hxx>
 #include <Geom2dGcc_MyL2dTanObl.hxx>
 #include <Geom2d_Circle.hxx>
@@ -66,7 +66,7 @@ Geom2dGcc_Lin2dTanObl::
     }
   }
   else {
-    Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
+    Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
     Standard_Real      aFirstPar  = Geom2dGcc_CurveTool::FirstParameter(C1);
     Standard_Real      aLastPar   = Geom2dGcc_CurveTool::LastParameter(C1);
     Standard_Integer   aNbSamples = Geom2dGcc_CurveTool::NbSamples(C1);
@@ -131,7 +131,7 @@ Geom2dGcc_Lin2dTanObl::
     }
   }
   else {
-    Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
+    Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
     Geom2dGcc_MyL2dTanObl Lin(Qc1,TheLine,TolAng,Param1,Angle);
     WellDone = Lin.IsDone();
     if(WellDone) { 
diff --git a/src/Geom2dGcc/Geom2dGcc_QCurve.cdl b/src/Geom2dGcc/Geom2dGcc_QCurve.cdl
new file mode 100644 (file)
index 0000000..6975c64
--- /dev/null
@@ -0,0 +1,64 @@
+-- Created on: 1991-04-15
+-- Created by: Philippe DAUTRY
+-- Copyright (c) 1991-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.
+
+class QCurve from Geom2dGcc
+
+       ---Purpose: Creates a qualified 2d line.
+
+uses Position from GccEnt,
+     Curve    from Geom2dAdaptor
+
+is
+
+Create(Curve     : Curve from Geom2dAdaptor;
+       Qualifier : Position from GccEnt ) 
+returns QCurve from Geom2dGcc;
+-- is private;
+
+Qualified(me) returns Curve from Geom2dAdaptor
+is static;
+
+Qualifier(me) returns Position from GccEnt
+is static;
+
+IsUnqualified(me) returns Boolean from Standard
+is static;
+       ---Purpose: Returns true if the solution is unqualified and false in the 
+       --          other cases.
+
+IsEnclosing(me) returns Boolean from Standard
+is static;
+       ---Purpose: Returns true if the solution is Enclosing the Curv and false in 
+       --          the other cases.
+
+IsEnclosed(me) returns Boolean from Standard
+is static;
+       ---Purpose: Returns true if the solution is Enclosed in the Curv and false in 
+       --          the other cases.
+
+IsOutside(me) returns Boolean from Standard
+is static;
+       ---Purpose: Returns true if the solution is Outside the Curv and false in 
+       --          the other cases.
+
+fields
+
+TheQualifier : Position from GccEnt;
+TheQualified : Curve from Geom2dAdaptor;
+
+end QCurve;
+
+
diff --git a/src/Geom2dGcc/Geom2dGcc_QCurve.cxx b/src/Geom2dGcc/Geom2dGcc_QCurve.cxx
new file mode 100644 (file)
index 0000000..870e0ca
--- /dev/null
@@ -0,0 +1,54 @@
+// Copyright (c) 1995-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 <Geom2dGcc_QCurve.ixx>
+
+//#include <Geom2dAdaptor_Curve.hxx>
+
+Geom2dAdaptor_Curve Geom2dGcc_QCurve::
+   Qualified () const { return TheQualified; }
+
+GccEnt_Position Geom2dGcc_QCurve::
+   Qualifier () const { return TheQualifier; }
+
+Standard_Boolean Geom2dGcc_QCurve::
+   IsUnqualified () const {
+     if (TheQualifier == GccEnt_unqualified ) { return Standard_True; }
+     else { return Standard_False; }
+   }
+
+Standard_Boolean Geom2dGcc_QCurve::
+   IsEnclosing () const {
+     if (TheQualifier == GccEnt_enclosing) { return Standard_True; }
+     else { return Standard_False; }
+   }
+
+Standard_Boolean Geom2dGcc_QCurve::
+   IsEnclosed () const {
+     if (TheQualifier == GccEnt_enclosed) { return Standard_True; }
+     else { return Standard_False; }
+   }
+
+Standard_Boolean Geom2dGcc_QCurve::
+   IsOutside () const {
+     if (TheQualifier == GccEnt_outside) { return Standard_True; }
+     else { return Standard_False; }
+   }
+
+Geom2dGcc_QCurve::
+   Geom2dGcc_QCurve (const Geom2dAdaptor_Curve&          Curve,
+                        const GccEnt_Position Qualifier) {
+   TheQualified = Curve;
+   TheQualifier = Qualifier;
+ }
index e24c7c7..a22abfd 100644 (file)
 package Geom2dHatch
 
 uses
-    Geom2dAdaptor ,
-    Geom2dInt ,
-    gp ,
-    HatchGen
+    Geom2dAdaptor,
+    Geom2dInt,
+    gp,
+    HatchGen,
+    TCollection,
+    TColStd,
+    TopClass,
+    TopAbs
 
 is
     
     class Intersector ;
     
-    class Hatcher instantiates Hatcher from HatchGen
-       (Curve       from Geom2dAdaptor,
-        Curve       from Geom2dAdaptor,
-        Intersector from Geom2dHatch) ;
+    class Hatcher;
+    
+    class Element;
+    class Elements;
+    class Hatching;
+    
+    class Hatchings instantiates DataMap from TCollection
+    (Integer          from Standard,
+     Hatching         from Geom2dHatch,
+     MapIntegerHasher from TColStd) ;
+
+    class Classifier instantiates FaceClassifier from  TopClass 
+    (Elements    from Geom2dHatch,
+     Curve       from Geom2dAdaptor,
+     Intersector from Geom2dHatch);
+
+    private class MapOfElements instantiates DataMap from TCollection
+    (Integer          from Standard,
+     Element          from Geom2dHatch,
+     MapIntegerHasher from TColStd);
 
 end Geom2dHatch ;
diff --git a/src/Geom2dHatch/Geom2dHatch_Element.cdl b/src/Geom2dHatch/Geom2dHatch_Element.cdl
new file mode 100644 (file)
index 0000000..9e0ce6c
--- /dev/null
@@ -0,0 +1,85 @@
+-- Created on: 1993-11-10
+-- Created by: Jean Marc LACHAUME
+-- 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.
+
+class Element from Geom2dHatch
+
+uses
+    Orientation from TopAbs,
+    Curve from Geom2dAdaptor
+
+is
+
+
+    Create
+    
+       returns Element from Geom2dHatch;
+
+    Create (Other : Element from Geom2dHatch) 
+    
+       ---Purpose: Magic constructor.
+
+       returns Element from Geom2dHatch ;
+     
+
+    Create (Curve       : Curve from Geom2dAdaptor ;
+           Orientation : Orientation from TopAbs = TopAbs_FORWARD)
+    
+       ---Purpose: Creates an element.
+
+       returns Element from Geom2dHatch ;
+
+
+    Curve (me)
+    
+       ---Purpose: Returns the curve associated to the element.
+
+       ---C++: return const &
+
+        returns Curve from Geom2dAdaptor
+        is static ;
+
+
+    ChangeCurve (me : in out)
+    
+       ---Purpose: Returns the curve associated to the element.
+
+       ---C++: return &
+
+        returns Curve from Geom2dAdaptor
+        is static ;
+
+
+    Orientation (me : in out ; Orientation : Orientation from TopAbs)
+
+       ---Purpose: Sets the orientation of the element.
+
+       is static ;
+
+
+    Orientation (me)
+
+       ---Purpose: Returns the orientation of the element.
+
+       returns Orientation from TopAbs
+       is static ;
+
+
+fields
+
+    myCurve       : Curve from Geom2dAdaptor ;
+    myOrientation : Orientation from TopAbs ;
+
+end Element from Geom2dHatch;
diff --git a/src/Geom2dHatch/Geom2dHatch_Element.cxx b/src/Geom2dHatch/Geom2dHatch_Element.cxx
new file mode 100644 (file)
index 0000000..a616fc3
--- /dev/null
@@ -0,0 +1,91 @@
+// Created on: 1993-11-03
+// Created by: Jean Marc LACHAUME
+// 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.
+
+//=======================================================================
+// Function : Geom2dHatch_Element
+// Purpose  : Magic Constructor.
+//=======================================================================
+
+#include <Geom2dHatch_Element.ixx>
+
+#include <Geom2dAdaptor_Curve.hxx>
+
+Geom2dHatch_Element::Geom2dHatch_Element (const Geom2dHatch_Element& Other) 
+: myCurve(Other.myCurve), myOrientation(Other.myOrientation) { 
+}
+  
+//=======================================================================
+// Function : Geom2dHatch_Element
+// Purpose  : Empty Constructor.
+//=======================================================================
+
+Geom2dHatch_Element::Geom2dHatch_Element () { 
+}
+  
+//=======================================================================
+// Function : Geom2dHatch_Element
+// Purpose  : Constructor.
+//=======================================================================
+
+Geom2dHatch_Element::Geom2dHatch_Element (const Geom2dAdaptor_Curve& Curve,
+                                         const TopAbs_Orientation Orientation) :
+       myCurve       (Curve),
+       myOrientation (Orientation)
+{
+}
+  
+//=======================================================================
+// Function : Curve
+// Purpose  : Returns the curve associated to the hatching.
+//=======================================================================
+
+const Geom2dAdaptor_Curve& Geom2dHatch_Element::Curve () const
+{
+  return myCurve ;
+}
+
+//=======================================================================
+// Function : ChangeCurve
+// Purpose  : Returns the curve associated to the hatching.
+//=======================================================================
+
+Geom2dAdaptor_Curve& Geom2dHatch_Element::ChangeCurve ()
+{
+  return myCurve ;
+}
+
+//=======================================================================
+// Function : Orientation
+// Purpose  : Sets the orientation of the element.
+//=======================================================================
+
+void Geom2dHatch_Element::Orientation (const TopAbs_Orientation Orientation)
+{
+  myOrientation = Orientation ;
+}
+
+//=======================================================================
+// Function : Orientation
+// Purpose  : Returns the orientation of the element.
+//=======================================================================
+
+TopAbs_Orientation Geom2dHatch_Element::Orientation () const
+{
+  return myOrientation ;
+}
+
+
+
diff --git a/src/Geom2dHatch/Geom2dHatch_Elements.cdl b/src/Geom2dHatch/Geom2dHatch_Elements.cdl
new file mode 100644 (file)
index 0000000..ff66bed
--- /dev/null
@@ -0,0 +1,147 @@
+-- Created on: 1994-12-16
+-- Created by: Laurent BUCHARD
+-- Copyright (c) 1994-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.
+
+-- Modified by skv - Fri Jul 14 16:46:18 2006 OCC12627
+
+
+class Elements from Geom2dHatch
+
+
+uses 
+    Orientation      from TopAbs,
+    Lin2d            from gp,
+    Pnt2d            from gp,
+    Integer          from Standard,
+    Element          from Geom2dHatch,
+    MapIntegerHasher from TColStd,
+    Curve            from Geom2dAdaptor,
+    MapOfElements    from Geom2dHatch,
+    DataMapIteratorOfMapOfElements from Geom2dHatch
+
+raises         
+    DomainError  from Standard,
+    NoSuchObject from Standard
+
+
+is 
+
+    Create
+    returns Elements from Geom2dHatch;
+
+    Create(Other : Elements from Geom2dHatch)
+    returns Elements from Geom2dHatch;
+
+        
+
+----------------------------------------------------------------------
+--               E m u l a t i o n   o f   D a t a M a p  
+--               
+--                  f r o m  T C o l l e c t  i o n                                                                          
+----------------------------------------------------------------------
+    Clear(me : in out)
+       ---C++: alias ~
+    is static;
+
+    Bind(me : in out; K : Integer from Standard; I : Element from Geom2dHatch) returns Boolean
+    is static;
+
+    IsBound(me; K : Integer from Standard) returns Boolean
+    is static;
+    
+    UnBind(me : in out; K : Integer from Standard) returns Boolean
+    is static;
+    
+    Find(me; K : Integer from Standard) returns any Element from Geom2dHatch
+    raises NoSuchObject from Standard  -- when <K> is not in the map.
+       ---C++: alias operator()
+       ---C++: return const &
+    is static;
+    
+    ChangeFind(me : in out; K : Integer from Standard) returns any Element from Geom2dHatch
+    raises NoSuchObject from Standard  -- when <K> is not in the map.
+       ---C++: alias operator()
+       ---C++: return &
+    is static;
+
+----------------------------------------------------------------------
+--      M e t h o d s   u s e d   b y   t h e   C l a s s i f i e r 
+--      
+--      see BRepClass_FaceExplorer for the Purposes
+----------------------------------------------------------------------
+
+    Reject(me;  P : Pnt2d from gp) 
+        returns Boolean from Standard
+    is static;
+    
+-- Modified by skv - Fri Jul 14 16:46:18 2006 OCC12627 Begin
+    Segment(me: in out;  P   :     Pnt2d from gp;
+                        L   : out Lin2d from gp; 
+                         Par : out Real)
+    returns  Boolean from Standard
+    is static;
+    
+    OtherSegment(me: in out;  P   :     Pnt2d from gp;
+                             L   : out Lin2d from gp; 
+                              Par : out Real)
+    returns Boolean from Standard
+    is static;
+    
+-- Modified by skv - Fri Jul 14 16:46:18 2006 OCC12627 End
+
+    InitWires(me : in out)
+    is static;
+    
+    MoreWires(me) returns
+       Boolean from Standard
+    is static;
+       
+    NextWire(me : in out)
+    is static;
+    
+    RejectWire(me; L : Lin2d from gp; 
+                 Par : Real  from Standard) 
+       returns Boolean from Standard
+    is static;
+    
+    InitEdges(me : in out)
+    is static;
+    
+    MoreEdges(me) 
+       returns Boolean from Standard
+    is static;
+    
+    NextEdge(me  : in out) 
+    is static;
+
+    RejectEdge(me; L : Lin2d from gp; 
+                 Par : Real  from Standard) 
+       returns Boolean from Standard
+    is static;
+    
+    CurrentEdge(me; E : out Curve  from Geom2dAdaptor;
+                  Or : out Orientation from TopAbs)
+    is static;
+    
+
+fields 
+
+    myMap    : MapOfElements from Geom2dHatch; 
+    Iter     : DataMapIteratorOfMapOfElements;
+    NumWire  : Integer from Standard;
+    NumEdge  : Integer from Standard;
+    myCurEdge: Integer from Standard;
+    
+end Elements from Geom2dHatch; 
diff --git a/src/Geom2dHatch/Geom2dHatch_Elements.cxx b/src/Geom2dHatch/Geom2dHatch_Elements.cxx
new file mode 100644 (file)
index 0000000..07d53da
--- /dev/null
@@ -0,0 +1,241 @@
+// Created on: 1994-12-16
+// Created by: Laurent BUCHARD
+// Copyright (c) 1994-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.
+
+//  Modified by skv - Fri Jul 14 17:03:47 2006 OCC12627
+
+#include <Geom2dHatch_Elements.ixx>
+
+#include <Standard_Integer.hxx>
+#include <Geom2dHatch_Element.hxx>
+#include <TColStd_MapIntegerHasher.hxx>
+#include <Geom2dAdaptor_Curve.hxx>
+
+#include <TopAbs_Orientation.hxx>
+#include <gp.hxx>
+#include <gp_Vec2d.hxx>
+
+Geom2dHatch_Elements::Geom2dHatch_Elements(const Geom2dHatch_Elements& )
+{
+  cout<<" Magic Constructor in Geom2dHatch_Elements:: "<<endl;
+}
+
+Geom2dHatch_Elements::Geom2dHatch_Elements()
+{
+  NumWire = 0;
+  NumEdge = 0;
+  myCurEdge = 1;
+}
+
+void Geom2dHatch_Elements::Clear()
+{
+  myMap.Clear();
+}
+
+Standard_Boolean Geom2dHatch_Elements::IsBound(const Standard_Integer K) const
+{
+  return(myMap.IsBound(K));
+}
+
+Standard_Boolean Geom2dHatch_Elements::UnBind(const Standard_Integer K)
+{
+  return(myMap.UnBind(K));
+}
+
+Standard_Boolean Geom2dHatch_Elements::Bind(const Standard_Integer K,const Geom2dHatch_Element& I)
+{
+  return(myMap.Bind(K,I));
+}
+
+const Geom2dHatch_Element& Geom2dHatch_Elements::Find(const Standard_Integer K) const
+{
+  return(myMap.Find(K));
+}
+
+Geom2dHatch_Element& Geom2dHatch_Elements::ChangeFind(const Standard_Integer K)
+{
+  return(myMap.ChangeFind(K));
+}
+
+//=======================================================================
+//function : Reject
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean  Geom2dHatch_Elements::Reject(const gp_Pnt2d&) const  {
+  return Standard_False;
+}
+
+//=======================================================================
+//function : Segment
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Geom2dHatch_Elements::Segment(const gp_Pnt2d& P, 
+                                                    gp_Lin2d& L, 
+                                                    Standard_Real& Par)
+{
+  myCurEdge = 1;
+
+  return OtherSegment(P, L, Par);
+}
+
+//=======================================================================
+//function : Segment
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Geom2dHatch_Elements::OtherSegment(const gp_Pnt2d& P, 
+                                                         gp_Lin2d& L, 
+                                                         Standard_Real& Par)
+{
+  Geom2dHatch_DataMapIteratorOfMapOfElements Itertemp;
+  Standard_Integer                        i;
+  
+  for(  Itertemp.Initialize(myMap), i = 1; Itertemp.More(); Itertemp.Next(), i++) { 
+    if (i < myCurEdge)
+      continue;
+
+    void *ptrmyMap = (void *)(&myMap);
+    Geom2dHatch_Element& Item=((Geom2dHatch_MapOfElements*)ptrmyMap)->ChangeFind(Itertemp.Key());
+    Geom2dAdaptor_Curve& E = Item.ChangeCurve();
+    TopAbs_Orientation Or= Item.Orientation();
+    gp_Pnt2d P2 = E.Value
+      ((E.FirstParameter() + E.LastParameter()) *0.5);
+    if ((Or == TopAbs_FORWARD) ||
+       (Or == TopAbs_REVERSED)) {
+      gp_Vec2d V(P,P2);
+      Par = V.Magnitude();
+      if (Par >= gp::Resolution()) {
+       L = gp_Lin2d(P,V);
+       myCurEdge++;
+       return Standard_True;
+      }
+    }
+  }
+
+  if (i == myCurEdge + 1) {
+    Par = RealLast();
+    L = gp_Lin2d(P,gp_Dir2d(1,0));
+    myCurEdge++;
+
+    return Standard_True;
+  }
+
+  return Standard_False;
+}
+
+//=======================================================================
+//function : InitWires
+//purpose  : 
+//=======================================================================
+
+void  Geom2dHatch_Elements::InitWires()  {
+  NumWire = 0;
+}
+
+//=======================================================================
+//function : RejectWire NYI
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Geom2dHatch_Elements::RejectWire(const gp_Lin2d& , 
+                                                  const Standard_Real) const 
+{
+  return Standard_False;
+}
+
+//=======================================================================
+//function : InitEdges
+//purpose  : 
+//=======================================================================
+
+void  Geom2dHatch_Elements::InitEdges()  {
+  NumEdge = 0;
+  Iter.Initialize(myMap);
+}
+
+//=======================================================================
+//function : RejectEdge NYI
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Geom2dHatch_Elements::RejectEdge(const gp_Lin2d& , 
+                                                 const Standard_Real ) const 
+{
+  return Standard_False;
+}
+
+
+//=======================================================================
+//function : CurrentEdge
+//purpose  : 
+//=======================================================================
+
+void  Geom2dHatch_Elements::CurrentEdge(Geom2dAdaptor_Curve& E, 
+                                       TopAbs_Orientation& Or) const 
+{
+  void *ptrmyMap = (void *)(&myMap);
+  Geom2dHatch_Element& Item=((Geom2dHatch_MapOfElements*)ptrmyMap)->ChangeFind(Iter.Key());
+
+  E = Item.ChangeCurve();
+  Or= Item.Orientation();
+#if 0 
+  E.Edge() = TopoDS::Edge(myEExplorer.Current());
+  E.Face() = myFace;
+  Or = E.Edge().Orientation();
+#endif
+}
+
+
+//=======================================================================
+//function : MoreWires
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean  Geom2dHatch_Elements::MoreWires() const 
+{
+  return (NumWire == 0);
+}
+
+//=======================================================================
+//function : NextWire
+//purpose  : 
+//=======================================================================
+
+void Geom2dHatch_Elements::NextWire()  {
+  NumWire++;
+}
+
+//=======================================================================
+//function : MoreEdges
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean  Geom2dHatch_Elements::MoreEdges() const  {
+  return(Iter.More());
+}
+
+//=======================================================================
+//function : NextEdge
+//purpose  : 
+//=======================================================================
+
+void Geom2dHatch_Elements::NextEdge()  {
+  Iter.Next();
+}
+
+
+
diff --git a/src/Geom2dHatch/Geom2dHatch_Hatcher.cdl b/src/Geom2dHatch/Geom2dHatch_Hatcher.cdl
new file mode 100644 (file)
index 0000000..b12435f
--- /dev/null
@@ -0,0 +1,491 @@
+-- Created on: 1993-10-25
+-- Created by: Jean Marc LACHAUME
+-- 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.
+
+class Hatcher from Geom2dHatch
+
+uses
+    MapIntegerHasher from TColStd,
+    PointOnHatching  from HatchGen,
+    Orientation      from TopAbs,
+    State            from TopAbs,
+    Domain           from HatchGen,
+    ErrorStatus      from HatchGen,
+    Curve            from Geom2dAdaptor,
+    Intersector      from Geom2dHatch,
+    Element          from Geom2dHatch,
+    Elements         from Geom2dHatch,
+    Hatching         from Geom2dHatch,
+    Hatchings        from Geom2dHatch,
+    Classifier       from Geom2dHatch
+
+raises
+    NoSuchObject      from Standard ,
+    OutOfRange        from Standard ,
+    NotDone           from StdFail
+    
+----------------------------------------------------------------------
+--  class Hatcher description.
+----------------------------------------------------------------------
+
+is
+
+---Category: General use
+
+
+    Create (Intersector : Intersector from Geom2dHatch ;
+           Confusion2d : Real    from Standard ;
+           Confusion3d : Real    from Standard ;
+           KeepPnt     : Boolean from Standard = Standard_False ;
+            KeepSeg     : Boolean from Standard = Standard_False)
+           
+       ---Purpose: Returns an empty hatcher.
+
+       returns Hatcher from Geom2dHatch;
+
+
+    Intersector (me : in out ; Intersector : Intersector from Geom2dHatch)
+    
+       ---Purpose: Sets the associated intersector.
+       is static ;
+       
+
+    Intersector (me : in out)
+    
+       ---Purpose: Returns the associated intersector.
+
+       ---C++: inline
+       ---C++: return const &
+
+       returns Intersector from Geom2dHatch
+       is static ;
+       
+
+    ChangeIntersector (me : in out)
+    
+       ---Purpose: Returns the associated intersector.
+
+       ---C++: inline
+       ---C++: return &
+
+       returns Intersector from Geom2dHatch
+       is static ;
+       
+
+    Confusion2d (me : in out ; Confusion : Real from Standard)
+    
+               ---Purpose: Sets the confusion tolerance.
+
+       is static ;
+
+
+    Confusion2d (me)
+    
+       ---Purpose: Returns the 2d confusion tolerance, i.e. the value under
+       --          which two points are considered identical in the
+       --          parametric space of the hatching.
+       
+       ---C++: inline
+       returns Real from Standard
+       is static ;
+
+
+    Confusion3d (me : in out ; Confusion : Real from Standard)
+    
+               ---Purpose: Sets the confusion tolerance.
+
+       is static ;
+
+
+    Confusion3d (me)
+    
+       ---Purpose: Returns the 3d confusion tolerance, i.e. the value under
+       --          which two points are considered identical in the
+       --          3d space of the hatching.
+
+       ---C++: inline
+       returns Real from Standard
+       is static ;
+
+
+    KeepPoints (me : in out; Keep : Boolean from Standard)
+    
+       ---Purpose: Sets the above flag.
+
+       is static ;
+
+
+    KeepPoints (me)
+    
+       ---Purpose: Returns the flag about the points consideration.
+
+       ---C++: inline
+       returns Boolean from Standard
+       is static ;
+
+
+    KeepSegments (me : in out; Keep : Boolean from Standard)
+    
+       ---Purpose: Sets the above flag.
+
+       is static ;
+
+
+    KeepSegments (me)
+    
+       ---Purpose: Returns the flag about the segments consideration.
+
+       ---C++: inline
+       returns Boolean from Standard
+       is static ;
+
+
+    Clear (me : in out)
+    
+       ---Purpose: Removes all the hatchings and all the elements.
+
+       ---C++: inline
+       is static ;
+
+
+---Category: Element
+
+
+    Element (me : in out ; IndE : Integer from Standard)
+    
+       ---Purpose: Returns the IndE-th element.
+
+       ---Category: Element
+
+       ---C++: inline
+       ---C++: return &
+
+       returns Element from Geom2dHatch
+        raises NoSuchObject from Standard
+       is static protected ;
+
+
+    ElementCurve (me; IndE : Integer from Standard)
+    
+       ---Purpose: Returns the curve associated to the IndE-th element.
+
+       ---Category: Element
+
+       ---C++: inline
+       ---C++: return const &
+
+       returns Curve from Geom2dAdaptor
+       raises NoSuchObject from Standard
+       is static ;
+
+
+    AddElement (me : in out ; Curve       : Curve from Geom2dAdaptor ;
+                             Orientation : Orientation from TopAbs = TopAbs_FORWARD)
+    
+       ---Purpose: Adds an element to the hatcher and returns its index.
+
+       ---Category: Element
+
+       returns Integer from Standard
+       is static ;
+
+
+    RemElement (me : in out ; IndE : Integer from Standard)
+    
+       ---Purpose: Removes the IndE-th element from the hatcher.
+
+       ---Category: Element
+
+       raises NoSuchObject from Standard
+       is static ;
+
+
+    ClrElements (me : in out)
+    
+       ---Purpose: Removes all the elements from the hatcher.
+
+       ---Category: Element
+
+       is static ;
+
+
+---Category: Hatching
+
+
+    Hatching (me : in out ; IndH : Integer from Standard)
+    
+       ---Purpose: Returns the IndH-th hatching.
+
+       ---Category: Hatching
+
+       ---C++: inline
+       ---C++: return &
+
+       returns Hatching from Geom2dHatch
+       raises NoSuchObject from Standard
+       is static protected ;
+
+
+    HatchingCurve (me; IndH : Integer from Standard)
+    
+       ---Purpose: Returns the curve associated to the IndH-th hatching.
+
+       ---Category: Hatching
+
+       ---C++: inline
+       ---C++: return const &
+
+       returns Curve from Geom2dAdaptor
+       raises NoSuchObject from Standard
+       is static ;
+
+
+    AddHatching (me : in out ; Curve : Curve from Geom2dAdaptor)
+    
+       ---Purpose: Adds a hatching to the hatcher and returns its index.
+
+       ---Category: Hatching
+
+       returns Integer from Standard
+        is static ;
+
+
+    RemHatching (me : in out ; IndH : Integer from Standard)
+    
+       ---Purpose: Removes the IndH-th hatching from the hatcher.
+
+       ---Category: Hatching
+
+       raises NoSuchObject from Standard
+       is static ;
+
+
+    ClrHatchings (me : in out)
+    
+       ---Purpose: Removes all the hatchings from the hatcher.
+
+       ---Category: Hatching
+
+       is static ;
+
+
+    NbPoints (me; IndH : Integer from Standard)
+
+       ---Purpose: Returns the number of intersection points of
+       --          the IndH-th hatching.
+
+       ---Category: Hatching - Test
+
+       ---C++: inline
+       returns Integer from Standard
+       raises NoSuchObject from Standard
+       is static ;
+
+
+    Point (me; IndH, IndP : Integer from Standard)
+    
+       ---Purpose: Returns the IndP-th intersection point of the
+       --          IndH-th hatching.
+
+       ---Category: Hatching - Test
+
+       ---C++: inline
+       ---C++: return const &
+
+       returns PointOnHatching from HatchGen
+       raises NoSuchObject from Standard,
+              OutOfRange   from Standard
+       is static ;
+
+
+---Category: Computation - Trimming
+
+    Trim (me : in out)
+    
+       ---Purpose: Trims all the hatchings of the hatcher by all the
+       --          elements of the hatcher.
+
+       is static ;
+
+
+    Trim (me : in out ; Curve : Curve from Geom2dAdaptor)
+    
+       ---Purpose: Adds a hatching to the hatcher and trims it by
+       --          the elements already given and returns its index.
+
+       ---Category: Computation
+
+       returns Integer from Standard
+       is static ;
+
+
+    Trim (me : in out ; IndH : Integer from Standard)
+    
+       ---Purpose: Trims the IndH-th hatching by the elements
+       --          already given.
+
+       ---Category: Computation
+
+       raises NoSuchObject from Standard
+        is static ;
+
+
+    Trim (me : in out ; IndH, IndE : Integer from Standard)
+    
+       ---Purpose: Trims the IndH-th hatching of the hatcher by the
+       --          IndE-th element.
+
+       ---Category: Computation
+
+       returns Boolean from Standard
+       is static private ;
+
+
+---Category: Computation - Domains
+
+    GlobalTransition (me : in out; Point : in out PointOnHatching from HatchGen)
+    
+       ---Purpose: Sets the global transition (the before and after
+       --          states and segment extremities flags) of the point.
+
+       ---Category: Computation - Domains
+
+       returns Boolean from Standard
+       is static private ;
+
+
+    ComputeDomains (me : in out)
+
+       ---Purpose: Computes the domains of all the hatchings.
+
+       ---Category: Computation - Domains
+
+       is static ;
+
+
+    ComputeDomains (me : in out ; IndH : Integer from Standard)
+
+       ---Purpose: Computes the domains of the IndH-th hatching.
+
+       ---Category: Computation - Domains
+
+       raises NoSuchObject from Standard
+       is static ;
+
+
+---Category: Results
+
+    TrimDone (me; IndH : Integer from Standard)
+    
+       ---Purpose: Returns the fact that the intersections were computed
+       --          for the IndH-th hatching. 
+
+       ---C++: inline
+       returns Boolean from Standard
+       raises NoSuchObject from Standard
+       is static ;
+
+
+    TrimFailed (me; IndH : Integer from Standard)
+    
+       ---Purpose: Returns the fact that the intersections failed
+       --          for the IndH-th hatching. 
+
+       ---C++: inline
+       returns Boolean from Standard
+       raises NoSuchObject from Standard
+       is static ;
+
+
+    IsDone (me)
+    
+       ---Purpose: Returns the fact that the domains were computed
+       --          for all the hatchings. 
+
+       ---C++: inline
+       returns Boolean from Standard
+       raises NoSuchObject from Standard
+       is static ;
+
+
+    IsDone (me; IndH : Integer from Standard)
+    
+       ---Purpose: Returns the fact that the domains were computed
+       --          for the IndH-th hatching. 
+
+       returns Boolean from Standard
+       raises NoSuchObject from Standard
+       is static ;
+
+
+    Status (me; IndH : Integer from Standard)
+    
+       ---Purpose: Returns the status about the IndH-th hatching. 
+
+       ---C++: inline
+       returns ErrorStatus from HatchGen
+       raises NoSuchObject from Standard
+       is static ;
+
+
+    NbDomains (me; IndH : Integer from Standard)
+
+       ---Purpose: Returns the number of domains of the IndH-th hatching.
+       --          Only ONE "INFINITE" domain means that the hatching is
+       --          fully included in the contour defined by the elements.
+
+       ---C++: inline
+       returns Integer from Standard
+       raises NoSuchObject from Standard ,
+              NotDone      from StdFail
+       is static ;
+
+
+    Domain (me; IndH : Integer from Standard ;
+               IDom : Integer from Standard )
+
+       ---Purpose: Returns the IDom-th domain of the IndH-th hatching.
+
+       ---C++: return const &
+
+       returns Domain from HatchGen
+       raises NoSuchObject from Standard ,
+              NotDone      from StdFail ,
+              OutOfRange   from Standard
+       is static ;
+
+
+---Category: Dump
+
+    Dump (me)
+    
+       ---Purpose: Dump the hatcher.
+
+       is static ;
+
+
+fields
+
+    myIntersector  : Intersector from Geom2dHatch;
+    myConfusion2d  : Real      from Standard ;
+    myConfusion3d  : Real      from Standard ;
+    myKeepPoints   : Boolean   from Standard ;
+    myKeepSegments : Boolean   from Standard ;
+    myNbElements   : Integer   from Standard ;
+    myElements     : Elements  from Geom2dHatch ;
+    myNbHatchings  : Integer   from Standard ;
+    myHatchings    : Hatchings from Geom2dHatch;
+
+end Hatcher from Geom2dHatch;
diff --git a/src/Geom2dHatch/Geom2dHatch_Hatcher.cxx b/src/Geom2dHatch/Geom2dHatch_Hatcher.cxx
new file mode 100644 (file)
index 0000000..0ff83b0
--- /dev/null
@@ -0,0 +1,1503 @@
+// Created on: 1993-11-04
+// Created by: Jean Marc LACHAUME
+// 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 <Geom2dHatch_Hatcher.ixx>
+
+#include <HatchGen_Domain.hxx>
+#include <HatchGen_Domains.hxx>
+#include <HatchGen_PointOnElement.hxx>
+#include <HatchGen_PointOnHatching.hxx>
+#include <IntRes2d_IntersectionPoint.hxx>
+#include <IntRes2d_IntersectionSegment.hxx>
+#include <IntRes2d_Transition.hxx>
+#include <Precision.hxx>
+#include <TopAbs.hxx>
+#include <TopTrans_CurveTransition.hxx>
+
+#include <Geom2dAdaptor_Curve.hxx>
+#include <Geom2dHatch_Intersector.hxx>
+#include <Geom2dHatch_Classifier.hxx>
+
+#define RAISE_IF_NOSUCHOBJECT 0
+#define TRACE_HATCHER 0
+
+//=======================================================================
+//=======================================================================
+//  Category : General use.
+//=======================================================================
+//=======================================================================
+
+//=======================================================================
+// Function : Geom2dHatch_Hatcher
+// Purpose  : Constructor.
+//=======================================================================
+
+Geom2dHatch_Hatcher::Geom2dHatch_Hatcher (const Geom2dHatch_Intersector&  Intersector,
+                                   const Standard_Real    Confusion2d,
+                                   const Standard_Real    Confusion3d,
+                                   const Standard_Boolean KeepPnt,
+                                   const Standard_Boolean KeepSeg) :
+       myIntersector  (Intersector) ,
+       myConfusion2d  (Confusion2d) ,
+       myConfusion3d  (Confusion3d) ,
+       myKeepPoints   (KeepPnt) ,
+       myKeepSegments (KeepSeg) ,
+       myNbElements   (0) ,
+       myNbHatchings  (0) 
+{
+}
+
+//=======================================================================
+// Function : Intersector
+// Purpose  : Sets the associated intersector.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::Intersector (const Geom2dHatch_Intersector& Intersector)
+{
+  myIntersector = Intersector ;
+  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
+    if (myHatchings.IsBound (IndH)) {
+      Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+      Hatching.ClrPoints() ;
+    }
+  }
+}
+
+
+//=======================================================================
+// Function : Confusion2d
+// Purpose  : Sets the 2dconfusion tolerance.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::Confusion2d (const Standard_Real Confusion)
+{
+  myConfusion2d = Confusion ;
+  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
+    if (myHatchings.IsBound (IndH)) {
+      Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+      Hatching.ClrPoints() ;
+    }
+  }
+}
+
+
+//=======================================================================
+// Function : Confusion3d
+// Purpose  : Sets the 3d confusion tolerance.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::Confusion3d (const Standard_Real Confusion)
+{
+  myConfusion3d = Confusion ;
+  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
+    if (myHatchings.IsBound (IndH)) {
+      Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+      Hatching.ClrPoints() ;
+    }
+  }
+}
+
+//=======================================================================
+// Function : KeepPoints
+// Purpose  : Sets the above flag.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::KeepPoints (const Standard_Boolean Keep)
+{
+  myKeepPoints = Keep ;
+  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
+    if (myHatchings.IsBound (IndH)) {
+      Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+      Hatching.ClrDomains() ;
+    }
+  }
+}
+
+
+//=======================================================================
+// Function : KeepSegments
+// Purpose  : Sets the above flag.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::KeepSegments (const Standard_Boolean Keep)
+{
+  myKeepSegments = Keep ;
+  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
+    if (myHatchings.IsBound (IndH)) {
+      Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+      Hatching.ClrDomains() ;
+    }
+  }
+}
+
+
+
+//=======================================================================
+//=======================================================================
+//  Category : Element.
+//=======================================================================
+//=======================================================================
+
+
+//=======================================================================
+// Function : AddElement
+// Purpose  : Adds an element to the Hatcher and returns its index.
+//=======================================================================
+
+Standard_Integer Geom2dHatch_Hatcher::AddElement (const Geom2dAdaptor_Curve& Curve,
+                                              const TopAbs_Orientation Orientation)
+{
+  Standard_Integer IndE ;
+  for (IndE = 1 ; IndE <= myNbElements && myElements.IsBound(IndE) ; IndE++) ;
+  if (IndE > myNbElements) {
+    myNbElements++ ;
+    IndE = myNbElements ;
+  }
+  Geom2dHatch_Element Element (Curve, Orientation) ;
+  myElements.Bind (IndE, Element) ;
+  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings; IndH++) {
+    if (myHatchings.IsBound(IndH)) {
+      Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+      Hatching.ClrPoints () ;
+    }
+  }
+  return IndE ;
+}
+
+//=======================================================================
+// Function : RemElement
+// Purpose  : Removes the IndE-th element from the hatcher.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::RemElement (const Standard_Integer IndE)
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
+#endif
+  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
+    if (myHatchings.IsBound (IndH)) {
+      Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+      Standard_Boolean DomainsToClear = Standard_False ;
+      for (Standard_Integer IPntH = Hatching.NbPoints() ; IPntH > 0 ; IPntH--) {
+       HatchGen_PointOnHatching PntH = Hatching.ChangePoint (IPntH) ;
+       for (Standard_Integer IPntE = PntH.NbPoints() ; IPntE > 0 ; IPntE--) {
+         if (PntH.Point(IPntE).Index() == IndE) {
+           PntH.RemPoint (IPntE) ;
+           DomainsToClear = Standard_True ;
+         }
+       }
+       if (PntH.NbPoints() == 0) Hatching.RemPoint (IPntH) ;
+      }
+      if (DomainsToClear) Hatching.ClrDomains() ;
+    }
+  }
+  myElements.UnBind (IndE) ;
+  if (IndE == myNbElements) myNbElements-- ;
+}
+
+//=======================================================================
+// Function : ClrElements
+// Purpose  : Removes all the elements from the hatcher.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::ClrElements ()
+{
+  if (myNbElements != 0) {
+    if (myNbHatchings != 0) {
+      for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
+       if (myHatchings.IsBound(IndH)) {
+         Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+         Hatching.ClrPoints() ;
+       }
+      }
+    }
+    myElements.Clear() ;
+    myNbElements = 0 ;
+  }
+}
+
+//=======================================================================
+//=======================================================================
+//  Category : Hatching.
+//=======================================================================
+//=======================================================================
+
+
+//=======================================================================
+// Function : AddHatching
+// Purpose  : Adds a hatching to the hatcher and returns its index.
+//=======================================================================
+
+Standard_Integer Geom2dHatch_Hatcher::AddHatching (const Geom2dAdaptor_Curve& Curve)
+{
+  Standard_Integer IndH ;
+  for (IndH = 1 ; IndH <= myNbHatchings && myHatchings.IsBound(IndH) ; IndH++) ;
+  if (IndH > myNbHatchings) {
+    myNbHatchings++ ;
+    IndH = myNbHatchings ;
+  }
+  Geom2dHatch_Hatching Hatching (Curve) ;
+  myHatchings.Bind (IndH, Hatching) ;
+  return IndH ;
+}
+
+//=======================================================================
+// Function : RemHatching
+// Purpose  : Removes the IndH-th hatching from the hatcher.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::RemHatching (const Standard_Integer IndH)
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+  Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+  Hatching.ClrPoints() ;
+  myHatchings.UnBind (IndH) ;
+  if (IndH == myNbHatchings) myNbHatchings-- ;
+}
+  
+//=======================================================================
+// Function : ClrHatchings
+// Purpose  : Removes all the hatchings from the hatcher.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::ClrHatchings ()
+{
+  if (myNbHatchings != 0) {
+    for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
+      if (myHatchings.IsBound(IndH)) {
+       Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+       Hatching.ClrPoints() ;
+      }
+    }
+    myHatchings.Clear() ;
+    myNbHatchings = 0 ;
+  }
+}
+
+
+
+//=======================================================================
+//=======================================================================
+//  Category : Computation - Trimming
+//=======================================================================
+//=======================================================================
+
+//=======================================================================
+// Function : Trim
+// Purpose  : Trims all the hatchings of the hatcher by all the elements
+//            of the hatcher.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::Trim ()
+{
+  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++)
+    if (myHatchings.IsBound (IndH)) 
+      Trim (IndH) ;
+}
+
+//=======================================================================
+// Function : Trim
+// Purpose  : Adds a hatching to the hatcher and trims it by the elements
+//            already given and returns its index.
+//=======================================================================
+
+Standard_Integer Geom2dHatch_Hatcher::Trim (const Geom2dAdaptor_Curve& Curve)
+{
+  Standard_Integer IndH = AddHatching (Curve) ;
+  Trim (IndH) ;
+  return IndH ;
+}
+
+//=======================================================================
+// Function : Trim
+// Purpose  : Trims the IndH-th hatching by the elements already given.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::Trim (const Standard_Integer IndH)
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+
+  Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+
+  Hatching.ClrPoints() ;
+
+  Standard_Boolean OK, AllOK ;
+
+  AllOK = Standard_True ;
+  for (Standard_Integer IndE = 1 ; IndE <= myNbElements ; IndE++) {
+    if (myElements.IsBound (IndE)) {
+      OK = Trim (IndH, IndE) ;
+      AllOK = AllOK && OK ;
+    }
+  }
+  Hatching.TrimDone (Standard_True) ;
+  Hatching.TrimFailed (!AllOK) ;
+
+  if (AllOK) {
+    for (Standard_Integer IPnt = 1 ; IPnt <= Hatching.NbPoints() ; IPnt++) {
+      HatchGen_PointOnHatching& PntH = Hatching.ChangePoint(IPnt) ;
+      OK = GlobalTransition (PntH) ;
+      AllOK = AllOK && OK ;
+    }
+    Hatching.Status (AllOK ? HatchGen_NoProblem : HatchGen_TransitionFailure) ;
+  }
+}
+
+#if TRACE_HATCHER
+
+//=======================================================================
+// Function : IntersectionPointDump
+// Purpose  : Dump of the intersection point.
+//=======================================================================
+
+static void IntersectionPointDump (const IntRes2d_IntersectionPoint& Pnt,
+                                  const Standard_Integer Index)
+{
+  Standard_Integer SavedPrecision = cout.precision() ;
+  cout.precision (15) ;
+  cout << "----- IntRes2d:: Point # " << setw(3) << Index << " ---------------" << endl ;
+  cout << "-- U: "<<Pnt.Value().X()<<"    V: "<<Pnt.Value().Y()<<endl;
+  cout << "-- Parameter on first   : " << Pnt.ParamOnFirst()  << endl ;
+  cout << "-- Position  on first   : " ;
+  switch (Pnt.TransitionOfFirst().PositionOnCurve()) {
+      case IntRes2d_Head   : cout << "HEAD"   ; break ;
+      case IntRes2d_Middle : cout << "MIDDLE" ; break ;
+      case IntRes2d_End    : cout << "END"    ; break ;
+  }
+  cout << endl ;
+  cout << "-- IntRes2d:: Transition on first  : " ;
+  switch (Pnt.TransitionOfFirst().TransitionType()) {
+      case IntRes2d_In        : cout << "IN"        ; break ;
+      case IntRes2d_Out       : cout << "OUT"       ; break ;
+      case IntRes2d_Touch     : cout << "TOUCH"     ; break ;
+      case IntRes2d_Undecided : cout << "UNDECIDED" ; break ;
+  }
+  cout << endl ;
+  if (Pnt.TransitionOfFirst().TransitionType() == IntRes2d_Touch) {
+    cout << "-- IntRes2d:: Situation on first   : " ;
+    switch (Pnt.TransitionOfFirst().Situation()) {
+       case IntRes2d_Inside  : cout << "INSIDE"  ; break ;
+       case IntRes2d_Outside : cout << "OUTSIDE" ; break ;
+       case IntRes2d_Unknown : cout << "UNKNOWN" ; break ;
+    }
+    cout << endl ;
+  }
+  cout << "--------------------------------------------" << endl ;
+  cout << "-- Parameter on second  : " << Pnt.ParamOnSecond() << endl ;
+  cout << "-- Position  on second  : " ;
+  switch (Pnt.TransitionOfSecond().PositionOnCurve()) {
+      case IntRes2d_Head   : cout << "HEAD"   ; break ;
+      case IntRes2d_Middle : cout << "MIDDLE" ; break ;
+      case IntRes2d_End    : cout << "END"    ; break ;
+  }
+  cout << endl ;
+  cout << "-- IntRes2d:: Transition on second : " ;
+  switch (Pnt.TransitionOfSecond().TransitionType()) {
+      case IntRes2d_In        : cout << "IN"        ; break ;
+      case IntRes2d_Out       : cout << "OUT"       ; break ;
+      case IntRes2d_Touch     : cout << "TOUCH"     ; break ;
+      case IntRes2d_Undecided : cout << "UNDECIDED" ; break ;
+  }
+  cout << endl ;
+  if (Pnt.TransitionOfSecond().TransitionType() == IntRes2d_Touch) {
+    cout << "-- IntRes2d:: Situation on second  : " ;
+    switch (Pnt.TransitionOfSecond().Situation()) {
+       case IntRes2d_Inside  : cout << "INSIDE"  ; break ;
+       case IntRes2d_Outside : cout << "OUTSIDE" ; break ;
+       case IntRes2d_Unknown : cout << "UNKNOWN" ; break ;
+    }
+    cout << endl ;
+  }
+  cout << "--------------------------------------------" << endl ;
+  cout.precision (SavedPrecision) ;
+}
+
+#endif
+
+//=======================================================================
+// Function : Trim
+// Purpose  : Trims the IndH-th hatching of the hatcher by the IndE th
+//            element.
+//=======================================================================
+
+Standard_Boolean Geom2dHatch_Hatcher::Trim (const Standard_Integer IndH,
+                                        const Standard_Integer IndE)
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+  Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
+#endif
+
+  Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+  Geom2dHatch_Element& Element   = myElements.ChangeFind  (IndE) ;
+
+  Geom2dAdaptor_Curve hatching = Hatching.ChangeCurve() ;
+  Geom2dAdaptor_Curve element  = Element.ChangeCurve() ;
+
+  myIntersector.Intersect (hatching, element) ;
+  
+#if TRACE_HATCHER
+  cout << "--- Hatcher - Trim:: Hatching # " << setw(3);
+  cout << IndH << " with Element # " << setw(3);
+  cout << IndE << " ----------" << endl ;
+#endif    
+  
+  if (!myIntersector.IsDone())  { 
+    cout<<" Intersector -> Done = False ";
+    return Standard_False ;
+  }
+  
+#if TRACE_HATCHER
+  if (myIntersector.IsEmpty()) {
+    cout << "No intersection" << endl ;
+    cout << "--------------------------------------------------------------------" << endl ;
+  }
+#endif    
+  
+  if (myIntersector.IsEmpty()) return Standard_True ;
+  
+#if TRACE_HATCHER
+  cout << "Number of intersection points   : " << setw(3) << (myIntersector.NbPoints())   << endl ;
+  cout << "Number of intersection segments : " << setw(3) << (myIntersector.NbSegments()) << endl ;
+#endif    
+  
+  //-----------------------------------------------------------------------
+  // Traitement des points d intersection.
+  //-----------------------------------------------------------------------
+  
+  for (Standard_Integer IPntI = 1 ; IPntI <= myIntersector.NbPoints() ; IPntI++) {
+    const IntRes2d_IntersectionPoint& PntI = myIntersector.Point (IPntI) ;
+    
+#if TRACE_HATCHER
+    IntersectionPointDump (PntI, IPntI) ;
+#endif
+    
+    HatchGen_PointOnElement PntE (PntI) ;
+    PntE.SetIndex (IndE) ;
+    
+    HatchGen_PointOnHatching PntH (PntI) ;
+    PntH.SetIndex (IndH) ;
+    PntH.AddPoint (PntE, myConfusion2d) ;
+    
+    Hatching.AddPoint (PntH, myConfusion2d) ;
+  }
+  
+  //-----------------------------------------------------------------------
+  // Traitement des segments d intersection.
+  //-----------------------------------------------------------------------
+  
+  for (Standard_Integer ISeg = 1 ; ISeg <= myIntersector.NbSegments() ; ISeg++) {
+    
+    const IntRes2d_IntersectionSegment& Seg = myIntersector.Segment (ISeg) ;
+    
+#if TRACE_HATCHER
+    cout << "----- Segment # " << setw(3) << ISeg << " -------------" << endl ;
+#endif
+    
+    Standard_Boolean FirstPoint = Seg.HasFirstPoint() ;
+    Standard_Boolean LastPoint  = Seg.HasLastPoint() ;
+    
+    //-----------------------------------------------------------------------
+    // Les deux points peuvent etre confondus.
+    //-----------------------------------------------------------------------
+    
+    if (FirstPoint && LastPoint) {
+      
+      const IntRes2d_IntersectionPoint& Pnt1 = Seg.FirstPoint() ;
+      const IntRes2d_IntersectionPoint& Pnt2 = Seg.LastPoint()  ;
+      
+      const IntRes2d_Transition& TrsPnt1H = Pnt1.TransitionOfFirst() ;
+      const IntRes2d_Transition& TrsPnt1E = Pnt1.TransitionOfSecond() ;
+      const IntRes2d_Transition& TrsPnt2H = Pnt2.TransitionOfFirst() ;
+      const IntRes2d_Transition& TrsPnt2E = Pnt2.TransitionOfSecond() ;
+      
+      IntRes2d_TypeTrans TypePnt1H = TrsPnt1H.TransitionType() ;
+      IntRes2d_TypeTrans TypePnt1E = TrsPnt1E.TransitionType() ;
+      IntRes2d_TypeTrans TypePnt2H = TrsPnt2H.TransitionType() ;
+      IntRes2d_TypeTrans TypePnt2E = TrsPnt2E.TransitionType() ;
+      
+      //-----------------------------------------------------------------------
+      // Les deux points peuvent etre confondus au regard de la precision du
+      // `hatcher'.
+      //-----------------------------------------------------------------------
+      
+      Standard_Boolean Conf2d = Abs (Pnt1.ParamOnFirst() - Pnt2.ParamOnFirst()) <= myConfusion2d ;
+
+      //-----------------------------------------------------------------------
+      // Les deux points peuvent etre `confondus' au regard des intersections.
+      //-----------------------------------------------------------------------
+
+      Standard_Boolean Conf3d = Standard_False ;
+
+      if (!Conf2d) {
+       Conf3d = Standard_True ;
+       if (Conf3d) Conf3d = TypePnt1H != IntRes2d_Touch && TypePnt1H != IntRes2d_Undecided ;
+       if (Conf3d) Conf3d = TypePnt1E != IntRes2d_Touch && TypePnt1E != IntRes2d_Undecided ;
+       if (Conf3d) Conf3d = TypePnt2H != IntRes2d_Touch && TypePnt2H != IntRes2d_Undecided ;
+       if (Conf3d) Conf3d = TypePnt2E != IntRes2d_Touch && TypePnt2E != IntRes2d_Undecided ;
+       if (Conf3d) Conf3d = TypePnt1H == TypePnt2H      && TypePnt1E == TypePnt2E ;
+       if (Conf3d) Conf3d = Pnt1.Value().Distance (Pnt2.Value()) <= myConfusion3d ;
+      }
+
+      if (Conf2d || Conf3d) {
+       
+       HatchGen_PointOnElement PntE ;
+       PntE.SetIndex (IndE) ;
+       PntE.SetParameter ((Pnt1.ParamOnSecond() + Pnt2.ParamOnSecond()) / 2.) ;
+       switch (TrsPnt1E.PositionOnCurve()) {
+         case IntRes2d_Head: { 
+           PntE.SetPosition(TopAbs_FORWARD) ;
+           break ;
+         }
+         case IntRes2d_Middle: {
+           switch (TrsPnt2E.PositionOnCurve()) {
+              case IntRes2d_Head: {
+                PntE.SetPosition (TopAbs_FORWARD);
+                break;
+              }
+              case IntRes2d_Middle: { 
+                PntE.SetPosition (TopAbs_INTERNAL) ;
+                break ;
+              }
+              case IntRes2d_End: {
+                PntE.SetPosition (TopAbs_REVERSED) ;
+                break ;
+              }
+              default: {
+                break;
+              }
+           }
+           break;
+         }
+         case IntRes2d_End:  { 
+           PntE.SetPosition(TopAbs_REVERSED) ;
+           break ;
+         }
+          default: {
+           break;
+         }
+       }
+       PntE.SetIntersectionType 
+         ((PntE.Position() == TopAbs_INTERNAL) ? HatchGen_TRUE : HatchGen_TOUCH) ;
+       PntE.SetStateBefore ((TypePnt1H == IntRes2d_In) ? TopAbs_OUT : TopAbs_IN) ;
+       PntE.SetStateAfter  ((TypePnt2H == IntRes2d_In) ? TopAbs_OUT : TopAbs_IN) ;
+       
+       HatchGen_PointOnHatching PntH ;
+       PntH.SetIndex (IndH) ;
+       PntH.SetParameter ((Pnt1.ParamOnFirst() + Pnt2.ParamOnFirst()) / 2.) ;
+       switch (TrsPnt1H.PositionOnCurve()) {
+          case IntRes2d_Head: {
+            PntH.SetPosition (TopAbs_FORWARD) ;
+            break ;
+          }
+          case IntRes2d_Middle: {
+            switch (TrsPnt2H.PositionOnCurve()) {
+               case IntRes2d_Head: {
+                 PntH.SetPosition (TopAbs_FORWARD) ;
+                 break ;
+               }
+               case IntRes2d_Middle: {
+                 PntH.SetPosition (TopAbs_INTERNAL) ;
+                 break ;
+               }
+               case IntRes2d_End: {
+                 PntH.SetPosition (TopAbs_REVERSED) ;
+                 break ;
+               }
+               default : {
+                 break ;
+               }
+            }
+            break ;
+          }
+          case IntRes2d_End: {
+            PntH.SetPosition (TopAbs_REVERSED) ;
+            break ;
+          }
+          default : {
+            break ;
+          }
+       }
+
+       PntH.AddPoint (PntE, myConfusion2d) ;
+       Hatching.AddPoint (PntH, myConfusion2d) ;
+       
+#if TRACE_HATCHER
+       IntersectionPointDump (Pnt1, 1) ;
+       IntersectionPointDump (Pnt2, 2) ;
+       cout << "THESE TWO POINTS ARE "
+            << (Conf2d ? "2D" : "3D")
+            << " CONFUSED INTO THE FOLLOWING" << endl ;
+       PntH.Dump() ;
+#endif
+       continue ;
+       
+      }
+      
+      //-----------------------------------------------------------------------
+      // Traitement du premier point du segment.
+      //-----------------------------------------------------------------------
+      
+      if (FirstPoint) {
+       
+       const IntRes2d_IntersectionPoint& PntI = Seg.FirstPoint() ;
+       
+#if TRACE_HATCHER
+       IntersectionPointDump (PntI, 1) ;
+#endif
+       
+       HatchGen_PointOnElement PntE (PntI) ;
+       PntE.SetIndex (IndE) ;
+       PntE.SetSegmentBeginning (Standard_True)  ;
+       PntE.SetSegmentEnd       (Standard_False) ;
+       
+       HatchGen_PointOnHatching PntH (PntI) ;
+       PntH.SetIndex (IndH) ;
+       PntH.AddPoint (PntE, myConfusion2d) ;
+       
+       Hatching.AddPoint (PntH, myConfusion2d) ;
+       
+#if TRACE_HATCHER
+      } 
+      else {
+       cout << "----- Has no first point --------" << endl ;
+       cout << "---------------------------------" << endl ;
+#endif
+       
+      }
+      
+      //-----------------------------------------------------------------------
+      // Traitement du deuxieme point du segment.
+      //-----------------------------------------------------------------------
+      
+      if (LastPoint) {
+       
+       const IntRes2d_IntersectionPoint& PntI = Seg.LastPoint() ;
+       
+#if TRACE_HATCHER
+       IntersectionPointDump (PntI, 2) ;
+#endif
+       
+       HatchGen_PointOnElement PntE (PntI) ;
+       PntE.SetIndex (IndE) ;
+       PntE.SetSegmentBeginning (Standard_False) ;
+       PntE.SetSegmentEnd       (Standard_True)  ;
+       
+       HatchGen_PointOnHatching PntH (PntI) ;
+       PntH.SetIndex (IndH) ;
+       PntH.AddPoint (PntE, myConfusion2d) ;
+       
+       Hatching.AddPoint (PntH, myConfusion2d) ;
+       
+#if TRACE_HATCHER
+      } 
+      else {
+       cout << "----- Has no last point ---------" << endl ;
+       cout << "---------------------------------" << endl ;
+#endif
+      }
+    }
+#if TRACE_HATCHER
+    cout << "--------------------------------------------------------------------" << endl ;
+#endif    
+    
+  }
+  return Standard_True;
+}
+//=======================================================================
+//=======================================================================
+//  Category : Computation - Domains
+//=======================================================================
+//=======================================================================
+
+//=======================================================================
+// Function : GlobalTransition
+// Purpose  : Returns the before and after states of the complex
+//            transition of the IndP-th intersection point of the
+//            IndH-th hatching.
+//=======================================================================
+
+Standard_Boolean Geom2dHatch_Hatcher::GlobalTransition (HatchGen_PointOnHatching& Point)
+{
+  TopAbs_State StateBefore = TopAbs_UNKNOWN ;
+  TopAbs_State StateAfter  = TopAbs_UNKNOWN ;
+  Standard_Boolean SegmentBegin = Standard_False ;
+  Standard_Boolean SegmentEnd   = Standard_False ;
+
+  gp_Dir2d Tangente2d, Normale2d ;
+  gp_Dir   Tangente,   Normale ;
+  Standard_Real Courbure ;
+
+  const Geom2dAdaptor_Curve& CurveH = HatchingCurve (Point.Index()) ;
+
+  myIntersector.LocalGeometry(CurveH.Curve(), Point.Parameter(), Tangente2d, Normale2d, Courbure);
+
+  Tangente.SetCoord (Tangente2d.X(), Tangente2d.Y(), 0.0) ;
+  if (Courbure < Precision::Confusion()) {
+    Normale.SetCoord (-Tangente2d.Y(), Tangente2d.X(), 0.0) ;
+  } else {
+    Normale.SetCoord (Normale2d.X(), Normale2d.Y(), 0.0) ;
+  }
+
+  TopTrans_CurveTransition ComplexTransition ;
+  ComplexTransition.Reset (Tangente, Normale, Courbure) ;
+
+#if TRACE_HATCHER
+  printf("\n ----- Global Transition Complex Transition Reset \n");
+  printf("\n       P:%+10.5g  Tg2d:%+10.5g , %+10.5g  N2d:%+10.5g , %+10.5g  Crv:%+10.5g\n\n",
+  Point.Parameter(),Tangente.X(),Tangente.Y(),Normale.X(),Normale.Y(),Courbure);
+#endif
+  for (Standard_Integer IPntE = 1 ; IPntE <= Point.NbPoints() ; IPntE++) 
+  {
+    const HatchGen_PointOnElement& PntE = Point.Point (IPntE) ;
+    
+    SegmentBegin = SegmentBegin || PntE.SegmentBeginning() ;
+    SegmentEnd   = SegmentEnd   || PntE.SegmentEnd() ;
+    
+    const Geom2dHatch_Element& Element = myElements.Find (PntE.Index()) ;
+    const Geom2dAdaptor_Curve& CurveE = Element.Curve() ;
+    
+    TopAbs_Orientation ElementOrientation = Element.Orientation() ;
+    Standard_Boolean ToReverse = (ElementOrientation == TopAbs_REVERSED);
+    Standard_Real Param ;
+    switch (PntE.Position()) 
+    {
+      case TopAbs_FORWARD  : 
+        Param = ToReverse ? CurveE.LastParameter() : CurveE.FirstParameter() ;
+        break ;
+
+      case TopAbs_INTERNAL : 
+        Param = PntE.Parameter() ;
+        break ;
+
+      case TopAbs_REVERSED : 
+        Param = ToReverse ? CurveE.FirstParameter() : CurveE.LastParameter() ;
+        break ;
+
+      default:
+        break;
+    }
+    
+//-- 
+#if TRACE_HATCHER
+    printf("\n ******** ToReverse: %d Param : %g   ANParam : %g \n",ToReverse,Param,PntE.Parameter());
+#endif
+    Param = PntE.Parameter();
+
+    myIntersector.LocalGeometry(CurveE.Curve(), Param, Tangente2d, Normale2d, Courbure);
+
+//-----------------------------------------------------------------------
+// Calcul de la transition locale. On suppose les relations suivantes :
+//  - Si l orientation de l element est INTERNAL ==> INTERNAL
+//  - Si l orientation de l element est EXTERNAL ==> EXTERNAL
+//  - Si tangence, on a IN-IN  ou OUT-OUT ==> INTERNAL/EXTERNAL
+//  - Sinon,       on a IN-OUT ou OUT-IN  ==> REVERSED/FORWARD 
+// Les deux dernieres conditions avec l element vu en FORWARD.    
+//-----------------------------------------------------------------------
+    TopAbs_Orientation LocalTransition = TopAbs_EXTERNAL;
+
+    if (ElementOrientation == TopAbs_INTERNAL) 
+      LocalTransition = TopAbs_INTERNAL ;
+
+    else if (ElementOrientation == TopAbs_EXTERNAL) 
+      LocalTransition = TopAbs_EXTERNAL ;
+
+    else if (PntE.IntersectionType() == HatchGen_TANGENT) 
+    {
+      if (PntE.Position() == TopAbs_INTERNAL) 
+      {
+        switch (PntE.StateBefore()) 
+        {
+        case TopAbs_IN  : LocalTransition = ToReverse ? TopAbs_EXTERNAL : TopAbs_INTERNAL ; break ;
+        case TopAbs_OUT : LocalTransition = ToReverse ? TopAbs_INTERNAL : TopAbs_EXTERNAL ; break ;
+        default: break;
+        }
+      } 
+      else 
+      {
+        switch (PntE.StateBefore()) 
+        {
+        case TopAbs_IN  : LocalTransition = ToReverse ? TopAbs_FORWARD  : TopAbs_REVERSED ; break ;
+        case TopAbs_OUT : LocalTransition = ToReverse ? TopAbs_REVERSED : TopAbs_FORWARD  ; break ;
+        default: break;
+        }
+      }
+    } 
+    else 
+    {
+      switch (PntE.StateBefore()) 
+      {
+      case TopAbs_IN  : LocalTransition = ToReverse ? TopAbs_FORWARD  : TopAbs_REVERSED ; break ;
+      case TopAbs_OUT : LocalTransition = ToReverse ? TopAbs_REVERSED : TopAbs_FORWARD  ; break ;
+      default: break;
+      }
+    }
+
+//-----------------------------------------------------------------------
+// Orientation de la tangente au point d interference.
+//-----------------------------------------------------------------------
+    TopAbs_Orientation TangenteOrientation = TopAbs_FORWARD;
+    switch (PntE.Position()) 
+    {
+    case TopAbs_FORWARD  : TangenteOrientation = ToReverse ? TopAbs_REVERSED : TopAbs_FORWARD  ; break ;
+    case TopAbs_INTERNAL : TangenteOrientation = TopAbs_INTERNAL ; break ;
+    case TopAbs_REVERSED : TangenteOrientation = ToReverse ? TopAbs_FORWARD  : TopAbs_REVERSED ; break ;
+    
+    default: 
+      break;
+    }
+
+//-----------------------------------------------------------------------
+// Proprietes geometriques.
+//-----------------------------------------------------------------------
+
+    if (ToReverse) {
+      Tangente.SetCoord (-Tangente2d.X(), -Tangente2d.Y(), 0.0) ;
+    } else {
+      Tangente.SetCoord ( Tangente2d.X(),  Tangente2d.Y(), 0.0) ;
+    }
+    Normale.SetCoord ( Normale2d.X(),  Normale2d.Y(), 0.0) ;
+
+#if TRACE_HATCHER
+    printf("\n \n----- Global Transition Complex Transition Compare" );
+    char *str1 = " ??? ";
+    char *str2 = " ??? ";
+    if(LocalTransition == TopAbs_INTERNAL) str1=" INTERNAL ";
+    if(LocalTransition == TopAbs_REVERSED) str1=" REVERSED ";
+    if(LocalTransition == TopAbs_FORWARD)  str1=" FORWARD  ";
+
+    if(TangenteOrientation == TopAbs_INTERNAL) str2=" INTERNAL ";
+    if(TangenteOrientation == TopAbs_REVERSED) str2=" REVERSED ";
+    if(TangenteOrientation == TopAbs_FORWARD)  str2=" FORWARD  ";
+
+    printf("\n       P:%+10.5g  Tg2d:%+10.5g , %+10.5g  N2d:%+10.5g , %+10.5g  Crv:%+10.5g LocalTr:%s TangOrie:%s\n",
+    Param,Tangente.X(),Tangente.Y(),Normale.X(),Normale.Y(),Courbure,str1,str2);
+#endif
+
+    ComplexTransition.Compare (Precision::Angular(),
+                               Tangente, Normale, Courbure,
+                               LocalTransition, TangenteOrientation) ;
+  }
+
+  switch (ComplexTransition.StateBefore()) {
+      case TopAbs_IN      : StateBefore = TopAbs_IN  ; break ;
+      case TopAbs_OUT     : StateBefore = TopAbs_OUT ; break ;
+      case TopAbs_ON      : return Standard_False ;
+      case TopAbs_UNKNOWN : return Standard_False ;
+  }
+  switch (ComplexTransition.StateAfter()) {
+      case TopAbs_IN      : StateAfter = TopAbs_IN  ; break ;
+      case TopAbs_OUT     : StateAfter = TopAbs_OUT ; break ;
+      case TopAbs_ON      : return Standard_False ;
+      case TopAbs_UNKNOWN : return Standard_False ;
+  }
+
+
+#if TRACE_HATCHER
+  printf("\n");
+  printf("\n --> StateBef :"); if(StateBefore==TopAbs_IN) printf(" IN "); else printf(" OUT ");
+  printf("\n --> StateAft :"); if(StateAfter==TopAbs_IN) printf(" IN "); else printf(" OUT ");
+  printf("\n------   Fin GlobalTransition\n");
+#endif
+  
+  Point.SetStateBefore      (StateBefore) ;
+  Point.SetStateAfter       (StateAfter) ;
+  Point.SetSegmentBeginning (SegmentBegin) ;
+  Point.SetSegmentEnd       (SegmentEnd) ;
+  return Standard_True ;
+}
+
+//=======================================================================
+// Function : ComputeDomains
+// Purpose  : Computes the domains of all the hatchings.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::ComputeDomains ()
+{
+  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++)
+    if (myHatchings.IsBound (IndH)) ComputeDomains (IndH) ;
+}
+
+//=======================================================================
+// Function : ComputeDomains
+// Purpose  : Computes the domains of the IndH-th hatching.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::ComputeDomains (const Standard_Integer IndH)
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+  
+  Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+  Hatching.ClrDomains() ;
+
+  Hatching.IsDone (Standard_False) ;
+
+  if (!Hatching.TrimDone()) Trim (IndH) ;
+  if (Hatching.Status() != HatchGen_NoProblem) return ;
+  
+  Standard_Boolean Points   = myKeepPoints ;
+  Standard_Boolean Segments = myKeepSegments ;
+  Standard_Integer ISav = 0 ;
+  Standard_Boolean SavPnt  = Standard_False ;
+  Standard_Integer NbOpenedSegments = 0 ;
+  Standard_Integer NbPnt = Hatching.NbPoints() ;
+  Standard_Integer IPnt =1;
+
+  if (NbPnt == 0) {
+    //-- cout << "The hatching # " << setw(3) << IndH << " has to be classified" << endl ;
+    Geom2dHatch_Classifier Classifier(myElements,Hatching.ClassificationPoint(),0.0000001); 
+    if(Classifier.State() == TopAbs_IN) { 
+      HatchGen_Domain domain ;
+      Hatching.AddDomain (domain) ;
+    }
+    Hatching.IsDone (Standard_True) ;
+    return ;
+  }
+  
+//for (Standard_Integer IPnt = 1 ; IPnt <= NbPnt ; IPnt++) {
+  for (IPnt = 1 ; IPnt <= NbPnt ; IPnt++) {
+    Standard_Boolean NoDomain   = Hatching.NbDomains() == 0 ; 
+    Standard_Boolean FirstPoint = IPnt ==     1 ;
+    Standard_Boolean LastPoint  = IPnt == NbPnt ;
+
+    const HatchGen_PointOnHatching& CurPnt = Hatching.Point (IPnt) ;
+
+#if TRACE_HATCHER
+    cout << "===== ComputeDomains:: Hatching # " << setw(3) << IndH << " =====" << endl ;
+    CurPnt.Dump (IPnt) ;
+    cout << "==========================================" << endl ;
+#endif
+    
+    
+//-----------------------------------------------------------------------
+// Calcul des domaines.
+//-----------------------------------------------------------------------
+
+    TopAbs_State     StateBefore  = CurPnt.StateBefore() ;
+    TopAbs_State     StateAfter   = CurPnt.StateAfter() ;
+    Standard_Boolean SegmentBegin = CurPnt.SegmentBeginning() ;
+    Standard_Boolean SegmentEnd   = CurPnt.SegmentEnd() ;
+
+    HatchGen_Domain domain ;
+
+//-----------------------------------------------------------------------
+// Initialisations dues au premier point.
+//-----------------------------------------------------------------------
+
+    if (FirstPoint) {
+      SavPnt  = Standard_False ;
+      ISav = 0 ;
+      NbOpenedSegments = 0 ;
+      if (SegmentEnd && SegmentBegin) {
+       if (StateAfter  == TopAbs_UNKNOWN) StateAfter  = TopAbs_IN ;
+       if (StateBefore == TopAbs_UNKNOWN) StateBefore = TopAbs_IN ;
+       if (Segments) {
+         SavPnt  = Standard_True ;
+         ISav = 0 ;
+       }
+      } else if (SegmentEnd) {
+       if (StateAfter == TopAbs_UNKNOWN) StateAfter = TopAbs_IN ;
+       if (Segments) {
+         SavPnt  = Standard_True ;
+         ISav = 0 ;
+       }
+      } else if (SegmentBegin) {
+       if (StateBefore == TopAbs_UNKNOWN) StateBefore = TopAbs_IN ;
+       if (StateBefore == TopAbs_IN) {
+         SavPnt  = Standard_True ;
+         ISav = 0 ;
+       }
+      } else {
+       if (StateBefore == TopAbs_IN) {
+         SavPnt  = Standard_True ;
+         ISav = 0 ;
+       }
+      }
+    }
+
+//-----------------------------------------------------------------------
+// Initialisations dues au dernier point.
+//-----------------------------------------------------------------------
+
+    if (LastPoint) {
+      if (SegmentEnd && SegmentBegin) {
+       if (StateAfter  == TopAbs_UNKNOWN) StateAfter  = TopAbs_IN ;
+       if (StateBefore == TopAbs_UNKNOWN) StateBefore = TopAbs_IN ;
+      } else if (SegmentEnd) {
+       if (StateAfter  == TopAbs_UNKNOWN) StateAfter = TopAbs_IN ;
+      } else if (SegmentBegin) {
+       if (StateBefore == TopAbs_UNKNOWN) StateBefore = TopAbs_IN ;
+      } else {
+      }
+    }
+    
+//-----------------------------------------------------------------------
+// Cas general.
+//-----------------------------------------------------------------------
+
+    Standard_Boolean ToAppend = Standard_False ;
+
+    if (SegmentEnd && SegmentBegin) {
+
+      if (StateBefore != TopAbs_IN && StateAfter != TopAbs_IN) {
+       Hatching.Status (HatchGen_IncompatibleStates) ;
+       return ;
+      }
+      if (Points) {
+       if (Segments) {
+         if (!SavPnt) {
+           if(NoDomain) { 
+             Hatching.Status (HatchGen_IncoherentParity) ;
+           }
+           else { 
+             Hatching.IsDone(Standard_True);
+           }
+           return ;
+         }
+         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
+         domain.SetSecondPoint (CurPnt) ;
+         ToAppend = Standard_True ;
+         SavPnt = Standard_True ;
+         ISav = IPnt ;
+       } else {
+         Standard_Boolean isININ = (StateBefore == TopAbs_IN && StateAfter == TopAbs_IN);
+         if (SavPnt && !isININ) {
+           if(NoDomain) { 
+             Hatching.Status (HatchGen_IncoherentParity) ;
+           }
+           else { 
+             Hatching.IsDone(Standard_True);
+           }
+           return ;
+         }
+         domain.SetPoints (CurPnt, CurPnt) ;
+         ToAppend = Standard_True ;
+         SavPnt = Standard_False ;
+         ISav = 0 ;
+       }
+      }
+         
+    } else if (SegmentEnd) {
+
+      if (Segments) {
+       if (StateAfter == TopAbs_OUT) {
+         if (!SavPnt) {
+           if(NoDomain) { 
+             Hatching.Status (HatchGen_IncoherentParity) ;
+           }
+           else { 
+             Hatching.IsDone(Standard_True);
+           }
+           return ;
+         }
+         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
+         domain.SetSecondPoint (CurPnt) ;
+         ToAppend = Standard_True ;
+       } else {
+         if (Points) {
+           if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
+           domain.SetSecondPoint (CurPnt) ;
+           ToAppend = Standard_True ;
+           SavPnt = Standard_True ;
+           ISav = IPnt ;
+         }
+       }
+      } else {
+       if (StateAfter == TopAbs_IN) {
+         SavPnt = Standard_True ;
+         ISav = IPnt ;
+       }
+      }
+      NbOpenedSegments-- ;
+      
+    } else if (SegmentBegin) {
+
+      if (Segments) {
+       if (StateBefore == TopAbs_OUT) {
+         SavPnt = Standard_True ;
+         ISav = IPnt ;
+       } else {
+         if (Points) {
+           if (!SavPnt) {
+             if(NoDomain) { 
+               Hatching.Status (HatchGen_IncoherentParity) ;
+             }
+             else { 
+               Hatching.IsDone(Standard_True);
+             }
+             
+             return ;
+           }
+           if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
+           domain.SetSecondPoint (CurPnt) ;
+           ToAppend = Standard_True ;
+           SavPnt = Standard_True ;
+           ISav = IPnt ;
+         }
+       }
+      } else {
+       if (StateBefore == TopAbs_IN) {
+         if (!SavPnt) {
+           if(NoDomain) { 
+             Hatching.Status (HatchGen_IncoherentParity) ;
+           }
+           else { 
+             Hatching.IsDone(Standard_True);
+           }
+           
+           return ;
+         }
+         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
+         domain.SetSecondPoint (CurPnt) ;
+         ToAppend = Standard_True ;
+//  Modified by Sergey KHROMOV - Fri Jan  5 12:05:30 2001
+//       SavPnt = Standard_False ;
+//       ISav = 0 ;
+         SavPnt = Standard_True ;
+         ISav = IPnt ;
+//  Modified by Sergey KHROMOV - Fri Jan  5 12:05:31 2001
+       }
+      }
+      NbOpenedSegments++ ;
+      
+    } else {
+      //-- ???????????????????????????????????????????????????????????????????????????
+      //-- Solution provisoire (lbr le 11 Aout 97 )
+      //-- si On a 2 points dont des points OUT OUT ou IN IN qui delimitent une isos
+      //-- on transforme les transitions 
+      if (StateBefore == TopAbs_OUT && StateAfter == TopAbs_OUT) {
+       if(NbPnt == 2) { 
+         if(FirstPoint) 
+           StateAfter  = TopAbs_IN; 
+         else
+           StateBefore = TopAbs_IN; 
+       }
+      }
+       //-- ???????????????????????????????????????????????????????????????????????????
+      if        (StateBefore == TopAbs_OUT && StateAfter == TopAbs_OUT) {
+
+       if (SavPnt) {
+         if(NoDomain) { 
+           Hatching.Status (HatchGen_IncoherentParity) ;
+         }
+         else { 
+           Hatching.IsDone(Standard_True);
+         }
+         
+         return ;
+       }
+       if (Points) {
+         domain.SetPoints (CurPnt, CurPnt) ;
+         ToAppend = Standard_True ;
+         SavPnt = Standard_True ;
+         ISav = IPnt ;
+       }
+
+      } else if (StateBefore == TopAbs_OUT && StateAfter == TopAbs_IN ) {
+
+       SavPnt = Standard_True ;
+       ISav = IPnt ;
+
+      } else if (StateBefore == TopAbs_IN  && StateAfter == TopAbs_OUT) {
+
+       if (!SavPnt) {
+         if(NoDomain) { 
+           Hatching.Status (HatchGen_IncoherentParity) ;
+         }
+         else { 
+           Hatching.IsDone(Standard_True);
+         }
+         
+         return ;
+       }
+       if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
+       domain.SetSecondPoint (CurPnt) ;
+       ToAppend = Standard_True ;
+       SavPnt = Standard_False ;
+       ISav = 0 ;
+
+      } else if (StateBefore == TopAbs_IN  && StateAfter == TopAbs_IN ) {
+
+       if (Points) {
+         if (NbOpenedSegments == 0) {
+           if (!SavPnt) {
+             if(NoDomain) { 
+               Hatching.Status (HatchGen_IncoherentParity) ;
+             }
+             else { 
+               Hatching.IsDone(Standard_True);
+             }
+             
+             return ;
+           }
+           if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
+           domain.SetSecondPoint (CurPnt) ;
+           ToAppend = Standard_True ;
+           SavPnt = Standard_True ;
+           ISav = IPnt ;
+         } else {
+           if (Segments) {
+             if (!SavPnt) {
+               if(NoDomain) { 
+                 Hatching.Status (HatchGen_IncoherentParity) ;
+               }
+               else { 
+                 Hatching.IsDone(Standard_True);
+               }
+
+               return ;
+             }
+             if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
+             domain.SetSecondPoint (CurPnt) ;
+             ToAppend = Standard_True ;
+             SavPnt = Standard_True ;
+             ISav = IPnt ;
+           } else {
+             if (SavPnt) {
+               if(NoDomain) { 
+                 Hatching.Status (HatchGen_IncoherentParity) ;
+               }
+               else { 
+                 Hatching.IsDone(Standard_True);
+               }
+               
+               return ;
+             }
+             domain.SetPoints (CurPnt, CurPnt) ;
+             ToAppend = Standard_True ;
+             SavPnt = Standard_False ;
+             ISav = 0 ;
+           }
+         }
+       }
+
+      } else {
+
+       Hatching.Status (HatchGen_IncompatibleStates) ;
+       return ;
+
+      }
+       
+    }
+
+//-----------------------------------------------------------------------
+// Ajout du domaine.
+//-----------------------------------------------------------------------
+
+    if (ToAppend) Hatching.AddDomain (domain) ;
+    
+//-----------------------------------------------------------------------
+// Traitement lie au dernier point.
+//-----------------------------------------------------------------------
+
+    if (LastPoint) {
+      
+      domain.SetPoints () ;
+      ToAppend = Standard_False ;
+      
+      if (SegmentEnd && SegmentBegin) {
+       
+       if (Segments) {
+         if (!SavPnt) {
+           if(NoDomain) { 
+             Hatching.Status (HatchGen_IncoherentParity) ;
+           }
+           else { 
+             Hatching.IsDone(Standard_True);
+           }
+           
+           return ;
+         }
+         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
+         ToAppend = Standard_True ;
+       }
+       
+      } else if (SegmentEnd) {
+
+       if (StateAfter == TopAbs_IN) {
+         if (!SavPnt) {
+           if(NoDomain) { 
+             Hatching.Status (HatchGen_IncoherentParity) ;
+           }
+           else { 
+             Hatching.IsDone(Standard_True);
+           }
+           
+           return ;
+         }
+         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
+         ToAppend = Standard_True ;
+       }
+       
+      } else if (SegmentBegin) {
+       
+       if (Segments) {
+         if (!SavPnt) {
+           if(NoDomain) { 
+             Hatching.Status (HatchGen_IncoherentParity) ;
+           }
+           else { 
+             Hatching.IsDone(Standard_True);
+           }
+           
+           return ;
+         }
+         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
+         ToAppend = Standard_True ;
+       }
+
+      } else {
+       
+       if (StateAfter == TopAbs_IN) {
+         if (!SavPnt) {
+           if(NoDomain) { 
+             Hatching.Status (HatchGen_IncoherentParity) ;
+           }
+           else { 
+             Hatching.IsDone(Standard_True);
+           }
+           
+           return ;
+         }
+         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
+         ToAppend = Standard_True ;
+       }
+
+      }
+      if (ToAppend) Hatching.AddDomain (domain) ;
+    }
+    
+  }
+  Hatching.IsDone(Standard_True) ;
+}
+
+//=======================================================================
+//=======================================================================
+//  Category : Results.
+//=======================================================================
+//=======================================================================
+
+
+//=======================================================================
+// Function : Domain
+// Purpose  : Returns the IDom-th domain of the IndH-th hatching.
+//=======================================================================
+
+const HatchGen_Domain& Geom2dHatch_Hatcher::Domain (const Standard_Integer IndH,
+                                                const Standard_Integer IDom) const
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+  const Geom2dHatch_Hatching& Hatching = myHatchings.Find (IndH) ;
+  StdFail_NotDone_Raise_if (!Hatching.IsDone(), "Geom2dHatch_Hatcher::Domain") ;
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_OutOfRange_Raise_if (IDom < 1 || IDom > Hatching.NbDomains(), "") ;
+#endif
+  const HatchGen_Domain& Domain = Hatching.Domain (IDom) ;
+  return Domain ;
+}
+
+//=======================================================================
+//=======================================================================
+//  Category : Dump.
+//=======================================================================
+//=======================================================================
+
+//=======================================================================
+// Function : Dump
+// Purpose  : Dumps the hatcher.
+//=======================================================================
+
+void Geom2dHatch_Hatcher::Dump () const
+{
+  cout << endl ;
+  cout << "========================================================" << endl ;
+  cout << "=== Dump of the hatcher ================================" << endl ;
+  cout << "========================================================" << endl ;
+  cout << endl ;
+
+  cout << "The points   are "
+       << (myKeepPoints   ? "    " : "not ")
+       << "considered."
+       << endl ;
+  cout << "The segments are "
+       << (myKeepSegments ? "    " : "not ")
+       << "considered."
+       << endl ;
+  cout << "2D Confusion tolerance : " << myConfusion2d << endl ;
+  cout << "3D Confusion tolerance : " << myConfusion3d << endl ;
+  
+  cout << myNbHatchings
+       << " hatching"
+       << ((myNbHatchings == 1) ? "" : "s")
+       << endl ;
+  cout << myNbElements
+       << " element"
+       << ((myNbElements  == 1) ? "" : "s")
+       << endl ;
+  
+  cout << endl ;
+  cout << "========================================================" << endl ;
+  cout << "=== Hatchings ==========================================" << endl ;
+  cout << "========================================================" << endl ;
+  cout << endl ;
+  
+  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
+    cout << "Hatching # " << IndH ;
+    if (!myHatchings.IsBound (IndH)) {
+      cout << " is not bound" << endl ;
+    } else {
+      const Geom2dHatch_Hatching& Hatching = myHatchings.Find (IndH) ;
+      Standard_Integer NbPnt = Hatching.NbPoints() ;
+      cout << " contains " << NbPnt << " restriction points :"  << endl ;
+      for (Standard_Integer IPnt = 1 ; IPnt <= NbPnt ; IPnt++) {
+       const HatchGen_PointOnHatching& PntH = Hatching.Point (IPnt) ;
+        PntH.Dump (IPnt) ;
+      }
+      cout << "----------------------------------------------" << endl ;
+    }
+  }
+
+  cout << endl ;
+  cout << "========================================================" << endl ;
+  cout << "=== Elements ===========================================" << endl ;
+  cout << "========================================================" << endl ;
+  cout << endl ;
+  
+  for (Standard_Integer IndE = 1 ; IndE <= myNbElements ; IndE++) {
+    cout << "Element # " << IndE ;
+    if (!myElements.IsBound (IndE)) {
+      cout << " is not bound" << endl ;
+    } else {
+      const Geom2dHatch_Element& Element = myElements.Find (IndE) ;
+      switch (Element.Orientation()) {
+        case TopAbs_FORWARD  : cout << " is FORWARD"  << endl ; break ;
+        case TopAbs_REVERSED : cout << " is REVERSED" << endl ; break ;
+        case TopAbs_INTERNAL : cout << " is INTERNAL" << endl ; break ;
+        case TopAbs_EXTERNAL : cout << " is EXTERNAL" << endl ; break ;
+      }
+    }
+  }
+
+  cout << endl ;
+}
diff --git a/src/Geom2dHatch/Geom2dHatch_Hatcher.lxx b/src/Geom2dHatch/Geom2dHatch_Hatcher.lxx
new file mode 100644 (file)
index 0000000..51773dd
--- /dev/null
@@ -0,0 +1,262 @@
+// Created on: 1995-01-03
+// Created by: Laurent BUCHARD
+// Copyright (c) 1995-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 RAISE_IF_NOSUCHOBJECT 0
+#define TRACE 0
+
+#include <StdFail_NotDone.hxx>
+
+#include <Geom2dAdaptor_Curve.hxx>
+#include <Geom2dHatch_Intersector.hxx>
+#include <Geom2dHatch_Hatching.hxx>
+#include <Geom2dHatch_Element.hxx>
+
+//=======================================================================
+// Function : Intersector
+// Purpose  : Returns the associated intersector.
+//=======================================================================
+
+inline const Geom2dHatch_Intersector& Geom2dHatch_Hatcher::Intersector ()
+{
+  return myIntersector ;
+}
+
+//=======================================================================
+// Function : ChangeIntersector
+// Purpose  : Returns the associated intersector.
+//=======================================================================
+
+inline Geom2dHatch_Intersector& Geom2dHatch_Hatcher::ChangeIntersector ()
+{
+  return myIntersector ;
+}
+
+//=======================================================================
+// Function : Confusion2d
+// Purpose  : Returns the 2d confusion tolerance.
+//=======================================================================
+
+inline Standard_Real Geom2dHatch_Hatcher::Confusion2d () const
+{
+  return myConfusion2d ;
+}
+
+//=======================================================================
+// Function : Confusion3d
+// Purpose  : Returns the 3d confusion tolerance.
+//=======================================================================
+
+inline Standard_Real Geom2dHatch_Hatcher::Confusion3d () const
+{
+  return myConfusion3d ;
+}
+
+//=======================================================================
+// Function : KeepPoints
+// Purpose  : Returns the flag about the points consideration.
+//=======================================================================
+
+inline Standard_Boolean Geom2dHatch_Hatcher::KeepPoints () const
+{
+  return myKeepPoints ;
+}
+
+//=======================================================================
+// Function : KeepSegments
+// Purpose  : Returns the flag about the segments consideration.
+//=======================================================================
+
+inline Standard_Boolean Geom2dHatch_Hatcher::KeepSegments () const
+{
+  return myKeepSegments ;
+}
+
+//=======================================================================
+// Function : Clear
+// Purpose  : Removes all the hatchings and all the elements.
+//=======================================================================
+
+inline void Geom2dHatch_Hatcher::Clear ()
+{
+  if (myNbHatchings != 0) ClrHatchings () ;
+  if (myNbElements  != 0) ClrElements  () ;
+}
+
+//=======================================================================
+// Function : Element
+// Purpose  : Returns the IndE-th element.
+//=======================================================================
+
+inline Geom2dHatch_Element& Geom2dHatch_Hatcher::Element (const Standard_Integer IndE)
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
+#endif
+  Geom2dHatch_Element& Element = myElements.ChangeFind (IndE) ;
+  return Element ;
+}
+
+//=======================================================================
+// Function : ElementCurve
+// Purpose  : Returns the curve associated to the IndE-th element.
+//=======================================================================
+
+inline const Geom2dAdaptor_Curve& Geom2dHatch_Hatcher::ElementCurve (const Standard_Integer IndE) const
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
+#endif
+  const Geom2dHatch_Element& Element = myElements.Find (IndE) ;
+  return Element.Curve() ;
+}
+
+
+//=======================================================================
+// Function : Hatching
+// Purpose  : Returns the IndH-th hatching.
+//=======================================================================
+
+inline Geom2dHatch_Hatching& Geom2dHatch_Hatcher::Hatching (const Standard_Integer IndH)
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+  Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
+  return Hatching ;
+}
+
+//=======================================================================
+// Function : HatchingCurve
+// Purpose  : Returns the curve associated to the IndH-th hatching.
+//=======================================================================
+
+inline const Geom2dAdaptor_Curve& Geom2dHatch_Hatcher::HatchingCurve (const Standard_Integer IndH) const
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+  const Geom2dHatch_Hatching& Hatching = myHatchings.Find (IndH) ;
+  return Hatching.Curve() ;
+}
+
+//=======================================================================
+// Function : NbPoints
+// Purpose  : Returns the number of intersection points of the IndH-th
+//            hatching.
+//=======================================================================
+
+inline Standard_Integer Geom2dHatch_Hatcher::NbPoints (const Standard_Integer IndH) const
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+  const Geom2dHatch_Hatching& Hatching = myHatchings.Find (IndH) ;
+  return Hatching.NbPoints() ;
+}
+
+//=======================================================================
+// Function : Point
+// Purpose  : Returns the IndP-th intersection point of the IndH-th
+//            hatching.
+//=======================================================================
+
+inline const HatchGen_PointOnHatching& Geom2dHatch_Hatcher::Point (const Standard_Integer IndH,
+                                                        const Standard_Integer IndP) const
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+  const Geom2dHatch_Hatching& Hatching = myHatchings.Find (IndH) ;
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_OutOfRange_Raise_if (IndP < 0 || IndP > Hatching.NbPoints(), "") ;
+#endif
+  const HatchGen_PointOnHatching& PntH = Hatching.Point (IndP) ;
+  return PntH ;
+}
+
+//=======================================================================
+// Function : TrimDone
+// Purpose  : Returns the fact that all the intersections were computed
+//            for the IndH-th hatching. 
+//=======================================================================
+
+inline Standard_Boolean Geom2dHatch_Hatcher::TrimDone (const Standard_Integer IndH) const
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+  const Geom2dHatch_Hatching& Hatching = myHatchings.Find (IndH) ;
+  return Hatching.TrimDone() ;
+}
+//=======================================================================
+// Function : TrimFailed
+// Purpose  : Returns the fact that all the intersections failed
+//            for the IndH-th hatching. 
+//=======================================================================
+
+inline Standard_Boolean Geom2dHatch_Hatcher::TrimFailed (const Standard_Integer IndH) const
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+  const Geom2dHatch_Hatching& Hatching = myHatchings.Find (IndH) ;
+  return Hatching.TrimFailed() ;
+}
+
+//=======================================================================
+// Function : IsDone
+// Purpose  : Returns the fact that all the domains were computed
+//            for the IndH-th hatching. 
+//=======================================================================
+
+inline Standard_Boolean Geom2dHatch_Hatcher::IsDone (const Standard_Integer IndH) const
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+  const Geom2dHatch_Hatching& Hatching = myHatchings.Find (IndH) ;
+  return Hatching.IsDone() ;
+}
+//=======================================================================
+// Function : Status
+// Purpose  : Returns the status about the IndH-th hatching. 
+//=======================================================================
+
+inline HatchGen_ErrorStatus Geom2dHatch_Hatcher::Status (const Standard_Integer IndH) const
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+  const Geom2dHatch_Hatching& Hatching = myHatchings.Find (IndH) ;
+  return Hatching.Status() ;
+}
+//=======================================================================
+// Function : NbDomains
+// Purpose  : Returns the number of domains of the IndH-th hatching.
+//=======================================================================
+
+inline Standard_Integer Geom2dHatch_Hatcher::NbDomains (const Standard_Integer IndH) const
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
+#endif
+  const Geom2dHatch_Hatching& Hatching = myHatchings.Find (IndH) ;
+  StdFail_NotDone_Raise_if (!Hatching.IsDone(), "Geom2dHatch_Hatcher::NbDomains") ;
+  return Hatching.NbDomains() ;
+}
+
+
+
diff --git a/src/Geom2dHatch/Geom2dHatch_Hatching.cdl b/src/Geom2dHatch/Geom2dHatch_Hatching.cdl
new file mode 100644 (file)
index 0000000..4827702
--- /dev/null
@@ -0,0 +1,257 @@
+-- Created on: 1993-11-10
+-- Created by: Jean Marc LACHAUME
+-- 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.
+
+class Hatching from Geom2dHatch
+
+uses
+    ErrorStatus      from HatchGen ,
+    PointOnHatching  from HatchGen ,
+    PointsOnHatching from HatchGen ,
+    Domain           from HatchGen ,
+    Domains          from HatchGen , 
+    Pnt2d            from gp,
+    Curve            from Geom2dAdaptor
+
+raises
+    OutOfRange   from Standard
+
+is
+
+     Create
+       
+       returns Hatching from Geom2dHatch;
+
+
+    Create (Curve : Curve from Geom2dAdaptor)
+    
+       ---Purpose: Creates a hatching.
+
+       returns Hatching from Geom2dHatch ;
+
+
+    Curve (me)
+    
+       ---Purpose: Returns the curve associated to the hatching.
+
+       ---C++: return const &
+
+        returns Curve from Geom2dAdaptor
+        is static ;
+
+
+    ChangeCurve (me : in out)
+    
+       ---Purpose: Returns the curve associated to the hatching.
+
+       ---C++: return &
+
+        returns Curve from Geom2dAdaptor
+        is static ;
+
+
+    TrimDone (me : in out ; Flag : Boolean from Standard)
+
+       ---Purpose: Sets the flag about the trimming computations to the
+       --          given value.
+
+       is static ;
+
+
+    TrimDone (me)
+
+       ---Purpose: Returns the flag about the trimming computations.
+
+       returns Boolean from Standard
+       is static ;
+
+
+    TrimFailed (me : in out ; Flag : Boolean from Standard)
+
+       ---Purpose: Sets the flag about the trimming failure to the
+       --          given value.
+
+       is static ;
+
+
+    TrimFailed (me)
+
+       ---Purpose: Returns the flag about the trimming failure.
+
+       returns Boolean from Standard
+       is static ;
+
+
+    IsDone (me : in out ; Flag : Boolean from Standard)
+
+       ---Purpose: Sets the flag about the domains computation to the
+       --          given value.
+
+       is static ;
+
+
+    IsDone (me)
+
+       ---Purpose: Returns the flag about the domains computation.
+
+       returns Boolean from Standard
+       is static ;
+
+
+    Status (me : in out ; Status : ErrorStatus from HatchGen)
+
+       ---Purpose: Sets the error status.
+
+       is static ;
+
+
+    Status (me)
+
+       ---Purpose: Returns the error status.
+
+       returns ErrorStatus from HatchGen
+       is static ;
+
+
+---Category: Points on hatching.
+
+    AddPoint (me : in out ; Point     : PointOnHatching from HatchGen ;
+                           Confusion : Real            from Standard)
+    
+       ---Purpose: Adds an intersection point to the hatching.
+
+       is static ;
+
+
+    NbPoints (me)
+    
+       ---Purpose: Returns the number of intersection points
+       --          of the hatching.
+
+        returns Integer from Standard
+        is static ;
+
+
+    Point (me ; Index : Integer from Standard)
+    
+       ---Purpose: Returns the Index-th intersection point of the
+       --          hatching.
+       --          The exception OutOfRange is raised if
+       --          Index < 1 or Index > NbPoints.
+
+       ---C++: return const &
+
+       returns PointOnHatching from HatchGen
+       raises OutOfRange from Standard
+       is static ;
+
+
+    ChangePoint (me : in out ; Index : Integer from Standard)
+    
+       ---Purpose: Returns the Index-th intersection point of the
+       --          hatching.
+       --          The exception OutOfRange is raised if
+       --          Index < 1 or Index > NbPoints.
+
+       ---C++: return &
+
+       returns PointOnHatching from HatchGen
+       raises OutOfRange from Standard
+       is static ;
+
+
+    RemPoint (me : in out ; Index : Integer from Standard)
+    
+       ---Purpose: Removes the Index-th intersection point of the
+       --          hatching.
+       --          The exception OutOfRange is raised if
+       --          Index < 1 or Index > NbPoints.
+
+       raises OutOfRange from Standard
+       is static ;
+
+
+    ClrPoints (me : in out)
+    
+       ---Purpose: Removes all the intersection points of the hatching.
+
+       is static ;
+
+
+---Category: Domains.
+
+
+    AddDomain (me : in out ; Domain : Domain from HatchGen)
+    
+       ---Purpose: Adds a domain to the hatching.
+
+       is static ;
+
+
+    NbDomains (me)
+    
+       ---Purpose: Returns the number of domains of the hatching.
+
+        returns Integer from Standard
+        is static ;
+
+
+    Domain (me ; Index : Integer from Standard)
+    
+       ---Purpose: Returns the Index-th domain of the hatching.
+       --          The exception OutOfRange is raised if
+       --          Index < 1 or Index > NbDomains.
+
+       ---C++: return const &
+
+       returns Domain from HatchGen
+       raises OutOfRange from Standard
+       is static ;
+
+
+    RemDomain (me : in out ; Index : Integer from Standard)
+    
+       ---Purpose: Removes the Index-th domain of the hatching.
+       --          The exception OutOfRange is raised if
+       --          Index < 1 or Index > NbDomains.
+
+       raises OutOfRange from Standard
+       is static ;
+
+
+    ClrDomains (me : in out)
+    
+       ---Purpose: Removes all the domains of the hatching.
+
+       is static ;
+
+
+    ClassificationPoint (me) 
+       ---Purpose: Returns a point on the curve. 
+       --          This point will be used for the classification.
+    returns Pnt2d from gp
+    is static;
+       
+fields
+
+    myCurve      : Curve from Geom2dAdaptor ;
+    myTrimDone   : Boolean          from Standard ;
+    myTrimFailed : Boolean          from Standard ;
+    myPoints     : PointsOnHatching from HatchGen ;
+    myIsDone     : Boolean          from Standard ;
+    myStatus     : ErrorStatus      from HatchGen ;
+    myDomains    : Domains          from HatchGen ;
+
+end Hatching from Geom2dHatch ;
diff --git a/src/Geom2dHatch/Geom2dHatch_Hatching.cxx b/src/Geom2dHatch/Geom2dHatch_Hatching.cxx
new file mode 100644 (file)
index 0000000..1c55ea3
--- /dev/null
@@ -0,0 +1,335 @@
+// Created on: 1993-11-03
+// Created by: Jean Marc LACHAUME
+// 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 <Geom2dHatch_Hatching.ixx>
+
+#include <HatchGen_PointOnElement.hxx>
+#include <Geom2dAdaptor_Curve.hxx>
+
+#define RAISE_IF_NOSUCHOBJECT 0
+
+#include <Precision.hxx>
+//=======================================================================
+// Function : Geom2dHatch_Hatching
+// Purpose  : Constructor.
+//=======================================================================
+
+Geom2dHatch_Hatching::Geom2dHatch_Hatching () {
+}
+
+//=======================================================================
+// Function : Geom2dHatch_Hatching
+// Purpose  : Constructor.
+//=======================================================================
+
+Geom2dHatch_Hatching::Geom2dHatch_Hatching (const Geom2dAdaptor_Curve& Curve) :
+       myCurve      (Curve),
+       myTrimDone   (Standard_False),
+       myTrimFailed (Standard_False),
+       myIsDone     (Standard_False),
+       myStatus     (HatchGen_NoProblem)
+{
+}
+
+//=======================================================================
+// Function : Curve
+// Purpose  : Returns the curve associated to the hatching.
+//=======================================================================
+
+const Geom2dAdaptor_Curve& Geom2dHatch_Hatching::Curve () const
+{
+  return myCurve ;
+}
+     
+//=======================================================================
+// Function : ChangeCurve
+// Purpose  : Returns the curve associated to the hatching.
+//=======================================================================
+
+Geom2dAdaptor_Curve& Geom2dHatch_Hatching::ChangeCurve ()
+{
+  return myCurve ;
+}
+     
+//=======================================================================
+// Function : TrimDone
+// Purpose  : Sets the flag about the trimmings computation to the given
+//            value.
+//=======================================================================
+
+void Geom2dHatch_Hatching::TrimDone (const Standard_Boolean Flag)
+{
+  myTrimDone = Flag ;
+}
+
+//=======================================================================
+// Function : TrimDone
+// Purpose  : Returns the flag about the trimmings computation.
+//=======================================================================
+
+Standard_Boolean Geom2dHatch_Hatching::TrimDone () const
+{
+  return myTrimDone ;
+}
+
+//=======================================================================
+// Function : TrimFailed
+// Purpose  : Sets the flag about the trimmings failure to the given
+//            value.
+//=======================================================================
+
+void Geom2dHatch_Hatching::TrimFailed (const Standard_Boolean Flag)
+{
+  myTrimFailed = Flag ;
+  if (myTrimFailed) myStatus = HatchGen_TrimFailure ;
+}
+
+//=======================================================================
+// Function : TrimFailed
+// Purpose  : Returns the flag about the trimmings failure.
+//=======================================================================
+
+Standard_Boolean Geom2dHatch_Hatching::TrimFailed () const
+{
+  return myTrimFailed ;
+}
+
+//=======================================================================
+// Function : IsDone
+// Purpose  : Sets the flag about the domains computation to the given
+//            value.
+//=======================================================================
+
+void Geom2dHatch_Hatching::IsDone (const Standard_Boolean Flag)
+{
+  myIsDone = Flag ;
+}
+
+//=======================================================================
+// Function : IsDone
+// Purpose  : Returns the flag about the domains computation.
+//=======================================================================
+
+Standard_Boolean Geom2dHatch_Hatching::IsDone () const
+{
+  return myIsDone ;
+}
+
+//=======================================================================
+// Function : SetStatus
+// Purpose  : Sets the error status.
+//=======================================================================
+
+void Geom2dHatch_Hatching::Status (const HatchGen_ErrorStatus Status)
+{
+  myStatus = Status ;
+}
+
+//=======================================================================
+// Function : Status
+// Purpose  : Returns the error status.
+//=======================================================================
+
+HatchGen_ErrorStatus Geom2dHatch_Hatching::Status () const
+{
+  return myStatus ;
+}
+
+//=======================================================================
+// Function : AddPoint
+// Purpose  : Adds an intersection point to the hatching.
+//=======================================================================
+
+void Geom2dHatch_Hatching::AddPoint (const HatchGen_PointOnHatching& Point,
+                                    const Standard_Real Confusion)
+{
+  Standard_Integer NbPoints = myPoints.Length () ;
+//for (Standard_Integer IPntH = 1 ; IPntH <= NbPoints ; IPntH++) {
+  Standard_Integer IPntH;
+  for (IPntH = 1 ; IPntH <= NbPoints ; IPntH++) {
+    const HatchGen_PointOnHatching& PntH = myPoints.Value (IPntH) ;
+    if (!PntH.IsLower (Point, Confusion)) break ;
+  }
+  if (IPntH > NbPoints) {
+    myPoints.Append (Point) ;
+  } else {
+    HatchGen_PointOnHatching& PntH = myPoints.ChangeValue (IPntH) ;
+    if (PntH.IsGreater (Point, Confusion)) {
+      myPoints.InsertBefore (IPntH, Point) ;
+    } else {
+      for (Standard_Integer IPntE = 1 ; IPntE <= Point.NbPoints() ; IPntE++) {
+       const HatchGen_PointOnElement& PntE = Point.Point (IPntE) ;
+       PntH.AddPoint (PntE, Confusion) ;
+      }
+    }
+  }
+  if (myIsDone) ClrDomains() ;
+}
+
+//=======================================================================
+// Function : NbPoints
+// Purpose  : Returns the number of intersection points on the hatching.
+//=======================================================================
+
+Standard_Integer Geom2dHatch_Hatching::NbPoints () const
+{
+  return myPoints.Length () ;
+}
+     
+//=======================================================================
+// Function : Point
+// Purpose  : Returns the Index-th intersection point on the hatching.
+//=======================================================================
+
+const HatchGen_PointOnHatching& Geom2dHatch_Hatching::Point (const Standard_Integer Index) const
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_Integer NbPoints = myPoints.Length () ;
+  Standard_OutOfRange_Raise_if (Index < 1 || Index > NbPoints, "") ;
+#endif
+  const HatchGen_PointOnHatching& Point = myPoints.Value (Index) ;
+  return Point ;
+}
+     
+//=======================================================================
+// Function : ChangePoint
+// Purpose  : Returns the Index-th intersection point on the hatching.
+//=======================================================================
+
+HatchGen_PointOnHatching& Geom2dHatch_Hatching::ChangePoint (const Standard_Integer Index) 
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_Integer NbPoints = myPoints.Length () ;
+  Standard_OutOfRange_Raise_if (Index < 1 || Index > NbPoints, "") ;
+#endif
+  HatchGen_PointOnHatching& Point = myPoints.ChangeValue (Index) ;
+  return Point ;
+}
+     
+//=======================================================================
+// Function : RemPoint
+// Purpose  : Removes the Index-th intersection point of the hatching.
+//=======================================================================
+
+void Geom2dHatch_Hatching::RemPoint (const Standard_Integer Index)
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_Integer NbPoints = myPoints.Length () ;
+  Standard_OutOfRange_Raise_if (Index < 1 || Index > NbPoints, "") ;
+#endif
+  if (myIsDone) ClrDomains() ;
+  myPoints.Remove (Index) ;
+}
+
+//=======================================================================
+// Function : ClrPoints
+// Purpose  : Removes all the intersection points of the hatching.
+//=======================================================================
+
+void Geom2dHatch_Hatching::ClrPoints ()
+{
+  if (myIsDone) ClrDomains() ;
+  for (Standard_Integer IPntH = 1 ; IPntH <= myPoints.Length() ; IPntH++) {
+    HatchGen_PointOnHatching& Point = myPoints.ChangeValue (IPntH) ;
+    Point.ClrPoints() ;
+  }
+  myPoints.Clear () ;
+  myTrimDone   = Standard_False ;
+  myTrimFailed = Standard_False ;
+}
+
+//=======================================================================
+// Function : AddDomain
+// Purpose  : Adds a domain to the hatching.
+//=======================================================================
+
+void Geom2dHatch_Hatching::AddDomain (const HatchGen_Domain& Domain)
+{
+  myDomains.Append (Domain) ;
+}
+
+//=======================================================================
+// Function : NbDomains
+// Purpose  : Returns the number of domains on the hatching.
+//=======================================================================
+
+Standard_Integer Geom2dHatch_Hatching::NbDomains () const
+{
+  return myDomains.Length () ;
+}
+     
+//=======================================================================
+// Function : Domain
+// Purpose  : Returns the Index-th domain on the hatching.
+//=======================================================================
+
+const HatchGen_Domain& Geom2dHatch_Hatching::Domain (const Standard_Integer Index) const
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_Integer NbDomains = myDomains.Length () ;
+  Standard_OutOfRange_Raise_if (Index < 1 || Index > NbDomains, "") ;
+#endif
+  const HatchGen_Domain& Domain = myDomains.Value (Index) ;
+  return Domain ;
+}
+     
+//=======================================================================
+// Function : RemDomain
+// Purpose  : Removes the Index-th domain of the hatching.
+//=======================================================================
+
+void Geom2dHatch_Hatching::RemDomain (const Standard_Integer Index)
+{
+#if RAISE_IF_NOSUCHOBJECT
+  Standard_Integer NbDomains = myDomains.Length () ;
+  Standard_OutOfRange_Raise_if (Index < 1 || Index > NbDomains, "") ;
+#endif
+  myDomains.Remove (Index) ;
+}
+
+//=======================================================================
+// Function : ClrDomains
+// Purpose  : Removes all the domains of the hatching.
+//=======================================================================
+
+void Geom2dHatch_Hatching::ClrDomains ()
+{
+  myDomains.Clear () ;
+  myIsDone = Standard_False ;
+}
+
+//=======================================================================
+// Function : ClassificationPoint
+// Purpose  : returns a 2d point on the curve 
+//=======================================================================
+gp_Pnt2d Geom2dHatch_Hatching::ClassificationPoint () const { 
+  Standard_Real t,a,b;
+  a = myCurve.FirstParameter();
+  b = myCurve.LastParameter();
+  if(b >= Precision::Infinite()) { 
+    if(a <= -Precision::Infinite()) { 
+      t=0;
+    }
+    else { 
+      t = a;
+    }
+  }
+  else { 
+    t = b; 
+  }
+  return(myCurve.Value(t));
+}
+    
index 941bc0c..b2cfbd8 100644 (file)
 package HatchGen
 
 uses
-    IntRes2d ,
-    StdFail ,
-    TopAbs ,
-    TCollection ,
-    TColStd,
-    gp,
-    TopClass
+    IntRes2d,
+    StdFail,
+    TopAbs,
+    TCollection,
+    gp
 
 is
 
@@ -65,17 +63,6 @@ is
     class Domain ;
     class Domains instantiates Sequence from TCollection
        (Domain from HatchGen) ;
-       
-    generic class HatchingGen ;
-    generic class ElementGen ;
-    generic class ElementsGen,MapOfElements;
-    
-    generic class Hatcher ,
-                  Hatching ,
-                 Hatchings ,
-                  Element ,
-                  Elements,
-                  Classifier;
 
 
 end HatchGen ;
diff --git a/src/HatchGen/HatchGen_ElementGen.cdl b/src/HatchGen/HatchGen_ElementGen.cdl
deleted file mode 100644 (file)
index 3e98bba..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
--- Created on: 1993-11-10
--- Created by: Jean Marc LACHAUME
--- 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.
-
-generic class ElementGen from HatchGen (TheElementCurve as any)
-
-uses
-    Orientation from TopAbs
-
-is
-
-
-    Create
-    
-       returns ElementGen from HatchGen;
-
-    Create (Other : ElementGen  from HatchGen) 
-    
-       ---Purpose: Magic constructor.
-
-       returns ElementGen from HatchGen ;
-     
-
-    Create (Curve       : TheElementCurve ;
-           Orientation : Orientation from TopAbs = TopAbs_FORWARD)
-    
-       ---Purpose: Creates an element.
-
-       returns ElementGen from HatchGen ;
-
-
-    Curve (me)
-    
-       ---Purpose: Returns the curve associated to the element.
-
-       ---C++: return const &
-
-        returns TheElementCurve
-        is static ;
-
-
-    ChangeCurve (me : in out)
-    
-       ---Purpose: Returns the curve associated to the element.
-
-       ---C++: return &
-
-        returns TheElementCurve
-        is static ;
-
-
-    Orientation (me : in out ; Orientation : Orientation from TopAbs)
-
-       ---Purpose: Sets the orientation of the element.
-
-       is static ;
-
-
-    Orientation (me)
-
-       ---Purpose: Returns the orientation of the element.
-
-       returns Orientation from TopAbs
-       is static ;
-
-
-fields
-
-    myCurve       : TheElementCurve ;
-    myOrientation : Orientation from TopAbs ;
-
-end ElementGen from HatchGen ;
diff --git a/src/HatchGen/HatchGen_ElementGen.gxx b/src/HatchGen/HatchGen_ElementGen.gxx
deleted file mode 100644 (file)
index 3759929..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-// Created on: 1993-11-03
-// Created by: Jean Marc LACHAUME
-// 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.
-
-//=======================================================================
-// Function : HatchGen_ElementGen
-// Purpose  : Magic Constructor.
-//=======================================================================
-
-HatchGen_ElementGen::HatchGen_ElementGen (const HatchGen_ElementGen& Other) 
-: myCurve(Other.myCurve), myOrientation(Other.myOrientation) { 
-}
-  
-//=======================================================================
-// Function : HatchGen_ElementGen
-// Purpose  : Empty Constructor.
-//=======================================================================
-
-HatchGen_ElementGen::HatchGen_ElementGen () { 
-}
-  
-//=======================================================================
-// Function : HatchGen_ElementGen
-// Purpose  : Constructor.
-//=======================================================================
-
-HatchGen_ElementGen::HatchGen_ElementGen (const TheElementCurve& Curve,
-                                         const TopAbs_Orientation Orientation) :
-       myCurve       (Curve),
-       myOrientation (Orientation)
-{
-}
-  
-//=======================================================================
-// Function : Curve
-// Purpose  : Returns the curve associated to the hatching.
-//=======================================================================
-
-const TheElementCurve& HatchGen_ElementGen::Curve () const
-{
-  return myCurve ;
-}
-
-//=======================================================================
-// Function : ChangeCurve
-// Purpose  : Returns the curve associated to the hatching.
-//=======================================================================
-
-TheElementCurve& HatchGen_ElementGen::ChangeCurve ()
-{
-  return myCurve ;
-}
-
-//=======================================================================
-// Function : Orientation
-// Purpose  : Sets the orientation of the element.
-//=======================================================================
-
-void HatchGen_ElementGen::Orientation (const TopAbs_Orientation Orientation)
-{
-  myOrientation = Orientation ;
-}
-
-//=======================================================================
-// Function : Orientation
-// Purpose  : Returns the orientation of the element.
-//=======================================================================
-
-TopAbs_Orientation HatchGen_ElementGen::Orientation () const
-{
-  return myOrientation ;
-}
-
-
-
diff --git a/src/HatchGen/HatchGen_ElementsGen.cdl b/src/HatchGen/HatchGen_ElementsGen.cdl
deleted file mode 100644 (file)
index 53ba8c7..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
--- Created on: 1994-12-16
--- Created by: Laurent BUCHARD
--- Copyright (c) 1994-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.
-
--- Modified by skv - Fri Jul 14 16:46:18 2006 OCC12627
-
-
-generic class ElementsGen from HatchGen
-   (TheKey          as any;
-    TheItem         as any;
-    TheHasher       as any;
-    TheCurve        as any)
-    
-
-uses 
-    Orientation      from TopAbs,
-    Lin2d            from gp,
-    Pnt2d            from gp
-
-raises         
-    DomainError  from Standard,
-    NoSuchObject from Standard
-
-
-private class MapOfElements from HatchGen instantiates 
-    DataMap from TCollection
-           (TheKey,
-            TheItem,
-            TheHasher);
-
-
-is 
-
-    Create
-    returns ElementsGen from HatchGen;
-
-    Create(Other : ElementsGen from HatchGen)
-    returns ElementsGen from HatchGen;
-
-        
-
-----------------------------------------------------------------------
---               E m u l a t i o n   o f   D a t a M a p  
---               
---                  f r o m  T C o l l e c t  i o n                                                                          
-----------------------------------------------------------------------
-    Clear(me : in out)
-       ---C++: alias ~
-    is static;
-
-    Bind(me : in out; K : TheKey; I : TheItem) returns Boolean
-    is static;
-
-    IsBound(me; K : TheKey) returns Boolean
-    is static;
-    
-    UnBind(me : in out; K : TheKey) returns Boolean
-    is static;
-    
-    Find(me; K : TheKey) returns any TheItem
-    raises NoSuchObject from Standard  -- when <K> is not in the map.
-       ---C++: alias operator()
-       ---C++: return const &
-    is static;
-    
-    ChangeFind(me : in out; K : TheKey) returns any TheItem
-    raises NoSuchObject from Standard  -- when <K> is not in the map.
-       ---C++: alias operator()
-       ---C++: return &
-    is static;
-
-----------------------------------------------------------------------
---      M e t h o d s   u s e d   b y   t h e   C l a s s i f i e r 
---      
---      see BRepClass_FaceExplorer for the Purposes
-----------------------------------------------------------------------
-
-    Reject(me;  P : Pnt2d from gp) 
-        returns Boolean from Standard
-    is static;
-    
--- Modified by skv - Fri Jul 14 16:46:18 2006 OCC12627 Begin
-    Segment(me: in out;  P   :     Pnt2d from gp;
-                        L   : out Lin2d from gp; 
-                         Par : out Real)
-    returns  Boolean from Standard
-    is static;
-    
-    OtherSegment(me: in out;  P   :     Pnt2d from gp;
-                             L   : out Lin2d from gp; 
-                              Par : out Real)
-    returns Boolean from Standard
-    is static;
-    
--- Modified by skv - Fri Jul 14 16:46:18 2006 OCC12627 End
-
-    InitWires(me : in out)
-    is static;
-    
-    MoreWires(me) returns
-       Boolean from Standard
-    is static;
-       
-    NextWire(me : in out)
-    is static;
-    
-    RejectWire(me; L : Lin2d from gp; 
-                 Par : Real  from Standard) 
-       returns Boolean from Standard
-    is static;
-    
-    InitEdges(me : in out)
-    is static;
-    
-    MoreEdges(me) 
-       returns Boolean from Standard
-    is static;
-    
-    NextEdge(me  : in out) 
-    is static;
-
-    RejectEdge(me; L : Lin2d from gp; 
-                 Par : Real  from Standard) 
-       returns Boolean from Standard
-    is static;
-    
-    CurrentEdge(me; E : out TheCurve;
-                  Or : out Orientation from TopAbs)
-    is static;
-    
-
-fields 
-
-    myMap    : MapOfElements; 
-    Iter     : DataMapIteratorOfMapOfElements;
-    NumWire  : Integer from Standard;
-    NumEdge  : Integer from Standard;
-    myCurEdge: Integer from Standard;
-    
-end ElementsGen from HatchGen; 
diff --git a/src/HatchGen/HatchGen_ElementsGen.gxx b/src/HatchGen/HatchGen_ElementsGen.gxx
deleted file mode 100644 (file)
index 4cc9038..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-// Created on: 1994-12-16
-// Created by: Laurent BUCHARD
-// Copyright (c) 1994-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.
-
-//  Modified by skv - Fri Jul 14 17:03:47 2006 OCC12627
-
-#include <TopAbs_Orientation.hxx>
-#include <gp.hxx>
-#include <gp_Vec2d.hxx>
-
-//HatchGen_ElementsGen::HatchGen_ElementsGen(const HatchGen_ElementsGen& Other) {
-HatchGen_ElementsGen::HatchGen_ElementsGen(const HatchGen_ElementsGen& ) {
-  cout<<" Magic Constructor in HatchGen_ElementsGen:: "<<endl;
-} 
-
-HatchGen_ElementsGen::HatchGen_ElementsGen() { 
-  NumWire = 0;
-  NumEdge = 0;
-  myCurEdge = 1;
-}
-
-void HatchGen_ElementsGen::Clear() { 
-  myMap.Clear();
-}
-
-Standard_Boolean HatchGen_ElementsGen::IsBound(const TheKey& K) const  { 
-  return(myMap.IsBound(K));
-}
-
-Standard_Boolean HatchGen_ElementsGen::UnBind(const TheKey& K) { 
-  return(myMap.UnBind(K));
-}
-
-Standard_Boolean HatchGen_ElementsGen::Bind(const TheKey& K,const TheItem& I) { 
-  return(myMap.Bind(K,I));
-}
-
-const TheItem& HatchGen_ElementsGen::Find(const TheKey& K) const { 
-  return(myMap.Find(K));
-}
-
-TheItem& HatchGen_ElementsGen::ChangeFind(const TheKey& K)  { 
-  return(myMap.ChangeFind(K));
-}
-
-//=======================================================================
-//function : Reject
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean  HatchGen_ElementsGen::Reject(const gp_Pnt2d&) const  {
-  return Standard_False;
-}
-
-//=======================================================================
-//function : Segment
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean HatchGen_ElementsGen::Segment(const gp_Pnt2d& P, 
-                                                    gp_Lin2d& L, 
-                                                    Standard_Real& Par)
-{
-  myCurEdge = 1;
-
-  return OtherSegment(P, L, Par);
-}
-
-//=======================================================================
-//function : Segment
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean HatchGen_ElementsGen::OtherSegment(const gp_Pnt2d& P, 
-                                                         gp_Lin2d& L, 
-                                                         Standard_Real& Par)
-{
-  HatchGen_DataMapIteratorOfMapOfElements Itertemp;
-  Standard_Integer                        i;
-  
-  for(  Itertemp.Initialize(myMap), i = 1; Itertemp.More(); Itertemp.Next(), i++) { 
-    if (i < myCurEdge)
-      continue;
-
-    void *ptrmyMap = (void *)(&myMap);
-    TheItem& Item=((HatchGen_MapOfElements*)ptrmyMap)->ChangeFind(Itertemp.Key());
-    TheCurve& E = Item.ChangeCurve();
-    TopAbs_Orientation Or= Item.Orientation();
-    gp_Pnt2d P2 = E.Value
-      ((E.FirstParameter() + E.LastParameter()) *0.5);
-    if ((Or == TopAbs_FORWARD) ||
-       (Or == TopAbs_REVERSED)) {
-      gp_Vec2d V(P,P2);
-      Par = V.Magnitude();
-      if (Par >= gp::Resolution()) {
-       L = gp_Lin2d(P,V);
-       myCurEdge++;
-       return Standard_True;
-      }
-    }
-  }
-
-  if (i == myCurEdge + 1) {
-    Par = RealLast();
-    L = gp_Lin2d(P,gp_Dir2d(1,0));
-    myCurEdge++;
-
-    return Standard_True;
-  }
-
-  return Standard_False;
-}
-
-//=======================================================================
-//function : InitWires
-//purpose  : 
-//=======================================================================
-
-void  HatchGen_ElementsGen::InitWires()  {
-  NumWire = 0;
-}
-
-//=======================================================================
-//function : RejectWire NYI
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean HatchGen_ElementsGen::RejectWire(const gp_Lin2d& , 
-                                                  const Standard_Real) const 
-{
-  return Standard_False;
-}
-
-//=======================================================================
-//function : InitEdges
-//purpose  : 
-//=======================================================================
-
-void  HatchGen_ElementsGen::InitEdges()  {
-  NumEdge = 0;
-  Iter.Initialize(myMap);
-}
-
-//=======================================================================
-//function : RejectEdge NYI
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean HatchGen_ElementsGen::RejectEdge(const gp_Lin2d& , 
-                                                 const Standard_Real ) const 
-{
-  return Standard_False;
-}
-
-
-//=======================================================================
-//function : CurrentEdge
-//purpose  : 
-//=======================================================================
-
-void  HatchGen_ElementsGen::CurrentEdge(TheCurve& E, 
-                                       TopAbs_Orientation& Or) const 
-{
-  void *ptrmyMap = (void *)(&myMap);
-  TheItem& Item=((HatchGen_MapOfElements*)ptrmyMap)->ChangeFind(Iter.Key());
-
-  E = Item.ChangeCurve();
-  Or= Item.Orientation();
-#if 0 
-  E.Edge() = TopoDS::Edge(myEExplorer.Current());
-  E.Face() = myFace;
-  Or = E.Edge().Orientation();
-#endif
-}
-
-
-//=======================================================================
-//function : MoreWires
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean  HatchGen_ElementsGen::MoreWires() const 
-{
-  return (NumWire == 0);
-}
-
-//=======================================================================
-//function : NextWire
-//purpose  : 
-//=======================================================================
-
-void HatchGen_ElementsGen::NextWire()  {
-  NumWire++;
-}
-
-//=======================================================================
-//function : MoreEdges
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean  HatchGen_ElementsGen::MoreEdges() const  {
-  return(Iter.More());
-}
-
-//=======================================================================
-//function : NextEdge
-//purpose  : 
-//=======================================================================
-
-void HatchGen_ElementsGen::NextEdge()  {
-  Iter.Next();
-}
-
-
-
diff --git a/src/HatchGen/HatchGen_Hatcher.cdl b/src/HatchGen/HatchGen_Hatcher.cdl
deleted file mode 100644 (file)
index 52f68c3..0000000
+++ /dev/null
@@ -1,513 +0,0 @@
--- Created on: 1993-10-25
--- Created by: Jean Marc LACHAUME
--- 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.
-
-generic class Hatcher from HatchGen
-    (TheCurveE      as any ; -- as Curve       from Geom2dAdaptor
-     TheCurveH      as any ; -- as Curve       from Geom2dAdaptor
-     TheIntersector as any ) -- as Intersector from HatchGen
-
-uses
-    MapIntegerHasher from TColStd  ,
-    PointOnHatching  from HatchGen ,
-    Orientation      from TopAbs ,
-    State            from TopAbs ,
-    Domain           from HatchGen ,
-    ErrorStatus      from HatchGen
-
-raises
-    NoSuchObject      from Standard ,
-    OutOfRange        from Standard ,
-    NotDone           from StdFail
-
-----------------------------------------------------------------------
---  Nested classes descriptions.
-----------------------------------------------------------------------
-
-class Element from HatchGen instantiates ElementGen from HatchGen
-    (TheCurveE) ;
-    
-class Elements from HatchGen instantiates ElementsGen from HatchGen
-    (Integer          from Standard,
-     Element          from HatchGen,
-     MapIntegerHasher from TColStd ,
-     TheCurveE                     ) ;
-     
-class Hatching from HatchGen instantiates HatchingGen from HatchGen
-    (TheCurveH) ;
-    
-class Hatchings from HatchGen instantiates DataMap from TCollection
-    (Integer          from Standard,
-     Hatching         from HatchGen,
-     MapIntegerHasher from TColStd) ;
-
-class Classifier from HatchGen instantiates FaceClassifier from  TopClass 
-    (Elements,
-     TheCurveE,
-     TheIntersector);
-
-----------------------------------------------------------------------
---  class Hatcher description.
-----------------------------------------------------------------------
-
-is
-
----Category: General use
-
-
-    Create (Intersector : TheIntersector ;
-           Confusion2d : Real    from Standard ;
-           Confusion3d : Real    from Standard ;
-           KeepPnt     : Boolean from Standard = Standard_False ;
-            KeepSeg     : Boolean from Standard = Standard_False)
-           
-       ---Purpose: Returns an empty hatcher.
-
-       returns Hatcher from HatchGen ;
-
-
-    Intersector (me : in out ; Intersector : TheIntersector)
-    
-       ---Purpose: Sets the associated intersector.
-       is static ;
-       
-
-    Intersector (me : in out)
-    
-       ---Purpose: Returns the associated intersector.
-
-       ---C++: inline
-       ---C++: return const &
-
-       returns TheIntersector
-       is static ;
-       
-
-    ChangeIntersector (me : in out)
-    
-       ---Purpose: Returns the associated intersector.
-
-       ---C++: inline
-       ---C++: return &
-
-       returns TheIntersector
-       is static ;
-       
-
-    Confusion2d (me : in out ; Confusion : Real from Standard)
-    
-               ---Purpose: Sets the confusion tolerance.
-
-       is static ;
-
-
-    Confusion2d (me)
-    
-       ---Purpose: Returns the 2d confusion tolerance, i.e. the value under
-       --          which two points are considered identical in the
-       --          parametric space of the hatching.
-       
-       ---C++: inline
-       returns Real from Standard
-       is static ;
-
-
-    Confusion3d (me : in out ; Confusion : Real from Standard)
-    
-               ---Purpose: Sets the confusion tolerance.
-
-       is static ;
-
-
-    Confusion3d (me)
-    
-       ---Purpose: Returns the 3d confusion tolerance, i.e. the value under
-       --          which two points are considered identical in the
-       --          3d space of the hatching.
-
-       ---C++: inline
-       returns Real from Standard
-       is static ;
-
-
-    KeepPoints (me : in out; Keep : Boolean from Standard)
-    
-       ---Purpose: Sets the above flag.
-
-       is static ;
-
-
-    KeepPoints (me)
-    
-       ---Purpose: Returns the flag about the points consideration.
-
-       ---C++: inline
-       returns Boolean from Standard
-       is static ;
-
-
-    KeepSegments (me : in out; Keep : Boolean from Standard)
-    
-       ---Purpose: Sets the above flag.
-
-       is static ;
-
-
-    KeepSegments (me)
-    
-       ---Purpose: Returns the flag about the segments consideration.
-
-       ---C++: inline
-       returns Boolean from Standard
-       is static ;
-
-
-    Clear (me : in out)
-    
-       ---Purpose: Removes all the hatchings and all the elements.
-
-       ---C++: inline
-       is static ;
-
-
----Category: Element
-
-
-    Element (me : in out ; IndE : Integer from Standard)
-    
-       ---Purpose: Returns the IndE-th element.
-
-       ---Category: Element
-
-       ---C++: inline
-       ---C++: return &
-
-       returns Element from HatchGen
-        raises NoSuchObject from Standard
-       is static protected ;
-
-
-    ElementCurve (me; IndE : Integer from Standard)
-    
-       ---Purpose: Returns the curve associated to the IndE-th element.
-
-       ---Category: Element
-
-       ---C++: inline
-       ---C++: return const &
-
-       returns TheCurveE
-       raises NoSuchObject from Standard
-       is static ;
-
-
-    AddElement (me : in out ; Curve       : TheCurveE ;
-                             Orientation : Orientation from TopAbs = TopAbs_FORWARD)
-    
-       ---Purpose: Adds an element to the hatcher and returns its index.
-
-       ---Category: Element
-
-       returns Integer from Standard
-       is static ;
-
-
-    RemElement (me : in out ; IndE : Integer from Standard)
-    
-       ---Purpose: Removes the IndE-th element from the hatcher.
-
-       ---Category: Element
-
-       raises NoSuchObject from Standard
-       is static ;
-
-
-    ClrElements (me : in out)
-    
-       ---Purpose: Removes all the elements from the hatcher.
-
-       ---Category: Element
-
-       is static ;
-
-
----Category: Hatching
-
-
-    Hatching (me : in out ; IndH : Integer from Standard)
-    
-       ---Purpose: Returns the IndH-th hatching.
-
-       ---Category: Hatching
-
-       ---C++: inline
-       ---C++: return &
-
-       returns Hatching from HatchGen
-       raises NoSuchObject from Standard
-       is static protected ;
-
-
-    HatchingCurve (me; IndH : Integer from Standard)
-    
-       ---Purpose: Returns the curve associated to the IndH-th hatching.
-
-       ---Category: Hatching
-
-       ---C++: inline
-       ---C++: return const &
-
-       returns TheCurveH
-       raises NoSuchObject from Standard
-       is static ;
-
-
-    AddHatching (me : in out ; Curve : TheCurveH)
-    
-       ---Purpose: Adds a hatching to the hatcher and returns its index.
-
-       ---Category: Hatching
-
-       returns Integer from Standard
-        is static ;
-
-
-    RemHatching (me : in out ; IndH : Integer from Standard)
-    
-       ---Purpose: Removes the IndH-th hatching from the hatcher.
-
-       ---Category: Hatching
-
-       raises NoSuchObject from Standard
-       is static ;
-
-
-    ClrHatchings (me : in out)
-    
-       ---Purpose: Removes all the hatchings from the hatcher.
-
-       ---Category: Hatching
-
-       is static ;
-
-
-    NbPoints (me; IndH : Integer from Standard)
-
-       ---Purpose: Returns the number of intersection points of
-       --          the IndH-th hatching.
-
-       ---Category: Hatching - Test
-
-       ---C++: inline
-       returns Integer from Standard
-       raises NoSuchObject from Standard
-       is static ;
-
-
-    Point (me; IndH, IndP : Integer from Standard)
-    
-       ---Purpose: Returns the IndP-th intersection point of the
-       --          IndH-th hatching.
-
-       ---Category: Hatching - Test
-
-       ---C++: inline
-       ---C++: return const &
-
-       returns PointOnHatching from HatchGen
-       raises NoSuchObject from Standard,
-              OutOfRange   from Standard
-       is static ;
-
-
----Category: Computation - Trimming
-
-    Trim (me : in out)
-    
-       ---Purpose: Trims all the hatchings of the hatcher by all the
-       --          elements of the hatcher.
-
-       is static ;
-
-
-    Trim (me : in out ; Curve : TheCurveH)
-    
-       ---Purpose: Adds a hatching to the hatcher and trims it by
-       --          the elements already given and returns its index.
-
-       ---Category: Computation
-
-       returns Integer from Standard
-       is static ;
-
-
-    Trim (me : in out ; IndH : Integer from Standard)
-    
-       ---Purpose: Trims the IndH-th hatching by the elements
-       --          already given.
-
-       ---Category: Computation
-
-       raises NoSuchObject from Standard
-        is static ;
-
-
-    Trim (me : in out ; IndH, IndE : Integer from Standard)
-    
-       ---Purpose: Trims the IndH-th hatching of the hatcher by the
-       --          IndE-th element.
-
-       ---Category: Computation
-
-       returns Boolean from Standard
-       is static private ;
-
-
----Category: Computation - Domains
-
-    GlobalTransition (me : in out; Point : in out PointOnHatching from HatchGen)
-    
-       ---Purpose: Sets the global transition (the before and after
-       --          states and segment extremities flags) of the point.
-
-       ---Category: Computation - Domains
-
-       returns Boolean from Standard
-       is static private ;
-
-
-    ComputeDomains (me : in out)
-
-       ---Purpose: Computes the domains of all the hatchings.
-
-       ---Category: Computation - Domains
-
-       is static ;
-
-
-    ComputeDomains (me : in out ; IndH : Integer from Standard)
-
-       ---Purpose: Computes the domains of the IndH-th hatching.
-
-       ---Category: Computation - Domains
-
-       raises NoSuchObject from Standard
-       is static ;
-
-
----Category: Results
-
-    TrimDone (me; IndH : Integer from Standard)
-    
-       ---Purpose: Returns the fact that the intersections were computed
-       --          for the IndH-th hatching. 
-
-       ---C++: inline
-       returns Boolean from Standard
-       raises NoSuchObject from Standard
-       is static ;
-
-
-    TrimFailed (me; IndH : Integer from Standard)
-    
-       ---Purpose: Returns the fact that the intersections failed
-       --          for the IndH-th hatching. 
-
-       ---C++: inline
-       returns Boolean from Standard
-       raises NoSuchObject from Standard
-       is static ;
-
-
-    IsDone (me)
-    
-       ---Purpose: Returns the fact that the domains were computed
-       --          for all the hatchings. 
-
-       ---C++: inline
-       returns Boolean from Standard
-       raises NoSuchObject from Standard
-       is static ;
-
-
-    IsDone (me; IndH : Integer from Standard)
-    
-       ---Purpose: Returns the fact that the domains were computed
-       --          for the IndH-th hatching. 
-
-       returns Boolean from Standard
-       raises NoSuchObject from Standard
-       is static ;
-
-
-    Status (me; IndH : Integer from Standard)
-    
-       ---Purpose: Returns the status about the IndH-th hatching. 
-
-       ---C++: inline
-       returns ErrorStatus from HatchGen
-       raises NoSuchObject from Standard
-       is static ;
-
-
-    NbDomains (me; IndH : Integer from Standard)
-
-       ---Purpose: Returns the number of domains of the IndH-th hatching.
-       --          Only ONE "INFINITE" domain means that the hatching is
-       --          fully included in the contour defined by the elements.
-
-       ---C++: inline
-       returns Integer from Standard
-       raises NoSuchObject from Standard ,
-              NotDone      from StdFail
-       is static ;
-
-
-    Domain (me; IndH : Integer from Standard ;
-               IDom : Integer from Standard )
-
-       ---Purpose: Returns the IDom-th domain of the IndH-th hatching.
-
-       ---C++: return const &
-
-       returns Domain from HatchGen
-       raises NoSuchObject from Standard ,
-              NotDone      from StdFail ,
-              OutOfRange   from Standard
-       is static ;
-
-
----Category: Dump
-
-    Dump (me)
-    
-       ---Purpose: Dump the hatcher.
-
-       is static ;
-
-
-fields
-
-    myIntersector  : TheIntersector ;
-    myConfusion2d  : Real      from Standard ;
-    myConfusion3d  : Real      from Standard ;
-    myKeepPoints   : Boolean   from Standard ;
-    myKeepSegments : Boolean   from Standard ;
-    myNbElements   : Integer   from Standard ;
-    myElements     : Elements  from HatchGen ;
-    myNbHatchings  : Integer   from Standard ;
-    myHatchings    : Hatchings from HatchGen ;
-
-end Hatcher from HatchGen ;
diff --git a/src/HatchGen/HatchGen_Hatcher.gxx b/src/HatchGen/HatchGen_Hatcher.gxx
deleted file mode 100644 (file)
index b8f871b..0000000
+++ /dev/null
@@ -1,1497 +0,0 @@
-// Created on: 1993-11-04
-// Created by: Jean Marc LACHAUME
-// 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 <HatchGen_Domain.hxx>
-#include <HatchGen_Domains.hxx>
-#include <HatchGen_PointOnElement.hxx>
-#include <HatchGen_PointOnHatching.hxx>
-#include <IntRes2d_IntersectionPoint.hxx>
-#include <IntRes2d_IntersectionSegment.hxx>
-#include <IntRes2d_Transition.hxx>
-#include <Precision.hxx>
-#include <TopAbs.hxx>
-#include <TopTrans_CurveTransition.hxx>
-
-#define RAISE_IF_NOSUCHOBJECT 0
-#define TRACE_HATCHER 0
-
-//=======================================================================
-//=======================================================================
-//  Category : General use.
-//=======================================================================
-//=======================================================================
-
-//=======================================================================
-// Function : HatchGen_Hatcher
-// Purpose  : Constructor.
-//=======================================================================
-
-HatchGen_Hatcher::HatchGen_Hatcher (const TheIntersector&  Intersector,
-                                   const Standard_Real    Confusion2d,
-                                   const Standard_Real    Confusion3d,
-                                   const Standard_Boolean KeepPnt,
-                                   const Standard_Boolean KeepSeg) :
-       myIntersector  (Intersector) ,
-       myConfusion2d  (Confusion2d) ,
-       myConfusion3d  (Confusion3d) ,
-       myKeepPoints   (KeepPnt) ,
-       myKeepSegments (KeepSeg) ,
-       myNbElements   (0) ,
-       myNbHatchings  (0) 
-{
-}
-
-//=======================================================================
-// Function : Intersector
-// Purpose  : Sets the associated intersector.
-//=======================================================================
-
-void HatchGen_Hatcher::Intersector (const TheIntersector& Intersector)
-{
-  myIntersector = Intersector ;
-  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
-    if (myHatchings.IsBound (IndH)) {
-      HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-      Hatching.ClrPoints() ;
-    }
-  }
-}
-
-
-//=======================================================================
-// Function : Confusion2d
-// Purpose  : Sets the 2dconfusion tolerance.
-//=======================================================================
-
-void HatchGen_Hatcher::Confusion2d (const Standard_Real Confusion)
-{
-  myConfusion2d = Confusion ;
-  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
-    if (myHatchings.IsBound (IndH)) {
-      HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-      Hatching.ClrPoints() ;
-    }
-  }
-}
-
-
-//=======================================================================
-// Function : Confusion3d
-// Purpose  : Sets the 3d confusion tolerance.
-//=======================================================================
-
-void HatchGen_Hatcher::Confusion3d (const Standard_Real Confusion)
-{
-  myConfusion3d = Confusion ;
-  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
-    if (myHatchings.IsBound (IndH)) {
-      HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-      Hatching.ClrPoints() ;
-    }
-  }
-}
-
-//=======================================================================
-// Function : KeepPoints
-// Purpose  : Sets the above flag.
-//=======================================================================
-
-void HatchGen_Hatcher::KeepPoints (const Standard_Boolean Keep)
-{
-  myKeepPoints = Keep ;
-  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
-    if (myHatchings.IsBound (IndH)) {
-      HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-      Hatching.ClrDomains() ;
-    }
-  }
-}
-
-
-//=======================================================================
-// Function : KeepSegments
-// Purpose  : Sets the above flag.
-//=======================================================================
-
-void HatchGen_Hatcher::KeepSegments (const Standard_Boolean Keep)
-{
-  myKeepSegments = Keep ;
-  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
-    if (myHatchings.IsBound (IndH)) {
-      HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-      Hatching.ClrDomains() ;
-    }
-  }
-}
-
-
-
-//=======================================================================
-//=======================================================================
-//  Category : Element.
-//=======================================================================
-//=======================================================================
-
-
-//=======================================================================
-// Function : AddElement
-// Purpose  : Adds an element to the Hatcher and returns its index.
-//=======================================================================
-
-Standard_Integer HatchGen_Hatcher::AddElement (const TheCurveE& Curve,
-                                              const TopAbs_Orientation Orientation)
-{
-  Standard_Integer IndE ;
-  for (IndE = 1 ; IndE <= myNbElements && myElements.IsBound(IndE) ; IndE++) ;
-  if (IndE > myNbElements) {
-    myNbElements++ ;
-    IndE = myNbElements ;
-  }
-  HatchGen_Element Element (Curve, Orientation) ;
-  myElements.Bind (IndE, Element) ;
-  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings; IndH++) {
-    if (myHatchings.IsBound(IndH)) {
-      HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-      Hatching.ClrPoints () ;
-    }
-  }
-  return IndE ;
-}
-
-//=======================================================================
-// Function : RemElement
-// Purpose  : Removes the IndE-th element from the hatcher.
-//=======================================================================
-
-void HatchGen_Hatcher::RemElement (const Standard_Integer IndE)
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
-#endif
-  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
-    if (myHatchings.IsBound (IndH)) {
-      HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-      Standard_Boolean DomainsToClear = Standard_False ;
-      for (Standard_Integer IPntH = Hatching.NbPoints() ; IPntH > 0 ; IPntH--) {
-       HatchGen_PointOnHatching PntH = Hatching.ChangePoint (IPntH) ;
-       for (Standard_Integer IPntE = PntH.NbPoints() ; IPntE > 0 ; IPntE--) {
-         if (PntH.Point(IPntE).Index() == IndE) {
-           PntH.RemPoint (IPntE) ;
-           DomainsToClear = Standard_True ;
-         }
-       }
-       if (PntH.NbPoints() == 0) Hatching.RemPoint (IPntH) ;
-      }
-      if (DomainsToClear) Hatching.ClrDomains() ;
-    }
-  }
-  myElements.UnBind (IndE) ;
-  if (IndE == myNbElements) myNbElements-- ;
-}
-
-//=======================================================================
-// Function : ClrElements
-// Purpose  : Removes all the elements from the hatcher.
-//=======================================================================
-
-void HatchGen_Hatcher::ClrElements ()
-{
-  if (myNbElements != 0) {
-    if (myNbHatchings != 0) {
-      for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
-       if (myHatchings.IsBound(IndH)) {
-         HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-         Hatching.ClrPoints() ;
-       }
-      }
-    }
-    myElements.Clear() ;
-    myNbElements = 0 ;
-  }
-}
-
-//=======================================================================
-//=======================================================================
-//  Category : Hatching.
-//=======================================================================
-//=======================================================================
-
-
-//=======================================================================
-// Function : AddHatching
-// Purpose  : Adds a hatching to the hatcher and returns its index.
-//=======================================================================
-
-Standard_Integer HatchGen_Hatcher::AddHatching (const TheCurveH& Curve)
-{
-  Standard_Integer IndH ;
-  for (IndH = 1 ; IndH <= myNbHatchings && myHatchings.IsBound(IndH) ; IndH++) ;
-  if (IndH > myNbHatchings) {
-    myNbHatchings++ ;
-    IndH = myNbHatchings ;
-  }
-  HatchGen_Hatching Hatching (Curve) ;
-  myHatchings.Bind (IndH, Hatching) ;
-  return IndH ;
-}
-
-//=======================================================================
-// Function : RemHatching
-// Purpose  : Removes the IndH-th hatching from the hatcher.
-//=======================================================================
-
-void HatchGen_Hatcher::RemHatching (const Standard_Integer IndH)
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-  HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-  Hatching.ClrPoints() ;
-  myHatchings.UnBind (IndH) ;
-  if (IndH == myNbHatchings) myNbHatchings-- ;
-}
-  
-//=======================================================================
-// Function : ClrHatchings
-// Purpose  : Removes all the hatchings from the hatcher.
-//=======================================================================
-
-void HatchGen_Hatcher::ClrHatchings ()
-{
-  if (myNbHatchings != 0) {
-    for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
-      if (myHatchings.IsBound(IndH)) {
-       HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-       Hatching.ClrPoints() ;
-      }
-    }
-    myHatchings.Clear() ;
-    myNbHatchings = 0 ;
-  }
-}
-
-
-
-//=======================================================================
-//=======================================================================
-//  Category : Computation - Trimming
-//=======================================================================
-//=======================================================================
-
-//=======================================================================
-// Function : Trim
-// Purpose  : Trims all the hatchings of the hatcher by all the elements
-//            of the hatcher.
-//=======================================================================
-
-void HatchGen_Hatcher::Trim ()
-{
-  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++)
-    if (myHatchings.IsBound (IndH)) 
-      Trim (IndH) ;
-}
-
-//=======================================================================
-// Function : Trim
-// Purpose  : Adds a hatching to the hatcher and trims it by the elements
-//            already given and returns its index.
-//=======================================================================
-
-Standard_Integer HatchGen_Hatcher::Trim (const TheCurveH& Curve)
-{
-  Standard_Integer IndH = AddHatching (Curve) ;
-  Trim (IndH) ;
-  return IndH ;
-}
-
-//=======================================================================
-// Function : Trim
-// Purpose  : Trims the IndH-th hatching by the elements already given.
-//=======================================================================
-
-void HatchGen_Hatcher::Trim (const Standard_Integer IndH)
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-
-  HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-
-  Hatching.ClrPoints() ;
-
-  Standard_Boolean OK, AllOK ;
-
-  AllOK = Standard_True ;
-  for (Standard_Integer IndE = 1 ; IndE <= myNbElements ; IndE++) {
-    if (myElements.IsBound (IndE)) {
-      OK = Trim (IndH, IndE) ;
-      AllOK = AllOK && OK ;
-    }
-  }
-  Hatching.TrimDone (Standard_True) ;
-  Hatching.TrimFailed (!AllOK) ;
-
-  if (AllOK) {
-    for (Standard_Integer IPnt = 1 ; IPnt <= Hatching.NbPoints() ; IPnt++) {
-      HatchGen_PointOnHatching& PntH = Hatching.ChangePoint(IPnt) ;
-      OK = GlobalTransition (PntH) ;
-      AllOK = AllOK && OK ;
-    }
-    Hatching.Status (AllOK ? HatchGen_NoProblem : HatchGen_TransitionFailure) ;
-  }
-}
-
-#if TRACE_HATCHER
-
-//=======================================================================
-// Function : IntersectionPointDump
-// Purpose  : Dump of the intersection point.
-//=======================================================================
-
-static void IntersectionPointDump (const IntRes2d_IntersectionPoint& Pnt,
-                                  const Standard_Integer Index)
-{
-  Standard_Integer SavedPrecision = cout.precision() ;
-  cout.precision (15) ;
-  cout << "----- IntRes2d:: Point # " << setw(3) << Index << " ---------------" << endl ;
-  cout << "-- U: "<<Pnt.Value().X()<<"    V: "<<Pnt.Value().Y()<<endl;
-  cout << "-- Parameter on first   : " << Pnt.ParamOnFirst()  << endl ;
-  cout << "-- Position  on first   : " ;
-  switch (Pnt.TransitionOfFirst().PositionOnCurve()) {
-      case IntRes2d_Head   : cout << "HEAD"   ; break ;
-      case IntRes2d_Middle : cout << "MIDDLE" ; break ;
-      case IntRes2d_End    : cout << "END"    ; break ;
-  }
-  cout << endl ;
-  cout << "-- IntRes2d:: Transition on first  : " ;
-  switch (Pnt.TransitionOfFirst().TransitionType()) {
-      case IntRes2d_In        : cout << "IN"        ; break ;
-      case IntRes2d_Out       : cout << "OUT"       ; break ;
-      case IntRes2d_Touch     : cout << "TOUCH"     ; break ;
-      case IntRes2d_Undecided : cout << "UNDECIDED" ; break ;
-  }
-  cout << endl ;
-  if (Pnt.TransitionOfFirst().TransitionType() == IntRes2d_Touch) {
-    cout << "-- IntRes2d:: Situation on first   : " ;
-    switch (Pnt.TransitionOfFirst().Situation()) {
-       case IntRes2d_Inside  : cout << "INSIDE"  ; break ;
-       case IntRes2d_Outside : cout << "OUTSIDE" ; break ;
-       case IntRes2d_Unknown : cout << "UNKNOWN" ; break ;
-    }
-    cout << endl ;
-  }
-  cout << "--------------------------------------------" << endl ;
-  cout << "-- Parameter on second  : " << Pnt.ParamOnSecond() << endl ;
-  cout << "-- Position  on second  : " ;
-  switch (Pnt.TransitionOfSecond().PositionOnCurve()) {
-      case IntRes2d_Head   : cout << "HEAD"   ; break ;
-      case IntRes2d_Middle : cout << "MIDDLE" ; break ;
-      case IntRes2d_End    : cout << "END"    ; break ;
-  }
-  cout << endl ;
-  cout << "-- IntRes2d:: Transition on second : " ;
-  switch (Pnt.TransitionOfSecond().TransitionType()) {
-      case IntRes2d_In        : cout << "IN"        ; break ;
-      case IntRes2d_Out       : cout << "OUT"       ; break ;
-      case IntRes2d_Touch     : cout << "TOUCH"     ; break ;
-      case IntRes2d_Undecided : cout << "UNDECIDED" ; break ;
-  }
-  cout << endl ;
-  if (Pnt.TransitionOfSecond().TransitionType() == IntRes2d_Touch) {
-    cout << "-- IntRes2d:: Situation on second  : " ;
-    switch (Pnt.TransitionOfSecond().Situation()) {
-       case IntRes2d_Inside  : cout << "INSIDE"  ; break ;
-       case IntRes2d_Outside : cout << "OUTSIDE" ; break ;
-       case IntRes2d_Unknown : cout << "UNKNOWN" ; break ;
-    }
-    cout << endl ;
-  }
-  cout << "--------------------------------------------" << endl ;
-  cout.precision (SavedPrecision) ;
-}
-
-#endif
-
-//=======================================================================
-// Function : Trim
-// Purpose  : Trims the IndH-th hatching of the hatcher by the IndE th
-//            element.
-//=======================================================================
-
-Standard_Boolean HatchGen_Hatcher::Trim (const Standard_Integer IndH,
-                                        const Standard_Integer IndE)
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-  Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
-#endif
-
-  HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-  HatchGen_Element& Element   = myElements.ChangeFind  (IndE) ;
-
-  TheCurveH hatching = Hatching.ChangeCurve() ;
-  TheCurveE element  = Element.ChangeCurve() ;
-
-  myIntersector.Intersect (hatching, element) ;
-  
-#if TRACE_HATCHER
-  cout << "--- Hatcher - Trim:: Hatching # " << setw(3);
-  cout << IndH << " with Element # " << setw(3);
-  cout << IndE << " ----------" << endl ;
-#endif    
-  
-  if (!myIntersector.IsDone())  { 
-    cout<<" Intersector -> Done = False ";
-    return Standard_False ;
-  }
-  
-#if TRACE_HATCHER
-  if (myIntersector.IsEmpty()) {
-    cout << "No intersection" << endl ;
-    cout << "--------------------------------------------------------------------" << endl ;
-  }
-#endif    
-  
-  if (myIntersector.IsEmpty()) return Standard_True ;
-  
-#if TRACE_HATCHER
-  cout << "Number of intersection points   : " << setw(3) << (myIntersector.NbPoints())   << endl ;
-  cout << "Number of intersection segments : " << setw(3) << (myIntersector.NbSegments()) << endl ;
-#endif    
-  
-  //-----------------------------------------------------------------------
-  // Traitement des points d intersection.
-  //-----------------------------------------------------------------------
-  
-  for (Standard_Integer IPntI = 1 ; IPntI <= myIntersector.NbPoints() ; IPntI++) {
-    const IntRes2d_IntersectionPoint& PntI = myIntersector.Point (IPntI) ;
-    
-#if TRACE_HATCHER
-    IntersectionPointDump (PntI, IPntI) ;
-#endif
-    
-    HatchGen_PointOnElement PntE (PntI) ;
-    PntE.SetIndex (IndE) ;
-    
-    HatchGen_PointOnHatching PntH (PntI) ;
-    PntH.SetIndex (IndH) ;
-    PntH.AddPoint (PntE, myConfusion2d) ;
-    
-    Hatching.AddPoint (PntH, myConfusion2d) ;
-  }
-  
-  //-----------------------------------------------------------------------
-  // Traitement des segments d intersection.
-  //-----------------------------------------------------------------------
-  
-  for (Standard_Integer ISeg = 1 ; ISeg <= myIntersector.NbSegments() ; ISeg++) {
-    
-    const IntRes2d_IntersectionSegment& Seg = myIntersector.Segment (ISeg) ;
-    
-#if TRACE_HATCHER
-    cout << "----- Segment # " << setw(3) << ISeg << " -------------" << endl ;
-#endif
-    
-    Standard_Boolean FirstPoint = Seg.HasFirstPoint() ;
-    Standard_Boolean LastPoint  = Seg.HasLastPoint() ;
-    
-    //-----------------------------------------------------------------------
-    // Les deux points peuvent etre confondus.
-    //-----------------------------------------------------------------------
-    
-    if (FirstPoint && LastPoint) {
-      
-      const IntRes2d_IntersectionPoint& Pnt1 = Seg.FirstPoint() ;
-      const IntRes2d_IntersectionPoint& Pnt2 = Seg.LastPoint()  ;
-      
-      const IntRes2d_Transition& TrsPnt1H = Pnt1.TransitionOfFirst() ;
-      const IntRes2d_Transition& TrsPnt1E = Pnt1.TransitionOfSecond() ;
-      const IntRes2d_Transition& TrsPnt2H = Pnt2.TransitionOfFirst() ;
-      const IntRes2d_Transition& TrsPnt2E = Pnt2.TransitionOfSecond() ;
-      
-      IntRes2d_TypeTrans TypePnt1H = TrsPnt1H.TransitionType() ;
-      IntRes2d_TypeTrans TypePnt1E = TrsPnt1E.TransitionType() ;
-      IntRes2d_TypeTrans TypePnt2H = TrsPnt2H.TransitionType() ;
-      IntRes2d_TypeTrans TypePnt2E = TrsPnt2E.TransitionType() ;
-      
-      //-----------------------------------------------------------------------
-      // Les deux points peuvent etre confondus au regard de la precision du
-      // `hatcher'.
-      //-----------------------------------------------------------------------
-      
-      Standard_Boolean Conf2d = Abs (Pnt1.ParamOnFirst() - Pnt2.ParamOnFirst()) <= myConfusion2d ;
-
-      //-----------------------------------------------------------------------
-      // Les deux points peuvent etre `confondus' au regard des intersections.
-      //-----------------------------------------------------------------------
-
-      Standard_Boolean Conf3d = Standard_False ;
-
-      if (!Conf2d) {
-       Conf3d = Standard_True ;
-       if (Conf3d) Conf3d = TypePnt1H != IntRes2d_Touch && TypePnt1H != IntRes2d_Undecided ;
-       if (Conf3d) Conf3d = TypePnt1E != IntRes2d_Touch && TypePnt1E != IntRes2d_Undecided ;
-       if (Conf3d) Conf3d = TypePnt2H != IntRes2d_Touch && TypePnt2H != IntRes2d_Undecided ;
-       if (Conf3d) Conf3d = TypePnt2E != IntRes2d_Touch && TypePnt2E != IntRes2d_Undecided ;
-       if (Conf3d) Conf3d = TypePnt1H == TypePnt2H      && TypePnt1E == TypePnt2E ;
-       if (Conf3d) Conf3d = Pnt1.Value().Distance (Pnt2.Value()) <= myConfusion3d ;
-      }
-
-      if (Conf2d || Conf3d) {
-       
-       HatchGen_PointOnElement PntE ;
-       PntE.SetIndex (IndE) ;
-       PntE.SetParameter ((Pnt1.ParamOnSecond() + Pnt2.ParamOnSecond()) / 2.) ;
-       switch (TrsPnt1E.PositionOnCurve()) {
-         case IntRes2d_Head: { 
-           PntE.SetPosition(TopAbs_FORWARD) ;
-           break ;
-         }
-         case IntRes2d_Middle: {
-           switch (TrsPnt2E.PositionOnCurve()) {
-              case IntRes2d_Head: {
-                PntE.SetPosition (TopAbs_FORWARD);
-                break;
-              }
-              case IntRes2d_Middle: { 
-                PntE.SetPosition (TopAbs_INTERNAL) ;
-                break ;
-              }
-              case IntRes2d_End: {
-                PntE.SetPosition (TopAbs_REVERSED) ;
-                break ;
-              }
-              default: {
-                break;
-              }
-           }
-           break;
-         }
-         case IntRes2d_End:  { 
-           PntE.SetPosition(TopAbs_REVERSED) ;
-           break ;
-         }
-          default: {
-           break;
-         }
-       }
-       PntE.SetIntersectionType 
-         ((PntE.Position() == TopAbs_INTERNAL) ? HatchGen_TRUE : HatchGen_TOUCH) ;
-       PntE.SetStateBefore ((TypePnt1H == IntRes2d_In) ? TopAbs_OUT : TopAbs_IN) ;
-       PntE.SetStateAfter  ((TypePnt2H == IntRes2d_In) ? TopAbs_OUT : TopAbs_IN) ;
-       
-       HatchGen_PointOnHatching PntH ;
-       PntH.SetIndex (IndH) ;
-       PntH.SetParameter ((Pnt1.ParamOnFirst() + Pnt2.ParamOnFirst()) / 2.) ;
-       switch (TrsPnt1H.PositionOnCurve()) {
-          case IntRes2d_Head: {
-            PntH.SetPosition (TopAbs_FORWARD) ;
-            break ;
-          }
-          case IntRes2d_Middle: {
-            switch (TrsPnt2H.PositionOnCurve()) {
-               case IntRes2d_Head: {
-                 PntH.SetPosition (TopAbs_FORWARD) ;
-                 break ;
-               }
-               case IntRes2d_Middle: {
-                 PntH.SetPosition (TopAbs_INTERNAL) ;
-                 break ;
-               }
-               case IntRes2d_End: {
-                 PntH.SetPosition (TopAbs_REVERSED) ;
-                 break ;
-               }
-               default : {
-                 break ;
-               }
-            }
-            break ;
-          }
-          case IntRes2d_End: {
-            PntH.SetPosition (TopAbs_REVERSED) ;
-            break ;
-          }
-          default : {
-            break ;
-          }
-       }
-
-       PntH.AddPoint (PntE, myConfusion2d) ;
-       Hatching.AddPoint (PntH, myConfusion2d) ;
-       
-#if TRACE_HATCHER
-       IntersectionPointDump (Pnt1, 1) ;
-       IntersectionPointDump (Pnt2, 2) ;
-       cout << "THESE TWO POINTS ARE "
-            << (Conf2d ? "2D" : "3D")
-            << " CONFUSED INTO THE FOLLOWING" << endl ;
-       PntH.Dump() ;
-#endif
-       continue ;
-       
-      }
-      
-      //-----------------------------------------------------------------------
-      // Traitement du premier point du segment.
-      //-----------------------------------------------------------------------
-      
-      if (FirstPoint) {
-       
-       const IntRes2d_IntersectionPoint& PntI = Seg.FirstPoint() ;
-       
-#if TRACE_HATCHER
-       IntersectionPointDump (PntI, 1) ;
-#endif
-       
-       HatchGen_PointOnElement PntE (PntI) ;
-       PntE.SetIndex (IndE) ;
-       PntE.SetSegmentBeginning (Standard_True)  ;
-       PntE.SetSegmentEnd       (Standard_False) ;
-       
-       HatchGen_PointOnHatching PntH (PntI) ;
-       PntH.SetIndex (IndH) ;
-       PntH.AddPoint (PntE, myConfusion2d) ;
-       
-       Hatching.AddPoint (PntH, myConfusion2d) ;
-       
-#if TRACE_HATCHER
-      } 
-      else {
-       cout << "----- Has no first point --------" << endl ;
-       cout << "---------------------------------" << endl ;
-#endif
-       
-      }
-      
-      //-----------------------------------------------------------------------
-      // Traitement du deuxieme point du segment.
-      //-----------------------------------------------------------------------
-      
-      if (LastPoint) {
-       
-       const IntRes2d_IntersectionPoint& PntI = Seg.LastPoint() ;
-       
-#if TRACE_HATCHER
-       IntersectionPointDump (PntI, 2) ;
-#endif
-       
-       HatchGen_PointOnElement PntE (PntI) ;
-       PntE.SetIndex (IndE) ;
-       PntE.SetSegmentBeginning (Standard_False) ;
-       PntE.SetSegmentEnd       (Standard_True)  ;
-       
-       HatchGen_PointOnHatching PntH (PntI) ;
-       PntH.SetIndex (IndH) ;
-       PntH.AddPoint (PntE, myConfusion2d) ;
-       
-       Hatching.AddPoint (PntH, myConfusion2d) ;
-       
-#if TRACE_HATCHER
-      } 
-      else {
-       cout << "----- Has no last point ---------" << endl ;
-       cout << "---------------------------------" << endl ;
-#endif
-      }
-    }
-#if TRACE_HATCHER
-    cout << "--------------------------------------------------------------------" << endl ;
-#endif    
-    
-  }
-  return Standard_True;
-}
-//=======================================================================
-//=======================================================================
-//  Category : Computation - Domains
-//=======================================================================
-//=======================================================================
-
-//=======================================================================
-// Function : GlobalTransition
-// Purpose  : Returns the before and after states of the complex
-//            transition of the IndP-th intersection point of the
-//            IndH-th hatching.
-//=======================================================================
-
-Standard_Boolean HatchGen_Hatcher::GlobalTransition (HatchGen_PointOnHatching& Point)
-{
-  TopAbs_State StateBefore = TopAbs_UNKNOWN ;
-  TopAbs_State StateAfter  = TopAbs_UNKNOWN ;
-  Standard_Boolean SegmentBegin = Standard_False ;
-  Standard_Boolean SegmentEnd   = Standard_False ;
-
-  gp_Dir2d Tangente2d, Normale2d ;
-  gp_Dir   Tangente,   Normale ;
-  Standard_Real Courbure ;
-
-  const TheCurveH& CurveH = HatchingCurve (Point.Index()) ;
-
-  myIntersector.LocalGeometry(CurveH.Curve(), Point.Parameter(), Tangente2d, Normale2d, Courbure);
-
-  Tangente.SetCoord (Tangente2d.X(), Tangente2d.Y(), 0.0) ;
-  if (Courbure < Precision::Confusion()) {
-    Normale.SetCoord (-Tangente2d.Y(), Tangente2d.X(), 0.0) ;
-  } else {
-    Normale.SetCoord (Normale2d.X(), Normale2d.Y(), 0.0) ;
-  }
-
-  TopTrans_CurveTransition ComplexTransition ;
-  ComplexTransition.Reset (Tangente, Normale, Courbure) ;
-
-#if TRACE_HATCHER
-  printf("\n ----- Global Transition Complex Transition Reset \n");
-  printf("\n       P:%+10.5g  Tg2d:%+10.5g , %+10.5g  N2d:%+10.5g , %+10.5g  Crv:%+10.5g\n\n",
-  Point.Parameter(),Tangente.X(),Tangente.Y(),Normale.X(),Normale.Y(),Courbure);
-#endif
-  for (Standard_Integer IPntE = 1 ; IPntE <= Point.NbPoints() ; IPntE++) 
-  {
-    const HatchGen_PointOnElement& PntE = Point.Point (IPntE) ;
-    
-    SegmentBegin = SegmentBegin || PntE.SegmentBeginning() ;
-    SegmentEnd   = SegmentEnd   || PntE.SegmentEnd() ;
-    
-    const HatchGen_Element& Element = myElements.Find (PntE.Index()) ;
-    const TheCurveE& CurveE = Element.Curve() ;
-    
-    TopAbs_Orientation ElementOrientation = Element.Orientation() ;
-    Standard_Boolean ToReverse = (ElementOrientation == TopAbs_REVERSED);
-    Standard_Real Param ;
-    switch (PntE.Position()) 
-    {
-      case TopAbs_FORWARD  : 
-        Param = ToReverse ? CurveE.LastParameter() : CurveE.FirstParameter() ;
-        break ;
-
-      case TopAbs_INTERNAL : 
-        Param = PntE.Parameter() ;
-        break ;
-
-      case TopAbs_REVERSED : 
-        Param = ToReverse ? CurveE.FirstParameter() : CurveE.LastParameter() ;
-        break ;
-
-      default:
-        break;
-    }
-    
-//-- 
-#if TRACE_HATCHER
-    printf("\n ******** ToReverse: %d Param : %g   ANParam : %g \n",ToReverse,Param,PntE.Parameter());
-#endif
-    Param = PntE.Parameter();
-
-    myIntersector.LocalGeometry(CurveE.Curve(), Param, Tangente2d, Normale2d, Courbure);
-
-//-----------------------------------------------------------------------
-// Calcul de la transition locale. On suppose les relations suivantes :
-//  - Si l orientation de l element est INTERNAL ==> INTERNAL
-//  - Si l orientation de l element est EXTERNAL ==> EXTERNAL
-//  - Si tangence, on a IN-IN  ou OUT-OUT ==> INTERNAL/EXTERNAL
-//  - Sinon,       on a IN-OUT ou OUT-IN  ==> REVERSED/FORWARD 
-// Les deux dernieres conditions avec l element vu en FORWARD.    
-//-----------------------------------------------------------------------
-    TopAbs_Orientation LocalTransition = TopAbs_EXTERNAL;
-
-    if (ElementOrientation == TopAbs_INTERNAL) 
-      LocalTransition = TopAbs_INTERNAL ;
-
-    else if (ElementOrientation == TopAbs_EXTERNAL) 
-      LocalTransition = TopAbs_EXTERNAL ;
-
-    else if (PntE.IntersectionType() == HatchGen_TANGENT) 
-    {
-      if (PntE.Position() == TopAbs_INTERNAL) 
-      {
-        switch (PntE.StateBefore()) 
-        {
-        case TopAbs_IN  : LocalTransition = ToReverse ? TopAbs_EXTERNAL : TopAbs_INTERNAL ; break ;
-        case TopAbs_OUT : LocalTransition = ToReverse ? TopAbs_INTERNAL : TopAbs_EXTERNAL ; break ;
-        default: break;
-        }
-      } 
-      else 
-      {
-        switch (PntE.StateBefore()) 
-        {
-        case TopAbs_IN  : LocalTransition = ToReverse ? TopAbs_FORWARD  : TopAbs_REVERSED ; break ;
-        case TopAbs_OUT : LocalTransition = ToReverse ? TopAbs_REVERSED : TopAbs_FORWARD  ; break ;
-        default: break;
-        }
-      }
-    } 
-    else 
-    {
-      switch (PntE.StateBefore()) 
-      {
-      case TopAbs_IN  : LocalTransition = ToReverse ? TopAbs_FORWARD  : TopAbs_REVERSED ; break ;
-      case TopAbs_OUT : LocalTransition = ToReverse ? TopAbs_REVERSED : TopAbs_FORWARD  ; break ;
-      default: break;
-      }
-    }
-
-//-----------------------------------------------------------------------
-// Orientation de la tangente au point d interference.
-//-----------------------------------------------------------------------
-    TopAbs_Orientation TangenteOrientation = TopAbs_FORWARD;
-    switch (PntE.Position()) 
-    {
-    case TopAbs_FORWARD  : TangenteOrientation = ToReverse ? TopAbs_REVERSED : TopAbs_FORWARD  ; break ;
-    case TopAbs_INTERNAL : TangenteOrientation = TopAbs_INTERNAL ; break ;
-    case TopAbs_REVERSED : TangenteOrientation = ToReverse ? TopAbs_FORWARD  : TopAbs_REVERSED ; break ;
-    
-    default: 
-      break;
-    }
-
-//-----------------------------------------------------------------------
-// Proprietes geometriques.
-//-----------------------------------------------------------------------
-
-    if (ToReverse) {
-      Tangente.SetCoord (-Tangente2d.X(), -Tangente2d.Y(), 0.0) ;
-    } else {
-      Tangente.SetCoord ( Tangente2d.X(),  Tangente2d.Y(), 0.0) ;
-    }
-    Normale.SetCoord ( Normale2d.X(),  Normale2d.Y(), 0.0) ;
-
-#if TRACE_HATCHER
-    printf("\n \n----- Global Transition Complex Transition Compare" );
-    char *str1 = " ??? ";
-    char *str2 = " ??? ";
-    if(LocalTransition == TopAbs_INTERNAL) str1=" INTERNAL ";
-    if(LocalTransition == TopAbs_REVERSED) str1=" REVERSED ";
-    if(LocalTransition == TopAbs_FORWARD)  str1=" FORWARD  ";
-
-    if(TangenteOrientation == TopAbs_INTERNAL) str2=" INTERNAL ";
-    if(TangenteOrientation == TopAbs_REVERSED) str2=" REVERSED ";
-    if(TangenteOrientation == TopAbs_FORWARD)  str2=" FORWARD  ";
-
-    printf("\n       P:%+10.5g  Tg2d:%+10.5g , %+10.5g  N2d:%+10.5g , %+10.5g  Crv:%+10.5g LocalTr:%s TangOrie:%s\n",
-    Param,Tangente.X(),Tangente.Y(),Normale.X(),Normale.Y(),Courbure,str1,str2);
-#endif
-
-    ComplexTransition.Compare (Precision::Angular(),
-                               Tangente, Normale, Courbure,
-                               LocalTransition, TangenteOrientation) ;
-  }
-
-  switch (ComplexTransition.StateBefore()) {
-      case TopAbs_IN      : StateBefore = TopAbs_IN  ; break ;
-      case TopAbs_OUT     : StateBefore = TopAbs_OUT ; break ;
-      case TopAbs_ON      : return Standard_False ;
-      case TopAbs_UNKNOWN : return Standard_False ;
-  }
-  switch (ComplexTransition.StateAfter()) {
-      case TopAbs_IN      : StateAfter = TopAbs_IN  ; break ;
-      case TopAbs_OUT     : StateAfter = TopAbs_OUT ; break ;
-      case TopAbs_ON      : return Standard_False ;
-      case TopAbs_UNKNOWN : return Standard_False ;
-  }
-
-
-#if TRACE_HATCHER
-  printf("\n");
-  printf("\n --> StateBef :"); if(StateBefore==TopAbs_IN) printf(" IN "); else printf(" OUT ");
-  printf("\n --> StateAft :"); if(StateAfter==TopAbs_IN) printf(" IN "); else printf(" OUT ");
-  printf("\n------   Fin GlobalTransition\n");
-#endif
-  
-  Point.SetStateBefore      (StateBefore) ;
-  Point.SetStateAfter       (StateAfter) ;
-  Point.SetSegmentBeginning (SegmentBegin) ;
-  Point.SetSegmentEnd       (SegmentEnd) ;
-  return Standard_True ;
-}
-
-//=======================================================================
-// Function : ComputeDomains
-// Purpose  : Computes the domains of all the hatchings.
-//=======================================================================
-
-void HatchGen_Hatcher::ComputeDomains ()
-{
-  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++)
-    if (myHatchings.IsBound (IndH)) ComputeDomains (IndH) ;
-}
-
-//=======================================================================
-// Function : ComputeDomains
-// Purpose  : Computes the domains of the IndH-th hatching.
-//=======================================================================
-
-void HatchGen_Hatcher::ComputeDomains (const Standard_Integer IndH)
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-  
-  HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-  Hatching.ClrDomains() ;
-
-  Hatching.IsDone (Standard_False) ;
-
-  if (!Hatching.TrimDone()) Trim (IndH) ;
-  if (Hatching.Status() != HatchGen_NoProblem) return ;
-  
-  Standard_Boolean Points   = myKeepPoints ;
-  Standard_Boolean Segments = myKeepSegments ;
-  Standard_Integer ISav = 0 ;
-  Standard_Boolean SavPnt  = Standard_False ;
-  Standard_Integer NbOpenedSegments = 0 ;
-  Standard_Integer NbPnt = Hatching.NbPoints() ;
-  Standard_Integer IPnt =1;
-
-  if (NbPnt == 0) {
-    //-- cout << "The hatching # " << setw(3) << IndH << " has to be classified" << endl ;
-    HatchGen_Classifier Classifier(myElements,Hatching.ClassificationPoint(),0.0000001); 
-    if(Classifier.State() == TopAbs_IN) { 
-      HatchGen_Domain domain ;
-      Hatching.AddDomain (domain) ;
-    }
-    Hatching.IsDone (Standard_True) ;
-    return ;
-  }
-  
-//for (Standard_Integer IPnt = 1 ; IPnt <= NbPnt ; IPnt++) {
-  for (IPnt = 1 ; IPnt <= NbPnt ; IPnt++) {
-    Standard_Boolean NoDomain   = Hatching.NbDomains() == 0 ; 
-    Standard_Boolean FirstPoint = IPnt ==     1 ;
-    Standard_Boolean LastPoint  = IPnt == NbPnt ;
-
-    const HatchGen_PointOnHatching& CurPnt = Hatching.Point (IPnt) ;
-
-#if TRACE_HATCHER
-    cout << "===== ComputeDomains:: Hatching # " << setw(3) << IndH << " =====" << endl ;
-    CurPnt.Dump (IPnt) ;
-    cout << "==========================================" << endl ;
-#endif
-    
-    
-//-----------------------------------------------------------------------
-// Calcul des domaines.
-//-----------------------------------------------------------------------
-
-    TopAbs_State     StateBefore  = CurPnt.StateBefore() ;
-    TopAbs_State     StateAfter   = CurPnt.StateAfter() ;
-    Standard_Boolean SegmentBegin = CurPnt.SegmentBeginning() ;
-    Standard_Boolean SegmentEnd   = CurPnt.SegmentEnd() ;
-
-    HatchGen_Domain domain ;
-
-//-----------------------------------------------------------------------
-// Initialisations dues au premier point.
-//-----------------------------------------------------------------------
-
-    if (FirstPoint) {
-      SavPnt  = Standard_False ;
-      ISav = 0 ;
-      NbOpenedSegments = 0 ;
-      if (SegmentEnd && SegmentBegin) {
-       if (StateAfter  == TopAbs_UNKNOWN) StateAfter  = TopAbs_IN ;
-       if (StateBefore == TopAbs_UNKNOWN) StateBefore = TopAbs_IN ;
-       if (Segments) {
-         SavPnt  = Standard_True ;
-         ISav = 0 ;
-       }
-      } else if (SegmentEnd) {
-       if (StateAfter == TopAbs_UNKNOWN) StateAfter = TopAbs_IN ;
-       if (Segments) {
-         SavPnt  = Standard_True ;
-         ISav = 0 ;
-       }
-      } else if (SegmentBegin) {
-       if (StateBefore == TopAbs_UNKNOWN) StateBefore = TopAbs_IN ;
-       if (StateBefore == TopAbs_IN) {
-         SavPnt  = Standard_True ;
-         ISav = 0 ;
-       }
-      } else {
-       if (StateBefore == TopAbs_IN) {
-         SavPnt  = Standard_True ;
-         ISav = 0 ;
-       }
-      }
-    }
-
-//-----------------------------------------------------------------------
-// Initialisations dues au dernier point.
-//-----------------------------------------------------------------------
-
-    if (LastPoint) {
-      if (SegmentEnd && SegmentBegin) {
-       if (StateAfter  == TopAbs_UNKNOWN) StateAfter  = TopAbs_IN ;
-       if (StateBefore == TopAbs_UNKNOWN) StateBefore = TopAbs_IN ;
-      } else if (SegmentEnd) {
-       if (StateAfter  == TopAbs_UNKNOWN) StateAfter = TopAbs_IN ;
-      } else if (SegmentBegin) {
-       if (StateBefore == TopAbs_UNKNOWN) StateBefore = TopAbs_IN ;
-      } else {
-      }
-    }
-    
-//-----------------------------------------------------------------------
-// Cas general.
-//-----------------------------------------------------------------------
-
-    Standard_Boolean ToAppend = Standard_False ;
-
-    if (SegmentEnd && SegmentBegin) {
-
-      if (StateBefore != TopAbs_IN && StateAfter != TopAbs_IN) {
-       Hatching.Status (HatchGen_IncompatibleStates) ;
-       return ;
-      }
-      if (Points) {
-       if (Segments) {
-         if (!SavPnt) {
-           if(NoDomain) { 
-             Hatching.Status (HatchGen_IncoherentParity) ;
-           }
-           else { 
-             Hatching.IsDone(Standard_True);
-           }
-           return ;
-         }
-         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
-         domain.SetSecondPoint (CurPnt) ;
-         ToAppend = Standard_True ;
-         SavPnt = Standard_True ;
-         ISav = IPnt ;
-       } else {
-         Standard_Boolean isININ = (StateBefore == TopAbs_IN && StateAfter == TopAbs_IN);
-         if (SavPnt && !isININ) {
-           if(NoDomain) { 
-             Hatching.Status (HatchGen_IncoherentParity) ;
-           }
-           else { 
-             Hatching.IsDone(Standard_True);
-           }
-           return ;
-         }
-         domain.SetPoints (CurPnt, CurPnt) ;
-         ToAppend = Standard_True ;
-         SavPnt = Standard_False ;
-         ISav = 0 ;
-       }
-      }
-         
-    } else if (SegmentEnd) {
-
-      if (Segments) {
-       if (StateAfter == TopAbs_OUT) {
-         if (!SavPnt) {
-           if(NoDomain) { 
-             Hatching.Status (HatchGen_IncoherentParity) ;
-           }
-           else { 
-             Hatching.IsDone(Standard_True);
-           }
-           return ;
-         }
-         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
-         domain.SetSecondPoint (CurPnt) ;
-         ToAppend = Standard_True ;
-       } else {
-         if (Points) {
-           if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
-           domain.SetSecondPoint (CurPnt) ;
-           ToAppend = Standard_True ;
-           SavPnt = Standard_True ;
-           ISav = IPnt ;
-         }
-       }
-      } else {
-       if (StateAfter == TopAbs_IN) {
-         SavPnt = Standard_True ;
-         ISav = IPnt ;
-       }
-      }
-      NbOpenedSegments-- ;
-      
-    } else if (SegmentBegin) {
-
-      if (Segments) {
-       if (StateBefore == TopAbs_OUT) {
-         SavPnt = Standard_True ;
-         ISav = IPnt ;
-       } else {
-         if (Points) {
-           if (!SavPnt) {
-             if(NoDomain) { 
-               Hatching.Status (HatchGen_IncoherentParity) ;
-             }
-             else { 
-               Hatching.IsDone(Standard_True);
-             }
-             
-             return ;
-           }
-           if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
-           domain.SetSecondPoint (CurPnt) ;
-           ToAppend = Standard_True ;
-           SavPnt = Standard_True ;
-           ISav = IPnt ;
-         }
-       }
-      } else {
-       if (StateBefore == TopAbs_IN) {
-         if (!SavPnt) {
-           if(NoDomain) { 
-             Hatching.Status (HatchGen_IncoherentParity) ;
-           }
-           else { 
-             Hatching.IsDone(Standard_True);
-           }
-           
-           return ;
-         }
-         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
-         domain.SetSecondPoint (CurPnt) ;
-         ToAppend = Standard_True ;
-//  Modified by Sergey KHROMOV - Fri Jan  5 12:05:30 2001
-//       SavPnt = Standard_False ;
-//       ISav = 0 ;
-         SavPnt = Standard_True ;
-         ISav = IPnt ;
-//  Modified by Sergey KHROMOV - Fri Jan  5 12:05:31 2001
-       }
-      }
-      NbOpenedSegments++ ;
-      
-    } else {
-      //-- ???????????????????????????????????????????????????????????????????????????
-      //-- Solution provisoire (lbr le 11 Aout 97 )
-      //-- si On a 2 points dont des points OUT OUT ou IN IN qui delimitent une isos
-      //-- on transforme les transitions 
-      if (StateBefore == TopAbs_OUT && StateAfter == TopAbs_OUT) {
-       if(NbPnt == 2) { 
-         if(FirstPoint) 
-           StateAfter  = TopAbs_IN; 
-         else
-           StateBefore = TopAbs_IN; 
-       }
-      }
-       //-- ???????????????????????????????????????????????????????????????????????????
-      if        (StateBefore == TopAbs_OUT && StateAfter == TopAbs_OUT) {
-
-       if (SavPnt) {
-         if(NoDomain) { 
-           Hatching.Status (HatchGen_IncoherentParity) ;
-         }
-         else { 
-           Hatching.IsDone(Standard_True);
-         }
-         
-         return ;
-       }
-       if (Points) {
-         domain.SetPoints (CurPnt, CurPnt) ;
-         ToAppend = Standard_True ;
-         SavPnt = Standard_True ;
-         ISav = IPnt ;
-       }
-
-      } else if (StateBefore == TopAbs_OUT && StateAfter == TopAbs_IN ) {
-
-       SavPnt = Standard_True ;
-       ISav = IPnt ;
-
-      } else if (StateBefore == TopAbs_IN  && StateAfter == TopAbs_OUT) {
-
-       if (!SavPnt) {
-         if(NoDomain) { 
-           Hatching.Status (HatchGen_IncoherentParity) ;
-         }
-         else { 
-           Hatching.IsDone(Standard_True);
-         }
-         
-         return ;
-       }
-       if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
-       domain.SetSecondPoint (CurPnt) ;
-       ToAppend = Standard_True ;
-       SavPnt = Standard_False ;
-       ISav = 0 ;
-
-      } else if (StateBefore == TopAbs_IN  && StateAfter == TopAbs_IN ) {
-
-       if (Points) {
-         if (NbOpenedSegments == 0) {
-           if (!SavPnt) {
-             if(NoDomain) { 
-               Hatching.Status (HatchGen_IncoherentParity) ;
-             }
-             else { 
-               Hatching.IsDone(Standard_True);
-             }
-             
-             return ;
-           }
-           if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
-           domain.SetSecondPoint (CurPnt) ;
-           ToAppend = Standard_True ;
-           SavPnt = Standard_True ;
-           ISav = IPnt ;
-         } else {
-           if (Segments) {
-             if (!SavPnt) {
-               if(NoDomain) { 
-                 Hatching.Status (HatchGen_IncoherentParity) ;
-               }
-               else { 
-                 Hatching.IsDone(Standard_True);
-               }
-
-               return ;
-             }
-             if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
-             domain.SetSecondPoint (CurPnt) ;
-             ToAppend = Standard_True ;
-             SavPnt = Standard_True ;
-             ISav = IPnt ;
-           } else {
-             if (SavPnt) {
-               if(NoDomain) { 
-                 Hatching.Status (HatchGen_IncoherentParity) ;
-               }
-               else { 
-                 Hatching.IsDone(Standard_True);
-               }
-               
-               return ;
-             }
-             domain.SetPoints (CurPnt, CurPnt) ;
-             ToAppend = Standard_True ;
-             SavPnt = Standard_False ;
-             ISav = 0 ;
-           }
-         }
-       }
-
-      } else {
-
-       Hatching.Status (HatchGen_IncompatibleStates) ;
-       return ;
-
-      }
-       
-    }
-
-//-----------------------------------------------------------------------
-// Ajout du domaine.
-//-----------------------------------------------------------------------
-
-    if (ToAppend) Hatching.AddDomain (domain) ;
-    
-//-----------------------------------------------------------------------
-// Traitement lie au dernier point.
-//-----------------------------------------------------------------------
-
-    if (LastPoint) {
-      
-      domain.SetPoints () ;
-      ToAppend = Standard_False ;
-      
-      if (SegmentEnd && SegmentBegin) {
-       
-       if (Segments) {
-         if (!SavPnt) {
-           if(NoDomain) { 
-             Hatching.Status (HatchGen_IncoherentParity) ;
-           }
-           else { 
-             Hatching.IsDone(Standard_True);
-           }
-           
-           return ;
-         }
-         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
-         ToAppend = Standard_True ;
-       }
-       
-      } else if (SegmentEnd) {
-
-       if (StateAfter == TopAbs_IN) {
-         if (!SavPnt) {
-           if(NoDomain) { 
-             Hatching.Status (HatchGen_IncoherentParity) ;
-           }
-           else { 
-             Hatching.IsDone(Standard_True);
-           }
-           
-           return ;
-         }
-         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
-         ToAppend = Standard_True ;
-       }
-       
-      } else if (SegmentBegin) {
-       
-       if (Segments) {
-         if (!SavPnt) {
-           if(NoDomain) { 
-             Hatching.Status (HatchGen_IncoherentParity) ;
-           }
-           else { 
-             Hatching.IsDone(Standard_True);
-           }
-           
-           return ;
-         }
-         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
-         ToAppend = Standard_True ;
-       }
-
-      } else {
-       
-       if (StateAfter == TopAbs_IN) {
-         if (!SavPnt) {
-           if(NoDomain) { 
-             Hatching.Status (HatchGen_IncoherentParity) ;
-           }
-           else { 
-             Hatching.IsDone(Standard_True);
-           }
-           
-           return ;
-         }
-         if (ISav != 0) domain.SetFirstPoint (Hatching.Point(ISav)) ;
-         ToAppend = Standard_True ;
-       }
-
-      }
-      if (ToAppend) Hatching.AddDomain (domain) ;
-    }
-    
-  }
-  Hatching.IsDone(Standard_True) ;
-}
-
-//=======================================================================
-//=======================================================================
-//  Category : Results.
-//=======================================================================
-//=======================================================================
-
-
-//=======================================================================
-// Function : Domain
-// Purpose  : Returns the IDom-th domain of the IndH-th hatching.
-//=======================================================================
-
-const HatchGen_Domain& HatchGen_Hatcher::Domain (const Standard_Integer IndH,
-                                                const Standard_Integer IDom) const
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
-  StdFail_NotDone_Raise_if (!Hatching.IsDone(), "HatchGen_Hatcher::Domain") ;
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_OutOfRange_Raise_if (IDom < 1 || IDom > Hatching.NbDomains(), "") ;
-#endif
-  const HatchGen_Domain& Domain = Hatching.Domain (IDom) ;
-  return Domain ;
-}
-
-//=======================================================================
-//=======================================================================
-//  Category : Dump.
-//=======================================================================
-//=======================================================================
-
-//=======================================================================
-// Function : Dump
-// Purpose  : Dumps the hatcher.
-//=======================================================================
-
-void HatchGen_Hatcher::Dump () const
-{
-  cout << endl ;
-  cout << "========================================================" << endl ;
-  cout << "=== Dump of the hatcher ================================" << endl ;
-  cout << "========================================================" << endl ;
-  cout << endl ;
-
-  cout << "The points   are "
-       << (myKeepPoints   ? "    " : "not ")
-       << "considered."
-       << endl ;
-  cout << "The segments are "
-       << (myKeepSegments ? "    " : "not ")
-       << "considered."
-       << endl ;
-  cout << "2D Confusion tolerance : " << myConfusion2d << endl ;
-  cout << "3D Confusion tolerance : " << myConfusion3d << endl ;
-  
-  cout << myNbHatchings
-       << " hatching"
-       << ((myNbHatchings == 1) ? "" : "s")
-       << endl ;
-  cout << myNbElements
-       << " element"
-       << ((myNbElements  == 1) ? "" : "s")
-       << endl ;
-  
-  cout << endl ;
-  cout << "========================================================" << endl ;
-  cout << "=== Hatchings ==========================================" << endl ;
-  cout << "========================================================" << endl ;
-  cout << endl ;
-  
-  for (Standard_Integer IndH = 1 ; IndH <= myNbHatchings ; IndH++) {
-    cout << "Hatching # " << IndH ;
-    if (!myHatchings.IsBound (IndH)) {
-      cout << " is not bound" << endl ;
-    } else {
-      const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
-      Standard_Integer NbPnt = Hatching.NbPoints() ;
-      cout << " contains " << NbPnt << " restriction points :"  << endl ;
-      for (Standard_Integer IPnt = 1 ; IPnt <= NbPnt ; IPnt++) {
-       const HatchGen_PointOnHatching& PntH = Hatching.Point (IPnt) ;
-        PntH.Dump (IPnt) ;
-      }
-      cout << "----------------------------------------------" << endl ;
-    }
-  }
-
-  cout << endl ;
-  cout << "========================================================" << endl ;
-  cout << "=== Elements ===========================================" << endl ;
-  cout << "========================================================" << endl ;
-  cout << endl ;
-  
-  for (Standard_Integer IndE = 1 ; IndE <= myNbElements ; IndE++) {
-    cout << "Element # " << IndE ;
-    if (!myElements.IsBound (IndE)) {
-      cout << " is not bound" << endl ;
-    } else {
-      const HatchGen_Element& Element = myElements.Find (IndE) ;
-      switch (Element.Orientation()) {
-        case TopAbs_FORWARD  : cout << " is FORWARD"  << endl ; break ;
-        case TopAbs_REVERSED : cout << " is REVERSED" << endl ; break ;
-        case TopAbs_INTERNAL : cout << " is INTERNAL" << endl ; break ;
-        case TopAbs_EXTERNAL : cout << " is EXTERNAL" << endl ; break ;
-      }
-    }
-  }
-
-  cout << endl ;
-}
diff --git a/src/HatchGen/HatchGen_Hatcher.lxx b/src/HatchGen/HatchGen_Hatcher.lxx
deleted file mode 100644 (file)
index e0b4074..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-// Created on: 1995-01-03
-// Created by: Laurent BUCHARD
-// Copyright (c) 1995-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 RAISE_IF_NOSUCHOBJECT 0
-#define TRACE 0
-
-#include <StdFail_NotDone.hxx>
-
-#include HatchGen_Element_hxx
-#include HatchGen_Elements_hxx
-#include TheIntersector_hxx
-#include TheCurveE_hxx
-#include HatchGen_Hatching_hxx
-//=======================================================================
-// Function : Intersector
-// Purpose  : Returns the associated intersector.
-//=======================================================================
-
-inline const TheIntersector& HatchGen_Hatcher::Intersector ()
-{
-  return myIntersector ;
-}
-
-//=======================================================================
-// Function : ChangeIntersector
-// Purpose  : Returns the associated intersector.
-//=======================================================================
-
-inline TheIntersector& HatchGen_Hatcher::ChangeIntersector ()
-{
-  return myIntersector ;
-}
-
-//=======================================================================
-// Function : Confusion2d
-// Purpose  : Returns the 2d confusion tolerance.
-//=======================================================================
-
-inline Standard_Real HatchGen_Hatcher::Confusion2d () const
-{
-  return myConfusion2d ;
-}
-
-//=======================================================================
-// Function : Confusion3d
-// Purpose  : Returns the 3d confusion tolerance.
-//=======================================================================
-
-inline Standard_Real HatchGen_Hatcher::Confusion3d () const
-{
-  return myConfusion3d ;
-}
-
-//=======================================================================
-// Function : KeepPoints
-// Purpose  : Returns the flag about the points consideration.
-//=======================================================================
-
-inline Standard_Boolean HatchGen_Hatcher::KeepPoints () const
-{
-  return myKeepPoints ;
-}
-
-//=======================================================================
-// Function : KeepSegments
-// Purpose  : Returns the flag about the segments consideration.
-//=======================================================================
-
-inline Standard_Boolean HatchGen_Hatcher::KeepSegments () const
-{
-  return myKeepSegments ;
-}
-
-//=======================================================================
-// Function : Clear
-// Purpose  : Removes all the hatchings and all the elements.
-//=======================================================================
-
-inline void HatchGen_Hatcher::Clear ()
-{
-  if (myNbHatchings != 0) ClrHatchings () ;
-  if (myNbElements  != 0) ClrElements  () ;
-}
-
-//=======================================================================
-// Function : Element
-// Purpose  : Returns the IndE-th element.
-//=======================================================================
-
-inline HatchGen_Element& HatchGen_Hatcher::Element (const Standard_Integer IndE)
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
-#endif
-  HatchGen_Element& Element = myElements.ChangeFind (IndE) ;
-  return Element ;
-}
-
-//=======================================================================
-// Function : ElementCurve
-// Purpose  : Returns the curve associated to the IndE-th element.
-//=======================================================================
-
-inline const TheCurveE& HatchGen_Hatcher::ElementCurve (const Standard_Integer IndE) const
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
-#endif
-  const HatchGen_Element& Element = myElements.Find (IndE) ;
-  return Element.Curve() ;
-}
-
-
-//=======================================================================
-// Function : Hatching
-// Purpose  : Returns the IndH-th hatching.
-//=======================================================================
-
-inline HatchGen_Hatching& HatchGen_Hatcher::Hatching (const Standard_Integer IndH)
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-  HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
-  return Hatching ;
-}
-
-//=======================================================================
-// Function : HatchingCurve
-// Purpose  : Returns the curve associated to the IndH-th hatching.
-//=======================================================================
-
-inline const TheCurveH& HatchGen_Hatcher::HatchingCurve (const Standard_Integer IndH) const
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
-  return Hatching.Curve() ;
-}
-
-//=======================================================================
-// Function : NbPoints
-// Purpose  : Returns the number of intersection points of the IndH-th
-//            hatching.
-//=======================================================================
-
-inline Standard_Integer HatchGen_Hatcher::NbPoints (const Standard_Integer IndH) const
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
-  return Hatching.NbPoints() ;
-}
-
-//=======================================================================
-// Function : Point
-// Purpose  : Returns the IndP-th intersection point of the IndH-th
-//            hatching.
-//=======================================================================
-
-inline const HatchGen_PointOnHatching& HatchGen_Hatcher::Point (const Standard_Integer IndH,
-                                                        const Standard_Integer IndP) const
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_OutOfRange_Raise_if (IndP < 0 || IndP > Hatching.NbPoints(), "") ;
-#endif
-  const HatchGen_PointOnHatching& PntH = Hatching.Point (IndP) ;
-  return PntH ;
-}
-
-//=======================================================================
-// Function : TrimDone
-// Purpose  : Returns the fact that all the intersections were computed
-//            for the IndH-th hatching. 
-//=======================================================================
-
-inline Standard_Boolean HatchGen_Hatcher::TrimDone (const Standard_Integer IndH) const
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
-  return Hatching.TrimDone() ;
-}
-//=======================================================================
-// Function : TrimFailed
-// Purpose  : Returns the fact that all the intersections failed
-//            for the IndH-th hatching. 
-//=======================================================================
-
-inline Standard_Boolean HatchGen_Hatcher::TrimFailed (const Standard_Integer IndH) const
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
-  return Hatching.TrimFailed() ;
-}
-
-//=======================================================================
-// Function : IsDone
-// Purpose  : Returns the fact that all the domains were computed
-//            for the IndH-th hatching. 
-//=======================================================================
-
-inline Standard_Boolean HatchGen_Hatcher::IsDone (const Standard_Integer IndH) const
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
-  return Hatching.IsDone() ;
-}
-//=======================================================================
-// Function : Status
-// Purpose  : Returns the status about the IndH-th hatching. 
-//=======================================================================
-
-inline HatchGen_ErrorStatus HatchGen_Hatcher::Status (const Standard_Integer IndH) const
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
-  return Hatching.Status() ;
-}
-//=======================================================================
-// Function : NbDomains
-// Purpose  : Returns the number of domains of the IndH-th hatching.
-//=======================================================================
-
-inline Standard_Integer HatchGen_Hatcher::NbDomains (const Standard_Integer IndH) const
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
-#endif
-  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
-  StdFail_NotDone_Raise_if (!Hatching.IsDone(), "HatchGen_Hatcher::NbDomains") ;
-  return Hatching.NbDomains() ;
-}
-
-
-
diff --git a/src/HatchGen/HatchGen_HatchingGen.cdl b/src/HatchGen/HatchGen_HatchingGen.cdl
deleted file mode 100644 (file)
index ecb23d9..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
--- Created on: 1993-11-10
--- Created by: Jean Marc LACHAUME
--- 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.
-
-generic class HatchingGen from HatchGen (TheHatchingCurve as any)
-
-uses
-    ErrorStatus      from HatchGen ,
-    PointOnHatching  from HatchGen ,
-    PointsOnHatching from HatchGen ,
-    Domain           from HatchGen ,
-    Domains          from HatchGen , 
-    Pnt2d            from gp
-
-raises
-    OutOfRange   from Standard
-
-is
-
-     Create
-       
-       returns HatchingGen from HatchGen;
-
-
-    Create (Curve : TheHatchingCurve)
-    
-       ---Purpose: Creates a hatching.
-
-       returns HatchingGen from HatchGen ;
-
-
-    Curve (me)
-    
-       ---Purpose: Returns the curve associated to the hatching.
-
-       ---C++: return const &
-
-        returns TheHatchingCurve
-        is static ;
-
-
-    ChangeCurve (me : in out)
-    
-       ---Purpose: Returns the curve associated to the hatching.
-
-       ---C++: return &
-
-        returns TheHatchingCurve
-        is static ;
-
-
-    TrimDone (me : in out ; Flag : Boolean from Standard)
-
-       ---Purpose: Sets the flag about the trimming computations to the
-       --          given value.
-
-       is static ;
-
-
-    TrimDone (me)
-
-       ---Purpose: Returns the flag about the trimming computations.
-
-       returns Boolean from Standard
-       is static ;
-
-
-    TrimFailed (me : in out ; Flag : Boolean from Standard)
-
-       ---Purpose: Sets the flag about the trimming failure to the
-       --          given value.
-
-       is static ;
-
-
-    TrimFailed (me)
-
-       ---Purpose: Returns the flag about the trimming failure.
-
-       returns Boolean from Standard
-       is static ;
-
-
-    IsDone (me : in out ; Flag : Boolean from Standard)
-
-       ---Purpose: Sets the flag about the domains computation to the
-       --          given value.
-
-       is static ;
-
-
-    IsDone (me)
-
-       ---Purpose: Returns the flag about the domains computation.
-
-       returns Boolean from Standard
-       is static ;
-
-
-    Status (me : in out ; Status : ErrorStatus from HatchGen)
-
-       ---Purpose: Sets the error status.
-
-       is static ;
-
-
-    Status (me)
-
-       ---Purpose: Returns the error status.
-
-       returns ErrorStatus from HatchGen
-       is static ;
-
-
----Category: Points on hatching.
-
-    AddPoint (me : in out ; Point     : PointOnHatching from HatchGen ;
-                           Confusion : Real            from Standard)
-    
-       ---Purpose: Adds an intersection point to the hatching.
-
-       is static ;
-
-
-    NbPoints (me)
-    
-       ---Purpose: Returns the number of intersection points
-       --          of the hatching.
-
-        returns Integer from Standard
-        is static ;
-
-
-    Point (me ; Index : Integer from Standard)
-    
-       ---Purpose: Returns the Index-th intersection point of the
-       --          hatching.
-       --          The exception OutOfRange is raised if
-       --          Index < 1 or Index > NbPoints.
-
-       ---C++: return const &
-
-       returns PointOnHatching from HatchGen
-       raises OutOfRange from Standard
-       is static ;
-
-
-    ChangePoint (me : in out ; Index : Integer from Standard)
-    
-       ---Purpose: Returns the Index-th intersection point of the
-       --          hatching.
-       --          The exception OutOfRange is raised if
-       --          Index < 1 or Index > NbPoints.
-
-       ---C++: return &
-
-       returns PointOnHatching from HatchGen
-       raises OutOfRange from Standard
-       is static ;
-
-
-    RemPoint (me : in out ; Index : Integer from Standard)
-    
-       ---Purpose: Removes the Index-th intersection point of the
-       --          hatching.
-       --          The exception OutOfRange is raised if
-       --          Index < 1 or Index > NbPoints.
-
-       raises OutOfRange from Standard
-       is static ;
-
-
-    ClrPoints (me : in out)
-    
-       ---Purpose: Removes all the intersection points of the hatching.
-
-       is static ;
-
-
----Category: Domains.
-
-
-    AddDomain (me : in out ; Domain : Domain from HatchGen)
-    
-       ---Purpose: Adds a domain to the hatching.
-
-       is static ;
-
-
-    NbDomains (me)
-    
-       ---Purpose: Returns the number of domains of the hatching.
-
-        returns Integer from Standard
-        is static ;
-
-
-    Domain (me ; Index : Integer from Standard)
-    
-       ---Purpose: Returns the Index-th domain of the hatching.
-       --          The exception OutOfRange is raised if
-       --          Index < 1 or Index > NbDomains.
-
-       ---C++: return const &
-
-       returns Domain from HatchGen
-       raises OutOfRange from Standard
-       is static ;
-
-
-    RemDomain (me : in out ; Index : Integer from Standard)
-    
-       ---Purpose: Removes the Index-th domain of the hatching.
-       --          The exception OutOfRange is raised if
-       --          Index < 1 or Index > NbDomains.
-
-       raises OutOfRange from Standard
-       is static ;
-
-
-    ClrDomains (me : in out)
-    
-       ---Purpose: Removes all the domains of the hatching.
-
-       is static ;
-
-
-    ClassificationPoint (me) 
-       ---Purpose: Returns a point on the curve. 
-       --          This point will be used for the classification.
-    returns Pnt2d from gp
-    is static;
-       
-fields
-
-    myCurve      : TheHatchingCurve ;
-    myTrimDone   : Boolean          from Standard ;
-    myTrimFailed : Boolean          from Standard ;
-    myPoints     : PointsOnHatching from HatchGen ;
-    myIsDone     : Boolean          from Standard ;
-    myStatus     : ErrorStatus      from HatchGen ;
-    myDomains    : Domains          from HatchGen ;
-
-end HatchingGen from HatchGen ;
diff --git a/src/HatchGen/HatchGen_HatchingGen.gxx b/src/HatchGen/HatchGen_HatchingGen.gxx
deleted file mode 100644 (file)
index 2b02a73..0000000
+++ /dev/null
@@ -1,332 +0,0 @@
-// Created on: 1993-11-03
-// Created by: Jean Marc LACHAUME
-// 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 <HatchGen_PointOnElement.hxx>
-
-#define RAISE_IF_NOSUCHOBJECT 0
-
-#include <Precision.hxx>
-//=======================================================================
-// Function : HatchGen_HatchingGen
-// Purpose  : Constructor.
-//=======================================================================
-
-HatchGen_HatchingGen::HatchGen_HatchingGen () {
-}
-
-//=======================================================================
-// Function : HatchGen_HatchingGen
-// Purpose  : Constructor.
-//=======================================================================
-
-HatchGen_HatchingGen::HatchGen_HatchingGen (const TheHatchingCurve& Curve) :
-       myCurve      (Curve),
-       myTrimDone   (Standard_False),
-       myTrimFailed (Standard_False),
-       myIsDone     (Standard_False),
-       myStatus     (HatchGen_NoProblem)
-{
-}
-
-//=======================================================================
-// Function : Curve
-// Purpose  : Returns the curve associated to the hatching.
-//=======================================================================
-
-const TheHatchingCurve& HatchGen_HatchingGen::Curve () const
-{
-  return myCurve ;
-}
-     
-//=======================================================================
-// Function : ChangeCurve
-// Purpose  : Returns the curve associated to the hatching.
-//=======================================================================
-
-TheHatchingCurve& HatchGen_HatchingGen::ChangeCurve ()
-{
-  return myCurve ;
-}
-     
-//=======================================================================
-// Function : TrimDone
-// Purpose  : Sets the flag about the trimmings computation to the given
-//            value.
-//=======================================================================
-
-void HatchGen_HatchingGen::TrimDone (const Standard_Boolean Flag)
-{
-  myTrimDone = Flag ;
-}
-
-//=======================================================================
-// Function : TrimDone
-// Purpose  : Returns the flag about the trimmings computation.
-//=======================================================================
-
-Standard_Boolean HatchGen_HatchingGen::TrimDone () const
-{
-  return myTrimDone ;
-}
-
-//=======================================================================
-// Function : TrimFailed
-// Purpose  : Sets the flag about the trimmings failure to the given
-//            value.
-//=======================================================================
-
-void HatchGen_HatchingGen::TrimFailed (const Standard_Boolean Flag)
-{
-  myTrimFailed = Flag ;
-  if (myTrimFailed) myStatus = HatchGen_TrimFailure ;
-}
-
-//=======================================================================
-// Function : TrimFailed
-// Purpose  : Returns the flag about the trimmings failure.
-//=======================================================================
-
-Standard_Boolean HatchGen_HatchingGen::TrimFailed () const
-{
-  return myTrimFailed ;
-}
-
-//=======================================================================
-// Function : IsDone
-// Purpose  : Sets the flag about the domains computation to the given
-//            value.
-//=======================================================================
-
-void HatchGen_HatchingGen::IsDone (const Standard_Boolean Flag)
-{
-  myIsDone = Flag ;
-}
-
-//=======================================================================
-// Function : IsDone
-// Purpose  : Returns the flag about the domains computation.
-//=======================================================================
-
-Standard_Boolean HatchGen_HatchingGen::IsDone () const
-{
-  return myIsDone ;
-}
-
-//=======================================================================
-// Function : SetStatus
-// Purpose  : Sets the error status.
-//=======================================================================
-
-void HatchGen_HatchingGen::Status (const HatchGen_ErrorStatus Status)
-{
-  myStatus = Status ;
-}
-
-//=======================================================================
-// Function : Status
-// Purpose  : Returns the error status.
-//=======================================================================
-
-HatchGen_ErrorStatus HatchGen_HatchingGen::Status () const
-{
-  return myStatus ;
-}
-
-//=======================================================================
-// Function : AddPoint
-// Purpose  : Adds an intersection point to the hatching.
-//=======================================================================
-
-void HatchGen_HatchingGen::AddPoint (const HatchGen_PointOnHatching& Point,
-                                    const Standard_Real Confusion)
-{
-  Standard_Integer NbPoints = myPoints.Length () ;
-//for (Standard_Integer IPntH = 1 ; IPntH <= NbPoints ; IPntH++) {
-  Standard_Integer IPntH;
-  for (IPntH = 1 ; IPntH <= NbPoints ; IPntH++) {
-    const HatchGen_PointOnHatching& PntH = myPoints.Value (IPntH) ;
-    if (!PntH.IsLower (Point, Confusion)) break ;
-  }
-  if (IPntH > NbPoints) {
-    myPoints.Append (Point) ;
-  } else {
-    HatchGen_PointOnHatching& PntH = myPoints.ChangeValue (IPntH) ;
-    if (PntH.IsGreater (Point, Confusion)) {
-      myPoints.InsertBefore (IPntH, Point) ;
-    } else {
-      for (Standard_Integer IPntE = 1 ; IPntE <= Point.NbPoints() ; IPntE++) {
-       const HatchGen_PointOnElement& PntE = Point.Point (IPntE) ;
-       PntH.AddPoint (PntE, Confusion) ;
-      }
-    }
-  }
-  if (myIsDone) ClrDomains() ;
-}
-
-//=======================================================================
-// Function : NbPoints
-// Purpose  : Returns the number of intersection points on the hatching.
-//=======================================================================
-
-Standard_Integer HatchGen_HatchingGen::NbPoints () const
-{
-  return myPoints.Length () ;
-}
-     
-//=======================================================================
-// Function : Point
-// Purpose  : Returns the Index-th intersection point on the hatching.
-//=======================================================================
-
-const HatchGen_PointOnHatching& HatchGen_HatchingGen::Point (const Standard_Integer Index) const
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_Integer NbPoints = myPoints.Length () ;
-  Standard_OutOfRange_Raise_if (Index < 1 || Index > NbPoints, "") ;
-#endif
-  const HatchGen_PointOnHatching& Point = myPoints.Value (Index) ;
-  return Point ;
-}
-     
-//=======================================================================
-// Function : ChangePoint
-// Purpose  : Returns the Index-th intersection point on the hatching.
-//=======================================================================
-
-HatchGen_PointOnHatching& HatchGen_HatchingGen::ChangePoint (const Standard_Integer Index) 
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_Integer NbPoints = myPoints.Length () ;
-  Standard_OutOfRange_Raise_if (Index < 1 || Index > NbPoints, "") ;
-#endif
-  HatchGen_PointOnHatching& Point = myPoints.ChangeValue (Index) ;
-  return Point ;
-}
-     
-//=======================================================================
-// Function : RemPoint
-// Purpose  : Removes the Index-th intersection point of the hatching.
-//=======================================================================
-
-void HatchGen_HatchingGen::RemPoint (const Standard_Integer Index)
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_Integer NbPoints = myPoints.Length () ;
-  Standard_OutOfRange_Raise_if (Index < 1 || Index > NbPoints, "") ;
-#endif
-  if (myIsDone) ClrDomains() ;
-  myPoints.Remove (Index) ;
-}
-
-//=======================================================================
-// Function : ClrPoints
-// Purpose  : Removes all the intersection points of the hatching.
-//=======================================================================
-
-void HatchGen_HatchingGen::ClrPoints ()
-{
-  if (myIsDone) ClrDomains() ;
-  for (Standard_Integer IPntH = 1 ; IPntH <= myPoints.Length() ; IPntH++) {
-    HatchGen_PointOnHatching& Point = myPoints.ChangeValue (IPntH) ;
-    Point.ClrPoints() ;
-  }
-  myPoints.Clear () ;
-  myTrimDone   = Standard_False ;
-  myTrimFailed = Standard_False ;
-}
-
-//=======================================================================
-// Function : AddDomain
-// Purpose  : Adds a domain to the hatching.
-//=======================================================================
-
-void HatchGen_HatchingGen::AddDomain (const HatchGen_Domain& Domain)
-{
-  myDomains.Append (Domain) ;
-}
-
-//=======================================================================
-// Function : NbDomains
-// Purpose  : Returns the number of domains on the hatching.
-//=======================================================================
-
-Standard_Integer HatchGen_HatchingGen::NbDomains () const
-{
-  return myDomains.Length () ;
-}
-     
-//=======================================================================
-// Function : Domain
-// Purpose  : Returns the Index-th domain on the hatching.
-//=======================================================================
-
-const HatchGen_Domain& HatchGen_HatchingGen::Domain (const Standard_Integer Index) const
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_Integer NbDomains = myDomains.Length () ;
-  Standard_OutOfRange_Raise_if (Index < 1 || Index > NbDomains, "") ;
-#endif
-  const HatchGen_Domain& Domain = myDomains.Value (Index) ;
-  return Domain ;
-}
-     
-//=======================================================================
-// Function : RemDomain
-// Purpose  : Removes the Index-th domain of the hatching.
-//=======================================================================
-
-void HatchGen_HatchingGen::RemDomain (const Standard_Integer Index)
-{
-#if RAISE_IF_NOSUCHOBJECT
-  Standard_Integer NbDomains = myDomains.Length () ;
-  Standard_OutOfRange_Raise_if (Index < 1 || Index > NbDomains, "") ;
-#endif
-  myDomains.Remove (Index) ;
-}
-
-//=======================================================================
-// Function : ClrDomains
-// Purpose  : Removes all the domains of the hatching.
-//=======================================================================
-
-void HatchGen_HatchingGen::ClrDomains ()
-{
-  myDomains.Clear () ;
-  myIsDone = Standard_False ;
-}
-
-//=======================================================================
-// Function : ClassificationPoint
-// Purpose  : returns a 2d point on the curve 
-//=======================================================================
-gp_Pnt2d HatchGen_HatchingGen::ClassificationPoint () const { 
-  Standard_Real t,a,b;
-  a = myCurve.FirstParameter();
-  b = myCurve.LastParameter();
-  if(b >= Precision::Infinite()) { 
-    if(a <= -Precision::Infinite()) { 
-      t=0;
-    }
-    else { 
-      t = a;
-    }
-  }
-  else { 
-    t = b; 
-  }
-  return(myCurve.Value(t));
-}
-    
index f35476d..28d7a61 100644 (file)
@@ -41,7 +41,7 @@
 #include <TopoDS_Edge.hxx>
 #include <Precision.hxx>
 #include <Geom2d_Circle.hxx>
-#include <Geom2dGcc_MyQCurve.hxx>
+#include <Geom2dGcc_QCurve.hxx>
 #include <GccEnt_QualifiedCirc.hxx>
 #include <Geom2dGcc_MyL2d2Tan.hxx>
 #include <BRepBuilderAPI_MakeWire.hxx>
@@ -154,7 +154,7 @@ static Standard_Integer BUC60843 (Draw_Interpretor& di, Standard_Integer argc,co
   }
   if(c1IsCircle) {
     Geom2dAdaptor_Curve acur(aCur2d2);
-    Geom2dGcc_MyQCurve qcur(acur, GccEnt_unqualified);
+    Geom2dGcc_QCurve qcur(acur, GccEnt_unqualified);
     GccEnt_QualifiedCirc qfromcur(aCir2d->Circ2d(), GccEnt_unqualified);
     Geom2dGcc_MyL2d2Tan lintan(qfromcur, qcur , par1, tol); 
     if (lintan.IsDone()) {
@@ -168,8 +168,8 @@ static Standard_Integer BUC60843 (Draw_Interpretor& di, Standard_Integer argc,co
   else {
     Geom2dAdaptor_Curve acur1(aCur2d1);
     Geom2dAdaptor_Curve acur2(aCur2d2);
-    Geom2dGcc_MyQCurve qcur1(acur1, GccEnt_unqualified);
-    Geom2dGcc_MyQCurve qcur2(acur2, GccEnt_unqualified);
+    Geom2dGcc_QCurve qcur1(acur1, GccEnt_unqualified);
+    Geom2dGcc_QCurve qcur2(acur2, GccEnt_unqualified);
     Geom2dGcc_MyL2d2Tan lintan(qcur1, qcur2 , par1, par2, tol); 
     if (lintan.IsDone()) {
       gp_Lin2d lin = lintan.ThisSolution();