b311480e |
1 | -- Created on: 1992-08-06 |
2 | -- Created by: Laurent BUCHARD |
3 | -- Copyright (c) 1992-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 | -- |
973c2be1 |
8 | -- This library is free software; you can redistribute it and / or modify it |
9 | -- under the terms of the GNU Lesser General Public 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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class QuadQuadGeo from IntAna |
18 | |
19 | ---Purpose: Geometric intersections between two natural quadrics |
20 | -- (Sphere , Cylinder , Cone , Pln from gp). |
21 | -- The possible intersections are : |
22 | -- - 1 point |
23 | -- - 1 or 2 line(s) |
24 | -- - 1 Point and 1 Line |
25 | -- - 1 circle |
26 | -- - 1 ellipse |
27 | -- - 1 parabola |
28 | -- - 1 or 2 hyperbola(s). |
29 | -- - Empty : there is no intersection between the two quadrics. |
30 | -- - Same : the quadrics are identical |
31 | -- - NoGeometricSolution : there may be an intersection, but it |
32 | -- is necessary to use an analytic algorithm to determine |
33 | -- it. See class IntQuadQuad from IntAna. |
34 | |
35 | |
36 | uses Pln from gp, |
37 | Cylinder from gp, |
38 | Cone from gp, |
7eed5d29 |
39 | Sphere from gp, |
40 | Torus from gp, |
7fd59977 |
41 | Pnt from gp, |
42 | Lin from gp, |
43 | Circ from gp, |
44 | Elips from gp, |
45 | Parab from gp, |
46 | Hypr from gp, |
47 | Dir from gp, |
48 | ResultType from IntAna |
49 | |
50 | |
51 | |
52 | raises NotDone from StdFail, |
7eed5d29 |
53 | DomainError from Standard, |
54 | OutOfRange from Standard |
7fd59977 |
55 | is |
56 | |
57 | Create |
7eed5d29 |
58 | ---Purpose: Empty constructor. |
59 | returns QuadQuadGeo from IntAna; |
60 | |
7fd59977 |
61 | |
7fd59977 |
62 | Create(P1,P2 : Pln from gp; |
63 | TolAng, Tol : Real from Standard) |
7eed5d29 |
64 | ---Purpose: Creates the intersection between two planes. |
65 | -- TolAng is the angular tolerance used to determine |
66 | -- if the planes are parallel. |
67 | -- Tol is the tolerance used to determine if the planes |
68 | -- are identical (only when they are parallel). |
69 | returns QuadQuadGeo from IntAna; |
7fd59977 |
70 | |
71 | |
72 | Perform(me : in out; |
73 | P1,P2 : Pln from gp; |
74 | TolAng, Tol : Real from Standard) |
7eed5d29 |
75 | ---Purpose: Intersects two planes. |
76 | -- TolAng is the angular tolerance used to determine |
77 | -- if the planes are parallel. |
78 | -- Tol is the tolerance used to determine if the planes |
79 | -- are identical (only when they are parallel). |
80 | is static; |
7fd59977 |
81 | |
82 | |
83 | Create(P : Pln from gp; |
84 | C : Cylinder from gp; |
04cbc9d3 |
85 | Tolang,Tol: Real from Standard; |
86 | H : Real from Standard = 0) |
87 | ---Purpose: Creates the intersection between a plane and a cylinder. |
88 | -- TolAng is the angular tolerance used to determine |
89 | -- if the axis of the cylinder is parallel to the plane. |
90 | -- Tol is the tolerance used to determine if the result |
91 | -- is a circle or an ellipse. If the maximum distance between |
92 | -- the ellipse solution and the circle centered at the ellipse |
93 | -- center is less than Tol, the result will be the circle. |
94 | -- H is the height of the cylinder <Cyl>. It is used to check |
95 | -- whether the plane and cylinder are parallel. |
04cbc9d3 |
96 | returns QuadQuadGeo from IntAna; |
7eed5d29 |
97 | |
7fd59977 |
98 | |
99 | Perform(me: in out; |
100 | P : Pln from gp; |
101 | C : Cylinder from gp; |
04cbc9d3 |
102 | Tolang,Tol: Real from Standard; |
103 | H :Real from Standard = 0) |
04cbc9d3 |
104 | ---Purpose: Intersects a plane and a cylinder. |
105 | -- TolAng is the angular tolerance used to determine |
106 | -- if the axis of the cylinder is parallel to the plane. |
107 | -- Tol is the tolerance used to determine if the result |
108 | -- is a circle or an ellipse. If the maximum distance between |
109 | -- the ellipse solution and the circle centered at the ellipse |
110 | -- center is less than Tol, the result will be the circle. |
111 | -- H is the height of the cylinder <Cyl>. It is used to check |
112 | -- whether the plane and cylinder are parallel. |
04cbc9d3 |
113 | is static; |
7eed5d29 |
114 | |
7fd59977 |
115 | |
116 | Create(P : Pln from gp; |
117 | S : Sphere from gp) |
7eed5d29 |
118 | ---Purpose: Creates the intersection between a plane and a sphere. |
119 | returns QuadQuadGeo from IntAna; |
7fd59977 |
120 | |
7fd59977 |
121 | |
7fd59977 |
122 | Perform(me: in out; |
123 | P : Pln from gp; |
124 | S : Sphere from gp) |
7eed5d29 |
125 | ---Purpose: Intersects a plane and a sphere. |
126 | is static; |
7fd59977 |
127 | |
7fd59977 |
128 | |
7fd59977 |
129 | Create(P : Pln from gp; |
130 | C : Cone from gp; |
131 | Tolang,Tol: Real from Standard) |
7eed5d29 |
132 | ---Purpose: Creates the intersection between a plane and a cone. |
133 | -- TolAng is the angular tolerance used to determine |
134 | -- if the axis of the cone is parallel or perpendicular |
135 | -- to the plane, and if the generating line of the cone |
136 | -- is parallel to the plane. |
137 | -- Tol is the tolerance used to determine if the apex |
138 | -- of the cone is in the plane. |
139 | returns QuadQuadGeo from IntAna; |
7fd59977 |
140 | |
7fd59977 |
141 | |
7fd59977 |
142 | Perform(me: in out; |
143 | P : Pln from gp; |
144 | C : Cone from gp; |
145 | Tolang,Tol: Real from Standard) |
7eed5d29 |
146 | ---Purpose: Intersects a plane and a cone. |
147 | -- TolAng is the angular tolerance used to determine |
148 | -- if the axis of the cone is parallel or perpendicular |
149 | -- to the plane, and if the generating line of the cone |
150 | -- is parallel to the plane. |
151 | -- Tol is the tolerance used to determine if the apex |
152 | -- of the cone is in the plane. |
153 | is static; |
7fd59977 |
154 | |
155 | |
156 | Create(Cyl1,Cyl2: Cylinder from gp; |
157 | Tol : Real from Standard) |
7eed5d29 |
158 | ---Purpose: Creates the intersection between two cylinders. |
159 | returns QuadQuadGeo from IntAna; |
7fd59977 |
160 | |
7fd59977 |
161 | |
162 | Perform(me : in out; |
163 | Cyl1,Cyl2: Cylinder from gp; |
164 | Tol : Real from Standard) |
7eed5d29 |
165 | ---Purpose: Intersects two cylinders |
166 | is static; |
7fd59977 |
167 | |
7fd59977 |
168 | |
169 | Create(Cyl: Cylinder from gp; |
170 | Sph: Sphere from gp; |
171 | Tol: Real from Standard) |
7eed5d29 |
172 | ---Purpose: Creates the intersection between a Cylinder and a Sphere. |
173 | returns QuadQuadGeo from IntAna; |
174 | |
175 | |
7fd59977 |
176 | Perform(me : in out; |
177 | Cyl: Cylinder from gp; |
178 | Sph: Sphere from gp; |
179 | Tol: Real from Standard) |
7eed5d29 |
180 | ---Purpose: Intersects a cylinder and a sphere. |
181 | is static; |
7fd59977 |
182 | |
7fd59977 |
183 | |
7fd59977 |
184 | Create(Cyl: Cylinder from gp; |
185 | Con: Cone from gp; |
186 | Tol: Real from Standard) |
7eed5d29 |
187 | ---Purpose: Creates the intersection between a Cylinder and a Cone |
188 | returns QuadQuadGeo from IntAna; |
7fd59977 |
189 | |
7fd59977 |
190 | |
7fd59977 |
191 | Perform(me : in out; |
192 | Cyl: Cylinder from gp; |
193 | Con: Cone from gp; |
194 | Tol: Real from Standard) |
7eed5d29 |
195 | ---Purpose: Intersects a cylinder and a cone. |
196 | is static; |
7fd59977 |
197 | |
7fd59977 |
198 | |
7fd59977 |
199 | Create(Sph1: Sphere from gp; |
200 | Sph2: Sphere from gp; |
201 | Tol : Real from Standard) |
7eed5d29 |
202 | ---Purpose: Creates the intersection between two Spheres. |
203 | returns QuadQuadGeo from IntAna; |
7fd59977 |
204 | |
7fd59977 |
205 | |
7fd59977 |
206 | Perform(me : in out; |
207 | Sph1: Sphere from gp; |
208 | Sph2: Sphere from gp; |
209 | Tol : Real from Standard) |
7eed5d29 |
210 | ---Purpose: Intersects a two spheres. |
211 | is static; |
7fd59977 |
212 | |
7fd59977 |
213 | |
7fd59977 |
214 | Create(Sph: Sphere from gp; |
215 | Con: Cone from gp; |
216 | Tol: Real from Standard) |
7eed5d29 |
217 | ---Purpose: Creates the intersection beween a Sphere and a Cone. |
218 | returns QuadQuadGeo from IntAna; |
219 | |
7fd59977 |
220 | |
7fd59977 |
221 | Perform(me : in out; |
222 | Sph: Sphere from gp; |
223 | Con: Cone from gp; |
224 | Tol: Real from Standard) |
7eed5d29 |
225 | ---Purpose: Intersects a sphere and a cone. |
226 | is static; |
7fd59977 |
227 | |
228 | |
7eed5d29 |
229 | Create(Con1: Cone from gp; |
230 | Con2: Cone from gp; |
231 | Tol : Real from Standard) |
232 | ---Purpose: Creates the intersection beween two cones. |
233 | returns QuadQuadGeo from IntAna; |
7fd59977 |
234 | |
235 | |
236 | Perform(me : in out; |
237 | Con1: Cone from gp; |
238 | Con2: Cone from gp; |
239 | Tol :Real from Standard) |
7eed5d29 |
240 | ---Purpose: Intersects two cones. |
241 | is static; |
242 | |
243 | |
244 | Create(Pln : Pln from gp; |
245 | Tor : Torus from gp; |
246 | Tol : Real from Standard) |
247 | ---Purpose: Creates the intersection beween plane and torus. |
248 | returns QuadQuadGeo from IntAna; |
7fd59977 |
249 | |
7fd59977 |
250 | |
7eed5d29 |
251 | Perform(me :in out; |
252 | Pln : Pln from gp; |
253 | Tor : Torus from gp; |
254 | Tol : Real from Standard) |
255 | ---Purpose: Intersects plane and torus. |
256 | is static; |
7fd59977 |
257 | |
258 | |
7eed5d29 |
259 | Create(Cyl : Cylinder from gp; |
260 | Tor : Torus from gp; |
261 | Tol : Real from Standard) |
262 | ---Purpose: Creates the intersection beween cylinder and torus. |
263 | returns QuadQuadGeo from IntAna; |
264 | |
265 | |
266 | Perform(me : in out; |
267 | Cyl : Cylinder from gp; |
268 | Tor : Torus from gp; |
269 | Tol : Real from Standard) |
270 | ---Purpose: Intersects cylinder and torus. |
271 | is static; |
272 | |
273 | |
274 | Create(Con : Cone from gp; |
275 | Tor : Torus from gp; |
276 | Tol : Real from Standard) |
277 | ---Purpose: Creates the intersection beween cone and torus. |
278 | returns QuadQuadGeo from IntAna; |
279 | |
280 | |
281 | Perform(me : in out; |
282 | Con : Cone from gp; |
283 | Tor : Torus from gp; |
284 | Tol : Real from Standard) |
285 | ---Purpose: Intersects cone and torus. |
286 | is static; |
287 | |
288 | |
289 | Create(Sph : Sphere from gp; |
290 | Tor : Torus from gp; |
291 | Tol : Real from Standard) |
292 | ---Purpose: Creates the intersection beween sphere and torus. |
293 | returns QuadQuadGeo from IntAna; |
294 | |
295 | |
296 | Perform(me : in out; |
297 | Sph : Sphere from gp; |
298 | Tor : Torus from gp; |
299 | Tol : Real from Standard) |
300 | ---Purpose: Intersects sphere and torus. |
301 | is static; |
7fd59977 |
302 | |
7fd59977 |
303 | |
7eed5d29 |
304 | Create(Tor1 : Torus from gp; |
305 | Tor2 : Torus from gp; |
306 | Tol : Real from Standard) |
307 | ---Purpose: Creates the intersection beween two toruses. |
308 | returns QuadQuadGeo from IntAna; |
309 | |
310 | |
311 | Perform(me : in out; |
312 | Tor1 : Torus from gp; |
313 | Tor2 : Torus from gp; |
314 | Tol : Real from Standard) |
315 | ---Purpose: Intersects two toruses. |
316 | is static; |
317 | |
318 | |
319 | IsDone(me) |
320 | ---Purpose: Returns Standard_True if the computation was successful. |
321 | -- |
322 | ---C++: inline |
323 | returns Boolean from Standard |
324 | is static; |
7fd59977 |
325 | |
326 | |
327 | TypeInter(me) |
7eed5d29 |
328 | ---Purpose: Returns the type of intersection. |
329 | -- |
330 | ---C++: inline |
331 | returns ResultType from IntAna |
332 | raises NotDone from StdFail |
333 | -- The exception NotDone is raised if IsDone return Standard_False. |
334 | is static; |
7fd59977 |
335 | |
7fd59977 |
336 | |
7eed5d29 |
337 | NbSolutions(me) |
338 | ---Purpose: Returns the number of interesections. |
339 | -- The possible intersections are : |
340 | -- - 1 point |
341 | -- - 1 or 2 line(s) |
342 | -- - 1 Point and 1 Line |
343 | -- - 1 circle |
344 | -- - 1 ellipse |
345 | -- - 1 parabola |
346 | -- - 1 or 2 hyperbola(s). |
347 | -- |
348 | ---C++: inline |
349 | returns Integer from Standard |
350 | raises NotDone from StdFail |
351 | -- The exception NotDone is raised if IsDone returns Standard_False. |
352 | is static; |
353 | |
354 | |
355 | Point(me; Num: Integer from Standard) |
356 | ---Purpose: Returns the point solution of range Num. |
357 | returns Pnt from gp |
358 | raises DomainError from Standard, |
359 | OutOfRange from Standard, |
360 | NotDone from StdFail |
361 | -- The exception NotDone is raised if IsDone return Standard_False. |
362 | -- The exception DomainError is raised if TypeInter does not return |
363 | -- IntAna_Point or TypeInter does not return IntAna_PointAndCircle. |
364 | -- The exception OutOfRange is raised if Num < 1 or Num > NbSolutions. |
365 | is static; |
7fd59977 |
366 | |
7fd59977 |
367 | |
7eed5d29 |
368 | Line(me; Num: Integer from Standard) |
369 | ---Purpose: Returns the line solution of range Num. |
370 | returns Lin from gp |
371 | raises DomainError from Standard, |
372 | OutOfRange from Standard, |
373 | NotDone from StdFail |
374 | -- The exception NotDone is raised if IsDone return Standard_False. |
375 | -- The exception DomainError is raised if TypeInter does not return |
376 | -- IntAna_Line. |
377 | -- The exception OutOfRange is raised if Num < 1 or Num > NbSolutions. |
378 | is static; |
379 | |
380 | |
381 | Circle(me; Num: Integer from Standard) |
382 | ---Purpose: Returns the circle solution of range Num. |
383 | returns Circ from gp |
384 | raises DomainError from Standard, |
385 | OutOfRange from Standard, |
386 | NotDone from StdFail |
387 | -- The exception NotDone is raised if IsDone return Standard_False. |
388 | -- The exception DomainError is raised if TypeInter does not return |
389 | -- IntAna_Circle or TypeInter does not return IntAna_PointAndCircle. |
390 | -- The exception OutOfRange is raised if Num < 1 or Num > NbSolutions. |
391 | is static; |
392 | |
393 | |
394 | Ellipse(me; Num: Integer from Standard) |
395 | ---Purpose: Returns the ellipse solution of range Num. |
396 | returns Elips from gp |
397 | raises DomainError from Standard, |
398 | OutOfRange from Standard, |
399 | NotDone from StdFail |
400 | -- The exception NotDone is raised if IsDone return Standard_False. |
401 | -- The exception DomainError is raised if TypeInter does not return |
402 | -- IntAna_Ellipse. |
403 | -- The exception OutOfRange is raised if Num < 1 or Num > NbSolutions. |
404 | is static; |
405 | |
406 | |
407 | Parabola(me; Num: Integer from Standard) |
408 | ---Purpose: Returns the parabola solution of range Num. |
409 | returns Parab from gp |
410 | raises DomainError from Standard, |
411 | OutOfRange from Standard, |
412 | NotDone from StdFail |
413 | -- The exception NotDone is raised if IsDone return Standard_False. |
414 | -- The exception DomainError is raised if TypeInter does not return |
415 | -- IntAna_Parabola. |
416 | -- The exception OutOfRange is raised if Num < 1 or Num > NbSolutions. |
417 | is static; |
418 | |
419 | |
420 | Hyperbola(me; Num: Integer from Standard) |
421 | ---Purpose: Returns the hyperbola solution of range Num. |
422 | returns Hypr from gp |
423 | raises DomainError from Standard, |
424 | OutOfRange from Standard, |
425 | NotDone from StdFail |
426 | -- The exception NotDone is raised if IsDone return Standard_False. |
427 | -- The exception DomainError is raised if TypeInter does not return |
428 | -- IntAna_Hyperbola. |
429 | -- The exception OutOfRange is raised if Num < 1 or Num > NbSolutions. |
430 | is static; |
431 | |
432 | HasCommonGen(me) returns Boolean from Standard; |
7fd59977 |
433 | PChar(me) returns Pnt from gp; |
434 | ---C++: return const& |
7eed5d29 |
435 | |
7fd59977 |
436 | InitTolerances(me:out) |
7eed5d29 |
437 | ---Purpose: Initialize the values of inner tolerances. |
438 | is protected; |
439 | |
7fd59977 |
440 | fields |
441 | |
442 | done : Boolean from Standard is protected; |
443 | |
444 | nbint : Integer from Standard is protected; |
445 | typeres : ResultType from IntAna is protected; |
446 | |
447 | pt1 : Pnt from gp is protected; |
448 | pt2 : Pnt from gp is protected; |
7eed5d29 |
449 | pt3 : Pnt from gp is protected; |
450 | pt4 : Pnt from gp is protected; |
7fd59977 |
451 | |
452 | dir1 : Dir from gp is protected; |
453 | dir2 : Dir from gp is protected; |
7eed5d29 |
454 | dir3 : Dir from gp is protected; |
455 | dir4 : Dir from gp is protected; |
7fd59977 |
456 | |
457 | param1 : Real from Standard is protected; |
458 | param2 : Real from Standard is protected; |
7eed5d29 |
459 | param3 : Real from Standard is protected; |
460 | param4 : Real from Standard is protected; |
7fd59977 |
461 | param1bis : Real from Standard is protected; |
462 | param2bis : Real from Standard is protected; |
463 | -- |
464 | myEPSILON_DISTANCE : Real from Standard is protected; |
465 | myEPSILON_ANGLE_CONE : Real from Standard is protected; |
466 | myEPSILON_MINI_CIRCLE_RADIUS : Real from Standard is protected; |
467 | myEPSILON_CYLINDER_DELTA_RADIUS : Real from Standard is protected; |
468 | myEPSILON_CYLINDER_DELTA_DISTANCE: Real from Standard is protected; |
469 | myEPSILON_AXES_PARA : Real from Standard is protected; |
470 | -- |
471 | myCommonGen : Boolean from Standard is protected; |
472 | myPChar : Pnt from gp is protected; |
7eed5d29 |
473 | |
7fd59977 |
474 | end QuadQuadGeo; |