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_MakeHyperbola_HeaderFile |
18 | #define _GCE2d_MakeHyperbola_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_Hyperbola.hxx> |
26 | |
42cf5bc1 |
27 | class StdFail_NotDone; |
28 | class gp_Hypr2d; |
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 Hyperbola from Geom2d. |
36 | //! * Create an Hyperbola from two apex and the center. |
37 | //! Defines the main branch of an hyperbola. |
38 | //! The parameterization range is ]-infinite,+infinite[ |
39 | //! It is possible to get the other branch and the two conjugate |
40 | //! branches of the main branch. |
41 | //! |
42 | //! ^YAxis |
43 | //! | |
44 | //! FirstConjugateBranch |
45 | //! | |
46 | //! Other | Main |
47 | //! --------------------- C ------------------------------>XAxis |
48 | //! Branch | Branch |
49 | //! | |
50 | //! SecondConjugateBranch |
51 | //! | |
52 | //! |
53 | //! The major radius is the distance between the Location point |
54 | //! of the hyperbola C and the apex of the main Branch (or the |
55 | //! Other branch). The major axis is the "XAxis". |
56 | //! The minor radius is the distance between the Location point |
57 | //! of the hyperbola C and the apex of the First (or Second) |
58 | //! Conjugate branch. The minor axis is the "YAxis". |
59 | //! The major radius can be lower than the minor radius. |
60 | class GCE2d_MakeHyperbola : public GCE2d_Root |
61 | { |
62 | public: |
63 | |
64 | DEFINE_STANDARD_ALLOC |
65 | |
66 | |
67 | |
68 | //! Creates an Hyperbola from a non persistent one from package gp |
69 | Standard_EXPORT GCE2d_MakeHyperbola(const gp_Hypr2d& H); |
70 | |
71 | |
72 | //! MajorAxis is the "XAxis" of the hyperbola. |
73 | //! The major radius of the hyperbola is on this "XAxis" and |
74 | //! the minor radius is on the "YAxis" of the hyperbola. |
75 | //! The status is "NegativeRadius" if MajorRadius < 0.0 or if |
76 | //! MinorRadius < 0.0 |
77 | Standard_EXPORT GCE2d_MakeHyperbola(const gp_Ax2d& MajorAxis, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const Standard_Boolean Sense); |
78 | |
79 | |
80 | //! Axis is the local coordinate system of the hyperbola. |
81 | //! The major radius of the hyperbola is on this "XAxis" and |
82 | //! the minor radius is on the "YAxis" of the hyperbola. |
83 | //! The status is "NegativeRadius" if MajorRadius < 0.0 or if |
84 | //! MinorRadius < 0.0 |
85 | Standard_EXPORT GCE2d_MakeHyperbola(const gp_Ax22d& Axis, const Standard_Real MajorRadius, const Standard_Real MinorRadius); |
86 | |
87 | //! Creates a hyperbol centered on the origin of the coordinate system |
88 | //! Axis, with major and minor radii MajorRadius and |
89 | //! MinorRadius, where the major axis is the "X Axis" |
90 | //! of Axis (Axis is the local coordinate system of the hyperbola). |
91 | //! The implicit orientation of the ellipse is: |
92 | //! - the sense defined by Axis or H, |
93 | //! - the sense defined by points Center, S1 and S2, |
94 | //! - the trigonometric sense if Sense is not given or is true, or |
95 | //! - the opposite sense if Sense is false. |
96 | //! Warning |
97 | //! If an error occurs (that is, when IsDone returns |
98 | //! false), the Status function returns: |
99 | //! - gce_NegativeRadius if MajorRadius or |
100 | //! MinorRadius is less than 0.0, or |
101 | //! - gce_InvertAxis if the major radius defined by |
102 | //! Center and S1 is less than the minor radius |
103 | //! defined by Center, S1 and S2.Make an Hyperbola with its center and two apexes. |
104 | Standard_EXPORT GCE2d_MakeHyperbola(const gp_Pnt2d& S1, const gp_Pnt2d& S2, const gp_Pnt2d& Center); |
105 | |
106 | //! Returns the constructed hyperbola. |
107 | //! Exceptions: StdFail_NotDone if no hyperbola is constructed. |
108 | Standard_EXPORT const Handle(Geom2d_Hyperbola)& Value() const; |
42cf5bc1 |
109 | |
d1a67b9d |
110 | operator const Handle(Geom2d_Hyperbola)& () const { return Value(); } |
42cf5bc1 |
111 | |
112 | private: |
42cf5bc1 |
113 | Handle(Geom2d_Hyperbola) TheHyperbola; |
42cf5bc1 |
114 | }; |
115 | |
42cf5bc1 |
116 | #endif // _GCE2d_MakeHyperbola_HeaderFile |