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