1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
|
-- File: OneAxis.cdl
-- Created: Tue Jul 23 14:01:59 1991
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1991, 1992
deferred generic class OneAxis from Primitives(
TheShell as any;
TheFace as any;
TheWire as any;
TheEdge as any;
TheVertex as any;
TheBuilder as any) -- as Builder from Primitives;
---Purpose: Algorithm to build primitives with one axis of
-- revolution.
--
-- The revolution body is described by :
--
-- A coordinate system (Ax2 from gp). The Z axis is
-- the rotational axis.
--
-- An Angle around the Axis, When the Angle is 2*PI
-- the primitive is not limited by planar faces. The
-- U parameter range from 0 to Angle.
--
-- A parameter range VMin, VMax on the meridian.
--
-- A meridian : The meridian is a curve described by
-- a set of deferred methods.
--
--
-- The topology consists of A shell, Faces, Wires,
-- Edges and Vertices. Methods are provided to build
-- all the elements. Building an element implies the
-- automatic building of all its sub-elements.
--
-- So building the shell builds everything.
--
-- There are at most 5 faces :
--
-- - The LateralFace.
--
-- - The TopFace and the BottomFace.
--
-- - The StartFace and the EndFace.
--
uses
Ax2 from gp,
Pnt2d from gp
raises
DomainError,
OutOfRange
is
Delete(me:out) is virtual ;
---C++: alias ~
Initialize(B : TheBuilder;
A : Ax2 from gp;
VMin, VMax : Real from Standard);
---Purpose: Creates a OneAxis algorithm. <B> is used to build
-- the Topology. The angle defaults to 2*PI.
SetMeridianOffset(me: in out;MeridianOffset : Real from Standard = 0)
---Purpose: The MeridianOffset is added to the parameters on
-- the meridian curve and to the V values of the
-- pcurves. This is used for the sphere for example,
-- to give a range on the meridian edge which is not
-- VMin, VMax.
is static;
Axes(me) returns Ax2 from gp
---Purpose: Returns the Ax2 from <me>.
---C++: return const &
is static;
Axes(me : in out; A : Ax2 from gp)
raises DomainError -- when some topology has been built or A > 2*PI
is static;
Angle(me) returns Real
is static;
Angle(me : in out; A : Real)
raises DomainError -- when some topology has been built or A > 2*PI
is static;
VMin(me) returns Real
is static;
VMin(me : in out; V : Real)
raises DomainError -- when some topology has been built
is static;
VMax(me) returns Real
is static;
VMax(me : in out; V : Real)
raises DomainError -- when some topology has been built
is static;
--
-- Methods to describe the meridian
-- They should be redefined in inherited classes
--
MakeEmptyLateralFace(me) returns TheFace
---Purpose: Returns a face with no edges. The surface is the
-- lateral surface with normals pointing outward. The
-- U parameter is the angle with the origin on the X
-- axis. The V parameter is the parameter of the
-- meridian.
is deferred;
MakeEmptyMeridianEdge(me; Ang : Real) returns TheEdge
---Purpose: Returns an edge with a 3D curve made from the
-- meridian in the XZ plane rotated by <Ang> around
-- the Z-axis. Ang may be 0 or myAngle.
is deferred;
SetMeridianPCurve(me; E : in out TheEdge; F : TheFace)
---Purpose: Sets the parametric curve of the edge <E> in the
-- face <F> to be the 2d representation of the
-- meridian.
is deferred;
MeridianValue(me; V : Real) returns Pnt2d from gp
---Purpose: Returns the meridian point at parameter <V> in the
-- plane XZ.
is deferred;
MeridianOnAxis(me; V : Real) returns Boolean
---Purpose: Returns True if the point of parameter <V> on the
-- meridian is on the Axis. Default implementation is
-- Abs(MeridianValue(V).X()) < Precision::Confusion()
is virtual;
MeridianClosed(me) returns Boolean
---Purpose: Returns True if the meridian is closed. Default
-- implementation is
-- MeridianValue(VMin).IsEqual(MeridianValue(VMax),
-- Precision::Confusion())
is virtual;
VMaxInfinite(me) returns Boolean
---Purpose: Returns True if VMax is infinite. Default
-- Precision::IsPositiveInfinite(VMax);
is virtual;
VMinInfinite(me) returns Boolean
---Purpose: Returns True if VMin is infinite. Default
-- Precision::IsNegativeInfinite(VMax);
is virtual;
-- Usefull booleans
HasTop(me) returns Boolean
---Purpose: Returns True if there is a top face.
--
-- That is neither : VMaxInfinite()
-- MeridianClosed()
-- MeridianOnAxis(VMax)
is virtual;
HasBottom(me) returns Boolean
---Purpose: Returns True if there is a bottom face.
--
-- That is neither : VMinInfinite()
-- MeridianClosed()
-- MeridianOnAxis(VMin)
is virtual;
HasSides(me) returns Boolean
---Purpose: Returns True if there are Start and End faces.
--
-- That is : 2*PI - Angle > Precision::Angular()
is virtual;
--
-- Methods to get the Topology of:
--
-- the shell
Shell(me : in out) returns TheShell
---Purpose: Returns the Shell containing all the Faces of the
-- primitive.
--
---C++: return const &
is static;
-- the Faces
LateralFace(me : in out) returns TheFace
---Purpose: Returns the lateral Face. It is oriented toward
-- the outside of the primitive.
--
---C++: return const &
is static;
TopFace(me : in out) returns TheFace
---Purpose: Returns the top planar Face. It is Oriented
-- toward the +Z axis (outside).
--
---C++: return const &
raises DomainError -- if !HasTop()
is static;
BottomFace(me : in out) returns TheFace
---Purpose: Returns the Bottom planar Face. It is Oriented
-- toward the -Z axis (outside).
--
---C++: return const &
raises DomainError -- if !HasBottom()
is static;
StartFace(me : in out) returns TheFace
---Purpose: Returns the Face starting the slice, it is
-- oriented toward the exterior of the primitive.
--
---C++: return const &
raises DomainError -- if !HasSides()
is static;
EndFace(me : in out) returns TheFace
---Purpose: Returns the Face ending the slice, it is oriented
-- toward the exterior of the primitive.
--
---C++: return const &
raises DomainError -- if !HasSides()
is static;
-- Wires
LateralWire(me : in out) returns TheWire
---Purpose: Returns the wire in the lateral face.
--
---C++: return const &
raises DomainError -- if VMinInfinite() && VMaxInfinite()
is static;
LateralStartWire(me : in out) returns TheWire
---Purpose: Returns the wire in the lateral face with the
-- start edge.
--
---C++: return const &
raises DomainError -- if ! (VMinInfinite() && VMaxInfinite())
is static;
LateralEndWire(me : in out) returns TheWire
---Purpose: Returns the wire with in lateral face with the end
-- edge.
--
---C++: return const &
raises DomainError -- if ! (VMinInfinite() && VMaxInfinite())
is static;
TopWire(me : in out) returns TheWire
---Purpose: Returns the wire in the top face.
--
---C++: return const &
raises DomainError -- if !HasTop()
is static;
BottomWire(me : in out) returns TheWire
---Purpose: Returns the wire in the bottom face.
--
---C++: return const &
raises DomainError -- if !HasBottom()
is static;
StartWire(me : in out) returns TheWire
---Purpose: Returns the wire in the start face.
--
---C++: return const &
raises DomainError -- if !HasSides()
is static;
AxisStartWire(me : in out) returns TheWire
---Purpose: Returns the wire in the start face with the
-- AxisEdge.
--
---C++: return const &
raises DomainError -- if !HasSides() ! (VMinInfinite() && VMaxInfinite())
is static;
EndWire(me : in out) returns TheWire
---Purpose: Returns the Wire in the end face.
--
---C++: return const &
raises DomainError -- if !HasSides()
is static;
AxisEndWire(me : in out) returns TheWire
---Purpose: Returns the Wire in the end face with the
-- AxisEdge.
--
---C++: return const &
raises DomainError -- if !HasSides() ! (VMinInfinite() && VMaxInfinite())
is static;
-- Edges
AxisEdge(me : in out) returns TheEdge
---Purpose: Returns the Edge built along the Axis and oriented
-- on +Z of the Axis.
--
---C++: return const &
raises DomainError -- if ! (MeridianOnAxis(VMin) || MeridianOnAxis(VMax))
is static;
StartEdge(me : in out) returns TheEdge
---Purpose: Returns the Edge at angle 0.
--
---C++: return const &
is static;
EndEdge(me : in out) returns TheEdge
---Purpose: Returns the Edge at angle Angle. If !HasSides()
-- the StartEdge and the EndEdge are the same edge.
--
---C++: return const &
is static;
StartTopEdge(me : in out) returns TheEdge
---Purpose: Returns the linear Edge between start Face and top
-- Face.
--
---C++: return const &
raises DomainError -- if ! (HasTop() && HasSides())
is static;
StartBottomEdge(me : in out) returns TheEdge
---Purpose: Returns the linear Edge between start Face and
-- bottom Face.
--
---C++: return const &
raises DomainError -- if ! (HasBottom() && HasSides())
is static;
EndTopEdge(me : in out) returns TheEdge
---Purpose: Returns the linear Edge between end Face and top
-- Face.
--
---C++: return const &
raises DomainError -- if ! (HasTop() && HasSides())
is static;
EndBottomEdge(me : in out) returns TheEdge
---Purpose: Returns the linear Edge between end Face and
-- bottom Face.
--
---C++: return const &
raises DomainError -- if ! (HasBottom() && HasSides())
is static;
TopEdge(me : in out) returns TheEdge
---Purpose: Returns the edge at VMax. If MeridianClosed() the
-- TopEdge and the BottomEdge are the same edge.
--
---C++: return const &
raises DomainError -- if VMaxInfinite()
is static;
BottomEdge(me : in out) returns TheEdge
---Purpose: Returns the edge at VMin. If MeridianClosed() the
-- TopEdge and the BottomEdge are the same edge.
--
---C++: return const &
raises DomainError -- if VMinInfinite()
is static;
-- Vertices
AxisTopVertex(me : in out) returns TheVertex
---Purpose: Returns the Vertex at the Top altitude on the axis.
--
---C++: return const &
raises DomainError -- if !MeridianOnAxis(VMax)
is static;
AxisBottomVertex(me : in out) returns TheVertex
---Purpose: Returns the Vertex at the Bottom altitude on the
-- axis.
--
---C++: return const &
raises DomainError -- if !MeridianOnAxis(VMin)
is static;
TopStartVertex(me : in out) returns TheVertex
---Purpose: Returns the vertex (0,VMax)
--
---C++: return const &
raises DomainError -- if VMaxInfinite()
is static;
TopEndVertex(me : in out) returns TheVertex
---Purpose: Returns the vertex (angle,VMax)
--
---C++: return const &
raises DomainError -- if VMaxInfinite()
is static;
BottomStartVertex(me : in out) returns TheVertex
---Purpose: Returns the vertex (0,VMin)
--
---C++: return const &
raises DomainError -- if VMinInfinite()
is static;
BottomEndVertex(me : in out) returns TheVertex
---Purpose: Returns the vertex (angle,VMax)
--
---C++: return const &
raises DomainError -- if VMinInfinite()
is static;
fields
myBuilder : TheBuilder is protected;
myAxes : Ax2 from gp;
myAngle : Real from Standard;
myVMin : Real from Standard;
myVMax : Real from Standard;
myMeridianOffset : Real from Standard;
-- the Topology
myShell : TheShell;
ShellBuilt : Boolean;
myVertices : TheVertex [6];
-- 0 : Vertex on top of the axis
-- 1 : on bottom of the axis
-- 2 : top, start
-- 3 : top, end
-- 4 : bottom, start
-- 5 : bottom, end
VerticesBuilt : Boolean [6];
myEdges : TheEdge [9];
-- 0 : Edge on the Axis
-- 1 : Start Edge
-- 2 : End Edge
-- 3 : Start Top
-- 4 : Start Bottom
-- 5 : End Top
-- 6 : End Bottom
-- 7 : Top
-- 8 : Bottom
EdgesBuilt : Boolean [9];
myWires : TheWire [9];
-- 0 : wire Lateral
-- 1 : Lateral Start
-- 2 : Lateral End
-- 3 : Top
-- 4 : Bottom
-- 5 : Start
-- 6 : Axis Start
-- 7 : End
-- 8 : Axis End
WiresBuilt : Boolean [9];
myFaces : TheFace [5];
-- 0 : Lateral Face
-- 1 : Top
-- 2 : Bottom
-- 3 : Start
-- 4 : End
FacesBuilt : Boolean [5];
end OneAxis;
|