42cf5bc1 |
1 | // Created on: 1993-03-10 |
2 | // Created by: JCV |
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 _Geom_ConicalSurface_HeaderFile |
18 | #define _Geom_ConicalSurface_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Real.hxx> |
24 | #include <Geom_ElementarySurface.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | class Standard_ConstructionError; |
28 | class Standard_RangeError; |
29 | class gp_Ax3; |
30 | class gp_Cone; |
31 | class gp_Trsf; |
32 | class gp_GTrsf2d; |
33 | class gp_Pnt; |
34 | class Geom_Curve; |
35 | class gp_Vec; |
36 | class Geom_Geometry; |
37 | |
38 | |
39 | class Geom_ConicalSurface; |
40 | DEFINE_STANDARD_HANDLE(Geom_ConicalSurface, Geom_ElementarySurface) |
41 | |
42 | //! Describes a cone. |
3306fdd9 |
43 | //! A cone is defined by the half-angle (can be negative) at its apex, and |
42cf5bc1 |
44 | //! is positioned in space by a coordinate system (a |
45 | //! gp_Ax3 object) and a reference radius as follows: |
46 | //! - The "main Axis" of the coordinate system is the |
47 | //! axis of revolution of the cone. |
48 | //! - The plane defined by the origin, the "X Direction" |
49 | //! and the "Y Direction" of the coordinate system is |
50 | //! the reference plane of the cone. The intersection |
51 | //! of the cone with this reference plane is a circle of |
52 | //! radius equal to the reference radius. |
53 | //! - The apex of the cone is on the negative side of |
54 | //! the "main Axis" of the coordinate system if the |
55 | //! half-angle is positive, and on the positive side if |
56 | //! the half-angle is negative. |
57 | //! This coordinate system is the "local coordinate |
58 | //! system" of the cone. The following apply: |
59 | //! - Rotation around its "main Axis", in the |
60 | //! trigonometric sense given by the "X Direction" |
61 | //! and the "Y Direction", defines the u parametric direction. |
62 | //! - Its "X Axis" gives the origin for the u parameter. |
63 | //! - Its "main Direction" is the v parametric direction of the cone. |
64 | //! - Its origin is the origin of the v parameter. |
65 | //! The parametric range of the two parameters is: |
316ea293 |
66 | //! @code |
67 | //! - [ 0, 2.*Pi ] for u, and |
68 | //! - ] -infinity, +infinity [ for v |
69 | //! @endcode |
70 | //! The parametric equation of the cone is: |
71 | //! @code |
72 | //! P(u, v) = O + (R + v*sin(Ang)) * (cos(u)*XDir + sin(u)*YDir) + v*cos(Ang)*ZDir |
73 | //! @endcode |
74 | //! where: |
42cf5bc1 |
75 | //! - O, XDir, YDir and ZDir are respectively |
76 | //! the origin, the "X Direction", the "Y Direction" and |
77 | //! the "Z Direction" of the cone's local coordinate system, |
78 | //! - Ang is the half-angle at the apex of the cone, and |
79 | //! - R is the reference radius. |
80 | class Geom_ConicalSurface : public Geom_ElementarySurface |
81 | { |
82 | |
83 | public: |
84 | |
85 | |
86 | |
87 | //! A3 defines the local coordinate system of the conical surface. |
3306fdd9 |
88 | //! Ang is the conical surface semi-angle. Its absolute value is in range |
89 | //! ]0, PI/2[. |
42cf5bc1 |
90 | //! Radius is the radius of the circle Viso in the placement plane |
91 | //! of the conical surface defined with "XAxis" and "YAxis". |
92 | //! The "ZDirection" of A3 defines the direction of the surface's |
93 | //! axis of symmetry. |
94 | //! If the location point of A3 is the apex of the surface |
95 | //! Radius = 0 . |
96 | //! At the creation the parametrization of the surface is defined |
97 | //! such that the normal Vector (N = D1U ^ D1V) is oriented towards |
98 | //! the "outside region" of the surface. |
99 | //! |
3306fdd9 |
100 | //! Raised if Radius < 0.0 or Abs(Ang) < Resolution from gp or |
101 | //! Abs(Ang) >= PI/2 - Resolution |
42cf5bc1 |
102 | Standard_EXPORT Geom_ConicalSurface(const gp_Ax3& A3, const Standard_Real Ang, const Standard_Real Radius); |
103 | |
104 | |
316ea293 |
105 | //! Creates a ConicalSurface from a non transient gp_Cone. |
42cf5bc1 |
106 | Standard_EXPORT Geom_ConicalSurface(const gp_Cone& C); |
42cf5bc1 |
107 | |
108 | //! Set <me> so that <me> has the same geometric properties as C. |
109 | Standard_EXPORT void SetCone (const gp_Cone& C); |
42cf5bc1 |
110 | |
316ea293 |
111 | //! Changes the radius of the conical surface in the placement plane (Z = 0, V = 0). |
112 | //! The local coordinate system is not modified. |
42cf5bc1 |
113 | //! Raised if R < 0.0 |
114 | Standard_EXPORT void SetRadius (const Standard_Real R); |
42cf5bc1 |
115 | |
116 | //! Changes the semi angle of the conical surface. |
3306fdd9 |
117 | //! Semi-angle can be negative. Its absolute value |
118 | //! Abs(Ang) is in range ]0,PI/2[. |
119 | //! Raises ConstructionError if Abs(Ang) < Resolution from gp or |
120 | //! Abs(Ang) >= PI/2 - Resolution |
121 | Standard_EXPORT void SetSemiAngle(const Standard_Real Ang); |
42cf5bc1 |
122 | |
316ea293 |
123 | //! Returns a non transient cone with the same geometric properties as <me>. |
42cf5bc1 |
124 | Standard_EXPORT gp_Cone Cone() const; |
316ea293 |
125 | |
126 | //! Eeturn 2.PI - U. |
79104795 |
127 | Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE; |
316ea293 |
128 | |
129 | //! Computes the u (or v) parameter on the modified surface, |
130 | //! when reversing its u (or v) parametric direction, |
131 | //! for any point of u parameter U (or of v parameter V) on this cone. |
42cf5bc1 |
132 | //! In the case of a cone, these functions return respectively: |
133 | //! - 2.*Pi - U, -V. |
79104795 |
134 | Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE; |
42cf5bc1 |
135 | |
316ea293 |
136 | //! Changes the orientation of this cone in the v parametric direction. |
137 | //! The bounds of the surface are not changed but the v parametric direction is reversed. |
42cf5bc1 |
138 | //! As a consequence, for a cone: |
139 | //! - the "main Direction" of the local coordinate system |
140 | //! is reversed, and |
141 | //! - the half-angle at the apex is inverted. |
142 | Standard_EXPORT virtual void VReverse() Standard_OVERRIDE; |
316ea293 |
143 | |
144 | //! Computes the parameters on the transformed surface for |
42cf5bc1 |
145 | //! the transform of the point of parameters U,V on <me>. |
316ea293 |
146 | //! @code |
147 | //! me->Transformed(T)->Value(U',V') |
148 | //! @endcode |
42cf5bc1 |
149 | //! is the same point as |
316ea293 |
150 | //! @code |
151 | //! me->Value(U,V).Transformed(T) |
152 | //! @endcode |
42cf5bc1 |
153 | //! Where U',V' are the new values of U,V after calling |
316ea293 |
154 | //! @code |
155 | //! me->TransformParameters(U,V,T) |
156 | //! @endcode |
157 | //! This method multiplies V by T.ScaleFactor() |
42cf5bc1 |
158 | Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const Standard_OVERRIDE; |
316ea293 |
159 | |
160 | //! Returns a 2d transformation used to find the new |
42cf5bc1 |
161 | //! parameters of a point on the transformed surface. |
316ea293 |
162 | //! @code |
163 | //! me->Transformed(T)->Value(U',V') |
164 | //! @endcode |
42cf5bc1 |
165 | //! is the same point as |
316ea293 |
166 | //! @code |
167 | //! me->Value(U,V).Transformed(T) |
168 | //! @endcode |
169 | //! Where U',V' are obtained by transforming U,V with the 2d transformation returned by |
170 | //! @code |
171 | //! me->ParametricTransformation(T) |
172 | //! @endcode |
173 | //! This method returns a scale centered on the U axis with T.ScaleFactor |
42cf5bc1 |
174 | Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE; |
316ea293 |
175 | |
42cf5bc1 |
176 | //! Computes the apex of this cone. It is on the negative |
177 | //! side of the axis of revolution of this cone if the |
178 | //! half-angle at the apex is positive, and on the positive |
179 | //! side of the "main Axis" if the half-angle is negative. |
180 | Standard_EXPORT gp_Pnt Apex() const; |
42cf5bc1 |
181 | |
182 | //! The conical surface is infinite in the V direction so |
183 | //! V1 = Realfirst from Standard and V2 = RealLast. |
184 | //! U1 = 0 and U2 = 2*PI. |
79104795 |
185 | Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE; |
42cf5bc1 |
186 | |
187 | //! Returns the coefficients of the implicit equation of the |
188 | //! quadric in the absolute cartesian coordinate system : |
189 | //! These coefficients are normalized. |
316ea293 |
190 | //! @code |
191 | //! A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) + 2.(C1.X + C2.Y + C3.Z) + D = 0.0 |
192 | //! @endcode |
42cf5bc1 |
193 | Standard_EXPORT void Coefficients (Standard_Real& A1, Standard_Real& A2, Standard_Real& A3, Standard_Real& B1, Standard_Real& B2, Standard_Real& B3, Standard_Real& C1, Standard_Real& C2, Standard_Real& C3, Standard_Real& D) const; |
316ea293 |
194 | |
42cf5bc1 |
195 | //! Returns the reference radius of this cone. |
196 | //! The reference radius is the radius of the circle formed |
197 | //! by the intersection of this cone and its reference |
198 | //! plane (i.e. the plane defined by the origin, "X |
199 | //! Direction" and "Y Direction" of the local coordinate |
200 | //! system of this cone). |
201 | //! If the apex of this cone is on the origin of the local |
202 | //! coordinate system of this cone, the returned value is 0. |
203 | Standard_EXPORT Standard_Real RefRadius() const; |
42cf5bc1 |
204 | |
3306fdd9 |
205 | //! Returns the semi-angle at the apex of this cone. |
206 | //! Attention! Semi-angle can be negative. |
42cf5bc1 |
207 | Standard_EXPORT Standard_Real SemiAngle() const; |
316ea293 |
208 | |
42cf5bc1 |
209 | //! returns True. |
79104795 |
210 | Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE; |
316ea293 |
211 | |
42cf5bc1 |
212 | //! returns False. |
79104795 |
213 | Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE; |
316ea293 |
214 | |
42cf5bc1 |
215 | //! Returns True. |
79104795 |
216 | Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; |
316ea293 |
217 | |
42cf5bc1 |
218 | //! Returns False. |
79104795 |
219 | Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; |
316ea293 |
220 | |
221 | //! Builds the U isoparametric line of this cone. |
222 | //! The origin of this line is on the reference plane of this cone |
223 | //! (i.e. the plane defined by the origin, "X Direction" |
42cf5bc1 |
224 | //! and "Y Direction" of the local coordinate system of this cone). |
79104795 |
225 | Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE; |
316ea293 |
226 | |
227 | //! Builds the V isoparametric circle of this cone. |
228 | //! It is the circle on this cone, located in the plane of Z |
229 | //! coordinate V*cos(Semi-Angle) in the local coordinate system of this cone. |
230 | //! The "Axis" of this circle is the axis of revolution of this cone. |
231 | //! Its starting point is defined by the "X Direction" of this cone. |
42cf5bc1 |
232 | //! Warning |
233 | //! If the V isoparametric circle is close to the apex of |
234 | //! this cone, the radius of the circle becomes very small. |
235 | //! It is possible to have a circle with radius equal to 0.0. |
79104795 |
236 | Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE; |
42cf5bc1 |
237 | |
316ea293 |
238 | //! Computes the point P (U, V) on the surface. |
239 | //! @code |
240 | //! P (U, V) = Loc + |
241 | //! (RefRadius + V * sin (Semi-Angle)) * (cos (U) * XDir + sin (U) * YDir) + |
242 | //! V * cos (Semi-Angle) * ZDir |
243 | //! @endcode |
42cf5bc1 |
244 | //! where Loc is the origin of the placement plane (XAxis, YAxis) |
316ea293 |
245 | //! XDir is the direction of the XAxis and YDir the direction of the YAxis. |
79104795 |
246 | Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE; |
42cf5bc1 |
247 | |
316ea293 |
248 | //! Computes the current point and the first derivatives in the directions U and V. |
79104795 |
249 | Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE; |
42cf5bc1 |
250 | |
316ea293 |
251 | //! Computes the current point, the first and the second derivatives in the directions U and V. |
79104795 |
252 | Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const Standard_OVERRIDE; |
42cf5bc1 |
253 | |
254 | //! Computes the current point, the first,the second and the third |
255 | //! derivatives in the directions U and V. |
79104795 |
256 | Standard_EXPORT void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const Standard_OVERRIDE; |
316ea293 |
257 | |
42cf5bc1 |
258 | //! Computes the derivative of order Nu in the u |
259 | //! parametric direction, and Nv in the v parametric |
260 | //! direction at the point of parameters (U, V) of this cone. |
261 | //! Exceptions |
262 | //! Standard_RangeError if: |
263 | //! - Nu + Nv is less than 1, |
264 | //! - Nu or Nv is negative. |
79104795 |
265 | Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE; |
316ea293 |
266 | |
42cf5bc1 |
267 | //! Applies the transformation T to this cone. |
79104795 |
268 | Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE; |
316ea293 |
269 | |
42cf5bc1 |
270 | //! Creates a new object which is a copy of this cone. |
79104795 |
271 | Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE; |
bc73b006 |
272 | //! Dumps the content of me into the stream |
273 | Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; |
274 | |
92efcf78 |
275 | DEFINE_STANDARD_RTTIEXT(Geom_ConicalSurface,Geom_ElementarySurface) |
42cf5bc1 |
276 | |
42cf5bc1 |
277 | private: |
278 | |
42cf5bc1 |
279 | Standard_Real radius; |
280 | Standard_Real semiAngle; |
281 | |
42cf5bc1 |
282 | }; |
283 | |
42cf5bc1 |
284 | #endif // _Geom_ConicalSurface_HeaderFile |