0032832: Coding - get rid of unused headers [FairCurve to GeomAPI]
[occt.git] / src / GeomAPI / GeomAPI.cxx
1 // Created on: 1994-08-05
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <GeomAPI.hxx>
18
19 #include <Adaptor3d_CurveOnSurface.hxx>
20 #include <Geom2d_Curve.hxx>
21 #include <Geom2d_TrimmedCurve.hxx>
22 #include <Geom2dAdaptor.hxx>
23 #include <Geom2dAdaptor_Curve.hxx>
24 #include <Geom_BezierCurve.hxx>
25 #include <Geom_Curve.hxx>
26 #include <Geom_Plane.hxx>
27 #include <GeomAdaptor.hxx>
28 #include <GeomAdaptor_Curve.hxx>
29 #include <GeomAdaptor_Surface.hxx>
30 #include <gp_Pln.hxx>
31 #include <ProjLib_ProjectedCurve.hxx>
32 #include <TColgp_Array1OfPnt.hxx>
33
34 //=======================================================================
35 //function : To2d
36 //purpose  : 
37 //=======================================================================
38 Handle(Geom2d_Curve) GeomAPI::To2d(const Handle(Geom_Curve)& C,
39                                    const gp_Pln& P)
40 {
41   Handle(Geom2d_Curve) result;
42   Handle(GeomAdaptor_Curve) HC = new GeomAdaptor_Curve(C);
43   Handle(Geom_Plane) Plane = new Geom_Plane(P);
44   Handle(GeomAdaptor_Surface) HS = new GeomAdaptor_Surface(Plane);
45
46   ProjLib_ProjectedCurve Proj(HS,HC);
47
48   if (Proj.GetType() != GeomAbs_OffsetCurve && 
49       Proj.GetType() != GeomAbs_OtherCurve) {
50     result = Geom2dAdaptor::MakeCurve(Proj);
51   }
52   
53   return result;
54 }
55
56
57
58 //=======================================================================
59 //function : To3d
60 //purpose  : 
61 //=======================================================================
62
63 Handle(Geom_Curve) GeomAPI::To3d(const Handle(Geom2d_Curve)& C,
64                                  const gp_Pln& P)
65 {
66   Handle(Geom2dAdaptor_Curve) AHC  = new Geom2dAdaptor_Curve(C);
67
68   Handle(Geom_Plane) ThePlane = new Geom_Plane(P);
69   Handle(GeomAdaptor_Surface) AHS = new GeomAdaptor_Surface(ThePlane);
70
71   Adaptor3d_CurveOnSurface COS(AHC,AHS);
72   return GeomAdaptor::MakeCurve(COS);
73 }