42cf5bc1 |
1 | // Created on: 1992-08-26 |
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 _gce_MakeElips_HeaderFile |
18 | #define _gce_MakeElips_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <gp_Elips.hxx> |
25 | #include <gce_Root.hxx> |
26 | #include <Standard_Real.hxx> |
27 | class StdFail_NotDone; |
28 | class gp_Ax2; |
29 | class gp_Pnt; |
30 | class gp_Elips; |
31 | |
32 | |
33 | //! This class implements the following algorithms used to |
34 | //! create an ellipse from gp. |
35 | //! |
36 | //! * Create an ellipse from its center, and two points: |
37 | //! one on the ciconference giving the major radius, the |
38 | //! other giving the value of the small radius. |
39 | class gce_MakeElips : public gce_Root |
40 | { |
41 | public: |
42 | |
43 | DEFINE_STANDARD_ALLOC |
44 | |
45 | |
46 | //! The major radius of the ellipse is on the "XAxis" and the |
47 | //! minor radius is on the "YAxis" of the ellipse. The "XAxis" |
48 | //! is defined with the "XDirection" of A2 and the "YAxis" is |
49 | //! defined with the "YDirection" of A2. |
50 | //! Warnings : |
51 | //! It is not forbidden to create an ellipse with |
52 | //! MajorRadius = MinorRadius. |
53 | Standard_EXPORT gce_MakeElips(const gp_Ax2& A2, const Standard_Real MajorRadius, const Standard_Real MinorRadius); |
54 | |
55 | //! Make an ellipse with its center and two points. |
56 | //! Warning |
57 | //! The MakeElips class does not prevent the |
58 | //! construction of an ellipse where the MajorRadius is |
59 | //! equal to the MinorRadius. |
60 | //! If an error occurs (that is, when IsDone returns |
61 | //! false), the Status function returns: |
62 | //! - gce_InvertRadius if MajorRadius is less than MinorRadius; |
63 | //! - gce_NegativeRadius if MinorRadius is less than 0.0; |
64 | //! - gce_NullAxis if the points S1 and Center are coincident; or |
65 | //! - gce_InvertAxis if: |
66 | //! - the major radius computed with Center and S1 |
67 | //! is less than the minor radius computed with Center, S1 and S2, or |
68 | //! - Center, S1 and S2 are collinear. |
69 | Standard_EXPORT gce_MakeElips(const gp_Pnt& S1, const gp_Pnt& S2, const gp_Pnt& Center); |
70 | |
71 | //! Returns the constructed ellipse. |
72 | //! Exceptions StdFail_NotDone if no ellipse is constructed. |
73 | Standard_EXPORT const gp_Elips& Value() const; |
74 | |
75 | Standard_EXPORT const gp_Elips& Operator() const; |
76 | Standard_EXPORT operator gp_Elips() const; |
77 | |
78 | |
79 | |
80 | |
81 | protected: |
82 | |
83 | |
84 | |
85 | |
86 | |
87 | private: |
88 | |
89 | |
90 | |
91 | gp_Elips TheElips; |
92 | |
93 | |
94 | }; |
95 | |
96 | |
97 | |
98 | |
99 | |
100 | |
101 | |
102 | #endif // _gce_MakeElips_HeaderFile |