0024778: Convertation of the generic classes to the non-generic. Part 9
[occt.git] / src / Geom2dGcc / Geom2dGcc_Circ2d3Tan.cxx
1 // Created on: 1992-10-21
2 // Created by: Remi GILET
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 <Geom2dGcc_Circ2d3Tan.ixx>
18 #include <Geom2dAdaptor_Curve.hxx>
19 #include <Geom2d_Line.hxx>
20 #include <Geom2d_Circle.hxx>
21 #include <Geom2dGcc_QCurve.hxx>
22 #include <Geom2dGcc_Circ2d3TanIter.hxx>
23 #include <GccEnt_QualifiedCirc.hxx>
24 #include <GccEnt_QualifiedLin.hxx>
25 #include <StdFail_NotDone.hxx>
26
27 Geom2dGcc_Circ2d3Tan::
28    Geom2dGcc_Circ2d3Tan (const Geom2dGcc_QualifiedCurve& Qualified1 ,
29                          const Geom2dGcc_QualifiedCurve& Qualified2 ,
30                          const Geom2dGcc_QualifiedCurve& Qualified3 ,
31                          const Standard_Real             Tolerance  ,
32                          const Standard_Real             Param1     ,
33                          const Standard_Real             Param2     ,
34                          const Standard_Real             Param3     ):
35   cirsol(1,16)   ,
36   qualifier1(1,16),
37   qualifier2(1,16),
38   qualifier3(1,16),
39   TheSame1(1,16) ,
40   TheSame2(1,16) ,
41   TheSame3(1,16) ,
42   pnttg1sol(1,16),
43   pnttg2sol(1,16),
44   pnttg3sol(1,16),
45   par1sol(1,16)  ,
46   par2sol(1,16)  ,
47   par3sol(1,16)  ,
48   pararg1(1,16)  ,
49   pararg2(1,16)  ,
50   pararg3(1,16)  
51 {
52   Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
53   Geom2dAdaptor_Curve C2 = Qualified2.Qualified();
54   Geom2dAdaptor_Curve C3 = Qualified3.Qualified();
55   Handle(Geom2d_Curve) CC1 = C1.Curve();
56   Handle(Geom2d_Curve) CC2 = C2.Curve();
57   Handle(Geom2d_Curve) CC3 = C3.Curve();
58   GeomAbs_CurveType Type1 = C1.GetType();
59   GeomAbs_CurveType Type2 = C2.GetType();
60   GeomAbs_CurveType Type3 = C3.GetType();
61
62 //=============================================================================
63 //                            Appel a GccAna.                                 +
64 //=============================================================================
65
66   NbrSol = 0;
67   if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle) &&
68       (Type2 == GeomAbs_Line || Type2 == GeomAbs_Circle) &&
69       (Type3 == GeomAbs_Line || Type3 == GeomAbs_Circle)) {
70     if (Type1 == GeomAbs_Circle) {
71       Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
72       gp_Circ2d c1(CCC1->Circ2d());
73       GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,Qualified1.Qualifier());
74       if (Type2 == GeomAbs_Circle) {
75         Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
76         gp_Circ2d c2(CCC2->Circ2d());
77         GccEnt_QualifiedCirc Qc2=GccEnt_QualifiedCirc(c2,
78                                                       Qualified2.Qualifier());
79         if (Type3 == GeomAbs_Circle) {
80           Handle(Geom2d_Circle) CCC3 = Handle(Geom2d_Circle)::DownCast(CC3);
81           gp_Circ2d c3(CCC3->Circ2d());
82           GccEnt_QualifiedCirc Qc3=GccEnt_QualifiedCirc(c3,
83                                                        Qualified3.Qualifier());
84           GccAna_Circ2d3Tan Circ(Qc1,Qc2,Qc3,Tolerance);
85           WellDone = Circ.IsDone();
86           NbrSol = Circ.NbSolutions();
87           for(Standard_Integer i=1; i<=NbrSol; i++) {
88             Circ.WhichQualifier(i,qualifier1(i),
89                                    qualifier2(i),qualifier3(i));
90           }
91           Results(Circ,1,2,3);
92         }
93         else {
94           Handle(Geom2d_Line) LL3 = Handle(Geom2d_Line)::DownCast(CC3);
95           gp_Lin2d l3(LL3->Lin2d());
96           GccEnt_QualifiedLin Ql3=GccEnt_QualifiedLin(l3,
97                                                       Qualified3.Qualifier());
98           GccAna_Circ2d3Tan Circ(Qc1,Qc2,Ql3,Tolerance);
99           WellDone = Circ.IsDone();
100           NbrSol = Circ.NbSolutions();
101           for(Standard_Integer i=1; i<=NbrSol; i++) {
102             Circ.WhichQualifier(i,qualifier1(i),
103                                    qualifier2(i),qualifier3(i));
104           }
105           Results(Circ,1,2,3);
106         }
107       }
108       else {
109         Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
110         gp_Lin2d l2(LL2->Lin2d());
111         GccEnt_QualifiedLin Ql2(l2,Qualified2.Qualifier());
112         if (Type3 == GeomAbs_Circle) {
113           Handle(Geom2d_Circle) CCC3 = Handle(Geom2d_Circle)::DownCast(CC3);
114           gp_Circ2d c3(CCC3->Circ2d());
115           GccEnt_QualifiedCirc Qc3(c3,Qualified3.Qualifier());
116           GccAna_Circ2d3Tan Circ(Qc1,Qc3,Ql2,Tolerance);
117           WellDone = Circ.IsDone();
118           NbrSol = Circ.NbSolutions();
119           for(Standard_Integer i=1; i<=NbrSol; i++) {
120             Circ.WhichQualifier(i,qualifier1(i),
121                                    qualifier3(i),qualifier2(i));
122           }
123           Results(Circ,1,3,2);
124         }
125         else {
126           Handle(Geom2d_Line) LL3 = Handle(Geom2d_Line)::DownCast(CC3);
127           gp_Lin2d l3(LL3->Lin2d());
128           GccEnt_QualifiedLin Ql3=GccEnt_QualifiedLin(l3,
129                                                       Qualified3.Qualifier());
130           GccAna_Circ2d3Tan Circ(Qc1,Ql2,Ql3,Tolerance);
131           WellDone = Circ.IsDone();
132           NbrSol = Circ.NbSolutions();
133           for(Standard_Integer i=1; i<=NbrSol; i++) {
134             Circ.WhichQualifier(i,qualifier1(i),
135                                    qualifier2(i),qualifier3(i));
136           }
137           Results(Circ,1,2,3);
138         }
139       }
140     }
141     else {
142       Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
143       gp_Lin2d l1(LL1->Lin2d());
144       GccEnt_QualifiedLin Ql1=GccEnt_QualifiedLin(l1,Qualified1.Qualifier());
145       if (Type2 == GeomAbs_Circle) {
146         Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
147         gp_Circ2d c2(CCC2->Circ2d());
148         GccEnt_QualifiedCirc Qc2=GccEnt_QualifiedCirc(c2,
149                                                       Qualified2.Qualifier());
150         if (Type3 == GeomAbs_Circle) {
151           Handle(Geom2d_Circle) CCC3 = Handle(Geom2d_Circle)::DownCast(CC3);
152           gp_Circ2d c3(CCC3->Circ2d());
153           GccEnt_QualifiedCirc Qc3=GccEnt_QualifiedCirc(c3,
154                                                        Qualified3.Qualifier());
155           GccAna_Circ2d3Tan Circ(Qc2,Qc3,Ql1,Tolerance);
156           WellDone = Circ.IsDone();
157           NbrSol = Circ.NbSolutions();
158           for(Standard_Integer i=1; i<=NbrSol; i++) {
159             Circ.WhichQualifier(i,qualifier3(i),
160                                    qualifier1(i),qualifier2(i));
161           }
162           Results(Circ,3,1,2);
163         }
164         else {
165           Handle(Geom2d_Line) LL3 = Handle(Geom2d_Line)::DownCast(CC3);
166           gp_Lin2d l3(LL3->Lin2d());
167           GccEnt_QualifiedLin Ql3=GccEnt_QualifiedLin(l3,
168                                                       Qualified3.Qualifier());
169           GccAna_Circ2d3Tan Circ(Qc2,Ql1,Ql3,Tolerance);
170           WellDone = Circ.IsDone();
171           NbrSol = Circ.NbSolutions();
172           for(Standard_Integer i=1; i<=NbrSol; i++) {
173             Circ.WhichQualifier(i,qualifier2(i),
174                                    qualifier1(i),qualifier3(i));
175           }
176           Results(Circ,2,1,3);
177         }
178       }
179       else {
180         Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
181         gp_Lin2d l2(LL2->Lin2d());
182         GccEnt_QualifiedLin Ql2=GccEnt_QualifiedLin(l2,Qualified2.Qualifier());
183         if (Type3 == GeomAbs_Circle) {
184           Handle(Geom2d_Circle) CCC3 = Handle(Geom2d_Circle)::DownCast(CC3);
185           gp_Circ2d c3(CCC3->Circ2d());
186           GccEnt_QualifiedCirc Qc3=GccEnt_QualifiedCirc(c3,
187                                                        Qualified3.Qualifier());
188           GccAna_Circ2d3Tan Circ(Qc3,Ql2,Ql1,Tolerance);
189           WellDone = Circ.IsDone();
190           NbrSol = Circ.NbSolutions();
191           for(Standard_Integer i=1; i<=NbrSol; i++) {
192             Circ.WhichQualifier(i,qualifier3(i),
193                                    qualifier2(i),qualifier1(i));
194           }
195           Results(Circ,3,2,1);
196         }
197         else {
198           Handle(Geom2d_Line) LL3 = Handle(Geom2d_Line)::DownCast(CC3);
199           gp_Lin2d l3(LL3->Lin2d());
200           GccEnt_QualifiedLin Ql3=GccEnt_QualifiedLin(l3,
201                                                       Qualified3.Qualifier());
202           GccAna_Circ2d3Tan Circ(Ql1,Ql2,Ql3,Tolerance);
203           WellDone = Circ.IsDone();
204           NbrSol = Circ.NbSolutions();
205           for(Standard_Integer i=1; i<=NbrSol; i++) {
206             Circ.WhichQualifier(i,qualifier1(i),
207                                    qualifier2(i),qualifier3(i));
208           }
209           Results(Circ,1,2,3);
210         }
211       }
212     }
213   }
214   else {
215     Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
216     Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
217     Geom2dGcc_QCurve Qc3(C3,Qualified3.Qualifier());
218     Geom2dGcc_Circ2d3TanIter Circ(Qc1,Qc2,Qc3,Param1,Param2,Param3,Tolerance);
219     WellDone = Circ.IsDone();
220     NbrSol = 1;
221     if (WellDone) {
222       cirsol(1)   = Circ.ThisSolution();
223       if (Circ.IsTheSame1()) { TheSame1(1) = 1; }
224       else {TheSame1(1) = 0; }
225       if (Circ.IsTheSame2()) { TheSame2(1) = 1; }
226       else {TheSame2(1) = 0; }
227       if (Circ.IsTheSame3()) { TheSame3(1) = 1; }
228       else {TheSame3(1) = 0; }
229       Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
230       Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
231       Circ.Tangency3(par3sol(1),pararg3(1),pnttg3sol(1));
232       Circ.WhichQualifier(qualifier1(1),qualifier2(1),qualifier3(1));
233     }
234   }
235 }
236
237 Geom2dGcc_Circ2d3Tan::
238    Geom2dGcc_Circ2d3Tan (const Geom2dGcc_QualifiedCurve& Qualified1 ,
239                          const Geom2dGcc_QualifiedCurve& Qualified2 ,
240                          const Handle(Geom2d_Point)&     Point      ,
241                          const Standard_Real             Tolerance  ,
242                          const Standard_Real             Param1     ,
243                          const Standard_Real             Param2     ):
244   cirsol(1,16)   ,
245   qualifier1(1,16),
246   qualifier2(1,16),
247   qualifier3(1,16),
248   TheSame1(1,16) ,
249   TheSame2(1,16) ,
250   TheSame3(1,16) ,
251   pnttg1sol(1,16),
252   pnttg2sol(1,16),
253   pnttg3sol(1,16),
254   par1sol(1,16)  ,
255   par2sol(1,16)  ,
256   par3sol(1,16)  ,
257   pararg1(1,16)  ,
258   pararg2(1,16)  ,
259   pararg3(1,16)  
260 {
261   Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
262   Geom2dAdaptor_Curve C2 = Qualified2.Qualified();
263   Handle(Geom2d_Curve) CC1 = C1.Curve();
264   Handle(Geom2d_Curve) CC2 = C2.Curve();
265   GeomAbs_CurveType Type1 = C1.GetType();
266   GeomAbs_CurveType Type2 = C2.GetType();
267
268 //=============================================================================
269 //                            Appel a GccAna.                                 +
270 //=============================================================================
271
272   NbrSol = 0;
273   if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle) &&
274       (Type2 == GeomAbs_Line || Type2 == GeomAbs_Circle)) {
275     if (Type1 == GeomAbs_Circle) {
276       Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
277       gp_Circ2d c1(CCC1->Circ2d());
278       GccEnt_QualifiedCirc Qc1(c1,Qualified1.Qualifier());
279       if (Type2 == GeomAbs_Circle) {
280         Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
281         gp_Circ2d c2(CCC2->Circ2d());
282         GccEnt_QualifiedCirc Qc2(c2,Qualified2.Qualifier());
283         GccAna_Circ2d3Tan Circ(Qc1,Qc2,Point->Pnt2d(),Tolerance);
284         WellDone = Circ.IsDone();
285         NbrSol = Circ.NbSolutions();
286         for(Standard_Integer i=1; i<=NbrSol; i++) {
287           Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i));
288         }
289         Results(Circ,1,2,3);
290       }
291       else {
292         Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
293         gp_Lin2d l2(LL2->Lin2d());
294         GccEnt_QualifiedLin Ql2(l2,Qualified2.Qualifier());
295         GccAna_Circ2d3Tan Circ(Qc1,Ql2,Point->Pnt2d(),Tolerance);
296         WellDone = Circ.IsDone();
297         NbrSol = Circ.NbSolutions();
298         for(Standard_Integer i=1; i<=NbrSol; i++) {
299           Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i));
300         }
301         Results(Circ,1,2,3);
302       }
303     }
304     else {
305       Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
306       gp_Lin2d l1(LL1->Lin2d());
307       GccEnt_QualifiedLin Ql1(l1,Qualified1.Qualifier());
308       if (Type2 == GeomAbs_Circle) {
309         Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
310         gp_Circ2d c2(CCC2->Circ2d());
311         GccEnt_QualifiedCirc Qc2(c2,Qualified2.Qualifier());
312         GccAna_Circ2d3Tan Circ(Qc2,Ql1,Point->Pnt2d(),Tolerance);
313         WellDone = Circ.IsDone();
314         NbrSol = Circ.NbSolutions();
315         for(Standard_Integer i=1; i<=NbrSol; i++) {
316           Circ.WhichQualifier(i,qualifier2(i),qualifier1(i),qualifier3(i));
317         }
318         Results(Circ,2,1,3);
319       }
320       else {
321         Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
322         gp_Lin2d l2(LL2->Lin2d());
323         GccEnt_QualifiedLin Ql2(l2,Qualified2.Qualifier());
324         GccAna_Circ2d3Tan Circ(Ql1,Ql2,Point->Pnt2d(),Tolerance);
325         WellDone = Circ.IsDone();
326         NbrSol = Circ.NbSolutions();
327         for(Standard_Integer i=1; i<=NbrSol; i++) {
328           Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i));
329         }
330         Results(Circ,1,2,3);
331       }
332     }
333   }
334   else {
335     Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
336     Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
337     Geom2dGcc_Circ2d3TanIter Circ(Qc1,Qc2,Point->Pnt2d(),Param1,Param2,Tolerance);
338     WellDone = Circ.IsDone();
339     NbrSol = 1;
340     if (WellDone) {
341       cirsol(1)   = Circ.ThisSolution();
342       if (Circ.IsTheSame1()) { TheSame1(1) = 1; }
343       else {TheSame1(1) = 0; }
344       if (Circ.IsTheSame2()) { TheSame2(1) = 1; }
345       else {TheSame2(1) = 0; }
346       if (Circ.IsTheSame3()) { TheSame3(1) = 1; }
347       else {TheSame3(1) = 0; }
348       Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
349       Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
350       Circ.Tangency3(par3sol(1),pararg3(1),pnttg3sol(1));
351       Circ.WhichQualifier(qualifier1(1),qualifier2(1),qualifier3(1));
352     }
353   }
354 }
355
356 Geom2dGcc_Circ2d3Tan::
357    Geom2dGcc_Circ2d3Tan (const Geom2dGcc_QualifiedCurve& Qualified1 ,
358                          const Handle(Geom2d_Point)&     Point1     ,
359                          const Handle(Geom2d_Point)&     Point2     ,
360                          const Standard_Real             Tolerance  ,
361                          const Standard_Real             Param1     ):
362   cirsol(1,16)   ,
363   qualifier1(1,16),
364   qualifier2(1,16),
365   qualifier3(1,16),
366   TheSame1(1,16) ,
367   TheSame2(1,16) ,
368   TheSame3(1,16) ,
369   pnttg1sol(1,16),
370   pnttg2sol(1,16),
371   pnttg3sol(1,16),
372   par1sol(1,16)  ,
373   par2sol(1,16)  ,
374   par3sol(1,16)  ,
375   pararg1(1,16)  ,
376   pararg2(1,16)  ,
377   pararg3(1,16)  
378 {
379   Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
380   Handle(Geom2d_Curve) CC1 = C1.Curve();
381   GeomAbs_CurveType Type1 = C1.GetType();
382
383 //=============================================================================
384 //                            Appel a GccAna.                                 +
385 //=============================================================================
386
387   NbrSol = 0;
388   if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle)) {
389     if (Type1 == GeomAbs_Circle) {
390       Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
391       gp_Circ2d c1(CCC1->Circ2d());
392       GccEnt_QualifiedCirc Qc1(c1,Qualified1.Qualifier());
393       GccAna_Circ2d3Tan Circ(Qc1,Point1->Pnt2d(),Point2->Pnt2d(),Tolerance);
394       WellDone = Circ.IsDone();
395       NbrSol = Circ.NbSolutions();
396       for(Standard_Integer i=1; i<=NbrSol; i++) {
397         Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i));
398       }
399       Results(Circ,1,2,3);
400     }
401     else {
402       Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
403       gp_Lin2d l1(LL1->Lin2d());
404       GccEnt_QualifiedLin Ql1(l1,Qualified1.Qualifier());
405       GccAna_Circ2d3Tan Circ(Ql1,Point1->Pnt2d(),Point2->Pnt2d(),Tolerance);
406       WellDone = Circ.IsDone();
407       NbrSol = Circ.NbSolutions();
408       for(Standard_Integer i=1; i<=NbrSol; i++) {
409         Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i));
410       }
411       Results(Circ,1,2,3);
412     }
413   }
414   else {
415     Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
416     Geom2dGcc_Circ2d3TanIter Circ(Qc1,Point1->Pnt2d(),Point2->Pnt2d(),
417                              Param1,Tolerance);
418     WellDone = Circ.IsDone();
419     NbrSol = 1;
420     if (WellDone) {
421       cirsol(1)   = Circ.ThisSolution();
422       if (Circ.IsTheSame1()) { TheSame1(1) = 1; }
423       else {TheSame1(1) = 0; }
424       if (Circ.IsTheSame2()) { TheSame2(1) = 1; }
425       else {TheSame2(1) = 0; }
426       if (Circ.IsTheSame3()) { TheSame3(1) = 1; }
427       else {TheSame3(1) = 0; }
428       Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
429       Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
430       Circ.Tangency3(par3sol(1),pararg3(1),pnttg3sol(1));
431       Circ.WhichQualifier(qualifier1(1),qualifier2(1),qualifier3(1));
432     }
433   }
434 }
435
436 Geom2dGcc_Circ2d3Tan::
437    Geom2dGcc_Circ2d3Tan (const Handle(Geom2d_Point)&     Point1     ,
438                          const Handle(Geom2d_Point)&     Point2     ,
439                          const Handle(Geom2d_Point)&     Point3     ,
440                          const Standard_Real             Tolerance  ):
441   cirsol(1,2)   ,
442   qualifier1(1,2),
443   qualifier2(1,2),
444   qualifier3(1,2),
445   TheSame1(1,2) ,
446   TheSame2(1,2) ,
447   TheSame3(1,2) ,
448   pnttg1sol(1,2),
449   pnttg2sol(1,2),
450   pnttg3sol(1,2),
451   par1sol(1,2)  ,
452   par2sol(1,2)  ,
453   par3sol(1,2)  ,
454   pararg1(1,2)  ,
455   pararg2(1,2)  ,
456   pararg3(1,2)  
457 {
458
459 //=============================================================================
460 //                            Appel a GccAna.                                 +
461 //=============================================================================
462
463   NbrSol = 0;
464   GccAna_Circ2d3Tan Circ(Point1->Pnt2d(),Point2->Pnt2d(),Point3->Pnt2d(),
465                          Tolerance);
466   WellDone = Circ.IsDone();
467   NbrSol = Circ.NbSolutions();
468   for(Standard_Integer i=1; i<=NbrSol; i++) {
469     Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i));
470   }
471   Results(Circ,1,2,3);
472 }
473
474
475 void Geom2dGcc_Circ2d3Tan::Results(const GccAna_Circ2d3Tan& Circ ,
476                                    const Standard_Integer   Rank1,
477                                    const Standard_Integer   Rank2,
478                                    const Standard_Integer   Rank3)
479 {
480   for (Standard_Integer j = 1; j <= NbrSol; j++) {
481     cirsol(j)   = Circ.ThisSolution(j);
482     Standard_Integer i1 = 0, i2 = 0, i3 = 0;
483     if (Circ.IsTheSame1(j)) { i1 = 1; }
484     if (Circ.IsTheSame2(j)) { i2 = 1; }
485     if (Circ.IsTheSame3(j)) { i3 = 1; }    
486     if (Rank1 == 1) { 
487       TheSame1(j) = i1; 
488       if ( i1 == 0)
489         Circ.Tangency1(j,par1sol(j),pararg1(j),pnttg1sol(j));
490     }
491     else if (Rank1 == 2) { 
492       TheSame1(j) = i2; 
493       if ( i2 == 0)
494         Circ.Tangency2(j,par1sol(j),pararg1(j),pnttg1sol(j));
495     }
496     else if (Rank1 == 3) { 
497       TheSame1(j) = i3; 
498       if ( i3 == 0)
499         Circ.Tangency3(j,par1sol(j),pararg1(j),pnttg1sol(j));
500     }
501     if (Rank2 == 1) { 
502       TheSame2(j) = i1; 
503       if ( i1 == 0)
504         Circ.Tangency1(j,par2sol(j),pararg2(j),pnttg2sol(j));
505     }
506     else if (Rank2 == 2) { 
507       TheSame2(j) = i2; 
508       if ( i2 == 0)
509         Circ.Tangency2(j,par2sol(j),pararg2(j),pnttg2sol(j));
510     }
511     else if (Rank2 == 3) { 
512       TheSame2(j) = i3; 
513       if ( i3 == 0)
514         Circ.Tangency3(j,par2sol(j),pararg2(j),pnttg2sol(j));
515     }
516     if (Rank3 == 1) { 
517       TheSame3(j) = i1; 
518       if ( i1 == 0)
519         Circ.Tangency1(j,par3sol(j),pararg3(j),pnttg3sol(j));
520     }
521     else if (Rank3 == 2) { 
522       TheSame3(j) = i2; 
523       if ( i2 == 0)
524         Circ.Tangency2(j,par3sol(j),pararg3(j),pnttg3sol(j));
525     }
526     else if (Rank3 == 3) { 
527       TheSame3(j) = i3; 
528       if ( i3 == 0)
529         Circ.Tangency3(j,par3sol(j),pararg3(j),pnttg3sol(j));
530     }
531   }
532 }
533
534 Standard_Boolean Geom2dGcc_Circ2d3Tan::
535    IsDone () const { return WellDone; }
536
537 Standard_Integer Geom2dGcc_Circ2d3Tan::
538   NbSolutions () const 
539
540   return (Standard_Integer ) NbrSol;
541 }
542
543 gp_Circ2d Geom2dGcc_Circ2d3Tan::
544   ThisSolution (const Standard_Integer Index) const 
545 {
546   if (!WellDone) { StdFail_NotDone::Raise(); }
547   if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
548   return cirsol(Index); 
549 }
550
551 void Geom2dGcc_Circ2d3Tan::
552   WhichQualifier (const Standard_Integer Index   ,
553                         GccEnt_Position& Qualif1 ,
554                         GccEnt_Position& Qualif2 ,
555                         GccEnt_Position& Qualif3) const
556 {
557   if (!WellDone) { StdFail_NotDone::Raise(); }
558   else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
559   else {
560     Qualif1 = qualifier1(Index);
561     Qualif2 = qualifier2(Index);
562     Qualif3 = qualifier3(Index);
563   }
564 }
565
566 void Geom2dGcc_Circ2d3Tan::
567   Tangency1 (const Standard_Integer Index,
568                    Standard_Real&   ParSol,
569                    Standard_Real&   ParArg,
570                    gp_Pnt2d&        PntSol) const
571 {
572   if (!WellDone) { StdFail_NotDone::Raise(); }
573   else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
574   else {
575     if (TheSame1(Index) == 0) {
576       ParSol = par1sol(Index);
577       ParArg = pararg1(Index);
578       PntSol = pnttg1sol(Index);
579     }
580     else { StdFail_NotDone::Raise(); }
581   }
582 }
583
584 void Geom2dGcc_Circ2d3Tan::
585    Tangency2 (const Standard_Integer Index,
586               Standard_Real& ParSol,
587               Standard_Real& ParArg,
588               gp_Pnt2d& PntSol) const
589 {
590   if (!WellDone) { StdFail_NotDone::Raise(); }
591   else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
592   else {
593     if (TheSame2(Index) == 0) {
594       ParSol = par2sol(Index);
595       ParArg = pararg2(Index);
596       PntSol = pnttg2sol(Index);
597     }
598     else { StdFail_NotDone::Raise(); }
599   }
600 }
601
602 void Geom2dGcc_Circ2d3Tan::
603    Tangency3 (const Standard_Integer Index,
604               Standard_Real& ParSol,
605               Standard_Real& ParArg,
606               gp_Pnt2d& PntSol) const
607 {
608   if (!WellDone) { StdFail_NotDone::Raise(); }
609   else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
610   else {
611     if (TheSame3(Index) == 0) {
612       ParSol = par3sol(Index);
613       ParArg = pararg3(Index);
614       PntSol = pnttg3sol(Index);
615     }
616     else { StdFail_NotDone::Raise(); }
617   }
618 }
619
620 Standard_Boolean Geom2dGcc_Circ2d3Tan::IsTheSame1 (const Standard_Integer Index) const
621 {
622   if (!WellDone) { StdFail_NotDone::Raise(); }
623   if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
624   if (TheSame1(Index) == 0) { return Standard_False; }
625   return Standard_True; 
626 }
627
628 Standard_Boolean Geom2dGcc_Circ2d3Tan::
629    IsTheSame2 (const Standard_Integer Index) const
630 {
631   if (!WellDone) { StdFail_NotDone::Raise(); }
632   if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
633   if (TheSame2(Index) == 0) { return Standard_False; }
634   return Standard_True;
635 }
636
637 Standard_Boolean Geom2dGcc_Circ2d3Tan::
638    IsTheSame3 (const Standard_Integer Index) const
639 {
640   if (!WellDone) { StdFail_NotDone::Raise(); }
641   if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
642   if (TheSame3(Index) == 0) { return Standard_False; }
643   return Standard_True; 
644 }
645
646
647