42cf5bc1 |
1 | // Created on: 1993-01-09 |
2 | // Created by: CKY / Contract Toubro-Larsen (Kiran) |
3 | // Copyright (c) 1993-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 _IGESGeom_ConicArc_HeaderFile |
18 | #define _IGESGeom_ConicArc_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Real.hxx> |
24 | #include <gp_XY.hxx> |
25 | #include <IGESData_IGESEntity.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | #include <Standard_Integer.hxx> |
28 | class gp_XY; |
29 | class gp_Pnt2d; |
30 | class gp_Pnt; |
31 | class gp_Dir; |
32 | |
33 | |
34 | class IGESGeom_ConicArc; |
35 | DEFINE_STANDARD_HANDLE(IGESGeom_ConicArc, IGESData_IGESEntity) |
36 | |
37 | //! defines IGESConicArc, Type <104> Form <0-3> in package IGESGeom |
38 | //! A conic arc is a bounded connected portion of a parent |
39 | //! conic curve which consists of more than one point. The |
40 | //! parent conic curve is either an ellipse, a parabola, or |
41 | //! a hyperbola. The definition space coordinate system is |
42 | //! always chosen so that the conic arc lies in a plane either |
43 | //! coincident with or parallel to XT, YT plane. Within such |
44 | //! a plane a conic is defined by the six coefficients in the |
45 | //! following equation. |
46 | //! A*XT^2 + B*XT*YT + C*YT^2 + D*XT + E*YT + F = 0 |
47 | class IGESGeom_ConicArc : public IGESData_IGESEntity |
48 | { |
49 | |
50 | public: |
51 | |
52 | |
53 | Standard_EXPORT IGESGeom_ConicArc(); |
54 | |
55 | //! This method is used to set the fields of the class |
56 | //! ConicalArc |
57 | //! - A, B, C, D, E, F : Coefficients of the equation |
58 | //! defining conic arc |
59 | //! - ZT : Parallel ZT displacement of the arc |
60 | //! from XT, YT plane. |
61 | //! - aStart : Starting point of the conic arc |
62 | //! - anEnd : End point of the conic arc |
63 | Standard_EXPORT void Init (const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D, const Standard_Real E, const Standard_Real F, const Standard_Real ZT, const gp_XY& aStart, const gp_XY& anEnd); |
64 | |
65 | //! sets the Form Number equal to ComputedFormNumber, |
66 | //! returns True if changed |
67 | Standard_EXPORT Standard_Boolean OwnCorrect(); |
68 | |
69 | //! Computes the Form Number according to the equation |
70 | //! 1 for Ellipse, 2 for Hyperbola, 3 for Parabola |
71 | Standard_EXPORT Standard_Integer ComputedFormNumber() const; |
72 | |
73 | Standard_EXPORT void Equation (Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& D, Standard_Real& E, Standard_Real& F) const; |
74 | |
75 | //! returns the Z displacement of the arc from XT, YT plane |
76 | Standard_EXPORT Standard_Real ZPlane() const; |
77 | |
78 | //! returns the starting point of the arc |
79 | Standard_EXPORT gp_Pnt2d StartPoint() const; |
80 | |
81 | //! returns the starting point of the arc after applying |
82 | //! Transf. Matrix |
83 | Standard_EXPORT gp_Pnt TransformedStartPoint() const; |
84 | |
85 | //! returns the end point of the arc |
86 | Standard_EXPORT gp_Pnt2d EndPoint() const; |
87 | |
88 | //! returns the end point of the arc after applying |
89 | //! Transf. Matrix |
90 | Standard_EXPORT gp_Pnt TransformedEndPoint() const; |
91 | |
92 | //! returns True if parent conic curve is an ellipse |
93 | Standard_EXPORT Standard_Boolean IsFromEllipse() const; |
94 | |
95 | //! returns True if parent conic curve is a parabola |
96 | Standard_EXPORT Standard_Boolean IsFromParabola() const; |
97 | |
98 | //! returns True if parent conic curve is a hyperbola |
99 | Standard_EXPORT Standard_Boolean IsFromHyperbola() const; |
100 | |
101 | //! returns True if StartPoint = EndPoint |
102 | Standard_EXPORT Standard_Boolean IsClosed() const; |
103 | |
104 | //! Z-Axis of conic (i.e. [0,0,1]) |
105 | Standard_EXPORT gp_Dir Axis() const; |
106 | |
107 | //! Z-Axis after applying Trans. Matrix |
108 | Standard_EXPORT gp_Dir TransformedAxis() const; |
109 | |
110 | //! Returns a Definition computed from equation, easier to use |
111 | //! <Center> : the center of the the conic (meaningless for |
112 | //! a parabola) (defined with Z displacement) |
113 | //! <MainAxis> : the Main Axis of the conic (for a Circle, |
114 | //! arbitrary the X Axis) |
115 | //! <Rmin,Rmax> : Minor and Major Radii of the conic |
116 | //! For a Circle, Rmin = Rmax, |
117 | //! For a Parabola, Rmin = Rmax = the Focal |
118 | //! Warning : the basic definition (by equation) is not very stable, |
119 | //! limit cases may be approximative |
120 | Standard_EXPORT void Definition (gp_Pnt& Center, gp_Dir& MainAxis, Standard_Real& rmin, Standard_Real& rmax) const; |
121 | |
122 | //! Same as Definition, but the Location is applied on the |
123 | //! Center and the MainAxis |
124 | Standard_EXPORT void TransformedDefinition (gp_Pnt& Center, gp_Dir& MainAxis, Standard_Real& rmin, Standard_Real& rmax) const; |
125 | |
126 | //! Computes and returns the coordinates of the definition of |
127 | //! a comic from its equation. Used by Definition & |
128 | //! TransformedDefinition, or may be called directly if needed |
129 | Standard_EXPORT void ComputedDefinition (Standard_Real& Xcen, Standard_Real& Ycen, Standard_Real& Xax, Standard_Real& Yax, Standard_Real& Rmin, Standard_Real& Rmax) const; |
130 | |
131 | |
132 | |
133 | |
92efcf78 |
134 | DEFINE_STANDARD_RTTIEXT(IGESGeom_ConicArc,IGESData_IGESEntity) |
42cf5bc1 |
135 | |
136 | protected: |
137 | |
138 | |
139 | |
140 | |
141 | private: |
142 | |
143 | |
144 | Standard_Real theA; |
145 | Standard_Real theB; |
146 | Standard_Real theC; |
147 | Standard_Real theD; |
148 | Standard_Real theE; |
149 | Standard_Real theF; |
150 | Standard_Real theZT; |
151 | gp_XY theStart; |
152 | gp_XY theEnd; |
153 | |
154 | |
155 | }; |
156 | |
157 | |
158 | |
159 | |
160 | |
161 | |
162 | |
163 | #endif // _IGESGeom_ConicArc_HeaderFile |