0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / IntCurve / IntCurve_UserIntConicCurveGen.gxx
1 // Created on: 1992-11-24
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <IntCurve_IntConicConic.hxx>
18 #include <gp_Lin2d.hxx>
19 #include <gp_Circ2d.hxx>
20 #include <gp_Elips2d.hxx>
21 #include <gp_Parab2d.hxx>
22 #include <gp_Hypr2d.hxx>
23 #include <Precision.hxx>        
24
25
26
27 IntCurve_UserIntConicCurveGen::IntCurve_UserIntConicCurveGen () {
28   done = Standard_False;
29 }
30 //-------------------------------------------------------------------------------------
31 IntCurve_UserIntConicCurveGen::IntCurve_UserIntConicCurveGen (const gp_Lin2d& Lin1,
32                                                               const IntRes2d_Domain& D1,
33                                                               const ThePCurve& C2,
34                                                               const IntRes2d_Domain& D2,
35                                                               const Standard_Real TolConf,
36                                                               const Standard_Real Tol) {
37   Perform(Lin1,D1,C2,D2,TolConf,Tol);
38 }
39 //-------------------------------------------------------------------------------------
40 IntCurve_UserIntConicCurveGen::IntCurve_UserIntConicCurveGen (const gp_Circ2d& Circ1,
41                                                               const IntRes2d_Domain& D1,
42                                                               const ThePCurve& C2,
43                                                               const IntRes2d_Domain& D2,
44                                                               const Standard_Real TolConf,
45                                                               const Standard_Real Tol) {
46   Perform(Circ1,D1,C2,D2,TolConf,Tol);
47 }
48 //-------------------------------------------------------------------------------------
49 IntCurve_UserIntConicCurveGen::IntCurve_UserIntConicCurveGen (const gp_Parab2d& Parab1,
50                                                               const IntRes2d_Domain& D1,
51                                                               const ThePCurve& C2,
52                                                               const IntRes2d_Domain& D2,
53                                                               const Standard_Real TolConf,
54                                                               const Standard_Real Tol) {
55   Perform(Parab1,D1,C2,D2,TolConf,Tol);
56 }
57 //-------------------------------------------------------------------------------------
58 IntCurve_UserIntConicCurveGen::IntCurve_UserIntConicCurveGen (const gp_Elips2d& Elips1,
59                                                               const IntRes2d_Domain& D1,
60                                                               const ThePCurve& C2,
61                                                               const IntRes2d_Domain& D2,
62                                                               const Standard_Real TolConf,
63                                                               const Standard_Real Tol) {
64   Perform(Elips1,D1,C2,D2,TolConf,Tol);
65 }
66 //-------------------------------------------------------------------------------------
67 IntCurve_UserIntConicCurveGen::IntCurve_UserIntConicCurveGen (const gp_Hypr2d& Hyper1,
68                                                               const IntRes2d_Domain& D1,
69                                                               const ThePCurve& C2,
70                                                               const IntRes2d_Domain& D2,
71                                                               const Standard_Real TolConf,
72                                                               const Standard_Real Tol) {
73   Perform(Hyper1,D1,C2,D2,TolConf,Tol);
74 }
75 //-------------------------------------------------------------------------------------  
76
77
78 //----------------------------------------------------------------------
79 void IntCurve_UserIntConicCurveGen::Perform (const gp_Lin2d& Lin1,
80                                              const IntRes2d_Domain& D1,
81                                              const ThePCurve& C2,
82                                              const IntRes2d_Domain& D2,
83                                              const Standard_Real TolConf,
84                                              const Standard_Real Tol) {
85   this->ResetFields();
86   Standard_Integer NbInterC2 = ThePCurveTool::NbIntervals(C2);
87   if(NbInterC2 > 1) { 
88     Standard_Real ParamInf,ParamSup;
89     Standard_Real D2FirstParam = D2.FirstParameter();
90     Standard_Real D2LastParam  = D2.LastParameter();
91     Standard_Boolean Ok = Standard_True;
92     param1inf = (D1.HasFirstPoint()) ? D1.FirstParameter() : -Precision::Infinite();
93     param1sup = (D1.HasLastPoint()) ?  D1.LastParameter()  : Precision::Infinite();
94     param2inf = ThePCurveTool::FirstParameter(C2);
95     param2sup = ThePCurveTool::LastParameter(C2);
96     IntRes2d_Domain DomainC2NumInter;
97
98     TColStd_Array1OfReal Tab2(1,NbInterC2+1);
99     ThePCurveTool::Intervals(C2,Tab2);    
100
101     for(Standard_Integer NumInterC2=1; Ok && (NumInterC2 <= NbInterC2);NumInterC2++) { 
102       ThePCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
103       if((ParamInf > D2LastParam)||(ParamSup < D2FirstParam)) Ok=Standard_False; 
104       else { 
105         if(ParamInf < D2FirstParam) ParamInf = D2FirstParam;
106         if(ParamSup > D2LastParam)  ParamSup = D2LastParam; 
107         if((ParamSup - ParamInf) > RealEpsilon()) { 
108           DomainC2NumInter.SetValues(ThePCurveTool::Value(C2,ParamInf),
109                                      ParamInf,
110                                      D2.FirstTolerance(),
111                                      ThePCurveTool::Value(C2,ParamSup),
112                                      ParamSup,
113                                      D2.LastTolerance());
114           InternalPerform(Lin1,D1,C2,DomainC2NumInter,TolConf,Tol,Standard_True);
115         }
116       }
117     }
118   }
119   else { 
120     InternalPerform(Lin1,D1,C2,D2,TolConf,Tol,Standard_False);
121   }
122 }
123 //--------------------------------------------------------------------------------
124 void IntCurve_UserIntConicCurveGen::Perform (const gp_Circ2d& Circ1,
125                                              const IntRes2d_Domain& D1,
126                                              const ThePCurve& C2,
127                                              const IntRes2d_Domain& D2,
128                                              const Standard_Real TolConf,
129                                              const Standard_Real Tol) {
130   this->ResetFields();
131   Standard_Integer NbInterC2 = ThePCurveTool::NbIntervals(C2);
132   if(NbInterC2 > 1) {
133     Standard_Real ParamInf,ParamSup;
134     Standard_Real D2FirstParam = D2.FirstParameter();
135     Standard_Real D2LastParam  = D2.LastParameter();
136     Standard_Boolean Ok = Standard_True;
137     
138     param1inf = (D1.HasFirstPoint()) ? D1.FirstParameter() : -Precision::Infinite();
139     param1sup = (D1.HasLastPoint()) ?  D1.LastParameter()  : Precision::Infinite();
140     param2inf = ThePCurveTool::FirstParameter(C2);
141     param2sup = ThePCurveTool::LastParameter(C2);
142     IntRes2d_Domain DomainC2NumInter;
143     
144     TColStd_Array1OfReal Tab2(1,NbInterC2+1);
145     ThePCurveTool::Intervals(C2,Tab2);    
146     
147     
148     for(Standard_Integer NumInterC2=1; Ok && (NumInterC2<=NbInterC2);NumInterC2++) { 
149       ThePCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
150       if((ParamInf > D2LastParam)||(ParamSup < D2FirstParam)) Ok=Standard_False; 
151       else { 
152         if(ParamInf < D2FirstParam) ParamInf = D2FirstParam;
153         if(ParamSup > D2LastParam)  ParamSup = D2LastParam; 
154         if((ParamSup - ParamInf) > RealEpsilon()) { 
155           DomainC2NumInter.SetValues(ThePCurveTool::Value(C2,ParamInf),
156                                      ParamInf,
157                                      D2.FirstTolerance(),
158                                      ThePCurveTool::Value(C2,ParamSup),
159                                      ParamSup,
160                                      D2.LastTolerance());
161           InternalPerform(Circ1,D1,C2,DomainC2NumInter,TolConf,Tol,Standard_True);
162         }
163       }
164     }
165   }
166   else { 
167     InternalPerform(Circ1,D1,C2,D2,TolConf,Tol,Standard_False);
168   }
169 }
170 //--------------------------------------------------------------------------------
171 void IntCurve_UserIntConicCurveGen::Perform (const gp_Parab2d& Parab1,
172                                              const IntRes2d_Domain& D1,
173                                              const ThePCurve& C2,
174                                              const IntRes2d_Domain& D2,
175                                              const Standard_Real TolConf,
176                                              const Standard_Real Tol) {
177   this->ResetFields();
178   Standard_Integer NbInterC2 = ThePCurveTool::NbIntervals(C2);  
179   if(NbInterC2 > 1) {
180     Standard_Real ParamInf,ParamSup;
181     Standard_Real D2FirstParam = D2.FirstParameter();
182     Standard_Real D2LastParam  = D2.LastParameter();
183     Standard_Boolean Ok = Standard_True;
184     param1inf = (D1.HasFirstPoint()) ? D1.FirstParameter() : -Precision::Infinite();
185     param1sup = (D1.HasLastPoint()) ?  D1.LastParameter()  : Precision::Infinite();
186     param2inf = ThePCurveTool::FirstParameter(C2);
187     param2sup = ThePCurveTool::LastParameter(C2);
188     IntRes2d_Domain DomainC2NumInter;
189
190     TColStd_Array1OfReal Tab2(1,NbInterC2+1);
191     ThePCurveTool::Intervals(C2,Tab2);    
192  
193     for(Standard_Integer NumInterC2=1; Ok && (NumInterC2<=NbInterC2);NumInterC2++) { 
194       ThePCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
195       if((ParamInf > D2LastParam)||(ParamSup < D2FirstParam)) Ok=Standard_False; 
196       else { 
197         if(ParamInf < D2FirstParam) ParamInf = D2FirstParam;
198         if(ParamSup > D2LastParam)  ParamSup = D2LastParam; 
199         if((ParamSup - ParamInf) > RealEpsilon()) { 
200           DomainC2NumInter.SetValues(ThePCurveTool::Value(C2,ParamInf),
201                                      ParamInf,
202                                      D2.FirstTolerance(),
203                                      ThePCurveTool::Value(C2,ParamSup),
204                                      ParamSup,
205                                      D2.LastTolerance());
206           InternalPerform(Parab1,D1,C2,DomainC2NumInter,TolConf,Tol,Standard_True);
207         }
208       }
209     }
210   }
211   else { 
212     InternalPerform(Parab1,D1,C2,D2,TolConf,Tol,Standard_False);
213   }
214 }
215 //--------------------------------------------------------------------------------
216 void IntCurve_UserIntConicCurveGen::Perform (const gp_Elips2d& Elips1,
217                                              const IntRes2d_Domain& D1,
218                                              const ThePCurve& C2,
219                                              const IntRes2d_Domain& D2,
220                                              const Standard_Real TolConf,
221                                              const Standard_Real Tol) {
222   this->ResetFields();
223   Standard_Integer NbInterC2 = ThePCurveTool::NbIntervals(C2);  
224   if(NbInterC2 > 1) {
225     Standard_Real ParamInf,ParamSup;
226     Standard_Real D2FirstParam = D2.FirstParameter();
227     Standard_Real D2LastParam  = D2.LastParameter();
228     Standard_Boolean Ok = Standard_True;
229     param1inf = (D1.HasFirstPoint()) ? D1.FirstParameter() : -Precision::Infinite();
230     param1sup = (D1.HasLastPoint()) ?  D1.LastParameter()  : Precision::Infinite();
231     param2inf = ThePCurveTool::FirstParameter(C2);
232     param2sup = ThePCurveTool::LastParameter(C2);
233     IntRes2d_Domain DomainC2NumInter;
234
235     TColStd_Array1OfReal Tab2(1,NbInterC2+1);
236     ThePCurveTool::Intervals(C2,Tab2);    
237
238     for(Standard_Integer NumInterC2=1; Ok && (NumInterC2<=NbInterC2);NumInterC2++) { 
239       ThePCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
240       if((ParamInf > D2LastParam)||(ParamSup < D2FirstParam)) Ok=Standard_False; 
241       else { 
242         if(ParamInf < D2FirstParam) ParamInf = D2FirstParam;
243         if(ParamSup > D2LastParam)  ParamSup = D2LastParam; 
244         if((ParamSup - ParamInf) > RealEpsilon()) { 
245           DomainC2NumInter.SetValues(ThePCurveTool::Value(C2,ParamInf),
246                                      ParamInf,
247                                      D2.FirstTolerance(),
248                                      ThePCurveTool::Value(C2,ParamSup),
249                                      ParamSup,
250                                      D2.LastTolerance());
251           InternalPerform(Elips1,D1,C2,DomainC2NumInter,TolConf,Tol,Standard_True);
252         }
253       }
254     }
255   }
256   else { 
257     InternalPerform(Elips1,D1,C2,D2,TolConf,Tol,Standard_False);
258   }
259 }
260 //--------------------------------------------------------------------------------
261 void IntCurve_UserIntConicCurveGen::Perform (const gp_Hypr2d& Hyper1,
262                                              const IntRes2d_Domain& D1,
263                                              const ThePCurve& C2,
264                                              const IntRes2d_Domain& D2,
265                                              const Standard_Real TolConf,
266                                              const Standard_Real Tol) {
267   this->ResetFields();
268   Standard_Integer NbInterC2 = ThePCurveTool::NbIntervals(C2);  
269   if(NbInterC2 > 1) {
270     Standard_Real ParamInf,ParamSup;
271     Standard_Real D2FirstParam = D2.FirstParameter();
272     Standard_Real D2LastParam  = D2.LastParameter();
273     Standard_Boolean Ok = Standard_True;
274     param1inf = (D1.HasFirstPoint()) ? D1.FirstParameter() : -Precision::Infinite();
275     param1sup = (D1.HasLastPoint()) ?  D1.LastParameter()  : Precision::Infinite();
276     param2inf = ThePCurveTool::FirstParameter(C2);
277     param2sup = ThePCurveTool::LastParameter(C2);
278     IntRes2d_Domain DomainC2NumInter;
279     
280     TColStd_Array1OfReal Tab2(1,NbInterC2+1);
281     ThePCurveTool::Intervals(C2,Tab2);    
282
283     for(Standard_Integer NumInterC2=1; Ok && (NumInterC2<=NbInterC2);NumInterC2++) { 
284       ThePCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
285       if((ParamInf > D2LastParam)||(ParamSup < D2FirstParam)) Ok=Standard_False; 
286       else { 
287         if(ParamInf < D2FirstParam) ParamInf = D2FirstParam;
288         if(ParamSup > D2LastParam)  ParamSup = D2LastParam; 
289         if((ParamSup - ParamInf) > RealEpsilon()) { 
290           DomainC2NumInter.SetValues(ThePCurveTool::Value(C2,ParamInf),
291                                      ParamInf,
292                                      D2.FirstTolerance(),
293                                      ThePCurveTool::Value(C2,ParamSup),
294                                      ParamSup,
295                                      D2.LastTolerance());
296           InternalPerform(Hyper1,D1,C2,DomainC2NumInter,TolConf,Tol,Standard_True);
297         }
298       }
299     }
300   }
301   else { 
302     InternalPerform(Hyper1,D1,C2,D2,TolConf,Tol,Standard_False);
303   }
304 }
305
306 //----------------------------------------------------------------------
307 //-- InternalPerform 
308 //-- Suppose des Courbes Lin...Hypr
309 //-- Si Composite == True 
310 //--     Les Resultats sont Ajoutes 
311 //-- Sinon
312 //--     Les Resultats sont Copies
313 //----------------------------------------------------------------------
314 void IntCurve_UserIntConicCurveGen::InternalPerform (const gp_Lin2d& Lin1,
315                                                      const IntRes2d_Domain& D1,
316                                                      const ThePCurve& C2,
317                                                      const IntRes2d_Domain& D2,
318                                                      const Standard_Real TolConf,
319                                                      const Standard_Real Tol,
320                                                      const Standard_Boolean Composite) {
321
322   GeomAbs_CurveType typ2 = ThePCurveTool::GetType(C2);
323   
324   switch (typ2) {
325     
326   case GeomAbs_Line:
327     {
328       intconiconi.SetReversedParameters(Standard_False);
329       intconiconi.Perform(Lin1,D1,ThePCurveTool::Line(C2),D2,TolConf,Tol);
330       if(Composite)    { this->Append(intconiconi,
331                                       param1inf,
332                                       param1sup,
333                                       param2inf,
334                                       param2sup);  }
335       else             { this->SetValues(intconiconi); }
336     }
337     break;
338     
339   case GeomAbs_Circle:
340     {
341       intconiconi.SetReversedParameters(Standard_False);
342       intconiconi.Perform(Lin1,D1,ThePCurveTool::Circle(C2),D2,TolConf,Tol);
343       if(Composite)    { this->Append(intconiconi,
344                                       param1inf,
345                                       param1sup,
346                                       param2inf,
347                                       param2sup);  }
348       else             { this->SetValues(intconiconi); }
349     }
350     break;
351     
352   case GeomAbs_Ellipse:
353     {
354       intconiconi.SetReversedParameters(Standard_False);
355       intconiconi.Perform(Lin1,D1,ThePCurveTool::Ellipse(C2),D2,TolConf,Tol);
356       if(Composite)    { this->Append(intconiconi,
357                                       param1inf,
358                                       param1sup,
359                                       param2inf,
360                                       param2sup);  }
361       else             { this->SetValues(intconiconi); }
362     }
363     break;
364     
365   case GeomAbs_Parabola:
366     {
367       intconiconi.SetReversedParameters(Standard_False);
368       intconiconi.Perform(Lin1,D1,ThePCurveTool::Parabola(C2),D2,TolConf,Tol);
369       if(Composite)    { this->Append(intconiconi,
370                                       param1inf,
371                                       param1sup,
372                                       param2inf,
373                                       param2sup);  }
374       else             { this->SetValues(intconiconi); }
375     }
376     break;
377     
378   case GeomAbs_Hyperbola:
379     {
380       intconiconi.SetReversedParameters(Standard_False);
381       intconiconi.Perform(Lin1,D1,ThePCurveTool::Hyperbola(C2),D2,TolConf,Tol);
382       if(Composite)    { this->Append(intconiconi,
383                                       param1inf,
384                                       param1sup,
385                                       param2inf,
386                                       param2sup);  }
387       else             { this->SetValues(intconiconi); }
388     }
389     break;
390     
391   default: 
392     {
393       intconicurv.SetReversedParameters(Standard_False);
394       intconicurv.Perform(Lin1,D1,C2,D2,TolConf,Tol);
395       if(Composite)    { this->Append(intconicurv,
396                                       param1inf,
397                                       param1sup,
398                                       param2inf,
399                                       param2sup);  }
400       else             { this->SetValues(intconicurv); }
401     }
402     break;
403   }
404 }
405   
406 //----------------------------------------------------------------------
407 void IntCurve_UserIntConicCurveGen::InternalPerform (const gp_Circ2d& Circ1,
408                                                      const IntRes2d_Domain& D1,
409                                                      const ThePCurve& C2,
410                                                      const IntRes2d_Domain& D2,
411                                                      const Standard_Real TolConf,
412                                                      const Standard_Real Tol,
413                                                      const Standard_Boolean Composite) { 
414
415   GeomAbs_CurveType typ2 = ThePCurveTool::GetType(C2);
416   
417   switch (typ2) {
418     
419   case GeomAbs_Line:
420     {
421       intconiconi.SetReversedParameters(Standard_True);
422       intconiconi.Perform(ThePCurveTool::Line(C2),D2,Circ1,D1,TolConf,Tol);
423       if(Composite)    { this->Append(intconiconi,
424                                       param1inf,
425                                       param1sup,
426                                       param2inf,
427                                       param2sup);  }
428       else             { this->SetValues(intconiconi); }
429     }
430     break;
431     
432   case GeomAbs_Circle:
433     {
434       intconiconi.SetReversedParameters(Standard_False);
435       intconiconi.Perform(Circ1,D1,ThePCurveTool::Circle(C2),D2,TolConf,Tol);
436       if(Composite)    { this->Append(intconiconi,
437                                       param1inf,
438                                       param1sup,
439                                       param2inf,
440                                       param2sup);  }
441       else             { this->SetValues(intconiconi); }
442     }
443     break;
444     
445   case GeomAbs_Ellipse:
446     {
447       intconiconi.SetReversedParameters(Standard_False);
448       intconiconi.Perform(Circ1,D1,ThePCurveTool::Ellipse(C2),D2,TolConf,Tol);
449       if(Composite)    { this->Append(intconiconi,
450                                       param1inf,
451                                       param1sup,
452                                       param2inf,
453                                       param2sup);  }
454       else             { this->SetValues(intconiconi); }
455     }
456     break;
457     
458   case GeomAbs_Parabola:
459     {
460       intconiconi.SetReversedParameters(Standard_False);
461       intconiconi.Perform(Circ1,D1,ThePCurveTool::Parabola(C2),D2,TolConf,Tol);
462       if(Composite)    { this->Append(intconiconi,
463                                       param1inf,
464                                       param1sup,
465                                       param2inf,
466                                       param2sup);  }
467       else             { this->SetValues(intconiconi); }
468     }
469     break;
470     
471   case GeomAbs_Hyperbola:
472     {
473       intconiconi.SetReversedParameters(Standard_False);
474       intconiconi.Perform(Circ1,D1,ThePCurveTool::Hyperbola(C2),D2,TolConf,Tol);
475       if(Composite)    { this->Append(intconiconi,
476                                       param1inf,
477                                       param1sup,
478                                       param2inf,
479                                       param2sup);  }
480       else             { this->SetValues(intconiconi); }
481     }
482     break;
483     
484   default:
485     {
486       intconicurv.SetReversedParameters(Standard_False);
487       intconicurv.Perform(Circ1,D1,C2,D2,TolConf,Tol);
488       if(Composite)    { this->Append(intconicurv,
489                                       param1inf,
490                                       param1sup,
491                                       param2inf,
492                                       param2sup);  }
493       else             { this->SetValues(intconicurv); }
494     }
495     break;  
496   }
497 }
498 //----------------------------------------------------------------------
499 void IntCurve_UserIntConicCurveGen::InternalPerform (const gp_Elips2d& Elips1,
500                                                      const IntRes2d_Domain& D1,
501                                                      const ThePCurve& C2,
502                                                      const IntRes2d_Domain& D2,
503                                                      const Standard_Real TolConf,
504                                                      const Standard_Real Tol,
505                                                      const Standard_Boolean Composite) { 
506   
507   GeomAbs_CurveType typ2 = ThePCurveTool::GetType(C2);
508     
509   switch (typ2) {
510     
511   case GeomAbs_Line:
512     {
513       intconiconi.SetReversedParameters(Standard_True);
514       intconiconi.Perform(ThePCurveTool::Line(C2),D2,Elips1,D1,TolConf,Tol);
515       if(Composite)    { this->Append(intconiconi,
516                                       param1inf,
517                                       param1sup,
518                                       param2inf,
519                                       param2sup);  }
520       else             { this->SetValues(intconiconi); }
521     }
522     break;
523     
524   case GeomAbs_Circle:
525     {
526       intconiconi.SetReversedParameters(Standard_True);
527       intconiconi.Perform(ThePCurveTool::Circle(C2),D2,Elips1,D1,TolConf,Tol);
528       if(Composite)    { this->Append(intconiconi,
529                                       param1inf,
530                                       param1sup,
531                                       param2inf,
532                                       param2sup);  }
533       else             { this->SetValues(intconiconi); }
534     }
535     break;
536     
537   case GeomAbs_Ellipse:
538     {
539       intconiconi.SetReversedParameters(Standard_False);
540       intconiconi.Perform(Elips1,D1,ThePCurveTool::Ellipse(C2),D2,TolConf,Tol);
541       if(Composite)    { this->Append(intconiconi,
542                                       param1inf,
543                                       param1sup,
544                                       param2inf,
545                                       param2sup);  }
546       else             { this->SetValues(intconiconi); }
547     }
548     break;
549     
550   case GeomAbs_Parabola:
551     {
552       intconiconi.SetReversedParameters(Standard_False);
553       intconiconi.Perform(Elips1,D1,ThePCurveTool::Parabola(C2),D2,TolConf,Tol);
554       if(Composite)    { this->Append(intconiconi,
555                                       param1inf,
556                                       param1sup,
557                                       param2inf,
558                                       param2sup);  }
559       else             { this->SetValues(intconiconi); }
560     }
561     break;
562     
563   case GeomAbs_Hyperbola:
564     {
565       intconiconi.SetReversedParameters(Standard_False);
566       intconiconi.Perform(Elips1,D1,ThePCurveTool::Hyperbola(C2),D2,
567                           TolConf,Tol);
568       if(Composite)    { this->Append(intconiconi,
569                                       param1inf,
570                                       param1sup,
571                                       param2inf,
572                                       param2sup);  }
573       else             { this->SetValues(intconiconi); }
574     }
575     break;
576     
577   default:
578     {
579       intconicurv.SetReversedParameters(Standard_False);
580       intconicurv.Perform(Elips1,D1,C2,D2,TolConf,Tol);
581       if(Composite)    { this->Append(intconicurv,
582                                       param1inf,
583                                       param1sup,
584                                       param2inf,
585                                       param2sup);  }
586       else             { this->SetValues(intconicurv); }
587     }
588     break;
589   }
590 }
591
592 //----------------------------------------------------------------------
593 void IntCurve_UserIntConicCurveGen::InternalPerform (const gp_Parab2d& Parab1,
594                                                      const IntRes2d_Domain& D1,
595                                                      const ThePCurve& C2,
596                                                      const IntRes2d_Domain& D2,
597                                                      const Standard_Real TolConf,
598                                                      const Standard_Real Tol,
599                                                      const Standard_Boolean Composite) { 
600
601   GeomAbs_CurveType typ2 = ThePCurveTool::GetType(C2);
602   
603   switch (typ2) {
604     
605   case GeomAbs_Line:
606     {
607       intconiconi.SetReversedParameters(Standard_True);
608       intconiconi.Perform(ThePCurveTool::Line(C2),D2,Parab1,D1,TolConf,Tol);
609       if(Composite)    { this->Append(intconiconi,
610                                       param1inf,
611                                       param1sup,
612                                       param2inf,
613                                       param2sup);  }
614       else             { this->SetValues(intconiconi); }
615     }
616     break;
617     
618   case GeomAbs_Circle:
619     {
620       intconiconi.SetReversedParameters(Standard_True);
621       intconiconi.Perform(ThePCurveTool::Circle(C2),D2,Parab1,D1,TolConf,Tol);
622       if(Composite)    { this->Append(intconiconi,
623                                       param1inf,
624                                       param1sup,
625                                       param2inf,
626                                       param2sup);  }
627       else             { this->SetValues(intconiconi); }
628     }
629     break;
630     
631   case GeomAbs_Ellipse:
632     {
633       intconiconi.SetReversedParameters(Standard_True);
634       intconiconi.Perform(ThePCurveTool::Ellipse(C2),D2,Parab1,D1,TolConf,Tol);
635       if(Composite)    { this->Append(intconiconi,
636                                       param1inf,
637                                       param1sup,
638                                       param2inf,
639                                       param2sup);  }
640       else             { this->SetValues(intconiconi); }
641     }
642     break;
643     
644   case GeomAbs_Parabola:
645     {
646       intconiconi.SetReversedParameters(Standard_False);
647       intconiconi.Perform(Parab1,D1,ThePCurveTool::Parabola(C2),D2,TolConf,Tol);
648       if(Composite)    { this->Append(intconiconi,
649                                       param1inf,
650                                       param1sup,
651                                       param2inf,
652                                       param2sup);  }
653       else             { this->SetValues(intconiconi); }
654     }
655     break;
656     
657   case GeomAbs_Hyperbola:
658     {
659       intconiconi.SetReversedParameters(Standard_False);
660       intconiconi.Perform(Parab1,D1,ThePCurveTool::Hyperbola(C2),D2,TolConf,Tol);
661       if(Composite)    { this->Append(intconiconi,
662                                       param1inf,
663                                       param1sup,
664                                       param2inf,
665                                       param2sup);  }
666       else             { this->SetValues(intconiconi); }
667     }
668     break;
669     
670   default:
671     {
672       intconicurv.SetReversedParameters(Standard_False);
673       intconicurv.Perform(Parab1,D1,C2,D2,TolConf,Tol);
674       if(Composite)    { this->Append(intconicurv,
675                                       param1inf,
676                                       param1sup,
677                                       param2inf,
678                                       param2sup);  }
679       else             { this->SetValues(intconicurv); }
680     }
681     break;
682   }
683 }
684   
685 //----------------------------------------------------------------------
686 void IntCurve_UserIntConicCurveGen::InternalPerform (const gp_Hypr2d& Hyper1,
687                                                      const IntRes2d_Domain& D1,
688                                                      const ThePCurve& C2,
689                                                      const IntRes2d_Domain& D2,
690                                                      const Standard_Real TolConf,
691                                                      const Standard_Real Tol,
692                                                      const Standard_Boolean Composite) { 
693
694   GeomAbs_CurveType typ2 = ThePCurveTool::GetType(C2);
695   
696   switch (typ2) {
697     
698   case GeomAbs_Line:
699     {
700       intconiconi.SetReversedParameters(Standard_True);
701       intconiconi.Perform(ThePCurveTool::Line(C2),D2,Hyper1,D1,TolConf,Tol);
702       if(Composite)    { this->Append(intconiconi,
703                                       param1inf,
704                                       param1sup,
705                                       param2inf,
706                                       param2sup);  }
707       else             { this->SetValues(intconiconi); }
708     }
709     break;
710     
711   case GeomAbs_Circle:
712     {
713       intconiconi.SetReversedParameters(Standard_True);
714       intconiconi.Perform(ThePCurveTool::Circle(C2),D2,Hyper1,D1,TolConf,Tol);
715       if(Composite)    { this->Append(intconiconi,
716                                       param1inf,
717                                       param1sup,
718                                       param2inf,
719                                       param2sup);  }
720       else             { this->SetValues(intconiconi); }
721     }
722     break;
723     
724   case GeomAbs_Ellipse:
725     {
726       intconiconi.SetReversedParameters(Standard_True);
727       intconiconi.Perform(ThePCurveTool::Ellipse(C2),D2,Hyper1,D1,TolConf,Tol);
728       if(Composite)    { this->Append(intconiconi,
729                                       param1inf,
730                                       param1sup,
731                                       param2inf,
732                                       param2sup);  }
733       else             { this->SetValues(intconiconi); }
734     }
735     break;
736     
737   case GeomAbs_Parabola:
738     {
739       intconiconi.SetReversedParameters(Standard_True);
740       intconiconi.Perform(ThePCurveTool::Parabola(C2),D2,Hyper1,D1,TolConf,Tol);
741       if(Composite)    { this->Append(intconiconi,
742                                       param1inf,
743                                       param1sup,
744                                       param2inf,
745                                       param2sup);  }
746       else             { this->SetValues(intconiconi); }
747     }
748     break;
749     
750   case GeomAbs_Hyperbola:
751     {
752       intconiconi.SetReversedParameters(Standard_False);
753       intconiconi.Perform(Hyper1,D1,ThePCurveTool::Hyperbola(C2),D2,TolConf,Tol);
754       if(Composite)    { this->Append(intconiconi,
755                                       param1inf,
756                                       param1sup,
757                                       param2inf,
758                                       param2sup);  }
759       else             { this->SetValues(intconiconi); }
760     }
761     break;
762     
763   default:
764     {
765       intconicurv.SetReversedParameters(Standard_False);
766       intconicurv.Perform(Hyper1,D1,
767                           C2,D2,TolConf,Tol);
768       if(Composite)    { this->Append(intconicurv,
769                                       param1inf,
770                                       param1sup,
771                                       param2inf,
772                                       param2sup);  }
773       else             { this->SetValues(intconicurv); }
774     }
775     break;
776   }
777 }
778 //--------------------------------------------------------------------------------