0024510: Remove unused local variables
[occt.git] / src / GccAna / GccAna_Circ2d2TanOn_11.cxx
CommitLineData
b311480e 1// Created on: 1992-01-02
2// Created by: Remi GILET
3// Copyright (c) 1992-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
973c2be1 8// This library is free software; you can redistribute it and / or modify it
9// under the terms of the GNU Lesser General Public 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17//=========================================================================
0d969553
Y
18// Creation of a circle tangent to two elements : Straight line. +
19// Circle. +
7fd59977 20// Point. +
0d969553
Y
21// center on a third : Straight line. +
22// Circle. +
7fd59977 23//=========================================================================
24
25#include <GccAna_Circ2d2TanOn.jxx>
26
27#include <ElCLib.hxx>
28#include <gp_Dir2d.hxx>
29#include <gp_Ax2d.hxx>
30#include <IntAna2d_AnaIntersection.hxx>
31#include <IntAna2d_IntPoint.hxx>
32#include <GccAna_Lin2dBisec.hxx>
33
34//=========================================================================
0d969553
Y
35// Creation of a circle passing by : 2 points Point1 and Point2. +
36// Center on : 1 circle OnCirc. +
37// with a Tolerance of precision : Tolerance. +
7fd59977 38// +
0d969553
Y
39// Create L1 the straight line of points equidistant to Point1 and Point2. +
40// Create then solutions cirsol so that : +
41// cirsol is the set of circles with center in one of inter- +
42// sections of L1 with OnCirc and the radius the distance between Point1 and +
43// the point calculated below. +
7fd59977 44//=========================================================================
45
46GccAna_Circ2d2TanOn::
47 GccAna_Circ2d2TanOn (const gp_Pnt2d& Point1 ,
48 const gp_Pnt2d& Point2 ,
49 const gp_Circ2d& OnCirc ,
50 const Standard_Real Tolerance ):
51 cirsol(1,2) ,
52 qualifier1(1,2) ,
53 qualifier2(1,2) ,
54 TheSame1(1,2) ,
55 TheSame2(1,2) ,
56 pnttg1sol(1,2) ,
57 pnttg2sol(1,2) ,
58 pntcen(1,2) ,
59 par1sol(1,2) ,
60 par2sol(1,2) ,
61 pararg1(1,2) ,
62 pararg2(1,2) ,
63 parcen3(1,2)
64{
65 TheSame1.Init(0);
66 TheSame2.Init(0);
67 WellDone = Standard_False;
68 NbrSol = 0;
69 gp_Dir2d dirx(1.,0.);
70 Standard_Real Tol = Abs(Tolerance);
71 Standard_Real dist = Point1.Distance(Point2);
72 Standard_Real dp1cen = Point1.Distance(OnCirc.Location());
73 Standard_Real dp2cen = Point2.Distance(OnCirc.Location());
74 Standard_Real R = OnCirc.Radius();
75 gp_Circ2d C1 = OnCirc;
76 if (dist<Tol||Abs(dp1cen+2*R-dp2cen)<Tol||Abs(dp2cen+2*R-dp1cen)<Tol){
77 WellDone = Standard_True;
78 return;
79 }
80 gp_Lin2d L1(gp_Pnt2d((Point1.XY()+Point2.XY())/2.0),
81 gp_Dir2d(Point1.Y()-Point2.Y(),Point2.X()-Point1.X()));
82 if (Abs(dp1cen+2*R-dp2cen)<Tol || Abs(dp2cen+2*R-dp1cen)<Tol) {
83 if (Abs(dp1cen+2*R-dp2cen)<Tol) {
84 C1 = gp_Circ2d(gp_Ax2d(OnCirc.Location(),dirx),
85 OnCirc.Radius()+Abs(dp2cen-dp1cen-2.0*R));
86 }
87 else if (Abs(dp1cen+2*R-dp2cen)<Tol) {
88 C1 = gp_Circ2d(gp_Ax2d(OnCirc.Location(),dirx),
89 OnCirc.Radius()+Abs(dp2cen-dp1cen-2.0*R));
90 }
91 }
92 IntAna2d_AnaIntersection Intp(L1,C1);
93 if (Intp.IsDone()) {
94 if (!Intp.IsEmpty()) {
95 for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
96 NbrSol++;
97 gp_Ax2d axe(Intp.Point(i).Value(),dirx);
98 cirsol(NbrSol) = gp_Circ2d(axe,Point1.Distance(Intp.Point(i).Value()));
99// ======================================================================
100 qualifier1(NbrSol) = GccEnt_noqualifier;
101 qualifier2(NbrSol) = GccEnt_noqualifier;
102 pnttg1sol(NbrSol) = Point1;
103 pararg1(NbrSol) = 0.;
104 par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),pnttg1sol(NbrSol));
105 pnttg2sol(NbrSol) = Point2;
106 pararg2(NbrSol) = 0.;
107 par2sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),pnttg2sol(NbrSol));
108 pntcen(NbrSol) = cirsol(NbrSol).Location();
109 parcen3(NbrSol)=ElCLib::Parameter(OnCirc,pntcen(NbrSol));
110 }
111 }
112 WellDone = Standard_True;
113 }
114}
115
116