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 _GC_MakeEllipse_HeaderFile |
18 | #define _GC_MakeEllipse_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <GC_Root.hxx> |
d1a67b9d |
25 | #include <Geom_Ellipse.hxx> |
26 | |
42cf5bc1 |
27 | class StdFail_NotDone; |
28 | class gp_Elips; |
29 | class gp_Ax2; |
30 | class gp_Pnt; |
31 | |
32 | |
33 | //! This class implements construction algorithms for an ellipse in |
34 | //! 3D space. The result is a Geom_Ellipse ellipse. |
35 | //! A MakeEllipse object provides a framework for: |
36 | //! - defining the construction of the ellipse, |
37 | //! - implementing the construction algorithm, and |
38 | //! - consulting the results. In particular, the Value |
39 | //! function returns the constructed ellipse. |
40 | class GC_MakeEllipse : public GC_Root |
41 | { |
42 | public: |
43 | |
44 | DEFINE_STANDARD_ALLOC |
45 | |
46 | |
47 | |
48 | //! Creates an ellipse from a non persistent ellipse E from package gp by its conversion. |
49 | Standard_EXPORT GC_MakeEllipse(const gp_Elips& E); |
50 | |
51 | //! Constructs an ellipse with major and minor radii MajorRadius and |
52 | //! MinorRadius, and located in the plane defined by |
53 | //! the "X Axis" and "Y Axis" of the coordinate system A2, where: |
54 | //! - its center is the origin of A2, and |
55 | //! - its major axis is the "X Axis" of A2; |
56 | //! Warnings : |
57 | //! The MakeEllipse class does not prevent the |
58 | //! construction of an ellipse where MajorRadius is equal to MinorRadius. |
59 | //! If an error occurs (that is, when IsDone returns |
60 | //! false), the Status function returns: |
61 | //! - gce_InvertRadius if MajorRadius is less than MinorRadius; |
62 | //! - gce_NegativeRadius if MinorRadius is less than 0.0; |
63 | //! - gce_NullAxis if the points S1 and Center are coincident; or |
64 | //! - gce_InvertAxis if: |
65 | //! - the major radius computed with Center and S1 |
66 | //! is less than the minor radius computed with Center, S1 and S2, or |
67 | //! - Center, S1 and S2 are collinear. |
68 | Standard_EXPORT GC_MakeEllipse(const gp_Ax2& A2, const Standard_Real MajorRadius, const Standard_Real MinorRadius); |
69 | |
70 | //! Constructs an ellipse centered on the point Center, where |
71 | //! - the plane of the ellipse is defined by Center, S1 and S2, |
72 | //! - its major axis is defined by Center and S1, |
73 | //! - its major radius is the distance between Center and S1, and |
74 | //! - its minor radius is the distance between S2 and the major axis. |
75 | Standard_EXPORT GC_MakeEllipse(const gp_Pnt& S1, const gp_Pnt& S2, const gp_Pnt& Center); |
76 | |
77 | //! Returns the constructed ellipse. |
78 | //! Exceptions StdFail_NotDone if no ellipse is constructed. |
79 | Standard_EXPORT const Handle(Geom_Ellipse)& Value() const; |
42cf5bc1 |
80 | |
d1a67b9d |
81 | operator const Handle(Geom_Ellipse)& () const { return Value(); } |
42cf5bc1 |
82 | |
83 | private: |
42cf5bc1 |
84 | Handle(Geom_Ellipse) TheEllipse; |
42cf5bc1 |
85 | }; |
86 | |
42cf5bc1 |
87 | #endif // _GC_MakeEllipse_HeaderFile |