b311480e |
1 | -- Created on: 1991-03-18 |
2 | -- Created by: Remy GILET |
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 Circ2d3Tan |
18 | |
19 | from GccAna |
20 | |
21 | ---Purpose: This class implements the algorithms used to |
22 | -- create 2d circles tangent to 3 points/lines/circles. |
23 | -- The arguments of all construction methods are : |
24 | -- - The three qualified elements for the |
25 | -- tangency constraints (QualifiedCirc, QualifiedLine, |
26 | -- Points). |
27 | -- - A real Tolerance. |
28 | -- Tolerance is only used in the limit cases. |
29 | -- For example : |
30 | -- We want to create a circle tangent to an UnqualifiedCirc |
31 | -- C1 and an UnqualifiedCirc C2 and an UnqualifiedCirc C3 |
32 | -- with a tolerance Tolerance. |
33 | -- If we do not use Tolerance it is impossible to find |
34 | -- a solution in the following case : C2 is inside C1 |
35 | -- and there is no intersection point between the two |
36 | -- circles, and C3 is completly outside C1. |
37 | -- With Tolerance we will find a solution if the |
38 | -- lowest distance between C1 and C2 is lower than or |
39 | -- equal Tolerance. |
40 | |
41 | |
42 | uses Pnt2d from gp, |
43 | Circ2d from gp, |
44 | QualifiedCirc from GccEnt, |
45 | QualifiedLin from GccEnt, |
46 | Array1OfReal from TColStd, |
47 | Array1OfInteger from TColStd, |
48 | Array1OfCirc2d from TColgp, |
49 | Array1OfPnt2d from TColgp, |
50 | Position from GccEnt, |
51 | Array1OfPosition from GccEnt |
52 | |
53 | raises OutOfRange from Standard, |
54 | NotDone from StdFail, |
55 | BadQualifier from GccEnt |
56 | |
57 | is |
58 | |
59 | Create(Qualified1 : QualifiedCirc from GccEnt ; |
60 | Qualified2 : QualifiedCirc from GccEnt ; |
61 | Qualified3 : QualifiedCirc from GccEnt ; |
62 | Tolerance : Real from Standard) returns Circ2d3Tan |
63 | ---Purpose: This method implements the algorithms used to |
64 | -- create 2d circles tangent to 3 circles. |
65 | -- ConstructionError is raised if there is a problem during |
66 | -- the computation. |
67 | raises BadQualifier from GccEnt; |
68 | |
69 | Create(Qualified1 : QualifiedCirc from GccEnt ; |
70 | Qualified2 : QualifiedCirc from GccEnt ; |
71 | Qualified3 : QualifiedLin from GccEnt ; |
72 | Tolerance : Real from Standard) returns Circ2d3Tan |
73 | ---Purpose: This method implements the algorithms used to |
74 | -- create 2d circles tangent to 2 circles and 1 line. |
75 | -- ConstructionError is raised if there is a problem during |
76 | -- the computation. |
77 | raises BadQualifier from GccEnt; |
78 | |
79 | Create(Qualified1 : QualifiedCirc from GccEnt ; |
80 | Qualified2 : QualifiedLin from GccEnt ; |
81 | Qualified3 : QualifiedLin from GccEnt ; |
82 | Tolerance : Real from Standard) returns Circ2d3Tan |
83 | ---Purpose: This method implements the algorithms used to |
84 | -- create 2d circles tangent to 1 circle and 2 lines. |
85 | -- ConstructionError is raised if there is a problem during |
86 | -- the computation. |
87 | raises BadQualifier from GccEnt; |
88 | |
89 | Create(Qualified1 : QualifiedLin from GccEnt ; |
90 | Qualified2 : QualifiedLin from GccEnt ; |
91 | Qualified3 : QualifiedLin from GccEnt ; |
92 | Tolerance : Real from Standard) returns Circ2d3Tan |
93 | ---Purpose: This method implements the algorithms used to |
94 | -- create 2d circles tangent to 3 lines. |
95 | -- ConstructionError is raised if there is a problem during |
96 | -- the computation. |
97 | raises BadQualifier from GccEnt; |
98 | |
99 | Create(Qualified1 : QualifiedCirc from GccEnt ; |
100 | Qualified2 : QualifiedCirc from GccEnt ; |
101 | Point3 : Pnt2d from gp ; |
102 | Tolerance : Real from Standard) returns Circ2d3Tan |
103 | ---Purpose: This method implements the algorithms used to |
104 | -- create 2d circles tangent to 2 circles and 1 Point. |
105 | -- ConstructionError is raised if there is a problem during |
106 | -- the computation. |
107 | raises BadQualifier from GccEnt; |
108 | |
109 | Create(Qualified1 : QualifiedCirc from GccEnt ; |
110 | Qualified2 : QualifiedLin from GccEnt ; |
111 | Point3 : Pnt2d from gp ; |
112 | Tolerance : Real from Standard) returns Circ2d3Tan |
113 | ---Purpose: This method implements the algorithms used to |
114 | -- create 2d circles tangent to a circle and a line and |
115 | -- 1 Point. |
116 | -- ConstructionError is raised if there is a problem during |
117 | -- the computation. |
118 | raises BadQualifier from GccEnt; |
119 | |
120 | Create(Qualified1 : QualifiedLin from GccEnt ; |
121 | Qualified2 : QualifiedLin from GccEnt ; |
122 | Point3 : Pnt2d from gp ; |
123 | Tolerance : Real from Standard) returns Circ2d3Tan |
124 | ---Purpose: This method implements the algorithms used to |
125 | -- create 2d circles tangent to 2 lines and 1 Point. |
126 | -- ConstructionError is raised if there is a problem during |
127 | -- the computation. |
128 | raises BadQualifier from GccEnt; |
129 | |
130 | Create(Qualified1 : QualifiedCirc from GccEnt ; |
131 | Point2 : Pnt2d from gp ; |
132 | Point3 : Pnt2d from gp ; |
133 | Tolerance : Real from Standard) returns Circ2d3Tan |
134 | ---Purpose: This method implements the algorithms used to |
135 | -- create 2d circles tangent to a circle and passing |
136 | -- thrue 2 Points. |
137 | -- ConstructionError is raised if there is a problem during |
138 | -- the computation. |
139 | raises BadQualifier from GccEnt; |
140 | |
141 | Create(Qualified1 : QualifiedLin from GccEnt ; |
142 | Point2 : Pnt2d from gp ; |
143 | Point3 : Pnt2d from gp ; |
144 | Tolerance : Real from Standard) returns Circ2d3Tan |
145 | ---Purpose: This method implements the algorithms used to |
146 | -- create 2d circles tangent to a line and passing |
147 | -- thrue 2 Points. |
148 | -- ConstructionError is raised if there is a problem during |
149 | -- the computation. |
150 | raises BadQualifier from GccEnt; |
151 | |
152 | Create(Point1 : Pnt2d from gp ; |
153 | Point2 : Pnt2d from gp ; |
154 | Point3 : Pnt2d from gp ; |
155 | Tolerance : Real from Standard) returns Circ2d3Tan; |
156 | ---Purpose: This method implements the algorithms used to |
157 | -- create 2d circles passing thrue 3 Points. |
158 | -- ConstructionError is raised if there is a problem during |
159 | -- the computation. |
160 | |
161 | -- -- .................................................................... |
162 | |
163 | IsDone(me) returns Boolean from Standard |
164 | is static; |
165 | ---Purpose: This method returns True if the construction |
166 | -- algorithm succeeded. |
167 | -- Note: IsDone protects against a failure arising from a |
168 | -- more internal intersection algorithm, which has |
169 | -- reached its numeric limits. |
170 | |
171 | NbSolutions(me) returns Integer from Standard |
172 | ---Purpose: This method returns the number of solutions. |
173 | -- Raises NotDone if the construction algorithm didn't succeed. |
174 | raises NotDone |
175 | is static; |
176 | |
177 | |
178 | ThisSolution(me ; Index : Integer from Standard) returns Circ2d from gp |
179 | ---Purpose: Returns the solution number Index and raises OutOfRange |
180 | -- exception if Index is greater than the number of |
181 | -- solutions. |
182 | -- Be careful: the Index is only a way to get all the |
183 | -- solutions, but is not associated to those outside the |
184 | -- context of the algorithm-object. |
185 | -- Raises OutOfRange if Index is greater than |
186 | -- the number of solutions. |
187 | -- It raises NotDone if the algorithm failed. |
188 | raises OutOfRange, NotDone |
189 | is static; |
190 | |
191 | |
192 | WhichQualifier(me ; |
193 | Index : Integer from Standard; |
194 | Qualif1 : out Position from GccEnt ; |
195 | Qualif2 : out Position from GccEnt ; |
196 | Qualif3 : out Position from GccEnt ) |
197 | raises OutOfRange, NotDone |
198 | is static; |
199 | ---Purpose: Returns the informations about the qualifiers of the |
200 | -- tangency |
201 | -- arguments concerning the solution number Index. |
202 | -- It returns the real qualifiers (the qualifiers given to the |
203 | -- constructor method in case of enclosed, enclosing and outside |
204 | -- and the qualifiers computedin case of unqualified). |
205 | |
206 | Tangency1(me ; |
207 | Index : Integer from Standard; |
208 | ParSol,ParArg : out Real from Standard; |
209 | PntSol : out Pnt2d from gp ) |
210 | ---Purpose: Returns informations about the tangency point between the |
211 | -- result number Index and the first argument. |
212 | -- ParSol is the intrinsic parameter of the point PntSol |
213 | -- on the solution curv. |
214 | -- ParArg is the intrinsic parameter of the point PntArg |
215 | -- on the argument curv. Raises OutOfRange if Index is greater than |
216 | -- the number of solutions. |
217 | -- It raises NotDone if the algorithm failed. |
218 | |
219 | raises OutOfRange, NotDone |
220 | is static; |
221 | |
222 | |
223 | Tangency2(me ; |
224 | Index : Integer from Standard; |
225 | ParSol,ParArg : out Real from Standard; |
226 | PntSol : out Pnt2d from gp ) |
227 | ---Purpose: Returns informations about the tangency point between the |
228 | -- result number Index and the first argument. |
229 | -- ParSol is the intrinsic parameter of the point PntSol |
230 | -- on the solution curv. |
231 | -- ParArg is the intrinsic parameter of the point Pntsol |
232 | -- on the argument curv. Raises OutOfRange if Index is greater than |
233 | -- the number of solutions. |
234 | -- It raises NotDone if the algorithm failed. |
235 | raises OutOfRange, NotDone |
236 | is static; |
237 | |
238 | |
239 | Tangency3(me ; |
240 | Index : Integer from Standard; |
241 | ParSol : out Real from Standard; |
242 | ParArg : out Real from Standard; |
243 | PntSol : out Pnt2d from gp ) |
244 | ---Purpose: Returns informations about the tangency point between the |
245 | -- result number Index and the first argument. |
246 | -- ParSol is the intrinsic parameter of the point PntSol |
247 | -- on the solution curv. |
248 | -- ParArg is the intrinsic parameter of the point Pntsol |
249 | -- on the argument curv. Raises OutOfRange if Index is greater than |
250 | -- the number of solutions. |
251 | -- It raises NotDone if the algorithm failed. |
252 | raises OutOfRange, NotDone |
253 | is static; |
254 | |
255 | |
256 | IsTheSame1(me ; |
257 | Index : Integer from Standard) returns Boolean from Standard |
258 | ---Purpose: Returns True if the solution number Index is equal to |
259 | -- the first argument. Raises OutOfRange if Index is greater than |
260 | -- the number of solutions. |
261 | -- It raises NotDone if the algorithm failed. |
262 | raises OutOfRange, NotDone |
263 | is static; |
264 | |
265 | |
266 | IsTheSame2(me ; |
267 | Index : Integer from Standard) returns Boolean from Standard |
268 | ---Purpose: Returns True if the solution number Index is equal to |
269 | -- the second argument. Raises OutOfRange Index is greater than |
270 | -- the number of solutions. |
271 | -- It raises NotDone if the algorithm failed. |
272 | raises OutOfRange, NotDone |
273 | is static; |
274 | |
275 | |
276 | IsTheSame3(me ; |
277 | Index : Integer from Standard) returns Boolean from Standard |
278 | ---Purpose: Returns True if the solution number Index is equal to |
279 | -- the third argument. Raises OutOfRange if Index is greater than |
280 | -- the number of solutions. |
281 | -- It raises NotDone if the algorithm failed. |
282 | raises OutOfRange, NotDone |
283 | is static; |
284 | |
285 | |
286 | fields |
287 | |
288 | WellDone : Boolean from Standard; |
289 | ---Purpose: True if the algorithm succeeded. |
290 | |
291 | NbrSol : Integer from Standard; |
292 | ---Purpose: The number of solutions found. |
293 | |
294 | cirsol : Array1OfCirc2d from TColgp; |
295 | -- The solutions. |
296 | |
297 | qualifier1 : Array1OfPosition from GccEnt; |
298 | ---Purpose: The qualifiers of the first argument. |
299 | |
300 | qualifier2 : Array1OfPosition from GccEnt ; |
301 | ---Purpose: The qualifiers of the second argument. |
302 | |
303 | qualifier3 : Array1OfPosition from GccEnt; |
304 | ---Purpose: The qualifiers of the third argument. |
305 | |
306 | TheSame1 : Array1OfInteger from TColStd; |
307 | ---Purpose: 1 if the solution and the first argument are the same |
308 | -- (2 circles). |
309 | -- If R1 is the radius of the first argument and Rsol the radius |
310 | -- of the solution and dist the distance between the two centers, |
311 | -- we consider the two circles are identical if R1+dist-Rsol is |
312 | -- less than Tolerance. |
313 | -- 0 in the other cases. |
314 | |
315 | TheSame2 : Array1OfInteger from TColStd; |
316 | ---Purpose: 1 if the solution and the second argument are the same |
317 | -- (2 circles). |
318 | -- If R2 is the radius of the second argument and Rsol the radius |
319 | -- of the solution and dist the distance between the two centers, |
320 | -- we consider the two circles are identical if R2+dist-Rsol is |
321 | -- less than Tolerance. |
322 | -- 0 in the other cases. |
323 | |
324 | TheSame3 : Array1OfInteger from TColStd; |
325 | ---Purpose: 1 if the solution and the third argument are the same |
326 | -- (2 circles). |
327 | -- If R3 is the radius of the third argument and Rsol the radius |
328 | -- of the solution and dist the distance between the two centers, |
329 | -- we consider the two circles are identical if R3+dist-Rsol is |
330 | -- less than Tolerance. |
331 | -- 0 in the other cases. |
332 | |
333 | pnttg1sol : Array1OfPnt2d from TColgp; |
334 | ---Purpose: The tangency point between the solution and the first |
335 | -- argument. |
336 | |
337 | pnttg2sol : Array1OfPnt2d from TColgp; |
338 | ---Purpose: The tangency point between the solution and the second |
339 | -- argument. |
340 | |
341 | pnttg3sol : Array1OfPnt2d from TColgp; |
342 | ---Purpose: The tangency point between the solution and the third |
343 | -- argument. |
344 | |
345 | par1sol : Array1OfReal from TColStd; |
346 | ---Purpose: The parameter of the tangency point between the solution |
347 | -- and the first argument on the solution. |
348 | |
349 | par2sol : Array1OfReal from TColStd; |
350 | ---Purpose: The parameter of the tangency point between the solution |
351 | -- and the second argument on the solution. |
352 | |
353 | par3sol : Array1OfReal from TColStd; |
354 | ---Purpose: The parameter of the tangency point between the solution |
355 | -- and the third argument on the solution. |
356 | |
357 | pararg1 : Array1OfReal from TColStd; |
358 | ---Purpose: The parameter of the tangency point between the solution |
359 | -- and the first argument on the first argument. |
360 | |
361 | pararg2 : Array1OfReal from TColStd; |
362 | ---Purpose: The parameter of the tangency point between the solution |
363 | -- and the second argument on the second argument. |
364 | |
365 | pararg3 : Array1OfReal from TColStd; |
366 | ---Purpose: The parameter of the tangency point between the solution |
367 | -- and the third argument on the second argument. |
368 | |
369 | end Circ2d3Tan; |