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_MakeEllipse_HeaderFile |
18 | #define _GCE2d_MakeEllipse_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_Ellipse.hxx> |
26 | |
42cf5bc1 |
27 | class StdFail_NotDone; |
28 | class gp_Elips2d; |
29 | class gp_Ax2d; |
30 | class gp_Ax22d; |
31 | class gp_Pnt2d; |
32 | |
33 | |
34 | //! This class implements the following algorithms used to |
35 | //! create Ellipse from Geom2d. |
36 | //! * Create an Ellipse from two apex and the center. |
37 | //! Defines an ellipse in 2D space. |
38 | //! The parametrization range is [0,2*PI]. |
39 | //! The ellipse is a closed and periodic curve. |
40 | //! The center of the ellipse is the "Location" point of its |
41 | //! axis placement "XAxis". |
42 | //! The "XAxis" of the ellipse defines the origin of the |
43 | //! parametrization, it is the major axis of the ellipse. |
44 | //! The YAxis is the minor axis of the ellipse. |
45 | class GCE2d_MakeEllipse : public GCE2d_Root |
46 | { |
47 | public: |
48 | |
49 | DEFINE_STANDARD_ALLOC |
50 | |
51 | |
52 | |
53 | //! Creates an ellipse from a non persistent one from package gp |
54 | Standard_EXPORT GCE2d_MakeEllipse(const gp_Elips2d& E); |
55 | |
56 | |
57 | //! MajorAxis is the local coordinate system of the ellipse. |
58 | //! It is the "XAxis". The minor axis is the YAxis of the |
59 | //! ellipse. |
60 | //! Sense give the sense of parametrization of the Ellipse. |
61 | //! It is not forbidden to create an ellipse with MajorRadius = |
62 | //! MinorRadius. |
63 | //! The status is "InvertRadius" if MajorRadius < MinorRadius or |
64 | //! "NegativeRadius" if MinorRadius < 0. |
65 | Standard_EXPORT GCE2d_MakeEllipse(const gp_Ax2d& MajorAxis, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const Standard_Boolean Sense = Standard_True); |
66 | |
67 | |
68 | //! Axis is the local coordinate system of the ellipse. |
69 | //! It is not forbidden to create an ellipse with MajorRadius = |
70 | //! MinorRadius. |
71 | //! The status is "InvertRadius" if MajorRadius < MinorRadius or |
72 | //! "NegativeRadius" if MinorRadius < 0. |
73 | Standard_EXPORT GCE2d_MakeEllipse(const gp_Ax22d& Axis, const Standard_Real MajorRadius, const Standard_Real MinorRadius); |
74 | |
75 | //! Make an Ellipse centered on the point Center, where |
76 | //! - the major axis of the ellipse is defined by Center and S1, |
77 | //! - its major radius is the distance between Center and S1, and |
78 | //! - its minor radius is the distance between S2 and the major axis. |
79 | //! The implicit orientation of the ellipse is: |
80 | //! - the sense defined by Axis or E, |
81 | //! - the sense defined by points Center, S1 and S2, |
82 | //! - the trigonometric sense if Sense is not given or is true, or |
83 | //! - the opposite sense if Sense is false. |
84 | Standard_EXPORT GCE2d_MakeEllipse(const gp_Pnt2d& S1, const gp_Pnt2d& S2, const gp_Pnt2d& Center); |
85 | |
86 | //! Returns the constructed ellipse. |
87 | //! Exceptions StdFail_NotDone if no ellipse is constructed. |
88 | Standard_EXPORT const Handle(Geom2d_Ellipse)& Value() const; |
42cf5bc1 |
89 | |
d1a67b9d |
90 | operator const Handle(Geom2d_Ellipse)& () const { return Value(); } |
42cf5bc1 |
91 | |
92 | private: |
42cf5bc1 |
93 | Handle(Geom2d_Ellipse) TheEllipse; |
42cf5bc1 |
94 | }; |
95 | |
42cf5bc1 |
96 | #endif // _GCE2d_MakeEllipse_HeaderFile |