7fd59977 |
1 | -- File: Geom_SurfaceOfRevolution.cdl |
2 | -- Created: Wed Mar 10 10:30:24 1993 |
3 | -- Author: JCV |
4 | -- <fid@phylox> |
5 | -- Copyright: Matra Datavision 1993 |
6 | |
7 | |
8 | class SurfaceOfRevolution from Geom inherits SweptSurface from Geom |
9 | |
10 | ---Purpose : Describes a surface of revolution (revolved surface). |
11 | -- Such a surface is obtained by rotating a curve (called |
12 | -- the "meridian") through a complete revolution about |
13 | -- an axis (referred to as the "axis of revolution"). The |
14 | -- curve and the axis must be in the same plane (the |
15 | -- "reference plane" of the surface). |
16 | -- Rotation around the axis of revolution in the |
17 | -- trigonometric sense defines the u parametric |
18 | -- direction. So the u parameter is an angle, and its |
19 | -- origin is given by the position of the meridian on the surface. |
20 | -- The parametric range for the u parameter is: [ 0, 2.*Pi ] |
21 | -- The v parameter is that of the meridian. |
22 | -- Note: A surface of revolution is built from a copy of the |
23 | -- original meridian. As a result the original meridian is |
24 | -- not modified when the surface is modified. |
25 | -- The form of a surface of revolution is typically a |
26 | -- general revolution surface |
27 | -- (GeomAbs_RevolutionForm). It can be: |
28 | -- - a conical surface, if the meridian is a line or a |
29 | -- trimmed line (GeomAbs_ConicalForm), |
30 | -- - a cylindrical surface, if the meridian is a line or a |
31 | -- trimmed line parallel to the axis of revolution |
32 | -- (GeomAbs_CylindricalForm), |
33 | -- - a planar surface if the meridian is a line or a |
34 | -- trimmed line perpendicular to the axis of revolution |
35 | -- of the surface (GeomAbs_PlanarForm), |
36 | -- - a toroidal surface, if the meridian is a circle or a |
37 | -- trimmed circle (GeomAbs_ToroidalForm), or |
38 | -- - a spherical surface, if the meridian is a circle, the |
39 | -- center of which is located on the axis of the |
40 | -- revolved surface (GeomAbs_SphericalForm). |
41 | -- Warning |
42 | -- Be careful not to construct a surface of revolution |
43 | -- where the curve and the axis or revolution are not |
44 | -- defined in the same plane. If you do not have a |
45 | -- correct configuration, you can correct your initial |
46 | -- curve, using a cylindrical projection in the reference plane. |
47 | |
48 | |
49 | |
50 | uses Ax1 from gp, |
51 | Ax2 from gp, |
52 | Dir from gp, |
53 | Pnt from gp, |
54 | Trsf from gp, |
55 | GTrsf2d from gp, |
56 | Vec from gp, |
57 | Curve from Geom, |
58 | Geometry from Geom, |
59 | Shape from GeomAbs, |
60 | BSplineCurve from Geom |
61 | |
62 | raises ConstructionError from Standard, |
63 | RangeError from Standard, |
64 | UndefinedDerivative from Geom |
65 | |
66 | |
67 | is |
68 | |
69 | |
70 | Create (C : Curve; A1 : Ax1) returns mutable SurfaceOfRevolution; |
71 | ---Purpose : |
72 | -- C : is the meridian or the referenced curve. |
73 | -- A1 is the axis of revolution. |
74 | -- The form of a SurfaceOfRevolution can be : |
75 | -- . a general revolution surface (RevolutionForm), |
76 | -- . a conical surface if the meridian is a line or a trimmed line |
77 | -- (ConicalForm), |
78 | -- . a cylindrical surface if the meridian is a line or a trimmed |
79 | -- line parallel to the revolution axis (CylindricalForm), |
80 | -- . a planar surface if the meridian is a line perpendicular to |
81 | -- the revolution axis of the surface (PlanarForm). |
82 | -- . a spherical surface, |
83 | -- . a toroidal surface, |
84 | -- . a quadric surface. |
85 | -- Warnings : |
86 | -- It is not checked that the curve C is planar and that the |
87 | -- surface axis is in the plane of the curve. |
88 | -- It is not checked that the revolved curve C doesn't |
89 | -- self-intersects. |
90 | |
91 | |
92 | SetAxis (me : mutable; A1 : Ax1); |
93 | ---Purpose : Changes the axis of revolution. |
94 | -- Warnings : |
95 | -- It is not checked that the axis is in the plane of the |
96 | -- revolved curve. |
97 | |
98 | |
99 | SetDirection (me : mutable; V : Dir); |
100 | ---Purpose : Changes the direction of the revolution axis. |
101 | -- Warnings : |
102 | -- It is not checked that the axis is in the plane of the |
103 | -- revolved curve. |
104 | |
105 | |
106 | |
107 | SetBasisCurve (me : mutable; C : Curve); |
108 | ---Purpose : Changes the revolved curve of the surface. |
109 | -- Warnings : |
110 | -- It is not checked that the curve C is planar and that the |
111 | -- surface axis is in the plane of the curve. |
112 | -- It is not checked that the revolved curve C doesn't |
113 | -- self-intersects. |
114 | |
115 | |
116 | SetLocation (me : mutable; P : Pnt); |
117 | ---Purpose : Changes the location point of the revolution axis. |
118 | -- Warnings : |
119 | -- It is not checked that the axis is in the plane of the |
120 | -- revolved curve. |
121 | |
122 | |
123 | Axis (me) returns Ax1; |
124 | ---Purpose : Returns the revolution axis of the surface. |
125 | |
126 | |
127 | Location (me) returns Pnt; |
128 | ---Purpose : |
129 | -- Returns the location point of the axis of revolution. |
130 | ---C++: return const& |
131 | |
132 | |
133 | ReferencePlane (me) returns Ax2 |
134 | ---Purpose : |
135 | -- Computes the position of the reference plane of the surface |
136 | -- defined by the basis curve and the symmetry axis. |
137 | -- The location point is the location point of the revolution's |
138 | -- axis, the XDirection of the plane is given by the revolution's |
139 | -- axis and the orientation of the normal to the plane is given |
140 | -- by the sense of revolution. |
141 | raises ConstructionError; |
142 | ---Purpose : |
143 | -- Raised if the revolved curve is not planar or if the revolved |
144 | -- curve and the symmetry axis are not in the same plane or if |
145 | -- the maximum of distance between the axis and the revolved |
146 | -- curve is lower or equal to Resolution from gp. |
147 | |
148 | |
149 | UReverse (me : mutable); |
150 | ---Purpose : Changes the orientation of this surface of revolution |
151 | -- in the u parametric direction. The bounds of the |
152 | -- surface are not changed but the given parametric |
153 | -- direction is reversed. Hence the orientation of the |
154 | -- surface is reversed. |
155 | -- As a consequence: |
156 | -- - UReverse reverses the direction of the axis of |
157 | -- revolution of this surface, |
158 | |
159 | |
160 | UReversedParameter ( me; U : Real) returns Real; |
161 | ---Purpose: Computes the u parameter on the modified |
162 | -- surface, when reversing its u parametric |
163 | -- direction, for any point of u parameter U on this surface of revolution. |
164 | -- In the case of a revolved surface: |
165 | -- - UReversedParameter returns 2.*Pi - U |
166 | |
167 | |
168 | VReverse (me : mutable); |
169 | ---Purpose : Changes the orientation of this surface of revolution |
170 | -- in the v parametric direction. The bounds of the |
171 | -- surface are not changed but the given parametric |
172 | -- direction is reversed. Hence the orientation of the |
173 | -- surface is reversed. |
174 | -- As a consequence: |
175 | -- - VReverse reverses the meridian of this surface of revolution. |
176 | |
177 | VReversedParameter (me; V : Real) returns Real; |
178 | ---Purpose: Computes the v parameter on the modified |
179 | -- surface, when reversing its v parametric |
180 | -- direction, for any point of v parameter V on this surface of revolution. |
181 | -- In the case of a revolved surface: |
182 | -- - VReversedParameter returns the reversed |
183 | -- parameter given by the function |
184 | -- ReversedParameter called with V on the meridian. |
185 | |
186 | TransformParameters(me; U,V : in out Real; T : Trsf from gp) |
187 | ---Purpose: Computes the parameters on the transformed surface for |
188 | -- the transform of the point of parameters U,V on <me>. |
189 | -- |
190 | -- me->Transformed(T)->Value(U',V') |
191 | -- |
192 | -- is the same point as |
193 | -- |
194 | -- me->Value(U,V).Transformed(T) |
195 | -- |
196 | -- Where U',V' are the new values of U,V after calling |
197 | -- |
198 | -- me->TranformParameters(U,V,T) |
199 | -- |
200 | -- This methods multiplies V by |
201 | -- BasisCurve()->ParametricTransformation(T) |
202 | is redefined; |
203 | |
204 | ParametricTransformation(me; T : Trsf from gp) returns GTrsf2d from gp |
205 | ---Purpose: Returns a 2d transformation used to find the new |
206 | -- parameters of a point on the transformed surface. |
207 | -- |
208 | -- me->Transformed(T)->Value(U',V') |
209 | -- |
210 | -- is the same point as |
211 | -- |
212 | -- me->Value(U,V).Transformed(T) |
213 | -- |
214 | -- Where U',V' are obtained by transforming U,V with |
215 | -- th 2d transformation returned by |
216 | -- |
217 | -- me->ParametricTransformation(T) |
218 | -- |
219 | -- This methods returns a scale centered on the |
220 | -- U axis with BasisCurve()->ParametricTransformation(T) |
221 | is redefined; |
222 | |
223 | Bounds (me; U1, U2, V1, V2 : out Real); |
224 | ---Purpose : Returns the parametric bounds U1, U2 , V1 and V2 of this surface. |
225 | -- A surface of revolution is always complete, so U1 = 0, U2 = 2*PI. |
226 | |
227 | |
228 | IsUClosed (me) returns Boolean; |
229 | ---Purpose : IsUClosed always returns true. |
230 | |
231 | |
232 | IsVClosed (me) returns Boolean; |
233 | ---Purpose : IsVClosed returns true if the meridian of this |
234 | -- surface of revolution is closed. |
235 | |
236 | |
237 | IsCNu (me; N : Integer) returns Boolean; |
238 | ---Purpose : IsCNu always returns true. |
239 | |
240 | |
241 | IsCNv (me; N : Integer) returns Boolean |
242 | ---Purpose : IsCNv returns true if the degree of continuity of the |
243 | -- meridian of this surface of revolution is at least N. |
244 | raises RangeError; |
245 | ---Purpose : Raised if N < 0. |
246 | |
247 | |
248 | IsUPeriodic (me) returns Boolean; |
249 | ---Purpose : Returns True. |
250 | |
251 | |
252 | IsVPeriodic (me) returns Boolean; |
253 | ---Purpose : IsVPeriodic returns true if the meridian of this |
254 | -- surface of revolution is periodic. |
255 | |
256 | |
257 | UIso (me; U : Real) returns mutable Curve; |
258 | ---Purpose : Computes the U isoparametric curve of this surface |
259 | -- of revolution. It is the curve obtained by rotating the |
260 | -- meridian through an angle U about the axis of revolution. |
261 | |
262 | |
263 | VIso (me; V : Real) returns mutable Curve; |
264 | ---Purpose : Computes the U isoparametric curve of this surface |
265 | -- of revolution. It is the curve obtained by rotating the |
266 | -- meridian through an angle U about the axis of revolution. |
267 | |
268 | |
269 | D0 (me; U, V : Real; P : out Pnt); |
270 | ---Purpose : Computes the point P (U, V) on the surface. |
271 | -- U is the angle of the rotation around the revolution axis. |
272 | -- The direction of this axis gives the sense of rotation. |
273 | -- V is the parameter of the revolved curve. |
274 | |
275 | |
276 | D1 (me; U, V : Real; P : out Pnt; D1U, D1V : out Vec) |
277 | ---Purpose : |
278 | -- Computes the current point and the first derivatives |
279 | -- in the directions U and V. |
280 | raises UndefinedDerivative; |
281 | ---Purpose : Raised if the continuity of the surface is not C1. |
282 | |
283 | |
284 | D2 (me; U, V : Real; P : out Pnt; D1U, D1V, D2U, D2V, D2UV : out Vec) |
285 | ---Purpose : |
286 | -- Computes the current point, the first and the second derivatives |
287 | -- in the directions U and V. |
288 | raises UndefinedDerivative; |
289 | ---Purpose : Raised if the continuity of the surface is not C2. |
290 | |
291 | |
292 | D3 (me; U, V : Real; P : out Pnt; |
293 | D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV : out Vec) |
294 | ---Purpose : |
295 | -- Computes the current point, the first,the second and the third |
296 | -- derivatives in the directions U and V. |
297 | raises UndefinedDerivative; |
298 | ---Purpose : Raised if the continuity of the surface is not C3. |
299 | |
300 | |
301 | DN (me; U, V : Real; Nu, Nv : Integer) |
302 | ---Purpose : |
303 | -- Computes the derivative of order Nu in the direction u and |
304 | -- Nv in the direction v. |
305 | returns Vec |
306 | raises UndefinedDerivative, |
307 | ---Purpose : |
308 | -- Raised if the continuity of the surface is not CNu in the u |
309 | -- direction and CNv in the v direction. |
310 | RangeError; |
311 | ---Purpose : Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. |
312 | |
313 | |
314 | |
315 | ---Purpose : The following functions evaluates the local |
316 | -- derivatives on surface. Useful to manage discontinuities |
317 | -- on the surface. |
318 | -- if Side = 1 -> P = S( U+,V ) |
319 | -- if Side = -1 -> P = S( U-,V ) |
320 | -- else P is betveen discontinuities |
321 | -- can be evaluated using methods of |
322 | -- global evaluations P = S( U ,V ) |
323 | |
324 | LocalD0 (me; U, V : Real; USide : Integer; |
325 | P : out Pnt); |
326 | |
327 | LocalD1 (me; U, V : Real; USide : Integer; |
328 | P : out Pnt; D1U, D1V : out Vec); |
329 | |
330 | LocalD2 (me; U, V : Real; USide : Integer; |
331 | P : out Pnt; D1U, D1V, D2U, D2V, D2UV : out Vec); |
332 | |
333 | LocalD3 (me; U, V : Real; USide : Integer; |
334 | P : out Pnt; D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV : |
335 | out Vec); |
336 | |
337 | LocalDN (me; U, V : Real; USide : Integer; |
338 | Nu, Nv : Integer) |
339 | returns Vec; |
340 | |
341 | Transform (me : mutable; T : Trsf); |
342 | ---Purpose: Applies the transformation T to this surface of revolution. |
343 | Copy (me) returns mutable like me; |
344 | ---Purpose: Creates a new object which is a copy of this surface of revolution. |
345 | fields |
346 | |
347 | loc : Pnt; |
348 | |
349 | end; |