0027111: Add generalized copy constructor in handle class for old compilers
[occt.git] / src / GCE2d / GCE2d_MakeParabola.hxx
1 // Created on: 1992-09-28
2 // Created by: Remi GILET
3 // Copyright (c) 1992-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 #ifndef _GCE2d_MakeParabola_HeaderFile
18 #define _GCE2d_MakeParabola_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <GCE2d_Root.hxx>
25 #include <Geom2d_Parabola.hxx>
26
27 class StdFail_NotDone;
28 class gp_Parab2d;
29 class gp_Ax22d;
30 class gp_Ax2d;
31 class gp_Pnt2d;
32
33
34 //! This class implements the following algorithms used to
35 //! create Parabola from Geom2d.
36 //! * Create an Parabola from two apex  and the center.
37 //! Defines the parabola in the parameterization range  :
38 //! ]-infinite,+infinite[
39 //! The vertex of the parabola is the "Location" point of the
40 //! local coordinate system "XAxis" of the parabola.
41 //! The "XAxis" of the parabola is its axis of symmetry.
42 //! The "Xaxis" is oriented from the vertex of the parabola to the
43 //! Focus of the parabola.
44 //! The equation of the parabola in the local coordinate system is
45 //! Y**2 = (2*P) * X
46 //! P is the distance between the focus and the directrix of the
47 //! parabola called Parameter).
48 //! The focal length F = P/2 is the distance between the vertex
49 //! and the focus of the parabola.
50 class GCE2d_MakeParabola  : public GCE2d_Root
51 {
52 public:
53
54   DEFINE_STANDARD_ALLOC
55
56   
57   //! Creates a parabola from a non persistent one.
58   Standard_EXPORT GCE2d_MakeParabola(const gp_Parab2d& Prb);
59   
60   //! Creates a parabola with its local coordinate system and it's focal
61   //! length "Focal".
62   //! The "Location" point of "Axis" is the vertex of the parabola
63   //! Status is "NegativeFocusLength" if Focal < 0.0
64   Standard_EXPORT GCE2d_MakeParabola(const gp_Ax22d& Axis, const Standard_Real Focal);
65   
66   //! Creates a parabola with its "MirrorAxis" and it's focal length "Focal".
67   //! MirrorAxis is the axis of symmetry of the curve, it is the
68   //! "XAxis". The "YAxis" is parallel to the directrix of the
69   //! parabola. The "Location" point of "MirrorAxis" is the vertex of the parabola
70   //! Status is "NegativeFocusLength" if Focal < 0.0
71   Standard_EXPORT GCE2d_MakeParabola(const gp_Ax2d& MirrorAxis, const Standard_Real Focal, const Standard_Boolean Sense);
72   
73   //! Creates a parabola with the local coordinate system and the focus point.
74   //! The sense of parametrization is given by Sense.
75   Standard_EXPORT GCE2d_MakeParabola(const gp_Ax22d& D, const gp_Pnt2d& F);
76   
77
78   //! D is the directrix of the parabola and F the focus point.
79   //! The symmetry axis "XAxis" of the parabola is normal to the
80   //! directrix and pass through the focus point F, but its
81   //! "Location" point is the vertex of the parabola.
82   //! The "YAxis" of the parabola is parallel to D and its "Location"
83   //! point is the vertex of the parabola.
84   Standard_EXPORT GCE2d_MakeParabola(const gp_Ax2d& D, const gp_Pnt2d& F, const Standard_Boolean Sense = Standard_True);
85   
86   //! Make a parabola with focal point S1 and
87   //! center O
88   //! The branch of the parabola returned will have <S1> as
89   //! focal point
90   //! The implicit orientation of the parabola is:
91   //! -   the same one as the parabola Prb,
92   //! -   the sense defined by the coordinate system Axis or the directrix D,
93   //! -   the trigonometric sense if Sense is not given or is true, or
94   //! -   the opposite sense if Sense is false.
95   //! Warning
96   //! The MakeParabola class does not prevent the
97   //! construction of a parabola with a null focal distance.
98   //! If an error occurs (that is, when IsDone returns
99   //! false), the Status function returns:
100   //! -   gce_NullFocusLength if Focal is less than 0.0, or
101   //! -   gce_NullAxis if points S1 and O are coincident.
102   Standard_EXPORT GCE2d_MakeParabola(const gp_Pnt2d& S1, const gp_Pnt2d& O);
103   
104   //! Returns the constructed parabola.
105   //! Exceptions StdFail_NotDone if no parabola is constructed.
106   Standard_EXPORT const Handle(Geom2d_Parabola)& Value() const;
107
108   operator const Handle(Geom2d_Parabola)& () const { return Value(); }
109
110 private:
111   Handle(Geom2d_Parabola) TheParabola;
112 };
113
114 #endif // _GCE2d_MakeParabola_HeaderFile