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