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