b311480e |
1 | // Created on: 1994-08-05 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1994-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
7fd59977 |
17 | |
7fd59977 |
18 | #include <Adaptor3d_CurveOnSurface.hxx> |
42cf5bc1 |
19 | #include <Geom2d_Curve.hxx> |
20 | #include <Geom2d_TrimmedCurve.hxx> |
7fd59977 |
21 | #include <Geom2dAdaptor.hxx> |
7fd59977 |
22 | #include <Geom2dAdaptor_HCurve.hxx> |
42cf5bc1 |
23 | #include <Geom_BezierCurve.hxx> |
24 | #include <Geom_BSplineCurve.hxx> |
7fd59977 |
25 | #include <Geom_Circle.hxx> |
42cf5bc1 |
26 | #include <Geom_Curve.hxx> |
7fd59977 |
27 | #include <Geom_Ellipse.hxx> |
7fd59977 |
28 | #include <Geom_Hyperbola.hxx> |
42cf5bc1 |
29 | #include <Geom_Line.hxx> |
30 | #include <Geom_Parabola.hxx> |
31 | #include <Geom_Plane.hxx> |
7fd59977 |
32 | #include <Geom_TrimmedCurve.hxx> |
42cf5bc1 |
33 | #include <GeomAdaptor.hxx> |
34 | #include <GeomAdaptor_HCurve.hxx> |
35 | #include <GeomAdaptor_HSurface.hxx> |
36 | #include <GeomAdaptor_Surface.hxx> |
37 | #include <GeomAPI.hxx> |
38 | #include <gp_Pln.hxx> |
39 | #include <ProjLib_ProjectedCurve.hxx> |
7fd59977 |
40 | #include <TColgp_Array1OfPnt.hxx> |
42cf5bc1 |
41 | #include <TColStd_Array1OfInteger.hxx> |
42 | #include <TColStd_Array1OfReal.hxx> |
7fd59977 |
43 | |
44 | //======================================================================= |
45 | //function : To2d |
46 | //purpose : |
47 | //======================================================================= |
7fd59977 |
48 | Handle(Geom2d_Curve) GeomAPI::To2d(const Handle(Geom_Curve)& C, |
49 | const gp_Pln& P) |
50 | { |
51 | Handle(Geom2d_Curve) result; |
52 | Handle(GeomAdaptor_HCurve) HC = new GeomAdaptor_HCurve(C); |
53 | Handle(Geom_Plane) Plane = new Geom_Plane(P); |
54 | Handle(GeomAdaptor_HSurface) HS = new GeomAdaptor_HSurface(Plane); |
55 | |
56 | ProjLib_ProjectedCurve Proj(HS,HC); |
57 | |
1aec3320 |
58 | if (Proj.GetType() != GeomAbs_OffsetCurve && |
59 | Proj.GetType() != GeomAbs_OtherCurve) { |
7fd59977 |
60 | result = Geom2dAdaptor::MakeCurve(Proj); |
61 | } |
62 | |
63 | return result; |
64 | } |
65 | |
66 | |
67 | |
68 | //======================================================================= |
69 | //function : To3d |
70 | //purpose : |
71 | //======================================================================= |
72 | |
73 | Handle(Geom_Curve) GeomAPI::To3d(const Handle(Geom2d_Curve)& C, |
74 | const gp_Pln& P) |
75 | { |
76 | Handle(Geom2dAdaptor_HCurve) AHC = new Geom2dAdaptor_HCurve(C); |
77 | |
78 | Handle(Geom_Plane) ThePlane = new Geom_Plane(P); |
79 | Handle(GeomAdaptor_HSurface) AHS = new GeomAdaptor_HSurface(ThePlane); |
80 | |
81 | Adaptor3d_CurveOnSurface COS(AHC,AHS); |
82 | return GeomAdaptor::MakeCurve(COS); |
83 | } |