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_CylindricalSurface_HeaderFile |
18 | #define _Geom_CylindricalSurface_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_Cylinder; |
31 | class gp_Trsf; |
32 | class gp_GTrsf2d; |
33 | class Geom_Curve; |
34 | class gp_Pnt; |
35 | class gp_Vec; |
36 | class Geom_Geometry; |
37 | |
38 | |
39 | class Geom_CylindricalSurface; |
40 | DEFINE_STANDARD_HANDLE(Geom_CylindricalSurface, Geom_ElementarySurface) |
41 | |
42 | //! This class defines the infinite cylindrical surface. |
43 | //! |
44 | //! Every cylindrical surface is set by the following equation: |
45 | //! S(U,V) = Location + R*cos(U)*XAxis + R*sin(U)*YAxis + V*ZAxis, |
46 | //! where R is cylinder radius. |
47 | //! |
48 | //! The local coordinate system of the CylindricalSurface is defined |
49 | //! with an axis placement (see class ElementarySurface). |
50 | //! |
51 | //! The "ZAxis" is the symmetry axis of the CylindricalSurface, |
52 | //! it gives the direction of increasing parametric value V. |
53 | //! |
54 | //! The parametrization range is : |
55 | //! U [0, 2*PI], V ]- infinite, + infinite[ |
56 | //! |
57 | //! The "XAxis" and the "YAxis" define the placement plane of the |
58 | //! surface (Z = 0, and parametric value V = 0) perpendicular to |
59 | //! the symmetry axis. The "XAxis" defines the origin of the |
60 | //! parameter U = 0. The trigonometric sense gives the positive |
61 | //! orientation for the parameter U. |
62 | //! |
63 | //! When you create a CylindricalSurface the U and V directions of |
64 | //! parametrization are such that at each point of the surface the |
65 | //! normal is oriented towards the "outside region". |
66 | //! |
67 | //! The methods UReverse VReverse change the orientation of the |
68 | //! surface. |
69 | class Geom_CylindricalSurface : public Geom_ElementarySurface |
70 | { |
71 | |
72 | public: |
73 | |
74 | |
75 | |
76 | //! A3 defines the local coordinate system of the cylindrical surface. |
77 | //! The "ZDirection" of A3 defines the direction of the surface's |
78 | //! axis of symmetry. |
79 | //! At the creation the parametrization of the surface is defined |
80 | //! such that the normal Vector (N = D1U ^ D1V) is oriented towards |
81 | //! the "outside region" of the surface. |
82 | //! Warnings : |
83 | //! It is not forbidden to create a cylindrical surface with |
84 | //! Radius = 0.0 |
85 | //! Raised if Radius < 0.0 |
86 | Standard_EXPORT Geom_CylindricalSurface(const gp_Ax3& A3, const Standard_Real Radius); |
87 | |
88 | |
89 | //! Creates a CylindricalSurface from a non transient Cylinder |
90 | //! from package gp. |
91 | Standard_EXPORT Geom_CylindricalSurface(const gp_Cylinder& C); |
92 | |
93 | |
94 | //! Set <me> so that <me> has the same geometric properties as C. |
95 | Standard_EXPORT void SetCylinder (const gp_Cylinder& C); |
96 | |
97 | //! Changes the radius of the cylinder. |
98 | //! Raised if R < 0.0 |
99 | Standard_EXPORT void SetRadius (const Standard_Real R); |
100 | |
101 | |
102 | //! returns a non transient cylinder with the same geometric |
103 | //! properties as <me>. |
104 | Standard_EXPORT gp_Cylinder Cylinder() const; |
105 | |
106 | //! Return the parameter on the Ureversed surface for |
107 | //! the point of parameter U on <me>. |
108 | //! Return 2.PI - U. |
109 | Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const; |
110 | |
111 | //! Return the parameter on the Vreversed surface for |
112 | //! the point of parameter V on <me>. |
113 | //! Return -V |
114 | Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const; |
115 | |
116 | //! Computes the parameters on the transformed surface for |
117 | //! the transform of the point of parameters U,V on <me>. |
118 | //! me->Transformed(T)->Value(U',V') |
119 | //! is the same point as |
120 | //! me->Value(U,V).Transformed(T) |
121 | //! Where U',V' are the new values of U,V after calling |
122 | //! me->TranformParameters(U,V,T) |
123 | //! This methods multiplies V by T.ScaleFactor() |
124 | Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const Standard_OVERRIDE; |
125 | |
126 | //! Returns a 2d transformation used to find the new |
127 | //! parameters of a point on the transformed surface. |
128 | //! me->Transformed(T)->Value(U',V') |
129 | //! is the same point as |
130 | //! me->Value(U,V).Transformed(T) |
131 | //! Where U',V' are obtained by transforming U,V with |
132 | //! th 2d transformation returned by |
133 | //! me->ParametricTransformation(T) |
134 | //! This methods returns a scale centered on the |
135 | //! U axis with T.ScaleFactor |
136 | Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE; |
137 | |
138 | |
139 | //! The CylindricalSurface is infinite in the V direction so |
140 | //! V1 = Realfirst, V2 = RealLast from package Standard. |
141 | //! U1 = 0 and U2 = 2*PI. |
142 | Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const; |
143 | |
144 | |
145 | //! Returns the coefficients of the implicit equation of the quadric |
146 | //! in the absolute cartesian coordinate system : |
147 | //! These coefficients are normalized. |
148 | //! A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) + |
149 | //! 2.(C1.X + C2.Y + C3.Z) + D = 0.0 |
150 | 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; |
151 | |
152 | //! Returns the radius of this cylinder. |
153 | Standard_EXPORT Standard_Real Radius() const; |
154 | |
155 | //! Returns True. |
156 | Standard_EXPORT Standard_Boolean IsUClosed() const; |
157 | |
158 | //! Returns False. |
159 | Standard_EXPORT Standard_Boolean IsVClosed() const; |
160 | |
161 | //! Returns True. |
162 | Standard_EXPORT Standard_Boolean IsUPeriodic() const; |
163 | |
164 | //! Returns False. |
165 | Standard_EXPORT Standard_Boolean IsVPeriodic() const; |
166 | |
167 | |
168 | //! The UIso curve is a Line. The location point of this line is |
169 | //! on the placement plane (XAxis, YAxis) of the surface. |
170 | //! This line is parallel to the axis of symmetry of the surface. |
171 | Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const; |
172 | |
173 | |
174 | //! The VIso curve is a circle. The start point of this circle |
175 | //! (U = 0) is defined with the "XAxis" of the surface. |
176 | //! The center of the circle is on the symmetry axis. |
177 | Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const; |
178 | |
179 | |
180 | //! Computes the point P (U, V) on the surface. |
181 | //! P (U, V) = Loc + Radius * (cos (U) * XDir + sin (U) * YDir) + |
182 | //! V * ZDir |
183 | //! where Loc is the origin of the placement plane (XAxis, YAxis) |
184 | //! XDir is the direction of the XAxis and YDir the direction of |
185 | //! the YAxis. |
186 | Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const; |
187 | |
188 | |
189 | //! Computes the current point and the first derivatives in the |
190 | //! directions U and V. |
191 | Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const; |
192 | |
193 | |
194 | //! Computes the current point, the first and the second derivatives |
195 | //! in the directions U and V. |
196 | 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; |
197 | |
198 | |
199 | //! Computes the current point, the first, the second and the |
200 | //! third derivatives in the directions U and V. |
201 | 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; |
202 | |
203 | |
204 | //! Computes the derivative of order Nu in the direction u and Nv |
205 | //! in the direction v. |
206 | //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. |
207 | Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const; |
208 | |
209 | //! Applies the transformation T to this cylinder. |
210 | Standard_EXPORT void Transform (const gp_Trsf& T); |
211 | |
212 | //! Creates a new object which is a copy of this cylinder. |
213 | Standard_EXPORT Handle(Geom_Geometry) Copy() const; |
214 | |
215 | |
216 | |
217 | |
218 | DEFINE_STANDARD_RTTI(Geom_CylindricalSurface,Geom_ElementarySurface) |
219 | |
220 | protected: |
221 | |
222 | |
223 | |
224 | |
225 | private: |
226 | |
227 | |
228 | Standard_Real radius; |
229 | |
230 | |
231 | }; |
232 | |
233 | |
234 | |
235 | |
236 | |
237 | |
238 | |
239 | #endif // _Geom_CylindricalSurface_HeaderFile |