42cf5bc1 |
1 | // Created on: 1991-03-21 |
2 | // Created by: Philippe DAUTRY |
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_Circ2d2TanRad_HeaderFile |
18 | #define _GccAna_Circ2d2TanRad_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <GccEnt_Array1OfPosition.hxx> |
26 | #include <TColStd_Array1OfInteger.hxx> |
27 | #include <Standard_Integer.hxx> |
28 | #include <TColgp_Array1OfCirc2d.hxx> |
29 | #include <TColgp_Array1OfPnt2d.hxx> |
30 | #include <TColStd_Array1OfReal.hxx> |
31 | #include <Standard_Real.hxx> |
32 | #include <GccEnt_Position.hxx> |
33 | class Standard_NegativeValue; |
34 | class Standard_OutOfRange; |
35 | class GccEnt_BadQualifier; |
36 | class StdFail_NotDone; |
37 | class GccEnt_QualifiedCirc; |
38 | class GccEnt_QualifiedLin; |
39 | class gp_Pnt2d; |
40 | class gp_Circ2d; |
41 | |
42 | |
43 | //! This class implements the algorithms used to |
44 | //! create 2d circles tangent to 2 |
45 | //! points/lines/circles and with a given radius. |
46 | //! For each construction methods arguments are: |
47 | //! - Two Qualified elements for tangency constraints. |
48 | //! (for example EnclosedCirc if we want the |
49 | //! solution inside the argument EnclosedCirc). |
50 | //! - Two Reals. One (Radius) for the radius and the |
51 | //! other (Tolerance) for the tolerance. |
52 | //! Tolerance is only used for the limit cases. |
53 | //! For example : |
54 | //! We want to create a circle inside a circle C1 and |
55 | //! inside a circle C2 with a radius Radius and a |
56 | //! tolerance Tolerance. |
57 | //! If we do not use Tolerance it is impossible to |
58 | //! find a solution in the following case : C2 is |
59 | //! inside C1 and there is no intersection point |
60 | //! between the two circles. |
61 | //! With Tolerance it gives a solution if the lowest |
62 | //! distance between C1 and C2 is lower than or equal |
63 | //! Tolerance. |
64 | class GccAna_Circ2d2TanRad |
65 | { |
66 | public: |
67 | |
68 | DEFINE_STANDARD_ALLOC |
69 | |
70 | |
71 | //! This method implements the algorithms used to |
72 | //! create 2d circles TANgent to two 2d circle with a |
73 | //! radius of Radius. |
74 | //! It raises NegativeValue if Radius is lower than zero. |
75 | Standard_EXPORT GccAna_Circ2d2TanRad(const GccEnt_QualifiedCirc& Qualified1, const GccEnt_QualifiedCirc& Qualified2, const Standard_Real Radius, const Standard_Real Tolerance); |
76 | |
77 | //! This method implements the algorithms used to |
78 | //! create 2d circles TANgent to a 2d circle and a 2d line |
79 | //! with a radius of Radius. |
80 | //! It raises NegativeValue if Radius is lower than zero. |
81 | Standard_EXPORT GccAna_Circ2d2TanRad(const GccEnt_QualifiedCirc& Qualified1, const GccEnt_QualifiedLin& Qualified2, const Standard_Real Radius, const Standard_Real Tolerance); |
82 | |
83 | //! This method implements the algorithms used to |
84 | //! create 2d circles TANgent to a 2d circle and a point |
85 | //! with a radius of Radius. |
86 | //! It raises NegativeValue if Radius is lower than zero. |
87 | Standard_EXPORT GccAna_Circ2d2TanRad(const GccEnt_QualifiedCirc& Qualified1, const gp_Pnt2d& Point2, const Standard_Real Radius, const Standard_Real Tolerance); |
88 | |
89 | //! This method implements the algorithms used to |
90 | //! create 2d circles TANgent to a 2d line and a point |
91 | //! with a radius of Radius. |
92 | //! It raises NegativeValue if Radius is lower than zero. |
93 | Standard_EXPORT GccAna_Circ2d2TanRad(const GccEnt_QualifiedLin& Qualified1, const gp_Pnt2d& Point2, const Standard_Real Radius, const Standard_Real Tolerance); |
94 | |
95 | //! This method implements the algorithms used to |
96 | //! create 2d circles TANgent to two 2d lines |
97 | //! with a radius of Radius. |
98 | //! It raises NegativeValue if Radius is lower than zero. |
99 | Standard_EXPORT GccAna_Circ2d2TanRad(const GccEnt_QualifiedLin& Qualified1, const GccEnt_QualifiedLin& Qualified2, const Standard_Real Radius, const Standard_Real Tolerance); |
100 | |
101 | //! This method implements the algorithms used to |
102 | //! create 2d circles passing through two points with a |
103 | //! radius of Radius. |
104 | //! It raises NegativeValue if Radius is lower than zero. |
105 | Standard_EXPORT GccAna_Circ2d2TanRad(const gp_Pnt2d& Point1, const gp_Pnt2d& Point2, const Standard_Real Radius, const Standard_Real Tolerance); |
106 | |
107 | //! This method returns True if the algorithm succeeded. |
108 | //! Note: IsDone protects against a failure arising from a |
109 | //! more internal intersection algorithm, which has reached its numeric limits. |
110 | Standard_EXPORT Standard_Boolean IsDone() const; |
111 | |
112 | //! This method returns the number of circles, representing solutions computed by this algorithm. |
113 | //! Exceptions |
114 | //! StdFail_NotDone if the construction fails. of solutions. |
115 | Standard_EXPORT Standard_Integer NbSolutions() const; |
116 | |
117 | //! Returns the solution number Index. |
118 | //! Be careful: the Index is only a way to get all the |
119 | //! solutions, but is not associated to those outside the context |
120 | //! of the algorithm-object. Raises OutOfRange exception if Index is greater |
121 | //! than the number of solutions. |
122 | //! It raises NotDone if the construction algorithm did not |
123 | //! succeed. |
124 | Standard_EXPORT gp_Circ2d ThisSolution (const Standard_Integer Index) const; |
125 | |
126 | //! Returns the information about the qualifiers of |
127 | //! the tangency arguments concerning the solution number Index. |
128 | //! It returns the real qualifiers (the qualifiers given to the |
129 | //! constructor method in case of enclosed, enclosing and outside |
130 | //! and the qualifiers computedin case of unqualified). |
131 | Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1, GccEnt_Position& Qualif2) const; |
132 | |
133 | //! Returns information about the tangency point between the |
134 | //! result number Index and the first argument. |
135 | //! ParSol is the intrinsic parameter of the point PntSol on the solution. |
136 | //! ParArg is the intrinsic parameter of the point PntSol on the first |
137 | //! argument. Raises OutOfRange if Index is greater than the number |
138 | //! of solutions. |
139 | //! It raises NotDone if the construction algorithm did not succeed |
140 | Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; |
141 | |
142 | //! Returns information about the tangency point between the |
143 | //! result number Index and the second argument. |
144 | //! ParSol is the intrinsic parameter of the point PntSol on |
145 | //! the solution. |
146 | //! ParArg is the intrinsic parameter of the point PntArg on |
147 | //! the second argument. Raises OutOfRange if Index is greater than the number |
148 | //! of solutions. |
149 | //! It raises NotDone if the construction algorithm did not succeed. |
150 | Standard_EXPORT void Tangency2 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; |
151 | |
152 | //! Returns True if the solution number Index is equal to |
153 | //! the first argument. Raises OutOfRange if Index is greater than the number |
154 | //! of solutions. |
155 | //! It raises NotDone if the construction algorithm did not |
156 | //! succeed. |
157 | Standard_EXPORT Standard_Boolean IsTheSame1 (const Standard_Integer Index) const; |
158 | |
159 | //! Returns True if the solution number Index is equal to |
160 | //! the second argument. Raises OutOfRange if Index is greater than the number |
161 | //! of solutions. |
162 | //! It raises NotDone if the construction algorithm did not succeed. |
163 | Standard_EXPORT Standard_Boolean IsTheSame2 (const Standard_Integer Index) const; |
164 | |
165 | |
166 | |
167 | |
168 | protected: |
169 | |
170 | |
171 | |
172 | |
173 | |
174 | private: |
175 | |
176 | |
177 | |
178 | Standard_Boolean WellDone; |
179 | GccEnt_Array1OfPosition qualifier1; |
180 | GccEnt_Array1OfPosition qualifier2; |
181 | TColStd_Array1OfInteger TheSame1; |
182 | TColStd_Array1OfInteger TheSame2; |
183 | Standard_Integer NbrSol; |
184 | TColgp_Array1OfCirc2d cirsol; |
185 | TColgp_Array1OfPnt2d pnttg1sol; |
186 | TColgp_Array1OfPnt2d pnttg2sol; |
187 | TColStd_Array1OfReal par1sol; |
188 | TColStd_Array1OfReal par2sol; |
189 | TColStd_Array1OfReal pararg1; |
190 | TColStd_Array1OfReal pararg2; |
191 | |
192 | |
193 | }; |
194 | |
195 | |
196 | |
197 | |
198 | |
199 | |
200 | |
201 | #endif // _GccAna_Circ2d2TanRad_HeaderFile |