0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / GccAna / GccAna_Circ2d3Tan.hxx
1 // Created on: 1991-03-18
2 // Created by: Remy 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 #ifndef _GccAna_Circ2d3Tan_HeaderFile
18 #define _GccAna_Circ2d3Tan_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <TColgp_Array1OfCirc2d.hxx>
27 #include <GccEnt_Array1OfPosition.hxx>
28 #include <TColStd_Array1OfInteger.hxx>
29 #include <TColgp_Array1OfPnt2d.hxx>
30 #include <TColStd_Array1OfReal.hxx>
31 #include <Standard_Real.hxx>
32 #include <GccEnt_Position.hxx>
33 class Standard_OutOfRange;
34 class StdFail_NotDone;
35 class GccEnt_BadQualifier;
36 class GccEnt_QualifiedCirc;
37 class GccEnt_QualifiedLin;
38 class gp_Pnt2d;
39 class gp_Circ2d;
40
41
42 //! This class implements the algorithms used to
43 //! create 2d circles tangent to 3 points/lines/circles.
44 //! The arguments of all construction methods are :
45 //! - The three qualified elements for the
46 //! tangency constraints (QualifiedCirc, QualifiedLine,
47 //! Points).
48 //! - A real Tolerance.
49 //! Tolerance is only used in the limit cases.
50 //! For example :
51 //! We want to create a circle tangent to an UnqualifiedCirc
52 //! C1 and an UnqualifiedCirc C2 and an UnqualifiedCirc C3
53 //! with a tolerance Tolerance.
54 //! If we do not use Tolerance it is impossible to find
55 //! a solution in the following case : C2 is inside C1
56 //! and there is no intersection point between the two
57 //! circles, and C3 is completly outside C1.
58 //! With Tolerance we will find a solution if the
59 //! lowest distance between C1 and C2 is lower than or
60 //! equal Tolerance.
61 class GccAna_Circ2d3Tan 
62 {
63 public:
64
65   DEFINE_STANDARD_ALLOC
66
67   
68   //! This method implements the algorithms used to
69   //! create 2d circles tangent to 3 circles.
70   //! ConstructionError is raised if there is a problem during
71   //! the computation.
72   Standard_EXPORT GccAna_Circ2d3Tan(const GccEnt_QualifiedCirc& Qualified1, const GccEnt_QualifiedCirc& Qualified2, const GccEnt_QualifiedCirc& Qualified3, const Standard_Real Tolerance);
73   
74   //! This method implements the algorithms used to
75   //! create 2d circles tangent to 2 circles and 1 line.
76   //! ConstructionError is raised if there is a problem during
77   //! the computation.
78   Standard_EXPORT GccAna_Circ2d3Tan(const GccEnt_QualifiedCirc& Qualified1, const GccEnt_QualifiedCirc& Qualified2, const GccEnt_QualifiedLin& Qualified3, const Standard_Real Tolerance);
79   
80   //! This method implements the algorithms used to
81   //! create 2d circles tangent to 1 circle and 2 lines.
82   //! ConstructionError is raised if there is a problem during
83   //! the computation.
84   Standard_EXPORT GccAna_Circ2d3Tan(const GccEnt_QualifiedCirc& Qualified1, const GccEnt_QualifiedLin& Qualified2, const GccEnt_QualifiedLin& Qualified3, const Standard_Real Tolerance);
85   
86   //! This method implements the algorithms used to
87   //! create 2d circles tangent to 3 lines.
88   //! ConstructionError is raised if there is a problem during
89   //! the computation.
90   Standard_EXPORT GccAna_Circ2d3Tan(const GccEnt_QualifiedLin& Qualified1, const GccEnt_QualifiedLin& Qualified2, const GccEnt_QualifiedLin& Qualified3, const Standard_Real Tolerance);
91   
92   //! This method implements the algorithms used to
93   //! create 2d circles tangent to 2 circles and 1 Point.
94   //! ConstructionError is raised if there is a problem during
95   //! the computation.
96   Standard_EXPORT GccAna_Circ2d3Tan(const GccEnt_QualifiedCirc& Qualified1, const GccEnt_QualifiedCirc& Qualified2, const gp_Pnt2d& Point3, const Standard_Real Tolerance);
97   
98   //! This method implements the algorithms used to
99   //! create 2d circles tangent to a circle and a line and
100   //! 1 Point.
101   //! ConstructionError is raised if there is a problem during
102   //! the computation.
103   Standard_EXPORT GccAna_Circ2d3Tan(const GccEnt_QualifiedCirc& Qualified1, const GccEnt_QualifiedLin& Qualified2, const gp_Pnt2d& Point3, const Standard_Real Tolerance);
104   
105   //! This method implements the algorithms used to
106   //! create 2d circles tangent to 2 lines and 1 Point.
107   //! ConstructionError is raised if there is a problem during
108   //! the computation.
109   Standard_EXPORT GccAna_Circ2d3Tan(const GccEnt_QualifiedLin& Qualified1, const GccEnt_QualifiedLin& Qualified2, const gp_Pnt2d& Point3, const Standard_Real Tolerance);
110   
111   //! This method implements the algorithms used to
112   //! create 2d circles tangent to a circle and passing
113   //! thrue 2 Points.
114   //! ConstructionError is raised if there is a problem during
115   //! the computation.
116   Standard_EXPORT GccAna_Circ2d3Tan(const GccEnt_QualifiedCirc& Qualified1, const gp_Pnt2d& Point2, const gp_Pnt2d& Point3, const Standard_Real Tolerance);
117   
118   //! This method implements the algorithms used to
119   //! create 2d circles tangent to a line and passing
120   //! thrue 2 Points.
121   //! ConstructionError is raised if there is a problem during
122   //! the computation.
123   Standard_EXPORT GccAna_Circ2d3Tan(const GccEnt_QualifiedLin& Qualified1, const gp_Pnt2d& Point2, const gp_Pnt2d& Point3, const Standard_Real Tolerance);
124   
125   //! This method implements the algorithms used to
126   //! create 2d circles passing thrue 3 Points.
127   //! ConstructionError is raised if there is a problem during
128   //! the computation.
129   Standard_EXPORT GccAna_Circ2d3Tan(const gp_Pnt2d& Point1, const gp_Pnt2d& Point2, const gp_Pnt2d& Point3, const Standard_Real Tolerance);
130   
131   //! This method returns True if the construction
132   //! algorithm succeeded.
133   //! Note: IsDone protects against a failure arising from a
134   //! more internal intersection algorithm, which has
135   //! reached its numeric limits.
136   Standard_EXPORT Standard_Boolean IsDone() const;
137   
138   //! This method returns the number of solutions.
139   //! Raises NotDone if the construction algorithm didn't succeed.
140   Standard_EXPORT Standard_Integer NbSolutions() const;
141   
142   //! Returns the solution number Index and raises OutOfRange
143   //! exception if Index is greater than the number of
144   //! solutions.
145   //! Be careful: the Index is only a way to get all the
146   //! solutions, but is not associated to those outside the
147   //! context of the algorithm-object.
148   //! Raises OutOfRange if Index is greater than
149   //! the number of solutions.
150   //! It raises NotDone if the algorithm failed.
151   Standard_EXPORT gp_Circ2d ThisSolution (const Standard_Integer Index) const;
152   
153   //! Returns the informations about the qualifiers of the
154   //! tangency
155   //! arguments concerning the solution number Index.
156   //! It returns the real qualifiers (the qualifiers given to the
157   //! constructor method in case of enclosed, enclosing and outside
158   //! and the qualifiers computedin case of unqualified).
159   Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1, GccEnt_Position& Qualif2, GccEnt_Position& Qualif3) const;
160   
161   //! Returns informations about the tangency point between the
162   //! result number Index and the first argument.
163   //! ParSol is the intrinsic parameter of the point PntSol
164   //! on the solution curv.
165   //! ParArg is the intrinsic parameter of the point PntArg
166   //! on the argument curv. Raises OutOfRange if Index is greater than
167   //! the number of solutions.
168   //! It raises NotDone if the algorithm failed.
169   Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
170   
171   //! Returns informations about the tangency point between the
172   //! result number Index and the first argument.
173   //! ParSol is the intrinsic parameter of the point PntSol
174   //! on the solution curv.
175   //! ParArg is the intrinsic parameter of the point Pntsol
176   //! on the argument curv. Raises OutOfRange if Index is greater than
177   //! the number of solutions.
178   //! It raises NotDone if the algorithm failed.
179   Standard_EXPORT void Tangency2 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
180   
181   //! Returns informations about the tangency point between the
182   //! result number Index and the first argument.
183   //! ParSol is the intrinsic parameter of the point PntSol
184   //! on the solution curv.
185   //! ParArg is the intrinsic parameter of the point Pntsol
186   //! on the argument curv. Raises OutOfRange if Index is greater than
187   //! the number of solutions.
188   //! It raises NotDone if the algorithm failed.
189   Standard_EXPORT void Tangency3 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
190   
191   //! Returns True if the solution number Index is equal to
192   //! the first argument. Raises OutOfRange if Index is greater than
193   //! the number of solutions.
194   //! It raises NotDone if the algorithm failed.
195   Standard_EXPORT Standard_Boolean IsTheSame1 (const Standard_Integer Index) const;
196   
197   //! Returns True if the solution number Index is equal to
198   //! the second argument. Raises OutOfRange Index is greater than
199   //! the number of solutions.
200   //! It raises NotDone if the algorithm failed.
201   Standard_EXPORT Standard_Boolean IsTheSame2 (const Standard_Integer Index) const;
202   
203   //! Returns True if the solution number Index is equal to
204   //! the third argument. Raises OutOfRange if Index is greater than
205   //! the number of solutions.
206   //! It raises NotDone if the algorithm failed.
207   Standard_EXPORT Standard_Boolean IsTheSame3 (const Standard_Integer Index) const;
208
209
210
211
212 protected:
213
214
215
216
217
218 private:
219
220
221
222   Standard_Boolean WellDone;
223   Standard_Integer NbrSol;
224   TColgp_Array1OfCirc2d cirsol;
225   GccEnt_Array1OfPosition qualifier1;
226   GccEnt_Array1OfPosition qualifier2;
227   GccEnt_Array1OfPosition qualifier3;
228   TColStd_Array1OfInteger TheSame1;
229   TColStd_Array1OfInteger TheSame2;
230   TColStd_Array1OfInteger TheSame3;
231   TColgp_Array1OfPnt2d pnttg1sol;
232   TColgp_Array1OfPnt2d pnttg2sol;
233   TColgp_Array1OfPnt2d pnttg3sol;
234   TColStd_Array1OfReal par1sol;
235   TColStd_Array1OfReal par2sol;
236   TColStd_Array1OfReal par3sol;
237   TColStd_Array1OfReal pararg1;
238   TColStd_Array1OfReal pararg2;
239   TColStd_Array1OfReal pararg3;
240
241
242 };
243
244
245
246
247
248
249
250 #endif // _GccAna_Circ2d3Tan_HeaderFile