0031035: Coding - uninitialized class fields reported by Visual Studio Code Analysis
[occt.git] / src / Geom2dGcc / Geom2dGcc_Circ2d3TanIter.cxx
1 // Created on: 1991-12-13
2 // Created by: Remi GILET
3 // Copyright (c) 1991-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 //=========================================================================
18 //   Creation d un cercle tangent a deux elements : Droite.               +
19 //                                                  Cercle.               +
20 //                                                  Point.                +
21 //                                                  Courbes.              +
22 //                        centre sur un troisieme : Droite.               +
23 //                                                  Cercle.               +
24 //                                                  Courbes.              +
25 //=========================================================================
26
27 #include <GccAna_Circ2d3Tan.hxx>
28 #include <GccEnt_BadQualifier.hxx>
29 #include <GccEnt_QualifiedCirc.hxx>
30 #include <GccEnt_QualifiedLin.hxx>
31 #include <Geom2dGcc_Circ2d3TanIter.hxx>
32 #include <Geom2dGcc_CurveTool.hxx>
33 #include <Geom2dGcc_FunctionTanCuCuCu.hxx>
34 #include <Geom2dGcc_QCurve.hxx>
35 #include <gp.hxx>
36 #include <gp_Ax2d.hxx>
37 #include <gp_Circ2d.hxx>
38 #include <gp_Dir2d.hxx>
39 #include <gp_Pnt2d.hxx>
40 #include <gp_Vec2d.hxx>
41 #include <math_FunctionSetRoot.hxx>
42 #include <math_NewtonFunctionSetRoot.hxx>
43 #include <StdFail_NotDone.hxx>
44
45 Geom2dGcc_Circ2d3TanIter::
46 Geom2dGcc_Circ2d3TanIter (const Geom2dGcc_QCurve& Qualified1 , 
47                           const Geom2dGcc_QCurve& Qualified2 ,
48                           const Geom2dGcc_QCurve& Qualified3 , 
49                           const Standard_Real      Param1     ,
50                           const Standard_Real      Param2     ,
51                           const Standard_Real      Param3     ,
52                           const Standard_Real      Tolerance  ) {
53
54                             TheSame1 = Standard_False;
55                             TheSame2 = Standard_False;
56                             TheSame3 = Standard_False;
57                             par1sol = 0.;
58                             par2sol = 0.;
59                             par3sol = 0.;
60                             pararg1 = 0.;
61                             pararg2 = 0.;
62                             pararg3 = 0.;
63
64                             Standard_Real Tol = Abs(Tolerance);
65                             WellDone = Standard_False;
66                             qualifier1 = GccEnt_noqualifier;
67                             qualifier2 = GccEnt_noqualifier;
68                             qualifier3 = GccEnt_noqualifier;
69                             if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() || 
70                               Qualified1.IsOutside() || Qualified1.IsUnqualified()) ||
71                               !(Qualified2.IsEnclosed() || Qualified2.IsEnclosing() || 
72                               Qualified2.IsOutside() || Qualified2.IsUnqualified()) ||
73                               !(Qualified3.IsEnclosed() || Qualified3.IsEnclosing() || 
74                               Qualified3.IsOutside() || Qualified3.IsUnqualified())) {
75                                 throw GccEnt_BadQualifier();
76                                 return;
77                             }
78                             Geom2dAdaptor_Curve Cu1 = Qualified1.Qualified();
79                             Geom2dAdaptor_Curve Cu2 = Qualified2.Qualified();
80                             Geom2dAdaptor_Curve Cu3 = Qualified3.Qualified();
81                             Geom2dGcc_FunctionTanCuCuCu Func(Cu1,Cu2,Cu3);
82                             math_Vector Umin(1,3);
83                             math_Vector Umax(1,3);
84                             math_Vector Ufirst(1,3);
85                             math_Vector tol(1,3);
86                             Umin(1) = Geom2dGcc_CurveTool::FirstParameter(Cu1);
87                             Umin(2) = Geom2dGcc_CurveTool::FirstParameter(Cu2);
88                             Umin(3) = Geom2dGcc_CurveTool::FirstParameter(Cu3);
89                             Umax(1) = Geom2dGcc_CurveTool::LastParameter(Cu1);
90                             Umax(2) = Geom2dGcc_CurveTool::LastParameter(Cu2);
91                             Umax(3) = Geom2dGcc_CurveTool::LastParameter(Cu3);
92                             Ufirst(1) = Param1;
93                             Ufirst(2) = Param2;
94                             Ufirst(3) = Param3;
95                             tol(1) = Geom2dGcc_CurveTool::EpsX(Cu1,Abs(Tolerance));
96                             tol(2) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolerance));
97                             tol(3) = Geom2dGcc_CurveTool::EpsX(Cu3,Abs(Tolerance));   
98                             math_FunctionSetRoot Root(Func, tol);
99                             Root.Perform(Func, Ufirst, Umin, Umax);
100                             if (Root.IsDone()) {
101                               Root.Root(Ufirst);
102                               Func.Value(Ufirst,Umin);
103                               gp_Pnt2d point1,point2,point3;
104                               gp_Vec2d Tan1,Tan2,Tan3;
105                               Geom2dGcc_CurveTool::D1(Cu1,Ufirst(1),point1,Tan1);
106                               Geom2dGcc_CurveTool::D1(Cu2,Ufirst(2),point2,Tan2);
107                               Geom2dGcc_CurveTool::D1(Cu3,Ufirst(3),point3,Tan3);
108                               GccAna_Circ2d3Tan circ(point1,point2,point3,Tol);
109                               if (circ.IsDone()) { 
110                                 cirsol = circ.ThisSolution(1);
111                                 gp_Pnt2d centre = cirsol.Location();
112                                 Standard_Real normetan1 = Tan1.Magnitude();
113                                 Standard_Real normetan2 = Tan2.Magnitude();
114                                 Standard_Real normetan3 = Tan3.Magnitude();
115                                 gp_Vec2d Vec1(point1,centre);
116                                 gp_Vec2d Vec2(point2,centre);
117                                 gp_Vec2d Vec3(point3,centre);
118                                 Standard_Real normevec1 = Vec1.Magnitude();
119                                 Standard_Real normevec2 = Vec2.Magnitude();
120                                 Standard_Real normevec3 = Vec3.Magnitude();
121                                 Standard_Real dot1,dot2,dot3;
122                                 if (normevec1 >= gp::Resolution() && normetan1 >= gp::Resolution()) {
123                                   dot1 = Vec1.Dot(Tan1)/(normevec1*normetan1);
124                                 }
125                                 else { dot1 = 0.; }
126                                 if (normevec2 >= gp::Resolution() && normetan2 >= gp::Resolution()) {
127                                   dot2 = Vec2.Dot(Tan2)/(normevec2*normetan2);
128                                 }
129                                 else { dot2 = 0.; }
130                                 if (normevec3 >= gp::Resolution() && normetan3 >= gp::Resolution()) {
131                                   dot3 = Vec3.Dot(Tan3)/(normevec3*normetan3);
132                                 }
133                                 else { dot3 = 0.; }
134                                 Tol = 1.e-12;
135                                 if (dot1 <= Tol && dot2 <=Tol && dot3 <= Tol) {
136                                   Standard_Real Angle1 = Vec1.Angle(Tan1);
137                                   if (Qualified1.IsUnqualified()||
138                                     (Qualified1.IsEnclosing()&&Angle1<=0.)||
139                                     (Qualified1.IsOutside() && Angle1 >= 0.) ||
140                                     (Qualified1.IsEnclosed() && Angle1 <= 0.)) {
141                                       Angle1 = Vec2.Angle(Tan2);
142                                       if (Qualified2.IsUnqualified() || 
143                                         (Qualified2.IsEnclosing()&&Angle1<=0.)||
144                                         (Qualified2.IsOutside() && Angle1 >= 0) ||
145                                         (Qualified2.IsEnclosed() && Angle1 <= 0.)) {
146                                           Angle1 = Vec3.Angle(Tan3);
147                                           if (Qualified3.IsUnqualified() || 
148                                             (Qualified3.IsEnclosing()&&Angle1<=0.)||
149                                             (Qualified3.IsOutside() && Angle1 >= 0) ||
150                                             (Qualified3.IsEnclosed() && Angle1 <= 0.)) {
151                                               qualifier1 = Qualified1.Qualifier();
152                                               qualifier2 = Qualified2.Qualifier();
153                                               qualifier3 = Qualified3.Qualifier();
154                                               pararg1 = Ufirst(1);
155                                               par1sol = 0.;
156                                               pnttg1sol = point1;
157                                               pararg2 = Ufirst(2);
158                                               pnttg2sol = point2;
159                                               par2sol = pnttg2sol.Distance(pnttg1sol);
160                                               pnttg3sol = point3;
161                                               pararg3 = Ufirst(3);
162                                               par3sol = pnttg3sol.Distance(pnttg1sol);
163                                               WellDone = Standard_True;
164                                           }
165                                       }
166                                   }
167                                 }
168                               }
169                             }
170 }
171
172 Geom2dGcc_Circ2d3TanIter::
173 Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedCirc& Qualified1 , 
174                           const Geom2dGcc_QCurve& Qualified2 ,
175                           const Geom2dGcc_QCurve& Qualified3 , 
176                           const Standard_Real      Param1     ,
177                           const Standard_Real      Param2     ,
178                           const Standard_Real      Param3     ,
179                           const Standard_Real      Tolerance     ) {
180
181                             TheSame1 = Standard_False;
182                             TheSame2 = Standard_False;
183                             TheSame3 = Standard_False;
184                             par1sol = 0.;
185                             par2sol = 0.;
186                             par3sol = 0.;
187                             pararg1 = 0.;
188                             pararg2 = 0.;
189                             pararg3 = 0.;
190
191                             Standard_Real Tol = Abs(Tolerance);
192                             WellDone = Standard_False;
193                             qualifier1 = GccEnt_noqualifier;
194                             qualifier2 = GccEnt_noqualifier;
195                             qualifier3 = GccEnt_noqualifier;
196                             if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() || 
197                               Qualified1.IsOutside() || Qualified1.IsUnqualified()) ||
198                               !(Qualified2.IsEnclosed() || Qualified2.IsEnclosing() || 
199                               Qualified2.IsOutside() || Qualified2.IsUnqualified()) ||
200                               !(Qualified3.IsEnclosed() || Qualified3.IsEnclosing() || 
201                               Qualified3.IsOutside() || Qualified3.IsUnqualified())) {
202                                 throw GccEnt_BadQualifier();
203                                 return;
204                             }
205                             gp_Circ2d C1 = Qualified1.Qualified();
206                             Geom2dAdaptor_Curve Cu2 = Qualified2.Qualified();
207                             Geom2dAdaptor_Curve Cu3 = Qualified3.Qualified();
208                             Geom2dGcc_FunctionTanCuCuCu Func(C1,Cu2,Cu3);
209                             math_Vector Umin(1,3);
210                             math_Vector Umax(1,3);
211                             math_Vector Ufirst(1,3);
212                             math_Vector tol(1,3);
213                             Umin(1) = 0.;
214                             Umin(2) = Geom2dGcc_CurveTool::FirstParameter(Cu2);
215                             Umin(3) = Geom2dGcc_CurveTool::FirstParameter(Cu3);
216                             Umax(1) = 2*M_PI;
217                             Umax(2) = Geom2dGcc_CurveTool::LastParameter(Cu2);
218                             Umax(3) = Geom2dGcc_CurveTool::LastParameter(Cu3);
219                             Ufirst(1) = Param1;
220                             Ufirst(2) = Param2;
221                             Ufirst(3) = Param3;
222                             tol(1) = 2.e-15*M_PI;
223                             tol(2) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolerance));
224                             tol(3) = Geom2dGcc_CurveTool::EpsX(Cu3,Abs(Tolerance));   
225                             math_FunctionSetRoot Root(Func, tol);
226                             Root.Perform(Func, Ufirst, Umin, Umax);
227                             if (Root.IsDone()) {
228                               Root.Root(Ufirst);
229                               Func.Value(Ufirst,Umin);
230                               gp_Pnt2d centre1(C1.Location());
231                               Standard_Real R1 = C1.Radius();
232                               gp_Pnt2d point1(centre1.XY()+R1*gp_XY(Cos(Ufirst(1)),Sin(Ufirst(1))));
233                               gp_Vec2d Tan1(gp_XY(-Sin(Ufirst(1)),Cos(Ufirst(1))));
234                               gp_Pnt2d point2,point3;
235                               //     gp_Vec2d Tan2,Tan3,Nor2,Nor3;
236                               gp_Vec2d Tan2,Tan3;
237                               Geom2dGcc_CurveTool::D1(Cu2,Ufirst(2),point2,Tan2);
238                               Geom2dGcc_CurveTool::D1(Cu3,Ufirst(3),point3,Tan3);
239                               GccAna_Circ2d3Tan circ(point1,point2,point3,Tol);
240                               if (circ.IsDone()) {
241                                 cirsol = circ.ThisSolution(1);
242                                 gp_Pnt2d centre(cirsol.Location());
243                                 Standard_Real dist = centre1.Distance(centre);
244                                 Standard_Real Rsol = cirsol.Radius();
245                                 Standard_Real normetan1 = Tan1.Magnitude();
246                                 Standard_Real normetan2 = Tan2.Magnitude();
247                                 Standard_Real normetan3 = Tan3.Magnitude();
248                                 gp_Vec2d Vec1(point1,centre);
249                                 gp_Vec2d Vec2(point2,centre);
250                                 gp_Vec2d Vec3(point3,centre);
251                                 Standard_Real normevec1 = Vec1.Magnitude();
252                                 Standard_Real normevec2 = Vec2.Magnitude();
253                                 Standard_Real normevec3 = Vec3.Magnitude();
254                                 Standard_Real dot1,dot2,dot3;
255                                 if (normevec1 >= gp::Resolution() && normetan1 >= gp::Resolution()) {
256                                   dot1 = Vec1.Dot(Tan1)/(normevec1*normetan1);
257                                 }
258                                 else { dot1 = 0.; }
259                                 if (normevec2 >= gp::Resolution() && normetan2 >= gp::Resolution()) {
260                                   dot2 = Vec2.Dot(Tan2)/(normevec2*normetan2);
261                                 }
262                                 else { dot2 = 0.; }
263                                 if (normevec3 >= gp::Resolution() && normetan3 >= gp::Resolution()) {
264                                   dot3 = Vec3.Dot(Tan3)/(normevec3*normetan3);
265                                 }
266                                 else { dot3 = 0.; }
267                                 Tol = 1.e-12;
268                                 if (dot1 <= Tol && dot2 <=Tol && dot3 <= Tol) {
269                                   if (Qualified1.IsUnqualified() || 
270                                     (Qualified1.IsEnclosing() && Rsol >= R1 && dist <= Rsol)||
271                                     (Qualified1.IsOutside() && dist >= Rsol) ||
272                                     (Qualified1.IsEnclosed() && Rsol <= R1 && dist <= Rsol)) {
273                                       Standard_Real Angle1 = Vec2.Angle(Tan2);
274                                       if (Qualified2.IsUnqualified() || 
275                                         (Qualified2.IsEnclosing()&&Angle1<=0.)||
276                                         (Qualified2.IsOutside() && Angle1 >= 0) ||
277                                         (Qualified2.IsEnclosed() && Angle1 <= 0.)) {
278                                           Angle1 = Vec3.Angle(Tan3);
279                                           if (Qualified3.IsUnqualified() || 
280                                             (Qualified3.IsEnclosing()&&Angle1<=0.)||
281                                             (Qualified3.IsOutside() && Angle1 >= 0) ||
282                                             (Qualified3.IsEnclosed() && Angle1 <= 0.)) {
283                                               qualifier1 = Qualified1.Qualifier();
284                                               qualifier2 = Qualified2.Qualifier();
285                                               qualifier3 = Qualified3.Qualifier();
286                                               pararg1 = Ufirst(1);
287                                               par1sol = 0.;
288                                               pnttg1sol = point1;
289                                               pararg2 = Ufirst(2);
290                                               pnttg2sol = point2;
291                                               par2sol = 0.;
292                                               pararg3 = Ufirst(3);
293                                               pnttg3sol = point3;
294                                               par3sol = 0.;
295                                               WellDone = Standard_True;
296                                           }
297                                       }
298                                   }
299                                 }
300                               }
301                             }
302 }
303
304 Geom2dGcc_Circ2d3TanIter::
305 Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedCirc& Qualified1 , 
306                           const GccEnt_QualifiedCirc& Qualified2 , 
307                           const Geom2dGcc_QCurve&    Qualified3 , 
308                           const Standard_Real         Param1     ,
309                           const Standard_Real         Param2     ,
310                           const Standard_Real         Param3     ,
311                           const Standard_Real         Tolerance     ) {
312
313                             TheSame1 = Standard_False;
314                             TheSame2 = Standard_False;
315                             TheSame3 = Standard_False;
316                             par1sol = 0.;
317                             par2sol = 0.;
318                             par3sol = 0.;
319                             pararg1 = 0.;
320                             pararg2 = 0.;
321                             pararg3 = 0.;
322
323                             Standard_Real Tol = Abs(Tolerance);
324                             WellDone = Standard_False;
325                             qualifier1 = GccEnt_noqualifier;
326                             qualifier2 = GccEnt_noqualifier;
327                             qualifier3 = GccEnt_noqualifier;
328                             if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() || 
329                               Qualified1.IsOutside() || Qualified1.IsUnqualified()) ||
330                               !(Qualified2.IsEnclosed() || Qualified2.IsEnclosing() || 
331                               Qualified2.IsOutside() || Qualified2.IsUnqualified()) ||
332                               !(Qualified3.IsEnclosed() || Qualified3.IsEnclosing() || 
333                               Qualified3.IsOutside() || Qualified3.IsUnqualified())) {
334                                 throw GccEnt_BadQualifier();
335                                 return;
336                             }
337                             gp_Circ2d C1 = Qualified1.Qualified();
338                             gp_Circ2d C2 = Qualified2.Qualified();
339                             Geom2dAdaptor_Curve Cu3 = Qualified3.Qualified();
340                             Geom2dGcc_FunctionTanCuCuCu Func(C1,C2,Cu3);
341                             math_Vector Umin(1,3);
342                             math_Vector Umax(1,3);
343                             math_Vector Ufirst(1,3);
344                             math_Vector tol(1,3);
345                             Umin(1) = 0.;
346                             Umin(2) = 0.;
347                             Umin(3) = Geom2dGcc_CurveTool::FirstParameter(Cu3);
348                             Umax(1) = 2*M_PI;
349                             Umax(2) = 2*M_PI;
350                             Umax(3) = Geom2dGcc_CurveTool::LastParameter(Cu3);
351                             Ufirst(1) = Param1;
352                             Ufirst(2) = Param2;
353                             Ufirst(3) = Param3;
354                             tol(1) = 2.e-15*M_PI;
355                             tol(2) = 2.e-15*M_PI;
356                             tol(3) = Geom2dGcc_CurveTool::EpsX(Cu3,Abs(Tolerance));   
357                             math_FunctionSetRoot Root(Func, tol);
358                             Root.Perform(Func, Ufirst, Umin, Umax);
359                             if (Root.IsDone()) {
360                               Root.Root(Ufirst);
361                               Func.Value(Ufirst,Umin);
362                               gp_Pnt2d centre1(C1.Location());
363                               Standard_Real R1 = C1.Radius();
364                               gp_Pnt2d point1(centre1.XY()+R1*gp_XY(Cos(Ufirst(1)),Sin(Ufirst(1))));
365                               gp_Vec2d Tan1(gp_XY(-Sin(Ufirst(1)),Cos(Ufirst(1))));
366                               gp_Pnt2d centre2(C2.Location());
367                               Standard_Real R2 = C2.Radius();
368                               gp_Pnt2d point2(centre2.XY()+R2*gp_XY(Cos(Ufirst(2)),Sin(Ufirst(2))));
369                               gp_Vec2d Tan2(gp_XY(-Sin(Ufirst(2)),Cos(Ufirst(2))));
370                               gp_Pnt2d point3;
371                               gp_Vec2d Tan3;
372                               Geom2dGcc_CurveTool::D1(Cu3,Ufirst(3),point3,Tan3);
373                               GccAna_Circ2d3Tan circ(point1,point2,point3,Tol);
374                               if (circ.IsDone()) {
375                                 cirsol = circ.ThisSolution(1);
376                                 gp_Pnt2d centre(cirsol.Location());
377                                 Standard_Real dist = centre1.Distance(centre);
378                                 Standard_Real Rsol = cirsol.Radius();
379                                 Standard_Real normetan1 = Tan1.Magnitude();
380                                 Standard_Real normetan2 = Tan2.Magnitude();
381                                 Standard_Real normetan3 = Tan3.Magnitude();
382                                 gp_Vec2d Vec1(point1,centre);
383                                 gp_Vec2d Vec2(point2,centre);
384                                 gp_Vec2d Vec3(point3,centre);
385                                 Standard_Real normevec1 = Vec1.Magnitude();
386                                 Standard_Real normevec2 = Vec2.Magnitude();
387                                 Standard_Real normevec3 = Vec3.Magnitude();
388                                 Standard_Real dot1,dot2,dot3;
389                                 if (normevec1 >= gp::Resolution() && normetan1 >= gp::Resolution()) {
390                                   dot1 = Vec1.Dot(Tan1)/(normevec1*normetan1);
391                                 }
392                                 else { dot1 = 0.; }
393                                 if (normevec2 >= gp::Resolution() && normetan2 >= gp::Resolution()) {
394                                   dot2 = Vec2.Dot(Tan2)/(normevec2*normetan2);
395                                 }
396                                 else { dot2 = 0.; }
397                                 if (normevec3 >= gp::Resolution() && normetan3 >= gp::Resolution()) {
398                                   dot3 = Vec3.Dot(Tan3)/(normevec3*normetan3);
399                                 }
400                                 else { dot3 = 0.; }
401                                 Tol = 1.e-12;
402                                 if (dot1 <= Tol && dot2 <=Tol && dot3 <= Tol) {
403                                   if (Qualified1.IsUnqualified() || 
404                                     (Qualified1.IsEnclosing() && Rsol >= R1 && dist <= Rsol)||
405                                     (Qualified1.IsOutside() && dist >= Rsol) ||
406                                     (Qualified1.IsEnclosed() && Rsol <= R1 && dist <= Rsol)) {
407                                       dist = centre2.Distance(centre);
408                                       if (Qualified1.IsUnqualified() || 
409                                         (Qualified1.IsEnclosing() && Rsol >= R2 && dist <= Rsol)||
410                                         (Qualified1.IsOutside() && dist >= Rsol) ||
411                                         (Qualified1.IsEnclosed() && Rsol <= R2 && dist <= Rsol)) {
412                                           gp_Vec2d Vec(point3,centre);
413                                           Standard_Real Angle1 = Vec.Angle(Tan3);
414                                           if (Qualified3.IsUnqualified() || 
415                                             (Qualified3.IsEnclosing()&&Angle1<=0.)||
416                                             (Qualified3.IsOutside() && Angle1 >= 0) ||
417                                             (Qualified3.IsEnclosed() && Angle1 <= 0.)) {
418                                               qualifier1 = Qualified1.Qualifier();
419                                               qualifier2 = Qualified2.Qualifier();
420                                               qualifier3 = Qualified3.Qualifier();
421                                               pararg1 = Ufirst(1);
422                                               par1sol = 0.;
423                                               pnttg1sol = point1;
424                                               pararg2 = Ufirst(2);
425                                               pnttg2sol = point2;
426                                               par2sol = 0.;
427                                               pararg3 = Ufirst(3);
428                                               pnttg3sol = point3;
429                                               par3sol = 0.;
430                                               WellDone = Standard_True;
431                                           }
432                                       }
433                                   }
434                                 }
435                               }
436                             }
437 }
438
439 Geom2dGcc_Circ2d3TanIter::
440 Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedLin& Qualified1 , 
441                           const Geom2dGcc_QCurve&   Qualified2 ,
442                           const Geom2dGcc_QCurve&   Qualified3 , 
443                           const Standard_Real        Param1     ,
444                           const Standard_Real        Param2     ,
445                           const Standard_Real        Param3     ,
446                           const Standard_Real        Tolerance  ) {
447
448                             TheSame1 = Standard_False;
449                             TheSame2 = Standard_False;
450                             TheSame3 = Standard_False;
451                             par1sol = 0.;
452                             par2sol = 0.;
453                             par3sol = 0.;
454                             pararg1 = 0.;
455                             pararg2 = 0.;
456                             pararg3 = 0.;
457
458                             Standard_Real Tol = Abs(Tolerance);
459                             WellDone = Standard_False;
460                             qualifier1 = GccEnt_noqualifier;
461                             qualifier2 = GccEnt_noqualifier;
462                             qualifier3 = GccEnt_noqualifier;
463                             if (!(Qualified1.IsEnclosed() ||
464                               Qualified1.IsOutside() || Qualified1.IsUnqualified()) ||
465                               !(Qualified2.IsEnclosed() || Qualified2.IsEnclosing() || 
466                               Qualified2.IsOutside() || Qualified2.IsUnqualified()) ||
467                               !(Qualified3.IsEnclosed() || Qualified3.IsEnclosing() || 
468                               Qualified3.IsOutside() || Qualified3.IsUnqualified())) {
469                                 throw GccEnt_BadQualifier();
470                                 return;
471                             }
472                             gp_Lin2d L1 = Qualified1.Qualified();
473                             Geom2dAdaptor_Curve Cu2 = Qualified2.Qualified();
474                             Geom2dAdaptor_Curve Cu3 = Qualified3.Qualified();
475                             Geom2dGcc_FunctionTanCuCuCu Func(L1,Cu2,Cu3);
476                             math_Vector Umin(1,3);
477                             math_Vector Umax(1,3);
478                             math_Vector Ufirst(1,3);
479                             math_Vector tol(1,3);
480                             Umin(1) = RealFirst();
481                             Umin(2) = Geom2dGcc_CurveTool::FirstParameter(Cu2);
482                             Umin(3) = Geom2dGcc_CurveTool::FirstParameter(Cu3);
483                             Umax(1) = RealLast();
484                             Umax(2) = Geom2dGcc_CurveTool::LastParameter(Cu2);
485                             Umax(3) = Geom2dGcc_CurveTool::LastParameter(Cu3);
486                             Ufirst(1) = Param1;
487                             Ufirst(2) = Param2;
488                             Ufirst(3) = Param3;
489                             tol(1) = 1.e-15;
490                             tol(2) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolerance));
491                             tol(3) = Geom2dGcc_CurveTool::EpsX(Cu3,Abs(Tolerance));   
492                             math_FunctionSetRoot Root(Func, tol);
493                             Root.Perform(Func, Ufirst, Umin, Umax);
494                             if (Root.IsDone()) {
495                               Root.Root(Ufirst);
496                               Func.Value(Ufirst,Umin);
497                               gp_Pnt2d centre1(L1.Location());
498                               gp_Pnt2d point1(centre1.XY()+Ufirst(1)*L1.Direction().XY());
499                               gp_Pnt2d point2,point3;
500                               gp_Vec2d Tan2,Tan3;
501                               Geom2dGcc_CurveTool::D1(Cu2,Ufirst(2),point2,Tan2);
502                               Geom2dGcc_CurveTool::D1(Cu3,Ufirst(3),point3,Tan3);
503                               GccAna_Circ2d3Tan circ(point1,point2,point3,Tol);
504                               if (circ.IsDone()) {
505                                 cirsol = circ.ThisSolution(1);
506                                 gp_Pnt2d centre(cirsol.Location());
507
508                                 // creation vaariables intermediaires pour WNT
509                                 gp_XY dummy1 = centre.XY()-L1.Location().XY();
510                                 gp_XY dummy2 (-L1.Direction().Y(),L1.Direction().X());
511                                 Standard_Real pscal=dummy1.Dot(dummy2);
512
513                                 gp_Vec2d Tan1(L1.Direction().XY());
514                                 Standard_Real normetan1 = Tan1.Magnitude();
515                                 Standard_Real normetan2 = Tan2.Magnitude();
516                                 Standard_Real normetan3 = Tan3.Magnitude();
517                                 gp_Vec2d Vec1(point1,centre);
518                                 gp_Vec2d Vec2(point2,centre);
519                                 gp_Vec2d Vec3(point3,centre);
520                                 Standard_Real normevec1 = Vec1.Magnitude();
521                                 Standard_Real normevec2 = Vec2.Magnitude();
522                                 Standard_Real normevec3 = Vec3.Magnitude();
523                                 Standard_Real dot1,dot2,dot3;
524                                 if (normevec1 >= gp::Resolution() && normetan1 >= gp::Resolution()) {
525                                   dot1 = Vec1.Dot(Tan1)/(normevec1*normetan1);
526                                 }
527                                 else { dot1 = 0.; }
528                                 if (normevec2 >= gp::Resolution() && normetan2 >= gp::Resolution()) {
529                                   dot2 = Vec2.Dot(Tan2)/(normevec2*normetan2);
530                                 }
531                                 else { dot2 = 0.; }
532                                 if (normevec3 >= gp::Resolution() && normetan3 >= gp::Resolution()) {
533                                   dot3 = Vec3.Dot(Tan3)/(normevec3*normetan3);
534                                 }
535                                 else { dot3 = 0.; }
536                                 Tol = 1.e-12;
537                                 if (dot1 <= Tol && dot2 <=Tol && dot3 <= Tol) {
538                                   if (Qualified1.IsUnqualified() || 
539                                     (Qualified1.IsOutside() && pscal <= 0.) ||
540                                     (Qualified1.IsEnclosed() && pscal >= 0.)) {
541                                       gp_Vec2d Vec(point2,centre);
542                                       Standard_Real Angle1 = Vec.Angle(Tan2);
543                                       if (Qualified2.IsUnqualified() || 
544                                         (Qualified2.IsEnclosing()&&Angle1<=0.)||
545                                         (Qualified2.IsOutside() && Angle1 >= 0) ||
546                                         (Qualified2.IsEnclosed() && Angle1 <= 0.)) {
547                                           Vec = gp_Vec2d(point3,centre);
548                                           Angle1 = Vec.Angle(Tan3);
549                                           if (Qualified3.IsUnqualified() || 
550                                             (Qualified3.IsEnclosing()&&Angle1<=0.)||
551                                             (Qualified3.IsOutside() && Angle1 >= 0) ||
552                                             (Qualified3.IsEnclosed() && Angle1 <= 0.)) {
553                                               qualifier1 = Qualified1.Qualifier();
554                                               qualifier2 = Qualified2.Qualifier();
555                                               qualifier3 = Qualified3.Qualifier();
556                                               pararg1 = Ufirst(1);
557                                               par1sol = 0.;
558                                               pnttg1sol = point1;
559                                               pararg2 = Ufirst(2);
560                                               pnttg2sol = point2;
561                                               par2sol = 0.;
562                                               pararg3 = Ufirst(3);
563                                               pnttg3sol = point3;
564                                               par3sol = 0.;
565                                               WellDone = Standard_True;
566                                           }
567                                       }
568                                   }
569                                 }
570                               }
571                             }
572 }
573
574 Geom2dGcc_Circ2d3TanIter::
575 Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedLin&  Qualified1 , 
576                           const GccEnt_QualifiedLin&  Qualified2 , 
577                           const Geom2dGcc_QCurve&    Qualified3 , 
578                           const Standard_Real         Param1     ,
579                           const Standard_Real         Param2     ,
580                           const Standard_Real         Param3     ,
581                           const Standard_Real         Tolerance  ){
582
583                             TheSame1 = Standard_False;
584                             TheSame2 = Standard_False;
585                             TheSame3 = Standard_False;
586                             par1sol = 0.;
587                             par2sol = 0.;
588                             par3sol = 0.;
589                             pararg1 = 0.;
590                             pararg2 = 0.;
591                             pararg3 = 0.;
592
593                             Standard_Real Tol = Abs(Tolerance);
594                             WellDone = Standard_False;
595                             qualifier1 = GccEnt_noqualifier;
596                             qualifier2 = GccEnt_noqualifier;
597                             qualifier3 = GccEnt_noqualifier;
598                             if (!(Qualified1.IsEnclosed() || 
599                               Qualified1.IsOutside() || Qualified1.IsUnqualified()) ||
600                               !(Qualified2.IsEnclosed() || 
601                               Qualified2.IsOutside() || Qualified2.IsUnqualified()) ||
602                               !(Qualified3.IsEnclosed() || Qualified3.IsEnclosing() || 
603                               Qualified3.IsOutside() || Qualified3.IsUnqualified())) {
604                                 throw GccEnt_BadQualifier();
605                                 return;
606                             }
607                             gp_Lin2d L1 = Qualified1.Qualified();
608                             gp_Lin2d L2 = Qualified2.Qualified();
609                             Geom2dAdaptor_Curve Cu3 = Qualified3.Qualified();
610                             Geom2dGcc_FunctionTanCuCuCu Func(L1,L2,Cu3);
611                             math_Vector Umin(1,3);
612                             math_Vector Umax(1,3);
613                             math_Vector Ufirst(1,3);
614                             math_Vector tol(1,3);
615                             Umin(1) = RealFirst();
616                             Umin(2) = RealFirst();
617                             Umin(3) = Geom2dGcc_CurveTool::FirstParameter(Cu3);
618                             Umax(1) = RealLast();
619                             Umax(2) = RealLast();
620                             Umax(3) = Geom2dGcc_CurveTool::LastParameter(Cu3);
621                             Ufirst(1) = Param1;
622                             Ufirst(2) = Param2;
623                             Ufirst(3) = Param3;
624                             tol(1) = 1.e-15;
625                             tol(2) = 1.e-15;
626                             tol(3) = Geom2dGcc_CurveTool::EpsX(Cu3,Abs(Tolerance));   
627                             math_FunctionSetRoot Root(Func, tol);
628                             Root.Perform(Func, Ufirst, Umin, Umax);
629                             if (Root.IsDone()) {
630                               Root.Root(Ufirst);
631                               Func.Value(Ufirst,Umin);
632                               gp_Pnt2d centre1(L1.Location());
633                               gp_Pnt2d point1(centre1.XY()+Ufirst(1)*L1.Direction().XY());
634                               gp_Pnt2d centre2(L2.Location());
635                               gp_Pnt2d point2(centre2.XY()+Ufirst(2)*L2.Direction().XY());
636                               gp_Pnt2d point3;
637                               gp_Vec2d Tan3;
638                               Geom2dGcc_CurveTool::D1(Cu3,Ufirst(3),point3,Tan3);
639                               GccAna_Circ2d3Tan circ(point1,point2,point3,Tol);
640                               if (circ.IsDone()) {
641                                 cirsol = circ.ThisSolution(1);
642                                 gp_Pnt2d centre(cirsol.Location());
643                                 Standard_Real pscal=centre.XY().Dot(gp_XY(-L1.Direction().Y(),
644                                   L1.Direction().X()));
645                                 if (Qualified1.IsUnqualified() || 
646                                   (Qualified1.IsOutside() && pscal <= 0.) ||
647                                   (Qualified1.IsEnclosed() && pscal >= 0.)) {
648                                     gp_Vec2d Tan1(L1.Direction().XY());
649                                     gp_Vec2d Tan2(L2.Direction().XY());
650                                     Standard_Real normetan1 = Tan1.Magnitude();
651                                     Standard_Real normetan2 = Tan2.Magnitude();
652                                     Standard_Real normetan3 = Tan3.Magnitude();
653                                     gp_Vec2d Vec1(point1,centre);
654                                     gp_Vec2d Vec2(point2,centre);
655                                     gp_Vec2d Vec3(point3,centre);
656                                     Standard_Real normevec1 = Vec1.Magnitude();
657                                     Standard_Real normevec2 = Vec2.Magnitude();
658                                     Standard_Real normevec3 = Vec3.Magnitude();
659                                     Standard_Real dot1,dot2,dot3;
660                                     if (normevec1 >= gp::Resolution() && normetan1 >= gp::Resolution()) {
661                                       dot1 = Vec1.Dot(Tan1)/(normevec1*normetan1);
662                                     }
663                                     else { dot1 = 0.; }
664                                     if (normevec2 >= gp::Resolution() && normetan2 >= gp::Resolution()) {
665                                       dot2 = Vec2.Dot(Tan2)/(normevec2*normetan2);
666                                     }
667                                     else { dot2 = 0.; }
668                                     if (normevec3 >= gp::Resolution() && normetan3 >= gp::Resolution()) {
669                                       dot3 = Vec3.Dot(Tan3)/(normevec3*normetan3);
670                                     }
671                                     else { dot3 = 0.; }
672                                     Tol = 1.e-12;
673                                     if (dot1 <= Tol && dot2 <=Tol && dot3 <= Tol) {
674                                       if (Qualified2.IsUnqualified() || 
675                                         (Qualified2.IsOutside() && pscal <= 0.) ||
676                                         (Qualified2.IsEnclosed() && pscal >= 0.)) {
677                                           Standard_Real Angle1 = Vec3.Angle(Tan3);
678                                           if (Qualified3.IsUnqualified() || 
679                                             (Qualified3.IsEnclosing()&&Angle1<=0.)||
680                                             (Qualified3.IsOutside() && Angle1 >= 0) ||
681                                             (Qualified3.IsEnclosed() && Angle1 <= 0.)) {
682                                               qualifier1 = Qualified1.Qualifier();
683                                               qualifier2 = Qualified2.Qualifier();
684                                               qualifier3 = Qualified3.Qualifier();
685                                               pararg1 = Ufirst(1);
686                                               par1sol = 0.;
687                                               pnttg1sol = point1;
688                                               pararg2 = Ufirst(2);
689                                               pnttg2sol = point2;
690                                               par2sol = 0.;
691                                               pararg3 = Ufirst(3);
692                                               pnttg3sol = point3;
693                                               par3sol = 0.;
694                                               WellDone = Standard_True;
695                                           }
696                                       }
697                                     }
698                                 }
699                               }
700                             }
701 }
702
703 Geom2dGcc_Circ2d3TanIter::
704 Geom2dGcc_Circ2d3TanIter (const Geom2dGcc_QCurve& Qualified1 ,
705                           const Geom2dGcc_QCurve& Qualified2 , 
706                           const gp_Pnt2d&          Point3     ,
707                           const Standard_Real      Param1     ,
708                           const Standard_Real      Param2     ,
709                           const Standard_Real      Tolerance  ) {
710
711                             TheSame1 = Standard_False;
712                             TheSame2 = Standard_False;
713                             TheSame3 = Standard_False;
714                             par1sol = 0.;
715                             par2sol = 0.;
716                             par3sol = 0.;
717                             pararg1 = 0.;
718                             pararg2 = 0.;
719                             pararg3 = 0.;
720
721                             Standard_Real Tol = Abs(Tolerance);
722                             WellDone = Standard_False;
723                             qualifier1 = GccEnt_noqualifier;
724                             qualifier2 = GccEnt_noqualifier;
725                             qualifier3 = GccEnt_noqualifier;
726                             if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() || 
727                               Qualified1.IsOutside() || Qualified1.IsUnqualified()) ||
728                               !(Qualified2.IsEnclosed() || Qualified2.IsEnclosing() || 
729                               Qualified2.IsOutside() || Qualified2.IsUnqualified())) {
730                                 throw GccEnt_BadQualifier();
731                                 return;
732                             }
733                             gp_Circ2d C1(gp_Ax2d(Point3,gp_Dir2d(1.,0.)),0.);
734                             Geom2dAdaptor_Curve Cu1 = Qualified1.Qualified();
735                             Geom2dAdaptor_Curve Cu2 = Qualified2.Qualified();
736                             Geom2dGcc_FunctionTanCuCuCu Func(C1,Cu1,Cu2);
737                             math_Vector Umin(1,3);
738                             math_Vector Umax(1,3);
739                             math_Vector Ufirst(1,3);
740                             math_Vector tol(1,3);
741                             Umin(1) = 0.;
742                             Umin(2) = Geom2dGcc_CurveTool::FirstParameter(Cu1);
743                             Umin(3) = Geom2dGcc_CurveTool::FirstParameter(Cu2);
744                             Umax(1) = 2*M_PI;
745                             Umax(2) = Geom2dGcc_CurveTool::LastParameter(Cu1);
746                             Umax(3) = Geom2dGcc_CurveTool::LastParameter(Cu2);
747                             Ufirst(1) = M_PI;
748                             Ufirst(2) = Param1;
749                             Ufirst(3) = Param2;
750                             tol(1) = 2.e-15*M_PI;
751                             tol(2) = Geom2dGcc_CurveTool::EpsX(Cu1,Abs(Tolerance));
752                             tol(3) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolerance));
753                             math_FunctionSetRoot Root(Func, tol);
754                             Root.Perform(Func, Ufirst, Umin, Umax);
755                             if (Root.IsDone()) {
756                               Root.Root(Ufirst);
757                               Func.Value(Ufirst,Umin);
758                               gp_Pnt2d point1,point2;
759                               //     gp_Vec2d Tan1,Tan2,Nor1,Nor2;
760                               gp_Vec2d Tan1,Tan2;
761                               Geom2dGcc_CurveTool::D1(Cu1,Ufirst(2),point1,Tan1);
762                               Geom2dGcc_CurveTool::D1(Cu2,Ufirst(3),point2,Tan2);
763                               GccAna_Circ2d3Tan circ(Point3,point1,point2,Tol);
764                               if (circ.IsDone()) {
765                                 cirsol = circ.ThisSolution(1);
766                                 gp_Pnt2d centre(cirsol.Location());
767                                 gp_Vec2d Tan3(-Sin(Ufirst(1)),Cos(Ufirst(1)));
768                                 Standard_Real normetan1 = Tan1.Magnitude();
769                                 Standard_Real normetan2 = Tan2.Magnitude();
770                                 Standard_Real normetan3 = Tan3.Magnitude();
771                                 gp_Vec2d Vec1(point1,centre);
772                                 gp_Vec2d Vec2(point2,centre);
773                                 gp_Vec2d Vec3(Point3,centre);
774                                 Standard_Real normevec1 = Vec1.Magnitude();
775                                 Standard_Real normevec2 = Vec2.Magnitude();
776                                 Standard_Real normevec3 = Vec3.Magnitude();
777                                 Standard_Real dot1,dot2,dot3;
778                                 if (normevec1 >= gp::Resolution() && normetan1 >= gp::Resolution()) {
779                                   dot1 = Vec1.Dot(Tan1)/(normevec1*normetan1);
780                                 }
781                                 else { dot1 = 0.; }
782                                 if (normevec2 >= gp::Resolution() && normetan2 >= gp::Resolution()) {
783                                   dot2 = Vec2.Dot(Tan2)/(normevec2*normetan2);
784                                 }
785                                 else { dot2 = 0.; }
786                                 if (normevec3 >= gp::Resolution() && normetan3 >= gp::Resolution()) {
787                                   dot3 = Vec3.Dot(Tan3)/(normevec3*normetan3);
788                                 }
789                                 else { dot3 = 0.; }
790                                 Tol = 1.e-12;
791                                 if (dot1 <= Tol && dot2 <=Tol && dot3 <= Tol) {
792                                   Standard_Real Angle1 = Vec1.Angle(Tan1);
793                                   if (Qualified1.IsUnqualified()||
794                                     (Qualified1.IsEnclosing()&&Angle1<=0.)||
795                                     (Qualified1.IsOutside() && Angle1 >= 0) ||
796                                     (Qualified1.IsEnclosed() && Angle1 <= 0.)) {
797                                       Angle1 = Vec2.Angle(Tan2);
798                                       if (Qualified1.IsUnqualified() ||
799                                         (Qualified1.IsEnclosing()&&Angle1<=0.)||
800                                         (Qualified1.IsOutside() && Angle1 >= 0) ||
801                                         (Qualified1.IsEnclosed() && Angle1 <= 0.)) {
802                                           qualifier1 = Qualified1.Qualifier();
803                                           qualifier2 = Qualified2.Qualifier();
804                                           qualifier3 = GccEnt_noqualifier;
805                                           pararg1 = Ufirst(2);
806                                           par1sol = 0.;
807                                           pnttg1sol = point1;
808                                           pararg2 = Ufirst(3);
809                                           pnttg2sol = point2;
810                                           par2sol = 0.;
811                                           pararg3 = 0.;
812                                           pnttg3sol = Point3;
813                                           par3sol = 0.;
814                                           WellDone = Standard_True;
815                                       }
816                                   }
817                                 }
818                               }
819                             }
820 }
821
822 Geom2dGcc_Circ2d3TanIter::
823 Geom2dGcc_Circ2d3TanIter (const Geom2dGcc_QCurve& Qualified1 ,
824                           const gp_Pnt2d&          Point2     ,
825                           const gp_Pnt2d&          Point3     ,
826                           const Standard_Real      Param1     ,
827                           const Standard_Real      Tolerance     ) {
828
829                             TheSame1 = Standard_False;
830                             TheSame2 = Standard_False;
831                             TheSame3 = Standard_False;
832                             par1sol = 0.;
833                             par2sol = 0.;
834                             par3sol = 0.;
835                             pararg1 = 0.;
836                             pararg2 = 0.;
837                             pararg3 = 0.;
838
839                             Standard_Real Tol = Abs(Tolerance);
840                             WellDone = Standard_False;
841                             qualifier1 = GccEnt_noqualifier;
842                             qualifier2 = GccEnt_noqualifier;
843                             qualifier3 = GccEnt_noqualifier;
844                             if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() || 
845                               Qualified1.IsOutside() || Qualified1.IsUnqualified())) {
846                                 throw GccEnt_BadQualifier();
847                                 return;
848                             }
849                             gp_Dir2d dirx(1.,0.);
850                             gp_Circ2d C1(gp_Ax2d(Point2,dirx),0.);
851                             gp_Circ2d C2(gp_Ax2d(Point3,dirx),0.);
852                             Geom2dAdaptor_Curve Cu1 = Qualified1.Qualified();
853                             Geom2dGcc_FunctionTanCuCuCu Func(C1,C2,Cu1);
854                             math_Vector Umin(1,3);
855                             math_Vector Umax(1,3);
856                             math_Vector Ufirst(1,3);
857                             math_Vector tol(1,3);
858                             Umin(1) = 0.;
859                             Umin(2) = 0.;
860                             Umin(3) = Geom2dGcc_CurveTool::FirstParameter(Cu1);
861                             Umax(1) = 2*M_PI;
862                             Umax(2) = 2*M_PI;
863                             Umax(3) = Geom2dGcc_CurveTool::LastParameter(Cu1);
864                             Ufirst(1) = M_PI;
865                             Ufirst(2) = M_PI;
866                             Ufirst(3) = Param1;
867                             tol(1) = 2.e-15*M_PI;
868                             tol(2) = 2.e-15*M_PI;
869                             tol(3) = Geom2dGcc_CurveTool::EpsX(Cu1,Abs(Tolerance));
870                             math_FunctionSetRoot Root(Func, tol);
871                             Root.Perform(Func, Ufirst, Umin, Umax);
872                             if (Root.IsDone()) {
873                               Root.Root(Ufirst);
874                               Func.Value(Ufirst,Umin);
875                               gp_Pnt2d point3;
876                               //     gp_Vec2d Tan3,Nor3;
877                               gp_Vec2d Tan3;
878                               Geom2dGcc_CurveTool::D1(Cu1,Ufirst(3),point3,Tan3);
879                               GccAna_Circ2d3Tan circ(Point2,Point3,point3,Tol);
880                               if (circ.IsDone()) { 
881                                 cirsol = circ.ThisSolution(1);
882                                 gp_Pnt2d centre(cirsol.Location());
883                                 gp_Vec2d Tan2(-Sin(Ufirst(2)),Cos(Ufirst(2)));
884                                 gp_Vec2d Tan1(-Sin(Ufirst(1)),Cos(Ufirst(1)));
885                                 Standard_Real normetan1 = Tan1.Magnitude();
886                                 Standard_Real normetan2 = Tan2.Magnitude();
887                                 Standard_Real normetan3 = Tan3.Magnitude();
888                                 gp_Vec2d Vec1(Point2,centre);
889                                 gp_Vec2d Vec2(Point3,centre);
890                                 gp_Vec2d Vec3(point3,centre);
891                                 Standard_Real normevec1 = Vec1.Magnitude();
892                                 Standard_Real normevec2 = Vec2.Magnitude();
893                                 Standard_Real normevec3 = Vec3.Magnitude();
894                                 Standard_Real dot1,dot2,dot3;
895                                 if (normevec1 >= gp::Resolution() && normetan1 >= gp::Resolution()) {
896                                   dot1 = Vec1.Dot(Tan1)/(normevec1*normetan1);
897                                 }
898                                 else { dot1 = 0.; }
899                                 if (normevec2 >= gp::Resolution() && normetan2 >= gp::Resolution()) {
900                                   dot2 = Vec2.Dot(Tan2)/(normevec2*normetan2);
901                                 }
902                                 else { dot2 = 0.; }
903                                 if (normevec3 >= gp::Resolution() && normetan3 >= gp::Resolution()) {
904                                   dot3 = Vec3.Dot(Tan3)/(normevec3*normetan3);
905                                 }
906                                 else { dot3 = 0.; }
907                                 Tol = 1.e-12;
908                                 if (dot1 <= Tol && dot2 <=Tol && dot3 <= Tol) {
909                                   Standard_Real Angle1 = Vec1.Angle(Tan1);
910                                   if (Qualified1.IsUnqualified() ||
911                                     (Qualified1.IsEnclosing()&&Angle1<=0.)||
912                                     (Qualified1.IsOutside() && Angle1 >= 0) ||
913                                     (Qualified1.IsEnclosed() && Angle1 <= 0.)) {
914                                       qualifier1 = Qualified1.Qualifier();
915                                       qualifier2 = GccEnt_noqualifier;
916                                       qualifier3 = GccEnt_noqualifier;
917                                       pararg1 = Ufirst(3);
918                                       par1sol = 0.;
919                                       pnttg1sol = point3;
920                                       pararg2 = 0.;
921                                       pnttg2sol = Point2;
922                                       par2sol = 0.;
923                                       pararg3 = 0.;
924                                       pnttg3sol = Point3;
925                                       par3sol = 0.;
926                                       WellDone = Standard_True;
927                                   }
928                                 }
929                               }
930                             }
931 }
932
933 Geom2dGcc_Circ2d3TanIter::
934 Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedLin&  Qualified1 , 
935                           const Geom2dGcc_QCurve&    Qualified2 ,
936                           const gp_Pnt2d&             Point3     ,
937                           const Standard_Real         Param1     ,
938                           const Standard_Real         Param2     ,
939                           const Standard_Real         Tolerance  ) {
940
941                             TheSame1 = Standard_False;
942                             TheSame2 = Standard_False;
943                             TheSame3 = Standard_False;
944                             par1sol = 0.;
945                             par2sol = 0.;
946                             par3sol = 0.;
947                             pararg1 = 0.;
948                             pararg2 = 0.;
949                             pararg3 = 0.;
950
951                             Standard_Real Tol = Abs(Tolerance);
952                             WellDone = Standard_False;
953                             qualifier1 = GccEnt_noqualifier;
954                             qualifier2 = GccEnt_noqualifier;
955                             qualifier3 = GccEnt_noqualifier;
956                             if (!(Qualified1.IsEnclosed() ||
957                               Qualified1.IsOutside() || Qualified1.IsUnqualified()) ||
958                               !(Qualified2.IsEnclosed() || Qualified2.IsEnclosing() || 
959                               Qualified2.IsOutside() || Qualified2.IsUnqualified())) {
960                                 throw GccEnt_BadQualifier();
961                                 return;
962                             }
963                             gp_Dir2d dirx(1.,0.);
964                             gp_Lin2d L1 = Qualified1.Qualified();
965                             Geom2dAdaptor_Curve Cu2 = Qualified2.Qualified();
966                             gp_Circ2d C3(gp_Ax2d(Point3,dirx),0.);
967                             Geom2dGcc_FunctionTanCuCuCu Func(C3,L1,Cu2);
968                             math_Vector Umin(1,3);
969                             math_Vector Umax(1,3);
970                             math_Vector Ufirst(1,3);
971                             math_Vector tol(1,3);
972                             Umin(2) = RealFirst();
973                             Umin(3) = Geom2dGcc_CurveTool::FirstParameter(Cu2);
974                             Umin(1) = 0.;
975                             Umax(2) = RealLast();
976                             Umax(3) = Geom2dGcc_CurveTool::LastParameter(Cu2);
977                             Umax(1) = 2*M_PI;
978                             Ufirst(2) = Param1;
979                             Ufirst(3) = Param2;
980                             Ufirst(1) = M_PI;
981                             tol(1) = 2.e-15;
982                             tol(2) = 1.e-15;
983                             tol(3) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolerance));
984                             math_FunctionSetRoot Root(Func, tol);
985                             Root.Perform(Func, Ufirst, Umin, Umax);
986                             if (Root.IsDone()) {
987                               Root.Root(Ufirst);
988                               Func.Value(Ufirst,Umin);
989                               gp_Pnt2d centre1(L1.Location());
990                               gp_Pnt2d point1(centre1.XY()+Ufirst(2)*L1.Direction().XY());
991                               gp_Pnt2d point2;
992                               gp_Vec2d Tan2;
993                               Geom2dGcc_CurveTool::D1(Cu2,Ufirst(2),point2,Tan2);
994                               GccAna_Circ2d3Tan circ(point1,point2,Point3,Tol);
995                               if (circ.IsDone()) {
996                                 cirsol = circ.ThisSolution(1);
997                                 gp_Pnt2d centre(cirsol.Location());
998                                 Standard_Real pscal=centre.XY().Dot(gp_XY(-L1.Direction().Y(),
999                                   L1.Direction().X()));
1000                                 gp_Vec2d Tan1(L1.Direction().XY());
1001                                 gp_Vec2d Tan3(-Sin(Ufirst(1)),Cos(Ufirst(1)));
1002                                 Standard_Real normetan1 = Tan1.Magnitude();
1003                                 Standard_Real normetan2 = Tan2.Magnitude();
1004                                 Standard_Real normetan3 = Tan3.Magnitude();
1005                                 gp_Vec2d Vec1(point1,centre);
1006                                 gp_Vec2d Vec2(point2,centre);
1007                                 gp_Vec2d Vec3(Point3,centre);
1008                                 Standard_Real normevec1 = Vec1.Magnitude();
1009                                 Standard_Real normevec2 = Vec2.Magnitude();
1010                                 Standard_Real normevec3 = Vec3.Magnitude();
1011                                 Standard_Real dot1,dot2,dot3;
1012                                 if (normevec1 >= gp::Resolution() && normetan1 >= gp::Resolution()) {
1013                                   dot1 = Vec1.Dot(Tan1)/(normevec1*normetan1);
1014                                 }
1015                                 else { dot1 = 0.; }
1016                                 if (normevec2 >= gp::Resolution() && normetan2 >= gp::Resolution()) {
1017                                   dot2 = Vec2.Dot(Tan2)/(normevec2*normetan2);
1018                                 }
1019                                 else { dot2 = 0.; }
1020                                 if (normevec3 >= gp::Resolution() && normetan3 >= gp::Resolution()) {
1021                                   dot3 = Vec3.Dot(Tan3)/(normevec3*normetan3);
1022                                 }
1023                                 else { dot3 = 0.; }
1024                                 Tol = 1.e-12;
1025                                 if (dot1 <= Tol && dot2 <=Tol && dot3 <= Tol) {
1026                                   if (Qualified1.IsUnqualified() || 
1027                                     (Qualified1.IsOutside() && pscal <= 0.) ||
1028                                     (Qualified1.IsEnclosed() && pscal >= 0.)) {
1029                                       Standard_Real Angle1 = Vec2.Angle(Tan2);
1030                                       if (Qualified2.IsUnqualified() || 
1031                                         (Qualified2.IsEnclosing()&&Angle1<=0.)||
1032                                         (Qualified2.IsOutside() && Angle1 >= 0) ||
1033                                         (Qualified2.IsEnclosed() && Angle1 <= 0.)) {
1034                                           qualifier1 = Qualified1.Qualifier();
1035                                           qualifier2 = Qualified2.Qualifier();
1036                                           qualifier3 = GccEnt_noqualifier;
1037                                           pararg1 = Ufirst(2);
1038                                           par1sol = 0.;
1039                                           pnttg1sol = point1;
1040                                           pararg2 = Ufirst(3);
1041                                           pnttg2sol = point2;
1042                                           par2sol = 0.;
1043                                           pararg3 = 0.;
1044                                           pnttg3sol = Point3;
1045                                           par3sol = 0.;
1046                                           WellDone = Standard_True;
1047                                       }
1048                                   }
1049                                 }
1050                               }
1051                             }
1052 }
1053
1054 Geom2dGcc_Circ2d3TanIter::
1055 Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedCirc& Qualified1 , 
1056                           const GccEnt_QualifiedLin&  Qualified2 , 
1057                           const Geom2dGcc_QCurve&     Qualified3 , 
1058                           const Standard_Real         Param1     ,
1059                           const Standard_Real         Param2     ,
1060                           const Standard_Real         Param3     ,
1061                           const Standard_Real         Tolerance  ) {
1062
1063                             TheSame1 = Standard_False;
1064                             TheSame2 = Standard_False;
1065                             TheSame3 = Standard_False;
1066                             par1sol = 0.;
1067                             par2sol = 0.;
1068                             par3sol = 0.;
1069                             pararg1 = 0.;
1070                             pararg2 = 0.;
1071                             pararg3 = 0.;
1072
1073                             Standard_Real Tol = Abs(Tolerance);
1074                             WellDone = Standard_False;
1075                             qualifier1 = GccEnt_noqualifier;
1076                             qualifier2 = GccEnt_noqualifier;
1077                             qualifier3 = GccEnt_noqualifier;
1078                             if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() || 
1079                               Qualified1.IsOutside() || Qualified1.IsUnqualified()) ||
1080                               !(Qualified2.IsEnclosed() ||
1081                               Qualified2.IsOutside() || Qualified2.IsUnqualified()) ||
1082                               !(Qualified3.IsEnclosed() || Qualified3.IsEnclosing() || 
1083                               Qualified3.IsOutside() || Qualified3.IsUnqualified())) {
1084                                 throw GccEnt_BadQualifier();
1085                                 return;
1086                             }
1087                             gp_Circ2d C1 = Qualified1.Qualified();
1088                             gp_Lin2d L2 = Qualified2.Qualified();
1089                             Geom2dAdaptor_Curve Cu3 = Qualified3.Qualified();
1090                             Geom2dGcc_FunctionTanCuCuCu Func(C1,L2,Cu3);
1091                             math_Vector Umin(1,3);
1092                             math_Vector Umax(1,3);
1093                             math_Vector Ufirst(1,3);
1094                             math_Vector tol(1,3);
1095                             Umin(1) = 0.;
1096                             Umin(2) = RealFirst();
1097                             Umin(3) = Geom2dGcc_CurveTool::FirstParameter(Cu3);
1098                             Umax(1) = 2*M_PI;
1099                             Umax(2) = RealLast();
1100                             Umax(3) = Geom2dGcc_CurveTool::LastParameter(Cu3);
1101                             Ufirst(1) = Param1;
1102                             Ufirst(2) = Param2;
1103                             Ufirst(3) = Param3;
1104                             tol(1) = 2.e-15*M_PI;
1105                             tol(2) = 1.e-15;
1106                             tol(3) = Geom2dGcc_CurveTool::EpsX(Cu3,Abs(Tolerance));
1107                             math_FunctionSetRoot Root(Func, tol);
1108                             Root.Perform(Func, Ufirst, Umin, Umax);
1109                             if (Root.IsDone()) {
1110                               Func.Value(Ufirst,Umin);
1111                               Root.Root(Ufirst);
1112                               gp_Pnt2d centre1(C1.Location());
1113                               Standard_Real R1 = C1.Radius();
1114                               gp_Pnt2d point1(centre1.XY()+R1*gp_XY(Cos(Ufirst(1)),Sin(Ufirst(1))));
1115                               gp_Pnt2d centre2(L2.Location());
1116                               gp_Pnt2d point2(centre2.XY()+Ufirst(2)*L2.Direction().XY());
1117                               gp_Pnt2d point3;
1118                               gp_Vec2d Tan3;
1119                               Geom2dGcc_CurveTool::D1(Cu3,Ufirst(3),point3,Tan3);
1120                               GccAna_Circ2d3Tan circ(point1,point2,point3,Tol);
1121                               if (circ.IsDone()) {
1122                                 cirsol = circ.ThisSolution(1);
1123                                 gp_Pnt2d centre(cirsol.Location());
1124                                 gp_Vec2d Tan1(-Sin(Ufirst(1)),Cos(Ufirst(1)));
1125                                 gp_Vec2d Tan2(L2.Direction().XY());
1126                                 Standard_Real normetan1 = Tan1.Magnitude();
1127                                 Standard_Real normetan2 = Tan2.Magnitude();
1128                                 Standard_Real normetan3 = Tan3.Magnitude();
1129                                 gp_Vec2d Vec1(point1,centre);
1130                                 gp_Vec2d Vec2(point2,centre);
1131                                 gp_Vec2d Vec3(point3,centre);
1132                                 Standard_Real normevec1 = Vec1.Magnitude();
1133                                 Standard_Real normevec2 = Vec2.Magnitude();
1134                                 Standard_Real normevec3 = Vec3.Magnitude();
1135                                 Standard_Real dot1,dot2,dot3;
1136                                 if (normevec1 >= gp::Resolution() && normetan1 >= gp::Resolution()) {
1137                                   dot1 = Vec1.Dot(Tan1)/(normevec1*normetan1);
1138                                 }
1139                                 else { dot1 = 0.; }
1140                                 if (normevec2 >= gp::Resolution() && normetan2 >= gp::Resolution()) {
1141                                   dot2 = Vec2.Dot(Tan2)/(normevec2*normetan2);
1142                                 }
1143                                 else { dot2 = 0.; }
1144                                 if (normevec3 >= gp::Resolution() && normetan3 >= gp::Resolution()) {
1145                                   dot3 = Vec3.Dot(Tan3)/(normevec3*normetan3);
1146                                 }
1147                                 else { dot3 = 0.; }
1148                                 Tol = 1.e-12;
1149                                 if (dot1 <= Tol && dot2 <=Tol && dot3 <= Tol) {
1150                                   Standard_Real dist = centre1.Distance(centre);
1151                                   Standard_Real Rsol = cirsol.Radius();
1152                                   if (Qualified1.IsUnqualified() || 
1153                                     (Qualified1.IsEnclosing() && Rsol >= R1 && dist <= Rsol)||
1154                                     (Qualified1.IsOutside() && dist >= Rsol) ||
1155                                     (Qualified1.IsEnclosed() && Rsol <= R1 && dist <= Rsol)) {
1156                                       Standard_Real pscal=centre.XY().Dot(gp_XY(-L2.Direction().Y(),
1157                                         L2.Direction().X()));
1158                                       if (Qualified2.IsUnqualified() || 
1159                                         (Qualified2.IsOutside() && pscal <= 0.) ||
1160                                         (Qualified2.IsEnclosed() && pscal >= 0.)) {
1161                                           Standard_Real Angle1 = Vec3.Angle(Tan3);
1162                                           if (Qualified3.IsUnqualified() || 
1163                                             (Qualified3.IsEnclosing()&&Angle1<=0.)||
1164                                             (Qualified3.IsOutside() && Angle1 >= 0) ||
1165                                             (Qualified3.IsEnclosed() && Angle1 <= 0.)) {
1166                                               qualifier1 = Qualified1.Qualifier();
1167                                               qualifier2 = Qualified2.Qualifier();
1168                                               qualifier3 = Qualified3.Qualifier();
1169                                               pararg1 = Ufirst(1);
1170                                               par1sol = 0.;
1171                                               pnttg1sol = point1;
1172                                               pararg2 = Ufirst(2);
1173                                               pnttg2sol = point2;
1174                                               par2sol = 0.;
1175                                               pararg3 = Ufirst(3);
1176                                               pnttg3sol = point3;
1177                                               par3sol = 0.;
1178                                               WellDone = Standard_True;
1179                                           }
1180                                       }
1181                                   }
1182                                 }
1183                               }
1184                             }
1185 }
1186
1187 Geom2dGcc_Circ2d3TanIter::
1188 Geom2dGcc_Circ2d3TanIter (const GccEnt_QualifiedCirc& Qualified1 , 
1189                           const Geom2dGcc_QCurve&     Qualified2 ,
1190                           const gp_Pnt2d&             Point3     ,
1191                           const Standard_Real         Param1     ,
1192                           const Standard_Real         Param2     ,
1193                           const Standard_Real         Tolerance  ) {
1194
1195                             TheSame1 = Standard_False;
1196                             TheSame2 = Standard_False;
1197                             TheSame3 = Standard_False;
1198                             par1sol = 0.;
1199                             par2sol = 0.;
1200                             par3sol = 0.;
1201                             pararg1 = 0.;
1202                             pararg2 = 0.;
1203                             pararg3 = 0.;
1204
1205                             Standard_Real Tol = Abs(Tolerance);
1206                             WellDone = Standard_False;
1207                             qualifier1 = GccEnt_noqualifier;
1208                             qualifier2 = GccEnt_noqualifier;
1209                             qualifier3 = GccEnt_noqualifier;
1210                             if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() || 
1211                               Qualified1.IsOutside() || Qualified1.IsUnqualified()) ||
1212                               !(Qualified2.IsEnclosed() || Qualified2.IsEnclosing() || 
1213                               Qualified2.IsOutside() || Qualified2.IsUnqualified())) {
1214                                 throw GccEnt_BadQualifier();
1215                                 return;
1216                             }
1217                             gp_Circ2d C1 = Qualified1.Qualified();
1218                             Geom2dAdaptor_Curve Cu2 = Qualified2.Qualified();
1219                             gp_Dir2d dirx(1.,0.);
1220                             gp_Circ2d C3(gp_Ax2d(Point3,dirx),0.);
1221                             Geom2dGcc_FunctionTanCuCuCu Func(C1,C3,Cu2);
1222                             math_Vector Umin(1,3);
1223                             math_Vector Umax(1,3);
1224                             math_Vector Ufirst(1,3);
1225                             math_Vector tol(1,3);
1226                             Umin(1) = 0.;
1227                             Umin(3) = Geom2dGcc_CurveTool::FirstParameter(Cu2);
1228                             Umin(2) = 0.;
1229                             Umax(1) = 2*M_PI;
1230                             Umax(3) = Geom2dGcc_CurveTool::LastParameter(Cu2);
1231                             Umax(2) = 2*M_PI;
1232                             Ufirst(1) = Param1;
1233                             Ufirst(2) = M_PI;
1234                             Ufirst(3) = Param2;
1235                             tol(1) = 2.e-15*M_PI;
1236                             tol(2) = 2.e-15*M_PI;
1237                             tol(3) = Geom2dGcc_CurveTool::EpsX(Cu2,Abs(Tolerance));
1238                             math_FunctionSetRoot Root(Func, tol);
1239                             Root.Perform(Func, Ufirst, Umin, Umax);
1240                             if (Root.IsDone()) {
1241                               Root.Root(Ufirst);
1242                               Func.Value(Ufirst,Umin);
1243                               gp_Pnt2d centre1(C1.Location());
1244                               Standard_Real R1 = C1.Radius();
1245                               gp_Pnt2d point1(centre1.XY()+R1*gp_XY(Cos(Ufirst(1)),Sin(Ufirst(1))));
1246                               gp_Pnt2d point2;
1247                               //     gp_Vec2d Tan2,Nor2;
1248                               gp_Vec2d Tan2;
1249                               Geom2dGcc_CurveTool::D1(Cu2,Ufirst(2),point2,Tan2);
1250                               GccAna_Circ2d3Tan circ(point1,point2,Point3,Tol);
1251                               if (circ.IsDone()) {
1252                                 cirsol = circ.ThisSolution(1);
1253                                 gp_Pnt2d centre(cirsol.Location());
1254                                 gp_Vec2d Tan1(-Sin(Ufirst(1)),Cos(Ufirst(1)));
1255                                 gp_Vec2d Tan3(-Sin(Ufirst(3)),Cos(Ufirst(3)));
1256                                 Standard_Real normetan2 = Tan2.Magnitude();
1257                                 gp_Vec2d Vec1(point1,centre);
1258                                 gp_Vec2d Vec2(point2,centre);
1259                                 gp_Vec2d Vec3(Point3,centre);
1260                                 Standard_Real normevec1 = Vec1.Magnitude();
1261                                 Standard_Real normevec2 = Vec2.Magnitude();
1262                                 Standard_Real normevec3 = Vec3.Magnitude();
1263                                 Standard_Real dot1,dot2,dot3;
1264                                 if (normevec1 >= gp::Resolution()) {
1265                                   dot1 = Vec1.Dot(Tan1)/(normevec1);
1266                                 }
1267                                 else { dot1 = 0.; }
1268                                 if (normevec2 >= gp::Resolution() && normetan2 >= gp::Resolution()) {
1269                                   dot2 = Vec2.Dot(Tan2)/(normevec2*normetan2);
1270                                 }
1271                                 else { dot2 = 0.; }
1272                                 if (normevec3 >= gp::Resolution()) {
1273                                   dot3 = Vec3.Dot(Tan3)/(normevec3);
1274                                 }
1275                                 else { dot3 = 0.; }
1276                                 Tol = 1.e-12;
1277                                 if (dot1 <= Tol && dot2 <=Tol && dot3 <= Tol) {
1278                                   Standard_Real dist = centre1.Distance(centre);
1279                                   Standard_Real Rsol = cirsol.Radius();
1280                                   if (Qualified1.IsUnqualified() || 
1281                                     (Qualified1.IsEnclosing() && Rsol >= R1 && dist <= Rsol)||
1282                                     (Qualified1.IsOutside() && dist >= Rsol) ||
1283                                     (Qualified1.IsEnclosed() && Rsol <= R1 && dist <= Rsol)) {
1284                                       Standard_Real Angle1 = Vec2.Angle(Tan2);
1285                                       if (Qualified2.IsUnqualified() || 
1286                                         (Qualified2.IsEnclosing()&&Angle1<=0.)||
1287                                         (Qualified2.IsOutside() && Angle1 >= 0) ||
1288                                         (Qualified2.IsEnclosed() && Angle1 <= 0.)) {
1289                                           qualifier1 = Qualified1.Qualifier();
1290                                           qualifier2 = Qualified2.Qualifier();
1291                                           qualifier3 = GccEnt_noqualifier;
1292                                           pararg1 = Ufirst(1);
1293                                           par1sol = 0.;
1294                                           pnttg1sol = point1;
1295                                           pararg2 = Ufirst(2);
1296                                           pnttg2sol = point2;
1297                                           par2sol = 0.;
1298                                           pararg3 = 0.;
1299                                           pnttg3sol = Point3;
1300                                           par3sol = 0.;
1301                                           WellDone = Standard_True;
1302                                       }
1303                                   }
1304                                 }
1305                               }
1306                             }
1307 }
1308
1309 Standard_Boolean Geom2dGcc_Circ2d3TanIter::
1310 IsDone () const{ return WellDone; }
1311
1312 gp_Circ2d Geom2dGcc_Circ2d3TanIter::
1313 ThisSolution () const{ return cirsol; }
1314
1315 void Geom2dGcc_Circ2d3TanIter:: 
1316 WhichQualifier (GccEnt_Position& Qualif1  ,
1317                 GccEnt_Position& Qualif2  ,
1318                 GccEnt_Position& Qualif3  ) const
1319 {
1320   if (!WellDone) { throw StdFail_NotDone(); }
1321   else {
1322     Qualif1 = qualifier1;
1323     Qualif2 = qualifier2;
1324     Qualif3 = qualifier3;
1325   }
1326 }
1327
1328 void Geom2dGcc_Circ2d3TanIter:: 
1329 Tangency1 (Standard_Real&      ParSol ,
1330            Standard_Real&      ParArg ,
1331            gp_Pnt2d&           PntSol ) const{
1332              if (!WellDone) { throw StdFail_NotDone(); }
1333              else {
1334                if (TheSame1 == 0) {
1335                  ParSol = par1sol;
1336                  ParArg = pararg1;
1337                  PntSol = pnttg1sol;
1338                }
1339                else { throw StdFail_NotDone(); }
1340              }
1341 }
1342
1343 void Geom2dGcc_Circ2d3TanIter:: 
1344 Tangency2 (Standard_Real&      ParSol         ,
1345            Standard_Real&      ParArg         ,
1346            gp_Pnt2d&  PntSol         ) const{
1347              if (!WellDone) { throw StdFail_NotDone(); }
1348              else {
1349                ParSol = par2sol;
1350                ParArg = pararg2;
1351                PntSol = pnttg2sol;
1352              }
1353 }
1354
1355 void Geom2dGcc_Circ2d3TanIter:: 
1356 Tangency3 (Standard_Real&      ParSol         ,
1357            Standard_Real&      ParArg         ,
1358            gp_Pnt2d&  PntSol         ) const{
1359              if (!WellDone) { throw StdFail_NotDone(); }
1360              else {
1361                ParSol = par3sol;
1362                ParArg = pararg3;
1363                PntSol = pnttg3sol;
1364              }
1365 }
1366
1367 Standard_Boolean Geom2dGcc_Circ2d3TanIter::
1368 IsTheSame1 () const
1369 {
1370   if (!WellDone) throw StdFail_NotDone();
1371
1372   if (TheSame1 == 0) 
1373     return Standard_False;
1374
1375   return Standard_True;
1376 }
1377
1378
1379 Standard_Boolean Geom2dGcc_Circ2d3TanIter::
1380 IsTheSame2 () const
1381 {
1382   if (!WellDone) throw StdFail_NotDone();
1383
1384   if (TheSame3 == 0) 
1385     return Standard_False;
1386
1387   return Standard_True;
1388
1389 }
1390
1391 Standard_Boolean Geom2dGcc_Circ2d3TanIter::
1392 IsTheSame3 () const
1393 {
1394   if (!WellDone) throw StdFail_NotDone();
1395
1396   return Standard_True;
1397 }