1 // File: GccAna_Circ2d2TanOn_5.cxx
2 // Created: Thu Jan 2 15:55:26 1992
6 #include <GccAna_Circ2d2TanOn.jxx>
9 #include <gp_Dir2d.hxx>
10 #include <gp_Ax2d.hxx>
11 #include <IntAna2d_AnaIntersection.hxx>
12 #include <IntAna2d_IntPoint.hxx>
14 //=========================================================================
15 // Creation of a circle passing by : 2 points Point1 and Point2. +
16 // Centered on : 1 straight line OnLine. +
17 // with a Tolerance of precision : Tolerance. +
19 // Create L1 straight line of points equidistant from Point1 and Point2. +
20 // Then create solutions cirsol such as : +
21 // cirsol is all circle with center at the intersections of +
22 // L1 with OnLine and the radius the distance between Point1 and the point +
23 // calculated above. +
24 //=========================================================================
27 GccAna_Circ2d2TanOn (const gp_Pnt2d& Point1 ,
28 const gp_Pnt2d& Point2 ,
29 const gp_Lin2d& OnLine ,
30 const Standard_Real Tolerance ):
47 WellDone = Standard_False;
51 Standard_Real dist = Point1.Distance(Point2);
52 if (dist < Abs(Tolerance)) { WellDone = Standard_True; }
54 gp_Lin2d L1(gp_Pnt2d((Point1.XY()+Point2.XY())/2.0),
55 gp_Dir2d(Point1.Y()-Point2.Y(),Point2.X()-Point1.X()));
56 IntAna2d_AnaIntersection Intp(L1,OnLine);
58 if (!Intp.IsEmpty()) {
59 for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
61 gp_Ax2d axe(Intp.Point(i).Value(),dirx);
62 cirsol(NbrSol)=gp_Circ2d(axe,Point1.Distance(Intp.Point(i).Value()));
63 // ====================================================================
64 qualifier1(NbrSol) = GccEnt_noqualifier;
65 qualifier2(NbrSol) = GccEnt_noqualifier;
66 pnttg1sol(NbrSol) = Point1;
67 pnttg2sol(NbrSol) = Point2;
68 pntcen(NbrSol) = cirsol(NbrSol).Location();
71 par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),pnttg1sol(NbrSol));
72 par2sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),pnttg2sol(NbrSol));
73 parcen3(NbrSol)=ElCLib::Parameter(OnLine,pntcen(NbrSol));
76 WellDone = Standard_True;