b311480e |
1 | -- Created on: 1991-03-21 |
2 | -- Created by: Philippe DAUTRY |
3 | -- Copyright (c) 1991-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 | -- |
d5f74e42 |
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 |
973c2be1 |
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 | class Circ2d2TanRad |
18 | |
19 | from GccAna |
20 | |
21 | ---Purpose: This class implements the algorithms used to |
22 | -- create 2d circles tangent to 2 |
23 | -- points/lines/circles and with a given radius. |
24 | -- For each construction methods arguments are: |
25 | -- - Two Qualified elements for tangency constraints. |
26 | -- (for example EnclosedCirc if we want the |
27 | -- solution inside the argument EnclosedCirc). |
28 | -- - Two Reals. One (Radius) for the radius and the |
29 | -- other (Tolerance) for the tolerance. |
30 | -- Tolerance is only used for the limit cases. |
31 | -- For example : |
32 | -- We want to create a circle inside a circle C1 and |
33 | -- inside a circle C2 with a radius Radius and a |
34 | -- tolerance Tolerance. |
35 | -- If we do not use Tolerance it is impossible to |
36 | -- find a solution in the following case : C2 is |
37 | -- inside C1 and there is no intersection point |
38 | -- between the two circles. |
39 | -- With Tolerance it gives a solution if the lowest |
40 | -- distance between C1 and C2 is lower than or equal |
41 | -- Tolerance. |
42 | |
43 | |
44 | |
45 | uses Pnt2d from gp, |
46 | Circ2d from gp, |
47 | QualifiedLin from GccEnt, |
48 | QualifiedCirc from GccEnt, |
49 | Array1OfReal from TColStd, |
50 | Array1OfInteger from TColStd, |
51 | Array1OfCirc2d from TColgp, |
52 | Array1OfPnt2d from TColgp, |
53 | Position from GccEnt, |
54 | Array1OfPosition from GccEnt |
55 | |
56 | raises NegativeValue from Standard, |
57 | OutOfRange from Standard, |
58 | BadQualifier from GccEnt, |
59 | NotDone from StdFail |
60 | |
61 | is |
62 | |
63 | Create(Qualified1 : QualifiedCirc from GccEnt ; |
64 | Qualified2 : QualifiedCirc from GccEnt ; |
65 | Radius : Real from Standard; |
66 | Tolerance : Real from Standard) returns Circ2d2TanRad |
67 | ---Purpose: This method implements the algorithms used to |
68 | -- create 2d circles TANgent to two 2d circle with a |
69 | -- radius of Radius. |
70 | raises NegativeValue, BadQualifier; |
71 | ---Purpose: It raises NegativeValue if Radius is lower than zero. |
72 | |
73 | Create(Qualified1 : QualifiedCirc from GccEnt ; |
74 | Qualified2 : QualifiedLin from GccEnt ; |
75 | Radius : Real from Standard; |
76 | Tolerance : Real from Standard) returns Circ2d2TanRad |
77 | ---Purpose: 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 | raises NegativeValue, BadQualifier; |
81 | ---Purpose: It raises NegativeValue if Radius is lower than zero. |
82 | |
83 | Create(Qualified1 : QualifiedCirc from GccEnt ; |
84 | Point2 : Pnt2d from gp ; |
85 | Radius : Real from Standard; |
86 | Tolerance : Real from Standard) returns Circ2d2TanRad |
87 | ---Purpose: This method implements the algorithms used to |
88 | -- create 2d circles TANgent to a 2d circle and a point |
89 | -- with a radius of Radius. |
90 | raises NegativeValue, BadQualifier; |
91 | ---Purpose: It raises NegativeValue if Radius is lower than zero. |
92 | |
93 | Create(Qualified1 : QualifiedLin from GccEnt ; |
94 | Point2 : Pnt2d from gp ; |
95 | Radius : Real from Standard; |
96 | Tolerance : Real from Standard) returns Circ2d2TanRad |
97 | ---Purpose: This method implements the algorithms used to |
98 | -- create 2d circles TANgent to a 2d line and a point |
99 | -- with a radius of Radius. |
100 | raises NegativeValue, BadQualifier; |
101 | ---Purpose: It raises NegativeValue if Radius is lower than zero. |
102 | |
103 | Create(Qualified1 : QualifiedLin from GccEnt ; |
104 | Qualified2 : QualifiedLin from GccEnt ; |
105 | Radius : Real from Standard; |
106 | Tolerance : Real from Standard) returns Circ2d2TanRad |
107 | ---Purpose: This method implements the algorithms used to |
108 | -- create 2d circles TANgent to two 2d lines |
109 | -- with a radius of Radius. |
110 | raises NegativeValue, BadQualifier; |
111 | ---Purpose: It raises NegativeValue if Radius is lower than zero. |
112 | |
113 | Create(Point1 : Pnt2d from gp ; |
114 | Point2 : Pnt2d from gp ; |
115 | Radius : Real from Standard; |
116 | Tolerance : Real from Standard) returns Circ2d2TanRad |
117 | ---Purpose: This method implements the algorithms used to |
118 | -- create 2d circles passing through two points with a |
119 | -- radius of Radius. |
120 | raises NegativeValue; |
121 | ---Purpose: It raises NegativeValue if Radius is lower than zero. |
122 | |
123 | -- -- .................................................................... |
124 | |
125 | IsDone(me) returns Boolean from Standard |
126 | is static; |
127 | ---Purpose: This method returns True if the algorithm succeeded. |
128 | -- Note: IsDone protects against a failure arising from a |
129 | -- more internal intersection algorithm, which has reached its numeric limits. |
130 | |
131 | NbSolutions(me) returns Integer from Standard |
132 | ---Purpose: This method returns the number of circles, representing solutions computed by this algorithm. |
133 | -- Exceptions |
134 | -- StdFail_NotDone if the construction fails. of solutions. |
135 | raises NotDone |
136 | is static; |
137 | |
138 | ThisSolution(me ; |
139 | Index : Integer from Standard) returns Circ2d from gp |
140 | ---Purpose: Returns the solution number Index. |
141 | -- Be careful: the Index is only a way to get all the |
142 | -- solutions, but is not associated to those outside the context |
143 | -- of the algorithm-object. Raises OutOfRange exception if Index is greater |
144 | -- than the number of solutions. |
145 | -- It raises NotDone if the construction algorithm did not |
146 | -- succeed. |
147 | |
148 | raises OutOfRange, NotDone |
149 | is static; |
150 | |
151 | |
152 | WhichQualifier(me ; |
153 | Index : Integer from Standard; |
154 | Qualif1 : out Position from GccEnt ; |
155 | Qualif2 : out Position from GccEnt ) |
156 | raises OutOfRange, NotDone |
157 | is static; |
158 | ---Purpose: Returns the information about the qualifiers of |
159 | -- the tangency arguments concerning the solution number Index. |
160 | -- It returns the real qualifiers (the qualifiers given to the |
161 | -- constructor method in case of enclosed, enclosing and outside |
162 | -- and the qualifiers computedin case of unqualified). |
163 | |
164 | Tangency1(me ; |
165 | Index : Integer from Standard; |
166 | ParSol : out Real from Standard; |
167 | ParArg : out Real from Standard; |
168 | PntSol : out Pnt2d from gp ) |
169 | ---Purpose: Returns information about the tangency point between the |
170 | -- result number Index and the first argument. |
171 | -- ParSol is the intrinsic parameter of the point PntSol on the solution. |
172 | -- ParArg is the intrinsic parameter of the point PntSol on the first |
173 | -- argument. Raises OutOfRange if Index is greater than the number |
174 | -- of solutions. |
175 | -- It raises NotDone if the construction algorithm did not succeed |
176 | raises OutOfRange, NotDone |
177 | is static; |
178 | |
179 | |
180 | Tangency2(me ; |
181 | Index : Integer from Standard; |
182 | ParSol,ParArg : out Real from Standard; |
183 | PntSol : out Pnt2d from gp ) |
184 | ---Purpose: Returns information about the tangency point between the |
185 | -- result number Index and the second argument. |
186 | -- ParSol is the intrinsic parameter of the point PntSol on |
187 | -- the solution. |
188 | -- ParArg is the intrinsic parameter of the point PntArg on |
189 | -- the second argument. Raises OutOfRange if Index is greater than the number |
190 | -- of solutions. |
191 | -- It raises NotDone if the construction algorithm did not succeed. |
192 | raises OutOfRange, NotDone |
193 | is static; |
194 | |
195 | |
196 | IsTheSame1(me ; |
197 | Index : Integer from Standard) returns Boolean from Standard |
198 | ---Purpose: Returns True if the solution number Index is equal to |
199 | -- the first argument. Raises OutOfRange if Index is greater than the number |
200 | -- of solutions. |
201 | -- It raises NotDone if the construction algorithm did not |
202 | -- succeed. |
203 | raises OutOfRange, NotDone |
204 | is static; |
205 | |
206 | |
207 | IsTheSame2(me ; |
208 | Index : Integer from Standard) returns Boolean from Standard |
209 | ---Purpose: Returns True if the solution number Index is equal to |
210 | -- the second argument. Raises OutOfRange if Index is greater than the number |
211 | -- of solutions. |
212 | -- It raises NotDone if the construction algorithm did not succeed. |
213 | raises OutOfRange, NotDone |
214 | is static; |
215 | |
216 | |
217 | fields |
218 | |
219 | WellDone : Boolean from Standard; |
220 | ---Purpose: True if the algorithm succeeded. |
221 | |
222 | qualifier1 : Array1OfPosition from GccEnt; |
223 | -- The qualifiers of the first argument. |
224 | |
225 | qualifier2 : Array1OfPosition from GccEnt; |
226 | -- The qualifiers of the second argument. |
227 | |
228 | TheSame1 : Array1OfInteger from TColStd; |
229 | ---Purpose: 1 if the solution and the first argument are the same |
230 | -- (2 circles). |
231 | -- If R1 is the radius of the first argument and Rsol the radius |
232 | -- of the solution and dist the distance between the two centers, |
233 | -- we consider the two circles are identical if R1+dist-Rsol is |
234 | -- less than Tolerance. |
235 | -- 0 in the other cases. |
236 | |
237 | TheSame2 : Array1OfInteger from TColStd; |
238 | ---Purpose: 1 if the solution and the second argument are the same |
239 | -- (2 circles). |
240 | -- If R2 is the radius of the second argument and Rsol the radius |
241 | -- of the solution and dist the distance between the two centers, |
242 | -- we consider the two circles are identical if R2+dist-Rsol is |
243 | -- less than Tolerance. |
244 | -- 0 in the other cases. |
245 | |
246 | NbrSol : Integer from Standard; |
247 | ---Purpose: The number of possible solutions. |
248 | |
249 | cirsol : Array1OfCirc2d from TColgp; |
250 | ---Purpose: The solutions. |
251 | |
252 | pnttg1sol : Array1OfPnt2d from TColgp; |
253 | ---Purpose: The tangency point between the solution and the first |
254 | -- argument on the solution. |
255 | |
256 | pnttg2sol : Array1OfPnt2d from TColgp; |
257 | ---Purpose: The tangency point between the solution and the second |
258 | -- argument on the solution. |
259 | |
260 | par1sol : Array1OfReal from TColStd; |
261 | ---Purpose: The parameter of the tangency point between the solution |
262 | -- and the first argument on the solution. |
263 | |
264 | par2sol : Array1OfReal from TColStd; |
265 | ---Purpose: The parameter of the tangency point between the solution |
266 | -- and the second argument on the solution. |
267 | |
268 | pararg1 : Array1OfReal from TColStd; |
269 | ---Purpose: The parameter of the tangency point between the solution |
270 | -- and the first argument on the first argument. |
271 | |
272 | pararg2 : Array1OfReal from TColStd; |
273 | ---Purpose: The parameter of the tangency point between the solution |
274 | -- and the second argument on the second argument. |
275 | |
276 | end Circ2d2TanRad; |