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_MakeHypr_HeaderFile |
18 | #define _gce_MakeHypr_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <gp_Hypr.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_Hypr; |
31 | |
32 | |
33 | //! This class implements the following algorithms used to |
34 | //! create Hyperbola from gp. |
35 | //! * Create an Hyperbola from its center, and two points: |
36 | //! one on its axis of symmetry giving the major radius, the |
37 | //! other giving the value of the small radius. |
38 | //! The three points give the plane of the hyperbola. |
39 | //! * Create an hyperbola from its axisplacement and its |
40 | //! MajorRadius and its MinorRadius. |
41 | //! |
42 | //! ^YAxis |
43 | //! | |
44 | //! FirstConjugateBranch |
45 | //! | |
46 | //! Other | Main |
47 | //! --------------------- C ------------------------------>XAxis |
48 | //! Branch | Branch |
49 | //! | |
50 | //! | |
51 | //! SecondConjugateBranch |
52 | //! | |
53 | //! |
54 | //! The local cartesian coordinate system of the ellipse is an |
55 | //! axis placement (two axis). |
56 | //! |
57 | //! The "XDirection" and the "YDirection" of the axis placement |
58 | //! define the plane of the hyperbola. |
59 | //! |
60 | //! The "Direction" of the axis placement defines the normal axis |
61 | //! to the hyperbola's plane. |
62 | //! |
63 | //! The "XAxis" of the hyperbola ("Location", "XDirection") is the |
64 | //! major axis and the "YAxis" of the hyperbola ("Location", |
65 | //! "YDirection") is the minor axis. |
66 | //! |
67 | //! Warnings : |
68 | //! The major radius (on the major axis) can be lower than the |
69 | //! minor radius (on the minor axis). |
70 | class gce_MakeHypr : public gce_Root |
71 | { |
72 | public: |
73 | |
74 | DEFINE_STANDARD_ALLOC |
75 | |
76 | |
77 | |
78 | //! A2 is the local coordinate system of the hyperbola. |
79 | //! In the local coordinates system A2 the equation of the |
80 | //! hyperbola is : |
81 | //! X*X / MajorRadius*MajorRadius - Y*Y / MinorRadius*MinorRadius = 1.0 |
82 | //! It is not forbidden to create an Hyperbola with MajorRadius = |
83 | //! MinorRadius. |
84 | //! For the hyperbola the MajorRadius can be lower than the |
85 | //! MinorRadius. |
86 | //! The status is "NegativeRadius" if MajorRadius < 0.0 and |
87 | //! "InvertRadius" if MinorRadius > MajorRadius. |
88 | Standard_EXPORT gce_MakeHypr(const gp_Ax2& A2, const Standard_Real MajorRadius, const Standard_Real MinorRadius); |
89 | |
90 | //! Constructs a hyperbola |
91 | //! - centered on the point Center, where: |
92 | //! - the plane of the hyperbola is defined by Center, S1 and S2, |
93 | //! - its major axis is defined by Center and S1, |
94 | //! - its major radius is the distance between Center and S1, and |
95 | //! - its minor radius is the distance between S2 and the major axis. |
96 | //! Warning |
97 | //! If an error occurs (that is, when IsDone returns |
98 | //! false), the Status function returns: |
99 | //! - gce_NegativeRadius if MajorRadius is less than 0.0; |
100 | //! - gce_InvertRadius if: |
101 | //! - the major radius (computed with Center, S1) is |
102 | //! less than the minor radius (computed with Center, S1 and S2), or |
103 | //! - MajorRadius is less than MinorRadius; or |
104 | //! - gce_ColinearPoints if S1, S2 and Center are collinear. |
105 | Standard_EXPORT gce_MakeHypr(const gp_Pnt& S1, const gp_Pnt& S2, const gp_Pnt& Center); |
106 | |
107 | //! Returns the constructed hyperbola. |
108 | //! Exceptions StdFail_NotDone if no hyperbola is constructed. |
109 | Standard_EXPORT const gp_Hypr& Value() const; |
110 | |
111 | Standard_EXPORT const gp_Hypr& Operator() const; |
112 | Standard_EXPORT operator gp_Hypr() const; |
113 | |
114 | |
115 | |
116 | |
117 | protected: |
118 | |
119 | |
120 | |
121 | |
122 | |
123 | private: |
124 | |
125 | |
126 | |
127 | gp_Hypr TheHypr; |
128 | |
129 | |
130 | }; |
131 | |
132 | |
133 | |
134 | |
135 | |
136 | |
137 | |
138 | #endif // _gce_MakeHypr_HeaderFile |