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