b311480e |
1 | // Created on: 1992-10-12 |
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 | // |
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 | |
17 | #include <GeomAbs_CurveType.hxx> |
18 | |
19 | |
20 | #include <IntCurve_IntConicConic.hxx> |
21 | #include <gp_Lin2d.hxx> |
22 | #include <gp_Circ2d.hxx> |
23 | #include <gp_Elips2d.hxx> |
24 | #include <gp_Parab2d.hxx> |
25 | #include <gp_Hypr2d.hxx> |
26 | #include <Precision.hxx> |
27 | |
28 | #include <TColStd_Array1OfReal.hxx> |
29 | |
30 | |
31 | void IntCurve_IntCurveCurveGen::Perform(const TheCurve& C, |
32 | const Standard_Real TolConf, |
33 | const Standard_Real Tol) { |
34 | IntRes2d_Domain D1; |
35 | Standard_Real TolDomain = Tol; |
36 | if(Tol<TolConf) TolDomain = TolConf; |
32ca7a51 |
37 | GeomAbs_CurveType typ = TheCurveTool::GetType(C); |
7fd59977 |
38 | switch(typ) { |
39 | case GeomAbs_Ellipse: |
40 | case GeomAbs_Circle: |
41 | case GeomAbs_Parabola: |
42 | case GeomAbs_Hyperbola: |
43 | case GeomAbs_Line: |
44 | ResetFields(); |
45 | done = Standard_True; |
46 | return; |
47 | |
48 | default: |
49 | { |
50 | Standard_Real paraminf = TheCurveTool::FirstParameter(C); |
51 | Standard_Real paramsup = TheCurveTool::LastParameter(C); |
df119b4e |
52 | if (Precision::IsInfinite(paraminf) && Precision::IsInfinite(paramsup)) { |
53 | done = Standard_False; |
54 | return; |
55 | } |
56 | // |
7fd59977 |
57 | if(paraminf>-Precision::Infinite()) { |
58 | if(paramsup<Precision::Infinite()) { |
59 | //-- paraminf-----------paramsup |
60 | D1.SetValues(TheCurveTool::Value(C,paraminf), |
61 | paraminf, |
62 | TolDomain, |
63 | TheCurveTool::Value(C,paramsup), |
64 | paramsup, |
65 | TolDomain); |
66 | } |
67 | else { |
68 | //-- paraminf------------... |
69 | D1.SetValues(TheCurveTool::Value(C,paraminf), |
70 | paraminf, |
71 | TolDomain, |
72 | Standard_True); |
73 | } |
74 | } |
75 | else { |
76 | if(paramsup<Precision::Infinite()) { |
77 | //-- ...-----------------paramsup |
78 | D1.SetValues(TheCurveTool::Value(C,paramsup), |
79 | paramsup, |
80 | TolDomain, |
81 | Standard_False); |
82 | } |
83 | } |
84 | this->ResetFields(); |
85 | intcurvcurv.SetReversedParameters(Standard_False); |
86 | intcurvcurv.Perform(C,D1,TolConf,Tol); |
87 | this->SetValues(intcurvcurv); |
88 | done = Standard_True; |
89 | } |
90 | } |
91 | } |
92 | |
93 | |
94 | void IntCurve_IntCurveCurveGen::Perform(const TheCurve& C, |
95 | const IntRes2d_Domain& D, |
96 | const Standard_Real TolConf, |
97 | const Standard_Real Tol) { |
32ca7a51 |
98 | GeomAbs_CurveType typ = TheCurveTool::GetType(C); |
7fd59977 |
99 | switch(typ) { |
100 | case GeomAbs_Ellipse: |
101 | case GeomAbs_Circle: |
102 | case GeomAbs_Parabola: |
103 | case GeomAbs_Hyperbola: |
104 | case GeomAbs_Line: |
105 | ResetFields(); |
106 | done = Standard_True; |
107 | return; |
108 | |
109 | default: |
110 | { |
111 | this->ResetFields(); |
112 | intcurvcurv.SetReversedParameters(Standard_False); |
113 | intcurvcurv.Perform(C,D,TolConf,Tol); |
114 | this->SetValues(intcurvcurv); |
115 | done = Standard_True; |
116 | } |
117 | } |
118 | } |
119 | |
120 | |
121 | |
122 | |
123 | //---------------------------------------------------------------------- |
124 | IntRes2d_Domain IntCurve_IntCurveCurveGen::ComputeDomain(const TheCurve& C1, |
125 | const Standard_Real TolDomain) const { |
126 | IntRes2d_Domain D1; |
127 | |
32ca7a51 |
128 | GeomAbs_CurveType typ = TheCurveTool::GetType(C1); |
7fd59977 |
129 | switch(typ) { |
130 | |
131 | case GeomAbs_Ellipse: |
132 | case GeomAbs_Circle: { |
133 | //--------------------------------------------------------------- |
134 | //-- if the curve is a trimmed curve, first and last parameters |
135 | //-- will be the parameters used to buid the domain |
136 | //-- |
137 | Standard_Real firstparameter = TheCurveTool::FirstParameter(C1); |
138 | Standard_Real lastparameter = TheCurveTool::LastParameter(C1); |
139 | |
140 | gp_Pnt2d P1(TheCurveTool::Value(C1,firstparameter)); |
141 | gp_Pnt2d P2(TheCurveTool::Value(C1,lastparameter)); |
142 | D1.SetValues(P1,firstparameter ,TolDomain, |
143 | P2,lastparameter ,TolDomain); |
c6541a0c |
144 | D1.SetEquivalentParameters(firstparameter,firstparameter+M_PI+M_PI); |
7fd59977 |
145 | break; |
146 | } |
147 | default: { |
148 | Standard_Real paraminf = TheCurveTool::FirstParameter(C1); |
149 | Standard_Real paramsup = TheCurveTool::LastParameter(C1); |
150 | if(paraminf>-Precision::Infinite()) { |
151 | if(paramsup<Precision::Infinite()) { |
152 | //-- paraminf-----------paramsup |
153 | D1.SetValues(TheCurveTool::Value(C1,paraminf), |
154 | paraminf, |
155 | TolDomain, |
156 | TheCurveTool::Value(C1,paramsup), |
157 | paramsup, |
158 | TolDomain); |
159 | } |
160 | else { |
161 | //-- paraminf------------... |
162 | D1.SetValues(TheCurveTool::Value(C1,paraminf), |
163 | paraminf, |
164 | TolDomain, |
165 | Standard_True); |
166 | } |
167 | } |
168 | else { |
169 | if(paramsup<Precision::Infinite()) { |
170 | //-- ...-----------------paramsup |
171 | D1.SetValues(TheCurveTool::Value(C1,paramsup), |
172 | paramsup, |
173 | TolDomain, |
174 | Standard_False); |
175 | } |
176 | } |
177 | break; |
178 | } |
179 | } |
180 | return(D1); |
181 | } |
182 | //---------------------------------------------------------------------- |
183 | //-- Perform : Si Une des courbes est Composite Alors decompose les appels |
184 | //---------------------------------------------------------------------- |
185 | void IntCurve_IntCurveCurveGen::Perform (const TheCurve& C1, |
186 | const IntRes2d_Domain& D1, |
187 | const TheCurve& C2, |
188 | const IntRes2d_Domain& D2, |
189 | const Standard_Real TolConf, |
190 | const Standard_Real Tol) { |
191 | this->ResetFields(); |
192 | Standard_Integer nbi1 = TheCurveTool::NbIntervals(C1); |
193 | if(nbi1 > 1) { |
194 | param1inf = TheCurveTool::FirstParameter(C1); |
195 | param1sup = TheCurveTool::LastParameter(C1); |
196 | } |
197 | else { |
198 | param1inf = (D1.HasFirstPoint())? (D1.FirstParameter()) : -Precision::Infinite(); |
199 | param1sup = (D1.HasLastPoint()) ? (D1.LastParameter()) : Precision::Infinite(); |
200 | } |
201 | Standard_Integer nbi2 = TheCurveTool::NbIntervals(C2); |
202 | if(nbi2 > 1) { |
203 | param2inf = TheCurveTool::FirstParameter(C2); |
204 | param2sup = TheCurveTool::LastParameter(C2); |
205 | } |
206 | else { |
207 | param2inf = (D2.HasFirstPoint())? (D2.FirstParameter()) : -Precision::Infinite(); |
208 | param2sup = (D2.HasLastPoint()) ? (D2.LastParameter()) : Precision::Infinite(); |
209 | } |
210 | if(nbi1>1 || nbi2>1) { |
211 | TColStd_Array1OfReal Tab1(1,nbi1+1); |
212 | TColStd_Array1OfReal Tab2(1,nbi2+1); |
213 | TheCurveTool::Intervals(C1,Tab1); |
214 | TheCurveTool::Intervals(C2,Tab2); |
215 | InternalCompositePerform(C1,D1,1,nbi1,Tab1, |
216 | C2,D2,1,nbi2,Tab2, |
217 | TolConf,Tol,Standard_True); |
218 | return; |
219 | } |
220 | else { |
221 | InternalPerform(C1,D1,C2,D2,TolConf,Tol,Standard_False); |
222 | } |
223 | } |
224 | |
225 | //---------------------------------------------------------------------- |
226 | //-- InternalPerform |
227 | //-- Suppose des Courbes Lin...Other |
228 | //-- Si Composite == True |
229 | //-- Les Resultats sont Ajoutes |
230 | //-- Sinon |
231 | //-- Les Resultats sont Copies |
232 | //---------------------------------------------------------------------- |
233 | void IntCurve_IntCurveCurveGen::InternalPerform (const TheCurve& C1, |
234 | const IntRes2d_Domain& D1, |
235 | const TheCurve& C2, |
236 | const IntRes2d_Domain& D2, |
237 | const Standard_Real TolConf, |
238 | const Standard_Real Tol, |
8696d65d |
239 | const Standard_Boolean Composite) |
240 | { |
7fd59977 |
241 | |
32ca7a51 |
242 | GeomAbs_CurveType typ1 = TheCurveTool::GetType(C1); |
243 | GeomAbs_CurveType typ2 = TheCurveTool::GetType(C2); |
7fd59977 |
244 | |
245 | |
8696d65d |
246 | switch (typ1) |
247 | { |
7fd59977 |
248 | case GeomAbs_Line: |
8696d65d |
249 | switch (typ2) |
7fd59977 |
250 | { |
8696d65d |
251 | case GeomAbs_Line: |
252 | { |
253 | intconiconi.SetReversedParameters(Standard_False); |
254 | intconiconi.Perform(TheCurveTool::Line(C1),D1, |
255 | TheCurveTool::Line(C2),D2,TolConf,Tol); |
256 | if(Composite) |
257 | { |
258 | this->Append(intconiconi, |
259 | param1inf, |
260 | param1sup, |
261 | param2inf, |
262 | param2sup); |
263 | } |
264 | else |
265 | { |
266 | this->SetValues(intconiconi); |
267 | } |
268 | } |
269 | break; |
7fd59977 |
270 | |
8696d65d |
271 | case GeomAbs_Circle: |
272 | { |
273 | intconiconi.SetReversedParameters(Standard_False); |
274 | intconiconi.Perform(TheCurveTool::Line(C1),D1, |
275 | TheCurveTool::Circle(C2),D2,TolConf,Tol); |
276 | if(Composite) |
277 | { |
278 | this->Append(intconiconi, |
279 | param1inf, |
280 | param1sup, |
281 | param2inf, |
282 | param2sup); |
283 | } |
284 | else |
285 | { |
286 | this->SetValues(intconiconi); |
287 | } |
288 | } |
289 | break; |
7fd59977 |
290 | |
8696d65d |
291 | case GeomAbs_Ellipse: |
292 | { |
293 | intconiconi.SetReversedParameters(Standard_False); |
294 | intconiconi.Perform(TheCurveTool::Line(C1),D1, |
295 | TheCurveTool::Ellipse(C2),D2,TolConf,Tol); |
296 | if(Composite) |
297 | { |
298 | this->Append(intconiconi, |
299 | param1inf, |
300 | param1sup, |
301 | param2inf, |
302 | param2sup); |
303 | } |
304 | else |
305 | { |
306 | this->SetValues(intconiconi); |
307 | } |
308 | } |
309 | break; |
7fd59977 |
310 | |
8696d65d |
311 | case GeomAbs_Parabola: |
312 | { |
313 | intconiconi.SetReversedParameters(Standard_False); |
314 | intconiconi.Perform(TheCurveTool::Line(C1),D1, |
315 | TheCurveTool::Parabola(C2),D2,TolConf,Tol); |
316 | if(Composite) |
317 | { |
318 | this->Append(intconiconi, |
319 | param1inf, |
320 | param1sup, |
321 | param2inf, |
322 | param2sup); |
323 | } |
324 | else |
325 | { |
326 | this->SetValues(intconiconi); |
327 | } |
328 | } |
329 | break; |
7fd59977 |
330 | |
8696d65d |
331 | case GeomAbs_Hyperbola: |
332 | { |
333 | intconiconi.SetReversedParameters(Standard_False); |
334 | intconiconi.Perform(TheCurveTool::Line(C1),D1, |
335 | TheCurveTool::Hyperbola(C2),D2,TolConf,Tol); |
336 | if(Composite) |
337 | { |
338 | this->Append(intconiconi, |
339 | param1inf, |
340 | param1sup, |
341 | param2inf, |
342 | param2sup); |
343 | } |
344 | else |
345 | { |
346 | this->SetValues(intconiconi); |
347 | } |
348 | } |
7fd59977 |
349 | |
8696d65d |
350 | break; |
7fd59977 |
351 | |
1aec3320 |
352 | default: |
8696d65d |
353 | { |
354 | intconicurv.SetReversedParameters(Standard_False); |
355 | intconicurv.Perform(TheCurveTool::Line(C1),D1, |
356 | C2,D2,TolConf,Tol); |
357 | if(Composite) |
358 | { |
359 | this->Append(intconicurv, |
360 | param1inf, |
361 | param1sup, |
362 | param2inf, |
363 | param2sup); |
364 | } |
365 | else |
366 | { |
367 | this->SetValues(intconicurv); |
368 | } |
7fd59977 |
369 | } |
8696d65d |
370 | break; |
371 | } |
7fd59977 |
372 | break; |
7fd59977 |
373 | |
8696d65d |
374 | case GeomAbs_Circle: |
375 | switch (typ2) |
376 | { |
377 | case GeomAbs_Line: |
378 | { |
379 | intconiconi.SetReversedParameters(Standard_True); |
380 | intconiconi.Perform(TheCurveTool::Line(C2),D2, |
381 | TheCurveTool::Circle(C1),D1,TolConf,Tol); |
382 | if(Composite) |
383 | { |
384 | this->Append(intconiconi, |
385 | param1inf, |
386 | param1sup, |
387 | param2inf, |
388 | param2sup); |
389 | } |
390 | else |
391 | { |
392 | this->SetValues(intconiconi); |
393 | } |
394 | } |
395 | break; |
7fd59977 |
396 | |
8696d65d |
397 | case GeomAbs_Circle: |
398 | { |
399 | intconiconi.SetReversedParameters(Standard_False); |
400 | intconiconi.Perform(TheCurveTool::Circle(C1),D1, |
401 | TheCurveTool::Circle(C2),D2,TolConf,Tol); |
402 | if(Composite) |
403 | { |
404 | this->Append(intconiconi, |
405 | param1inf, |
406 | param1sup, |
407 | param2inf, |
408 | param2sup); |
409 | } |
410 | else |
411 | { |
412 | this->SetValues(intconiconi); |
413 | } |
414 | } |
415 | break; |
7fd59977 |
416 | |
8696d65d |
417 | case GeomAbs_Ellipse: |
418 | { |
419 | intconiconi.SetReversedParameters(Standard_False); |
420 | intconiconi.Perform(TheCurveTool::Circle(C1),D1, |
421 | TheCurveTool::Ellipse(C2),D2,TolConf,Tol); |
422 | if(Composite) |
423 | { |
424 | this->Append(intconiconi, |
425 | param1inf, |
426 | param1sup, |
427 | param2inf, |
428 | param2sup); |
429 | } |
430 | else |
431 | { |
432 | this->SetValues(intconiconi); |
433 | } |
434 | } |
435 | break; |
7fd59977 |
436 | |
8696d65d |
437 | case GeomAbs_Parabola: |
438 | { |
439 | intconiconi.SetReversedParameters(Standard_False); |
440 | intconiconi.Perform(TheCurveTool::Circle(C1),D1, |
441 | TheCurveTool::Parabola(C2),D2,TolConf,Tol); |
442 | if(Composite) |
443 | { |
444 | this->Append(intconiconi, |
445 | param1inf, |
446 | param1sup, |
447 | param2inf, |
448 | param2sup); |
449 | } |
450 | else |
451 | { |
452 | this->SetValues(intconiconi); |
453 | } |
454 | } |
455 | break; |
7fd59977 |
456 | |
8696d65d |
457 | case GeomAbs_Hyperbola: |
458 | { |
459 | intconiconi.SetReversedParameters(Standard_False); |
460 | intconiconi.Perform(TheCurveTool::Circle(C1),D1, |
461 | TheCurveTool::Hyperbola(C2),D2,TolConf,Tol); |
462 | if(Composite) |
463 | { |
464 | this->Append(intconiconi, |
465 | param1inf, |
466 | param1sup, |
467 | param2inf, |
468 | param2sup); |
469 | } |
470 | else |
471 | { |
472 | this->SetValues(intconiconi); |
473 | } |
474 | } |
475 | break; |
7fd59977 |
476 | |
1aec3320 |
477 | default: |
8696d65d |
478 | { |
479 | intconicurv.SetReversedParameters(Standard_False); |
480 | intconicurv.Perform(TheCurveTool::Circle(C1),D1, |
481 | C2,D2,TolConf,Tol); |
482 | if(Composite) |
483 | { |
484 | this->Append(intconicurv, |
485 | param1inf, |
486 | param1sup, |
487 | param2inf, |
488 | param2sup); } |
489 | else |
490 | { |
491 | this->SetValues(intconicurv); |
492 | } |
7fd59977 |
493 | } |
8696d65d |
494 | |
495 | break; |
496 | } |
7fd59977 |
497 | break; |
498 | |
8696d65d |
499 | case GeomAbs_Ellipse: |
500 | switch (typ2) |
501 | { |
7fd59977 |
502 | case GeomAbs_Line: |
8696d65d |
503 | { |
504 | intconiconi.SetReversedParameters(Standard_True); |
505 | intconiconi.Perform(TheCurveTool::Line(C2),D2, |
506 | TheCurveTool::Ellipse(C1),D1, |
507 | TolConf,Tol); |
508 | |
509 | if(Composite) |
510 | { |
511 | this->Append(intconiconi, |
512 | param1inf, |
513 | param1sup, |
514 | param2inf, |
515 | param2sup); |
516 | } |
517 | else |
518 | { |
519 | this->SetValues(intconiconi); |
520 | } |
521 | } |
522 | break; |
7fd59977 |
523 | |
524 | case GeomAbs_Circle: |
8696d65d |
525 | { |
526 | intconiconi.SetReversedParameters(Standard_True); |
527 | |
528 | intconiconi.Perform(TheCurveTool::Circle(C2),D2, |
529 | TheCurveTool::Ellipse(C1),D1,TolConf,Tol); |
530 | if(Composite) |
531 | { |
532 | this->Append(intconiconi, |
533 | param1inf, |
534 | param1sup, |
535 | param2inf, |
536 | param2sup); |
537 | } |
538 | else |
539 | { |
540 | this->SetValues(intconiconi); |
541 | } |
542 | } |
543 | break; |
7fd59977 |
544 | |
545 | case GeomAbs_Ellipse: |
8696d65d |
546 | { |
547 | intconiconi.SetReversedParameters(Standard_False); |
548 | intconiconi.Perform(TheCurveTool::Ellipse(C1),D1, |
549 | TheCurveTool::Ellipse(C2),D2,TolConf,Tol); |
550 | if(Composite) |
551 | { |
552 | this->Append(intconiconi, |
553 | param1inf, |
554 | param1sup, |
555 | param2inf, |
556 | param2sup); |
557 | } |
558 | else |
559 | { |
560 | this->SetValues(intconiconi); |
561 | } |
562 | } |
563 | break; |
7fd59977 |
564 | |
565 | case GeomAbs_Parabola: |
8696d65d |
566 | { |
567 | intconiconi.SetReversedParameters(Standard_False); |
568 | intconiconi.Perform(TheCurveTool::Ellipse(C1),D1, |
569 | TheCurveTool::Parabola(C2),D2,TolConf,Tol); |
570 | if(Composite) |
571 | { |
572 | this->Append(intconiconi, |
573 | param1inf, |
574 | param1sup, |
575 | param2inf, |
576 | param2sup); |
577 | } |
578 | else |
579 | { |
580 | this->SetValues(intconiconi); |
581 | } |
582 | } |
583 | break; |
7fd59977 |
584 | |
585 | case GeomAbs_Hyperbola: |
8696d65d |
586 | { |
587 | intconiconi.SetReversedParameters(Standard_False); |
588 | intconiconi.Perform(TheCurveTool::Ellipse(C1),D1, |
589 | TheCurveTool::Hyperbola(C2),D2, |
590 | TolConf,Tol); |
591 | if(Composite) |
592 | { |
593 | this->Append(intconiconi, |
594 | param1inf, |
595 | param1sup, |
596 | param2inf, |
597 | param2sup); |
598 | } |
599 | else |
600 | { |
601 | this->SetValues(intconiconi); |
602 | } |
603 | } |
604 | break; |
7fd59977 |
605 | |
1aec3320 |
606 | default: |
8696d65d |
607 | { |
608 | intconicurv.SetReversedParameters(Standard_False); |
609 | intconicurv.Perform(TheCurveTool::Ellipse(C1),D1, |
610 | C2,D2,TolConf,Tol); |
611 | if(Composite) |
612 | { |
613 | this->Append(intconicurv, |
614 | param1inf, |
615 | param1sup, |
616 | param2inf, |
617 | param2sup); |
618 | } |
619 | else |
620 | { |
621 | this->SetValues(intconicurv); |
622 | } |
623 | } |
624 | break; |
625 | } |
7fd59977 |
626 | break; |
627 | |
8696d65d |
628 | case GeomAbs_Parabola: |
629 | switch (typ2) |
630 | { |
631 | case GeomAbs_Line: |
632 | { |
633 | intconiconi.SetReversedParameters(Standard_True); |
634 | intconiconi.Perform(TheCurveTool::Line(C2),D2, |
635 | TheCurveTool::Parabola(C1),D1,TolConf,Tol); |
636 | if(Composite) |
637 | { |
638 | this->Append(intconiconi, |
639 | param1inf, |
640 | param1sup, |
641 | param2inf, |
642 | param2sup); |
643 | } |
644 | else |
645 | { |
646 | this->SetValues(intconiconi); |
647 | } |
648 | } |
649 | break; |
7fd59977 |
650 | |
8696d65d |
651 | case GeomAbs_Circle: |
652 | { |
653 | intconiconi.SetReversedParameters(Standard_True); |
654 | intconiconi.Perform(TheCurveTool::Circle(C2),D2, |
655 | TheCurveTool::Parabola(C1),D1,TolConf,Tol); |
656 | if(Composite) |
657 | { this->Append(intconiconi, |
658 | param1inf, |
659 | param1sup, |
660 | param2inf, |
661 | param2sup); |
662 | } |
663 | else |
664 | { |
665 | this->SetValues(intconiconi); |
666 | } |
667 | } |
668 | break; |
7fd59977 |
669 | |
8696d65d |
670 | case GeomAbs_Ellipse: |
671 | { |
672 | intconiconi.SetReversedParameters(Standard_True); |
673 | intconiconi.Perform(TheCurveTool::Ellipse(C2),D2, |
674 | TheCurveTool::Parabola(C1),D1,TolConf,Tol); |
675 | if(Composite) |
676 | { |
677 | this->Append(intconiconi, |
678 | param1inf, |
679 | param1sup, |
680 | param2inf, |
681 | param2sup); |
682 | } |
683 | else |
684 | { |
685 | this->SetValues(intconiconi); |
686 | } |
7fd59977 |
687 | } |
8696d65d |
688 | break; |
7fd59977 |
689 | |
8696d65d |
690 | case GeomAbs_Parabola: |
691 | { |
692 | intconiconi.SetReversedParameters(Standard_False); |
693 | intconiconi.Perform(TheCurveTool::Parabola(C1),D1, |
694 | TheCurveTool::Parabola(C2),D2,TolConf,Tol); |
695 | if(Composite) |
696 | { |
697 | this->Append(intconiconi, |
698 | param1inf, |
699 | param1sup, |
700 | param2inf, |
701 | param2sup); |
702 | } |
703 | else |
704 | { |
705 | this->SetValues(intconiconi); |
706 | } |
707 | } |
708 | break; |
7fd59977 |
709 | |
710 | case GeomAbs_Hyperbola: |
8696d65d |
711 | { |
712 | intconiconi.SetReversedParameters(Standard_False); |
713 | intconiconi.Perform(TheCurveTool::Parabola(C1),D1, |
714 | TheCurveTool::Hyperbola(C2),D2, |
715 | TolConf,Tol); |
716 | if(Composite) |
717 | { |
718 | this->Append(intconiconi, |
719 | param1inf, |
720 | param1sup, |
721 | param2inf, |
722 | param2sup); |
723 | } |
724 | else |
725 | { |
726 | this->SetValues(intconiconi); |
727 | } |
728 | } |
729 | break; |
7fd59977 |
730 | |
1aec3320 |
731 | default: |
8696d65d |
732 | { |
733 | intconicurv.SetReversedParameters(Standard_False); |
734 | intconicurv.Perform(TheCurveTool::Parabola(C1),D1, |
735 | C2,D2,TolConf,Tol); |
736 | if(Composite) |
737 | { |
738 | this->Append(intconicurv, |
739 | param1inf, |
740 | param1sup, |
741 | param2inf, |
742 | param2sup); |
743 | } |
744 | else |
745 | { |
746 | this->SetValues(intconicurv); |
747 | } |
748 | } |
749 | break; |
750 | } |
751 | break; |
7fd59977 |
752 | |
8696d65d |
753 | case GeomAbs_Hyperbola: |
754 | switch (typ2) |
755 | { |
756 | case GeomAbs_Line: |
757 | { |
758 | intconiconi.SetReversedParameters(Standard_True); |
759 | intconiconi.Perform(TheCurveTool::Line(C2),D2, |
760 | TheCurveTool::Hyperbola(C1),D1,TolConf,Tol); |
761 | if(Composite) |
762 | { |
763 | this->Append(intconiconi, |
764 | param1inf, |
765 | param1sup, |
766 | param2inf, |
767 | param2sup); |
768 | } |
769 | else |
770 | { |
771 | this->SetValues(intconiconi); |
772 | } |
773 | } |
774 | break; |
7fd59977 |
775 | |
8696d65d |
776 | case GeomAbs_Circle: |
777 | { |
778 | intconiconi.SetReversedParameters(Standard_True); |
779 | intconiconi.Perform(TheCurveTool::Circle(C2),D2, |
780 | TheCurveTool::Hyperbola(C1),D1,TolConf,Tol); |
781 | if(Composite) { this->Append(intconiconi, |
782 | param1inf, |
783 | param1sup, |
784 | param2inf, |
785 | param2sup); } |
786 | else { this->SetValues(intconiconi); } |
787 | } |
788 | break; |
7fd59977 |
789 | |
8696d65d |
790 | case GeomAbs_Ellipse: |
791 | { |
792 | intconiconi.SetReversedParameters(Standard_True); |
793 | intconiconi.Perform(TheCurveTool::Ellipse(C2),D2, |
794 | TheCurveTool::Hyperbola(C1),D1,TolConf,Tol); |
795 | if(Composite) { this->Append(intconiconi, |
796 | param1inf, |
797 | param1sup, |
798 | param2inf, |
799 | param2sup); } |
800 | else { this->SetValues(intconiconi); } |
801 | } |
802 | break; |
7fd59977 |
803 | |
8696d65d |
804 | case GeomAbs_Parabola: |
805 | { |
806 | intconiconi.SetReversedParameters(Standard_True); |
807 | intconiconi.Perform(TheCurveTool::Parabola(C2),D2, |
808 | TheCurveTool::Hyperbola(C1),D1,TolConf,Tol); |
809 | if(Composite) { this->Append(intconiconi, |
810 | param1inf, |
811 | param1sup, |
812 | param2inf, |
813 | param2sup); } |
814 | else { this->SetValues(intconiconi); } |
7fd59977 |
815 | } |
8696d65d |
816 | break; |
7fd59977 |
817 | |
8696d65d |
818 | case GeomAbs_Hyperbola: |
819 | { |
820 | intconiconi.SetReversedParameters(Standard_False); |
821 | intconiconi.Perform(TheCurveTool::Hyperbola(C1),D1, |
822 | TheCurveTool::Hyperbola(C2),D2, |
823 | TolConf,Tol); |
824 | if(Composite) { this->Append(intconiconi, |
825 | param1inf, |
826 | param1sup, |
827 | param2inf, |
828 | param2sup); } |
829 | else { this->SetValues(intconiconi); } |
830 | } |
831 | break; |
7fd59977 |
832 | |
1aec3320 |
833 | default: |
8696d65d |
834 | { |
835 | intconicurv.SetReversedParameters(Standard_False); |
836 | intconicurv.Perform(TheCurveTool::Hyperbola(C1),D1, |
837 | C2,D2,TolConf,Tol); |
838 | if(Composite) { this->Append(intconicurv, |
839 | param1inf, |
840 | param1sup, |
841 | param2inf, |
842 | param2sup); } |
843 | else { this->SetValues(intconicurv); } |
844 | } |
845 | break; |
846 | } |
847 | break; |
7fd59977 |
848 | |
1aec3320 |
849 | default: |
8696d65d |
850 | switch (typ2) |
851 | { |
852 | case GeomAbs_Line: |
853 | { |
854 | intconicurv.SetReversedParameters(Standard_True); |
855 | intconicurv.Perform(TheCurveTool::Line(C2),D2, C1,D1,TolConf,Tol); |
856 | if(Composite) |
857 | { |
858 | this->Append(intconicurv, |
859 | param1inf, |
860 | param1sup, |
861 | param2inf, |
862 | param2sup); |
863 | } |
864 | else |
865 | { |
866 | this->SetValues(intconicurv); |
867 | } |
868 | } |
869 | break; |
7fd59977 |
870 | |
8696d65d |
871 | case GeomAbs_Circle: |
872 | { |
873 | intconicurv.SetReversedParameters(Standard_True); |
874 | intconicurv.Perform(TheCurveTool::Circle(C2),D2, C1,D1,TolConf,Tol); |
875 | if(Composite) |
876 | { |
877 | this->Append(intconicurv, |
878 | param1inf, |
879 | param1sup, |
880 | param2inf, |
881 | param2sup); |
882 | } |
883 | else |
884 | { |
885 | this->SetValues(intconicurv); |
886 | } |
887 | } |
888 | break; |
7fd59977 |
889 | |
8696d65d |
890 | case GeomAbs_Ellipse: |
891 | { |
892 | intconicurv.SetReversedParameters(Standard_True); |
893 | intconicurv.Perform(TheCurveTool::Ellipse(C2),D2, C1,D1,TolConf,Tol); |
894 | if(Composite) |
895 | { |
896 | this->Append(intconicurv, |
897 | param1inf, |
898 | param1sup, |
899 | param2inf, |
900 | param2sup); |
901 | } |
902 | else |
903 | { |
904 | this->SetValues(intconicurv); |
905 | } |
906 | } |
907 | break; |
7fd59977 |
908 | |
8696d65d |
909 | case GeomAbs_Parabola: |
910 | { |
911 | intconicurv.SetReversedParameters(Standard_True); |
912 | intconicurv.Perform(TheCurveTool::Parabola(C2),D2,C1,D1,TolConf,Tol); |
913 | if(Composite) |
914 | { |
915 | this->Append(intconicurv, |
916 | param1inf, |
917 | param1sup, |
918 | param2inf, |
919 | param2sup); |
920 | } |
921 | else |
922 | { |
923 | this->SetValues(intconicurv); |
924 | } |
925 | } |
926 | break; |
7fd59977 |
927 | |
8696d65d |
928 | case GeomAbs_Hyperbola: |
929 | { |
930 | intconicurv.SetReversedParameters(Standard_True); |
931 | intconicurv.Perform(TheCurveTool::Hyperbola(C2),D2,C1,D1, |
932 | TolConf,Tol); |
933 | if(Composite) |
934 | { |
935 | this->Append(intconicurv, |
936 | param1inf, |
937 | param1sup, |
938 | param2inf, |
939 | param2sup); |
940 | } |
941 | else |
942 | { |
943 | this->SetValues(intconicurv); |
944 | } |
945 | } |
946 | break; |
947 | |
1aec3320 |
948 | default: |
8696d65d |
949 | { |
950 | intcurvcurv.SetReversedParameters(Standard_False); |
951 | intcurvcurv.Perform(C1,D1, C2,D2,TolConf,Tol); |
952 | if(Composite) |
953 | { |
954 | this->Append(intcurvcurv, |
955 | param1inf, |
956 | param1sup, |
957 | param2inf, |
958 | param2sup); } |
959 | else |
960 | { |
961 | this->SetValues(intcurvcurv); |
962 | } |
963 | done = Standard_True; |
7fd59977 |
964 | } |
965 | break; |
966 | } |
8696d65d |
967 | break; |
7fd59977 |
968 | } |
969 | } |
970 | |
de8791ee |
971 | void IntCurve_IntCurveCurveGen::InternalCompositePerform_noRecurs( |
972 | const Standard_Integer NbInterC1, |
973 | const TheCurve& C1, |
974 | const Standard_Integer NumInterC1, |
975 | const TColStd_Array1OfReal& Tab1, |
976 | const IntRes2d_Domain& D1, |
977 | const Standard_Integer NbInterC2, |
978 | const TheCurve& C2, |
979 | const Standard_Integer NumInterC2, |
980 | const TColStd_Array1OfReal& Tab2, |
981 | const IntRes2d_Domain& D2, |
982 | const Standard_Real TolConf, |
983 | const Standard_Real Tol) |
984 | { |
985 | |
986 | |
987 | if(NumInterC2>NbInterC2) |
988 | return; |
989 | |
990 | |
991 | IntRes2d_Domain DomainC1NumInter; |
992 | IntRes2d_Domain DomainC2NumInter; |
993 | |
994 | //---------------------------------------------------------------------- |
995 | //-- Creation du domaine associe a la portion de C1 |
996 | //---------------------------------------------------------------------- |
997 | Standard_Boolean DomainIsOK = Standard_True; |
998 | Standard_Real ParamInf,ParamSup; |
999 | |
1000 | if(NbInterC1>1) { |
1001 | TheCurveTool::GetInterval(C1,NumInterC1,Tab1,ParamInf,ParamSup); |
1002 | //-------------------------------------------------------------- |
1003 | //-- Verification : Domaine Inclu dans Intervalle de Definition |
1004 | //-------------------------------------------------------------- |
1005 | |
1006 | Standard_Real u; |
1007 | |
1008 | u = D1.FirstParameter(); |
1009 | if(ParamInf < u) { ParamInf = u; } |
1010 | |
1011 | u = D1.LastParameter(); |
1012 | if(ParamSup > u) { ParamSup = u; } |
1013 | |
1014 | if((ParamSup - ParamInf) > 1e-10) { |
1015 | DomainC1NumInter.SetValues(TheCurveTool::Value(C1,ParamInf), |
1016 | ParamInf, |
1017 | D1.FirstTolerance(), |
1018 | TheCurveTool::Value(C1,ParamSup), |
1019 | ParamSup, |
1020 | D1.LastTolerance()); |
1021 | } else { |
1022 | DomainIsOK = Standard_False; |
1023 | } |
1024 | } else { |
1025 | DomainC1NumInter = D1; |
1026 | } |
1027 | |
1028 | //---------------------------------------------------------------------- |
1029 | //-- Creation du domaine associe a la portion de C2 |
1030 | //---------------------------------------------------------------------- |
1031 | if(NbInterC2 > 1) { |
1032 | TheCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup); |
1033 | //-------------------------------------------------------------- |
1034 | //-- Verification : Domaine Inclu dans Intervalle de Definition |
1035 | //-------------------------------------------------------------- |
1036 | |
1037 | Standard_Real u; |
1038 | |
1039 | u = D2.FirstParameter(); |
1040 | if(ParamInf < u) { ParamInf = u; } |
1041 | u = D2.LastParameter(); |
1042 | |
1043 | if(ParamSup > u) { ParamSup = u; } |
1044 | |
1045 | if((ParamSup - ParamInf) > 1e-10) { |
1046 | DomainC2NumInter.SetValues(TheCurveTool::Value(C2,ParamInf), |
1047 | ParamInf, |
1048 | D2.FirstTolerance(), |
1049 | TheCurveTool::Value(C2,ParamSup), |
1050 | ParamSup, |
1051 | D2.LastTolerance()); |
1052 | } else { |
1053 | DomainIsOK = Standard_False; |
1054 | } |
1055 | } else { |
1056 | DomainC2NumInter = D2; |
1057 | } |
1058 | |
1059 | if(DomainIsOK) { |
1060 | InternalPerform(C2,DomainC2NumInter, |
1061 | C1,DomainC1NumInter, |
1062 | TolConf,Tol, |
1063 | Standard_True); |
1064 | } |
1065 | } |
1066 | |
7fd59977 |
1067 | |
1068 | |
1069 | |
1070 | //-- C1 ou C2 sont des courbes composites |
1071 | //-- |
1072 | |
1073 | void |
1074 | IntCurve_IntCurveCurveGen::InternalCompositePerform(const TheCurve& C1, |
1075 | const IntRes2d_Domain& D1, |
1076 | const Standard_Integer XXXNumInterC1, |
1077 | const Standard_Integer NbInterC1, |
1078 | const TColStd_Array1OfReal& Tab1, |
1079 | const TheCurve& C2, |
1080 | const IntRes2d_Domain& D2, |
1081 | const Standard_Integer XXXNumInterC2, |
1082 | const Standard_Integer NbInterC2, |
1083 | const TColStd_Array1OfReal& Tab2, |
1084 | const Standard_Real TolConf, |
1085 | const Standard_Real Tol, |
1086 | const Standard_Boolean RecursOnC2) { |
1087 | |
de8791ee |
1088 | Standard_Integer NumInterC2=XXXNumInterC2; |
7fd59977 |
1089 | Standard_Integer NumInterC1=XXXNumInterC1; |
1090 | |
1091 | |
1092 | // Standard_Boolean Arret=Standard_False; |
1093 | |
de8791ee |
1094 | if(NumInterC2>NbInterC2) |
1095 | return; |
1096 | |
1097 | if(!RecursOnC2){ |
1098 | InternalCompositePerform_noRecurs(NbInterC1, C1, NumInterC1, Tab1, D1, NbInterC2, C2, NumInterC2, Tab2, D2, TolConf, Tol); |
1099 | return; |
1100 | } |
1101 | |
1102 | for(Standard_Integer i=NumInterC1 ; i<=NbInterC1; i++) { |
1103 | NumInterC1=i; |
1104 | /* |
1105 | InternalCompositePerform(C2,D2,NumInterC2,NbInterC2,Tab2, |
1106 | C1,D1,NumInterC1,NbInterC1,Tab1, |
1107 | TolConf,Tol,Standard_False); |
1108 | */ |
1109 | |
1110 | InternalCompositePerform_noRecurs(NbInterC2,C2,NumInterC2,Tab2,D2,NbInterC1,C1,NumInterC1,Tab1,D1,TolConf,Tol); |
1111 | } |
1112 | |
1113 | if(NumInterC2<NbInterC2) { |
1114 | NumInterC2++; |
1115 | NumInterC1=1; |
1116 | |
1117 | InternalCompositePerform(C1,D1,NumInterC1,NbInterC1,Tab1, |
1118 | C2,D2,NumInterC2,NbInterC2,Tab2, |
1119 | TolConf,Tol, |
1120 | Standard_True); |
7fd59977 |
1121 | } |
1122 | } |
1123 | |
5ae6e53d |
1124 | //======================================================================= |
1125 | //function : SetMinNbSamples |
1126 | //purpose : |
1127 | //======================================================================= |
1128 | void IntCurve_IntCurveCurveGen::SetMinNbSamples(const Standard_Integer theMinNbSamples) |
1129 | { |
1130 | intcurvcurv.SetMinNbSamples(theMinNbSamples); |
1131 | } |
7fd59977 |
1132 | |
5ae6e53d |
1133 | //======================================================================= |
1134 | //function : GetMinNbSamples |
1135 | //purpose : |
1136 | //======================================================================= |
1137 | Standard_Integer IntCurve_IntCurveCurveGen::GetMinNbSamples() const |
1138 | { |
1139 | return intcurvcurv.GetMinNbSamples(); |
1140 | } |