1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 //========================================================================
16 // circulaire tangent a un element de type : - Cercle. +
19 // centre sur un deuxieme element de type : - Cercle. +
21 // de rayon donne : Radius. +
22 //========================================================================
24 #include <Adaptor2d_OffsetCurve.hxx>
26 #include <GccEnt_BadQualifier.hxx>
27 #include <GccEnt_QualifiedCirc.hxx>
28 #include <GccEnt_QualifiedLin.hxx>
29 #include <Geom2dAdaptor_Curve.hxx>
30 #include <Geom2dAdaptor_HCurve.hxx>
31 #include <Geom2dGcc_Circ2dTanOnRadGeo.hxx>
32 #include <Geom2dGcc_CurveTool.hxx>
33 #include <Geom2dGcc_QCurve.hxx>
34 #include <Geom2dInt_GInter.hxx>
35 #include <gp_Circ2d.hxx>
36 #include <gp_Dir2d.hxx>
37 #include <gp_Lin2d.hxx>
38 #include <gp_Pnt2d.hxx>
39 #include <IntRes2d_Domain.hxx>
40 #include <IntRes2d_IntersectionPoint.hxx>
41 #include <math_DirectPolynomialRoots.hxx>
42 #include <Standard_NegativeValue.hxx>
43 #include <Standard_OutOfRange.hxx>
44 #include <StdFail_NotDone.hxx>
45 #include <TColStd_Array1OfReal.hxx>
47 //=========================================================================
48 // Cercle tangent : a un cercle Qualified1 (C1). +
49 // centre : sur une droite OnLine. +
50 // de rayon : Radius. +
52 // On initialise le tableau de solutions cirsol ainsi que tous les +
54 // On elimine en fonction du qualifieur les cas ne presentant pas de +
56 // On resoud l equation du second degre indiquant que le point de centre +
57 // recherche (xc,yc) est a une distance Radius du cercle C1 et +
58 // sur la droite OnLine. +
59 // Les solutions sont representees par les cercles : +
60 // - de centre Pntcen(xc,yc) +
61 // - de rayon Radius. +
62 //=========================================================================
63 Geom2dGcc_Circ2dTanOnRadGeo::
64 Geom2dGcc_Circ2dTanOnRadGeo (const Geom2dGcc_QCurve& Qualified1,
65 const gp_Lin2d& OnLine ,
66 const Standard_Real Radius ,
67 const Standard_Real Tolerance ):
69 //=========================================================================
70 // Initialisation des champs. +
71 //=========================================================================
83 //=========================================================================
85 //=========================================================================
87 gp_Dir2d dirx(1.0,0.0);
88 Standard_Real Tol = Abs(Tolerance);
89 Standard_Real thefirst = -100000.;
90 Standard_Real thelast = 100000.;
91 Standard_Real firstparam;
92 Standard_Real lastparam;
93 WellDone = Standard_False;
95 if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() ||
96 Qualified1.IsOutside() || Qualified1.IsUnqualified())) {
97 throw GccEnt_BadQualifier();
100 Standard_Integer nbrcote1 = 0;
101 TColStd_Array1OfReal Coef(1,2);
102 Geom2dAdaptor_Curve Cu1 = Qualified1.Qualified();
104 if (Radius < 0.0) { throw Standard_NegativeValue(); }
106 if (Qualified1.IsEnclosed()) {
107 // ===========================
111 else if(Qualified1.IsOutside()) {
112 // ===============================
116 else if(Qualified1.IsUnqualified()) {
117 // ===================================
123 Geom2dInt_TheIntConicCurveOfGInter Intp;
124 for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
125 Handle(Geom2dAdaptor_HCurve) HCu1 = new Geom2dAdaptor_HCurve(Cu1);
126 Adaptor2d_OffsetCurve C2(HCu1,Coef(jcote1));
127 firstparam = Max(C2.FirstParameter(),thefirst);
128 lastparam = Min(C2.LastParameter(),thelast);
129 IntRes2d_Domain D2(C2.Value(firstparam), firstparam, Tol,
130 C2.Value(lastparam), lastparam, Tol);
131 Intp.Perform(OnLine,D1,C2,D2,Tol,Tol);
133 if (!Intp.IsEmpty()) {
134 for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
136 gp_Pnt2d Center(Intp.Point(i).Value());
137 cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
138 // =======================================================
139 qualifier1(NbrSol) = Qualified1.Qualifier();
140 TheSame1(NbrSol) = 0;
141 pararg1(NbrSol) = Intp.Point(i).ParamOnSecond();
142 parcen3(NbrSol) = Intp.Point(i).ParamOnFirst();
143 par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
145 pnttg1sol(NbrSol) = gp_Pnt2d(Geom2dGcc_CurveTool::Value(Cu1,pararg1(NbrSol)));
146 pntcen3(NbrSol) = Center;
149 WellDone = Standard_True;
155 //=========================================================================
156 // Cercle tangent : a un cercle Qualified1 (C1). +
157 // centre : sur une droite OnLine. +
158 // de rayon : Radius. +
160 // On initialise le tableau de solutions cirsol ainsi que tous les +
162 // On elimine en fonction du qualifieur les cas ne presentant pas de +
164 // On resoud l equation du second degre indiquant que le point de centre +
165 // recherche (xc,yc) est a une distance Radius du cercle C1 et +
166 // sur la droite OnLine. +
167 // Les solutions sont representees par les cercles : +
168 // - de centre Pntcen(xc,yc) +
169 // - de rayon Radius. +
170 //=========================================================================
172 Geom2dGcc_Circ2dTanOnRadGeo::
173 Geom2dGcc_Circ2dTanOnRadGeo (const Geom2dGcc_QCurve& Qualified1,
174 const gp_Circ2d& OnCirc ,
175 const Standard_Real Radius ,
176 const Standard_Real Tolerance ):
178 //=========================================================================
179 // Initialisation des champs. +
180 //=========================================================================
192 //=========================================================================
194 //=========================================================================
196 gp_Dir2d dirx(1.0,0.0);
197 Standard_Real thefirst = -100000.;
198 Standard_Real thelast = 100000.;
199 Standard_Real firstparam;
200 Standard_Real lastparam;
201 Standard_Real Tol = Abs(Tolerance);
202 Standard_Integer nbrcote1=0;
203 WellDone = Standard_False;
205 if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() ||
206 Qualified1.IsOutside() || Qualified1.IsUnqualified())) {
207 throw GccEnt_BadQualifier();
210 TColStd_Array1OfReal cote1(1,2);
211 Geom2dAdaptor_Curve Cu1 = Qualified1.Qualified();
214 throw Standard_NegativeValue();
217 if (Qualified1.IsEnclosed()) {
218 // ===========================
222 else if(Qualified1.IsOutside()) {
223 // ===============================
227 else if(Qualified1.IsUnqualified()) {
228 // ===================================
233 IntRes2d_Domain D1(ElCLib::Value(0.,OnCirc), 0.,Tol,
234 ElCLib::Value(2.*M_PI,OnCirc),2.*M_PI,Tol);
235 D1.SetEquivalentParameters(0.,2.*M_PI);
236 Geom2dInt_TheIntConicCurveOfGInter Intp;
237 for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
238 Handle(Geom2dAdaptor_HCurve) HCu1 = new Geom2dAdaptor_HCurve(Cu1);
239 Adaptor2d_OffsetCurve C2(HCu1,cote1(jcote1));
240 firstparam = Max(C2.FirstParameter(),thefirst);
241 lastparam = Min(C2.LastParameter(),thelast);
242 IntRes2d_Domain D2(C2.Value(firstparam),firstparam,Tol,
243 C2.Value(lastparam),lastparam,Tol);
244 Intp.Perform(OnCirc,D1,C2,D2,Tol,Tol);
246 if (!Intp.IsEmpty()) {
247 for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
249 gp_Pnt2d Center(Intp.Point(i).Value());
250 cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
251 // =======================================================
252 qualifier1(NbrSol) = Qualified1.Qualifier();
253 TheSame1(NbrSol) = 0;
254 pararg1(NbrSol) = Intp.Point(i).ParamOnSecond();
255 parcen3(NbrSol) = Intp.Point(i).ParamOnFirst();
256 par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
258 pnttg1sol(NbrSol) = gp_Pnt2d(Geom2dGcc_CurveTool::Value(Cu1,pararg1(NbrSol)));
259 pntcen3(NbrSol) = Center;
262 WellDone = Standard_True;
268 //=========================================================================
269 // Cercle tangent : a un cercle Qualified1 (C1). +
270 // centre : sur une droite OnLine. +
271 // de rayon : Radius. +
273 // On initialise le tableau de solutions cirsol ainsi que tous les +
275 // On elimine en fonction du qualifieur les cas ne presentant pas de +
277 // On resoud l equation du second degre indiquant que le point de centre +
278 // recherche (xc,yc) est a une distance Radius du cercle C1 et +
279 // sur la droite OnLine. +
280 // Les solutions sont representees par les cercles : +
281 // - de centre Pntcen(xc,yc) +
282 // - de rayon Radius. +
283 //=========================================================================
285 Geom2dGcc_Circ2dTanOnRadGeo::
286 Geom2dGcc_Circ2dTanOnRadGeo (const GccEnt_QualifiedCirc& Qualified1,
287 const Geom2dAdaptor_Curve& OnCurv ,
288 const Standard_Real Radius ,
289 const Standard_Real Tolerance ):
291 //=========================================================================
292 // Initialisation des champs. +
293 //=========================================================================
305 //=========================================================================
307 //=========================================================================
309 gp_Dir2d dirx(1.0,0.0);
310 Standard_Real thefirst = -100000.;
311 Standard_Real thelast = 100000.;
312 Standard_Real firstparam;
313 Standard_Real lastparam;
314 Standard_Real Tol = Abs(Tolerance);
315 Standard_Integer nbrcote1=0;
316 WellDone = Standard_False;
318 if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() ||
319 Qualified1.IsOutside() || Qualified1.IsUnqualified())) {
320 throw GccEnt_BadQualifier();
323 TColStd_Array1OfReal cote1(1,2);
324 gp_Circ2d C1 = Qualified1.Qualified();
325 gp_Pnt2d center1(C1.Location());
326 Standard_Real R1 = C1.Radius();
329 throw Standard_NegativeValue();
332 if (Qualified1.IsEnclosed()) {
333 // ===========================
337 else if(Qualified1.IsOutside()) {
338 // ===============================
342 else if(Qualified1.IsUnqualified()) {
343 // ===================================
348 Geom2dInt_TheIntConicCurveOfGInter Intp;
349 for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
350 gp_Circ2d Circ(C1.XAxis(),R1 + cote1(jcote1));
351 IntRes2d_Domain D1(ElCLib::Value(0.,Circ), 0.,Tol,
352 ElCLib::Value(2.*M_PI,Circ),2.*M_PI,Tol);
353 D1.SetEquivalentParameters(0.,2.*M_PI);
354 firstparam = Max(Geom2dGcc_CurveTool::FirstParameter(OnCurv),thefirst);
355 lastparam = Min(Geom2dGcc_CurveTool::LastParameter(OnCurv),thelast);
356 IntRes2d_Domain D2(Geom2dGcc_CurveTool::Value(OnCurv,firstparam),firstparam,Tol,
357 Geom2dGcc_CurveTool::Value(OnCurv,lastparam),lastparam,Tol);
358 Intp.Perform(Circ,D1,OnCurv,D2,Tol,Tol);
360 if (!Intp.IsEmpty()) {
361 for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
363 gp_Pnt2d Center(Intp.Point(i).Value());
364 cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
365 // =======================================================
366 Standard_Real distcc1 = Center.Distance(center1);
367 if (!Qualified1.IsUnqualified()) {
368 qualifier1(NbrSol) = Qualified1.Qualifier();
370 else if (Abs(distcc1+Radius-R1) < Tol) {
371 qualifier1(NbrSol) = GccEnt_enclosed;
373 else if (Abs(distcc1-R1-Radius) < Tol) {
374 qualifier1(NbrSol) = GccEnt_outside;
376 else { qualifier1(NbrSol) = GccEnt_enclosing; }
377 TheSame1(NbrSol) = 0;
378 pararg1(NbrSol) = Intp.Point(i).ParamOnFirst();
379 parcen3(NbrSol) = Intp.Point(i).ParamOnSecond();
380 par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
382 pnttg1sol(NbrSol) = ElCLib::Value(pararg1(NbrSol),C1);
383 pntcen3(NbrSol) = Center;
386 WellDone = Standard_True;
392 //=========================================================================
393 // Cercle tangent : a un cercle Qualified1 (C1). +
394 // centre : sur une droite OnLine. +
395 // de rayon : Radius. +
397 // On initialise le tableau de solutions cirsol ainsi que tous les +
399 // On elimine en fonction du qualifieur les cas ne presentant pas de +
401 // On resoud l equation du second degre indiquant que le point de centre +
402 // recherche (xc,yc) est a une distance Radius du cercle C1 et +
403 // sur la droite OnLine. +
404 // Les solutions sont representees par les cercles : +
405 // - de centre Pntcen(xc,yc) +
406 // - de rayon Radius. +
407 //=========================================================================
409 Geom2dGcc_Circ2dTanOnRadGeo::
410 Geom2dGcc_Circ2dTanOnRadGeo (const GccEnt_QualifiedLin& Qualified1,
411 const Geom2dAdaptor_Curve& OnCurv ,
412 const Standard_Real Radius ,
413 const Standard_Real Tolerance ):
415 //=========================================================================
416 // Initialisation des champs. +
417 //=========================================================================
429 //=========================================================================
431 //=========================================================================
433 gp_Dir2d dirx(1.0,0.0);
434 Standard_Real thefirst = -100000.;
435 Standard_Real thelast = 100000.;
436 Standard_Real firstparam;
437 Standard_Real lastparam;
438 Standard_Real Tol = Abs(Tolerance);
439 WellDone = Standard_False;
441 if (!(Qualified1.IsEnclosed() ||
442 Qualified1.IsOutside() || Qualified1.IsUnqualified())) {
443 throw GccEnt_BadQualifier();
446 Standard_Integer nbrcote1=0;
447 TColStd_Array1OfReal cote1(1,2);
448 gp_Lin2d L1 = Qualified1.Qualified();
449 gp_Pnt2d origin1(L1.Location());
450 gp_Dir2d dir1(L1.Direction());
451 gp_Dir2d norm1(-dir1.Y(),dir1.X());
454 throw Standard_NegativeValue();
457 if (Qualified1.IsEnclosed()) {
458 // ===========================
462 else if(Qualified1.IsOutside()) {
463 // ===============================
467 else if(Qualified1.IsUnqualified()) {
468 // ===================================
473 Geom2dInt_TheIntConicCurveOfGInter Intp;
474 for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
475 gp_Pnt2d Point(dir1.XY()+cote1(jcote1)*norm1.XY());
476 gp_Lin2d Line(Point,dir1); // ligne avec deport.
478 firstparam = Max(Geom2dGcc_CurveTool::FirstParameter(OnCurv),thefirst);
479 lastparam = Min(Geom2dGcc_CurveTool::LastParameter(OnCurv),thelast);
480 IntRes2d_Domain D2(Geom2dGcc_CurveTool::Value(OnCurv,firstparam),firstparam,Tol,
481 Geom2dGcc_CurveTool::Value(OnCurv,lastparam),lastparam,Tol);
482 Intp.Perform(Line,D1,OnCurv,D2,Tol,Tol);
484 if (!Intp.IsEmpty()) {
485 for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
487 gp_Pnt2d Center(Intp.Point(i).Value());
488 cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
489 // =======================================================
490 gp_Dir2d dc1(origin1.XY()-Center.XY());
491 if (!Qualified1.IsUnqualified()) {
492 qualifier1(NbrSol) = Qualified1.Qualifier();
494 else if (dc1.Dot(norm1) > 0.0) {
495 qualifier1(NbrSol) = GccEnt_outside;
497 else { qualifier1(NbrSol) = GccEnt_enclosed; }
498 TheSame1(NbrSol) = 0;
499 pararg1(NbrSol) = Intp.Point(i).ParamOnFirst();
500 parcen3(NbrSol) = Intp.Point(i).ParamOnSecond();
501 par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
503 pnttg1sol(NbrSol) = ElCLib::Value(pararg1(NbrSol),L1);
504 pntcen3(NbrSol) = Center;
507 WellDone = Standard_True;
513 //=========================================================================
514 // Cercle tangent : a un cercle Qualified1 (C1). +
515 // centre : sur une droite OnLine. +
516 // de rayon : Radius. +
518 // On initialise le tableau de solutions cirsol ainsi que tous les +
520 // On elimine en fonction du qualifieur les cas ne presentant pas de +
522 // On resoud l equation du second degre indiquant que le point de centre +
523 // recherche (xc,yc) est a une distance Radius du cercle C1 et +
524 // sur la droite OnLine. +
525 // Les solutions sont representees par les cercles : +
526 // - de centre Pntcen(xc,yc) +
527 // - de rayon Radius. +
528 //=========================================================================
530 Geom2dGcc_Circ2dTanOnRadGeo::
531 Geom2dGcc_Circ2dTanOnRadGeo (const Geom2dGcc_QCurve& Qualified1,
532 const Geom2dAdaptor_Curve& OnCurv ,
533 const Standard_Real Radius ,
534 const Standard_Real Tolerance ):
536 //=========================================================================
537 // Initialisation des champs. +
538 //=========================================================================
550 //=========================================================================
552 //=========================================================================
554 gp_Dir2d dirx(1.0,0.0);
555 Standard_Real thefirst = -100000.;
556 Standard_Real thelast = 100000.;
557 Standard_Real firstparam;
558 Standard_Real lastparam;
559 Standard_Real Tol = Abs(Tolerance);
560 Standard_Integer nbrcote1=0;
561 WellDone = Standard_False;
563 if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() ||
564 Qualified1.IsOutside() || Qualified1.IsUnqualified())) {
565 throw GccEnt_BadQualifier();
568 TColStd_Array1OfReal cote1(1,2);
569 Geom2dAdaptor_Curve Cu1 = Qualified1.Qualified();
572 throw Standard_NegativeValue();
575 if (Qualified1.IsEnclosed()) {
576 // ===========================
580 else if(Qualified1.IsOutside()) {
581 // ===============================
585 else if(Qualified1.IsUnqualified()) {
586 // ===================================
591 Geom2dInt_GInter Intp;
592 for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
593 Handle(Geom2dAdaptor_HCurve) HCu1 = new Geom2dAdaptor_HCurve(Cu1);
594 Adaptor2d_OffsetCurve C1(HCu1,cote1(jcote1));
595 firstparam = Max(C1.FirstParameter(),thefirst);
596 lastparam = Min(C1.LastParameter(),thelast);
597 IntRes2d_Domain D1(C1.Value(firstparam), firstparam, Tol,
598 C1.Value(lastparam), lastparam, Tol);
599 Handle(Geom2dAdaptor_HCurve) HOnCurv = new Geom2dAdaptor_HCurve(OnCurv);
600 Adaptor2d_OffsetCurve C2(HOnCurv);
601 firstparam = Max(C2.FirstParameter(),thefirst);
602 lastparam = Min(C2.LastParameter(),thelast);
603 IntRes2d_Domain D2(C2.Value(firstparam), firstparam, Tol,
604 C2.Value(lastparam), lastparam, Tol);
605 Intp.Perform(C1,D1,C2,D2,Tol,Tol);
607 if (!Intp.IsEmpty()) {
608 for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
610 gp_Pnt2d Center(Intp.Point(i).Value());
611 cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
612 // =======================================================
613 qualifier1(NbrSol) = Qualified1.Qualifier();
614 TheSame1(NbrSol) = 0;
615 pararg1(NbrSol) = Intp.Point(i).ParamOnFirst();
616 parcen3(NbrSol) = Intp.Point(i).ParamOnSecond();
617 par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
619 pnttg1sol(NbrSol) = gp_Pnt2d(Geom2dGcc_CurveTool::Value(Cu1,pararg1(NbrSol)));
620 pntcen3(NbrSol) = Center;
623 WellDone = Standard_True;
629 //=========================================================================
630 // Cercle tangent : a un cercle Qualified1 (C1). +
631 // centre : sur une droite OnLine. +
632 // de rayon : Radius. +
634 // On initialise le tableau de solutions cirsol ainsi que tous les +
636 // On elimine en fonction du qualifieur les cas ne presentant pas de +
638 // On resoud l equation du second degre indiquant que le point de centre +
639 // recherche (xc,yc) est a une distance Radius du cercle C1 et +
640 // sur la droite OnLine. +
641 // Les solutions sont representees par les cercles : +
642 // - de centre Pntcen(xc,yc) +
643 // - de rayon Radius. +
644 //=========================================================================
646 Geom2dGcc_Circ2dTanOnRadGeo::
647 Geom2dGcc_Circ2dTanOnRadGeo (const gp_Pnt2d& Point1 ,
648 const Geom2dAdaptor_Curve& OnCurv ,
649 const Standard_Real Radius ,
650 const Standard_Real Tolerance ):
652 //=========================================================================
653 // Initialisation des champs. +
654 //=========================================================================
666 //=========================================================================
668 //=========================================================================
670 gp_Dir2d dirx(1.0,0.0);
671 Standard_Real thefirst = -100000.;
672 Standard_Real thelast = 100000.;
673 Standard_Real firstparam;
674 Standard_Real lastparam;
675 Standard_Real Tol = Abs(Tolerance);
676 WellDone = Standard_False;
680 throw Standard_NegativeValue();
683 // gp_Dir2d Dir(-y1dir,x1dir);
684 gp_Circ2d Circ(gp_Ax2d(Point1,gp_Dir2d(1.,0.)),Radius);
685 IntRes2d_Domain D1(ElCLib::Value(0.,Circ), 0.,Tol,
686 ElCLib::Value(2.*M_PI,Circ),2*M_PI,Tol);
687 D1.SetEquivalentParameters(0.,2.*M_PI);
688 firstparam = Max(Geom2dGcc_CurveTool::FirstParameter(OnCurv),thefirst);
689 lastparam = Min(Geom2dGcc_CurveTool::LastParameter(OnCurv),thelast);
690 IntRes2d_Domain D2(Geom2dGcc_CurveTool::Value(OnCurv,firstparam),firstparam,Tol,
691 Geom2dGcc_CurveTool::Value(OnCurv,lastparam),lastparam,Tol);
692 Geom2dInt_TheIntConicCurveOfGInter Intp(Circ,D1,OnCurv,D2,Tol,Tol);
694 if (!Intp.IsEmpty()) {
695 for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
697 gp_Pnt2d Center(Intp.Point(i).Value());
698 cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
699 // =======================================================
700 qualifier1(NbrSol) = GccEnt_noqualifier;
701 TheSame1(NbrSol) = 0;
702 pararg1(NbrSol) = Intp.Point(i).ParamOnFirst();
703 parcen3(NbrSol) = Intp.Point(i).ParamOnSecond();
704 par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
706 pnttg1sol(NbrSol) = Point1;
707 pntcen3(NbrSol) = Center;
709 WellDone = Standard_True;
715 //=========================================================================
717 Standard_Boolean Geom2dGcc_Circ2dTanOnRadGeo::
718 IsDone () const { return WellDone; }
720 Standard_Integer Geom2dGcc_Circ2dTanOnRadGeo::
721 NbSolutions () const { return NbrSol; }
723 gp_Circ2d Geom2dGcc_Circ2dTanOnRadGeo::
724 ThisSolution (const Standard_Integer Index) const
727 if (Index > NbrSol || Index <= 0)
728 throw Standard_OutOfRange();
730 return cirsol(Index);
733 void Geom2dGcc_Circ2dTanOnRadGeo::
734 WhichQualifier(const Standard_Integer Index ,
735 GccEnt_Position& Qualif1 ) const
737 if (!WellDone) { throw StdFail_NotDone(); }
738 else if (Index <= 0 ||Index > NbrSol) { throw Standard_OutOfRange(); }
740 Qualif1 = qualifier1(Index);
744 void Geom2dGcc_Circ2dTanOnRadGeo::
745 Tangency1 (const Standard_Integer Index,
746 Standard_Real& ParSol,
747 Standard_Real& ParArg,
748 gp_Pnt2d& PntSol) const{
750 throw StdFail_NotDone();
752 else if (Index <= 0 ||Index > NbrSol) {
753 throw Standard_OutOfRange();
756 ParSol = par1sol(Index);
757 ParArg = pararg1(Index);
758 PntSol = gp_Pnt2d(pnttg1sol(Index));
762 void Geom2dGcc_Circ2dTanOnRadGeo::
763 CenterOn3 (const Standard_Integer Index,
764 Standard_Real& ParArg,
765 gp_Pnt2d& PntSol) const {
767 throw StdFail_NotDone();
769 else if (Index <= 0 ||Index > NbrSol) {
770 throw Standard_OutOfRange();
773 ParArg = parcen3(Index);
774 PntSol = pnttg1sol(Index);
778 Standard_Boolean Geom2dGcc_Circ2dTanOnRadGeo::
779 IsTheSame1 (const Standard_Integer Index) const
781 if (!WellDone) throw StdFail_NotDone();
782 if (Index <= 0 ||Index > NbrSol) throw Standard_OutOfRange();
784 if (TheSame1(Index) == 0)
785 return Standard_False;
787 return Standard_True;