b311480e |
1 | -- Created on: 1991-03-22 |
2 | -- Created by: Remy GILET |
3 | -- Copyright (c) 1991-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | class Circ2d2TanOn |
23 | |
24 | from GccAna |
25 | |
26 | ---Purpose: Describes functions for building a 2D circle |
27 | -- - tangential to 2 curves, or |
28 | -- - tangential to a curve and passing through a point, or |
29 | -- - passing through 2 points, |
30 | -- and with its center on a curve. For these analytic |
31 | -- algorithms, curves are circles or lines. |
32 | -- A Circ2d2TanOn object provides a framework for: |
33 | -- - defining the construction of 2D circles(s), |
34 | -- - implementing the construction algorithm, and |
35 | -- - consulting the result(s). |
36 | |
37 | uses Pnt2d from gp, |
38 | Lin2d from gp, |
39 | Circ2d from gp, |
40 | QualifiedLin from GccEnt, |
41 | QualifiedCirc from GccEnt, |
42 | Array1OfReal from TColStd, |
43 | Array1OfInteger from TColStd, |
44 | Array1OfPnt2d from TColgp, |
45 | Array1OfCirc2d from TColgp, |
46 | Position from GccEnt, |
47 | Array1OfPosition from GccEnt |
48 | |
49 | raises OutOfRange from Standard, |
50 | NotDone from StdFail, |
51 | BadQualifier from GccEnt |
52 | |
53 | is |
54 | |
55 | ---Category : On a 2d line ............................................... |
56 | |
57 | Create(Qualified1 : QualifiedCirc ; |
58 | Qualified2 : QualifiedCirc ; |
59 | OnLine : Lin2d ; |
60 | Tolerance : Real ) returns Circ2d2TanOn |
61 | ---Purpose: This method implements the algorithms used to |
62 | -- create 2d circles TANgent to two 2d circles and |
63 | -- having the center ON a 2d line. |
64 | raises BadQualifier from GccEnt; |
65 | |
66 | Create(Qualified1 : QualifiedCirc ; |
67 | Qualified2 : QualifiedLin ; |
68 | OnLine : Lin2d ; |
69 | Tolerance : Real ) returns Circ2d2TanOn |
70 | ---Purpose: This method implements the algorithms used to |
71 | -- create 2d circles TANgent to a 2d circle and a 2d line |
72 | -- having the center ON a 2d line. |
73 | raises BadQualifier from GccEnt; |
74 | |
75 | Create(Qualified1 : QualifiedLin ; |
76 | Qualified2 : QualifiedLin ; |
77 | OnLine : Lin2d ; |
78 | Tolerance : Real ) returns Circ2d2TanOn |
79 | ---Purpose: This method implements the algorithms used to |
80 | -- create 2d circles TANgent to two 2d lines |
81 | -- having the center ON a 2d line. |
82 | raises BadQualifier from GccEnt; |
83 | |
84 | Create(Qualified1 : QualifiedCirc ; |
85 | Point2 : Pnt2d ; |
86 | OnLine : Lin2d ; |
87 | Tolerance : Real ) returns Circ2d2TanOn |
88 | ---Purpose: This method implements the algorithms used to |
89 | -- create 2d circles TANgent to a 2d circle and a point |
90 | -- having the center ON a 2d line. |
91 | raises BadQualifier from GccEnt; |
92 | |
93 | Create(Qualified1 : QualifiedLin ; |
94 | Point2 : Pnt2d ; |
95 | OnLine : Lin2d ; |
96 | Tolerance : Real ) returns Circ2d2TanOn |
97 | ---Purpose: This method implements the algorithms used to |
98 | -- create 2d circles TANgent to a 2d line and a point |
99 | -- having the center ON a 2d line. |
100 | raises BadQualifier from GccEnt; |
101 | |
102 | Create(Point1 : Pnt2d ; |
103 | Point2 : Pnt2d ; |
104 | OnLine : Lin2d ; |
105 | Tolerance : Real ) returns Circ2d2TanOn; |
106 | ---Purpose: This method implements the algorithms used to |
107 | -- create 2d circles TANgent to two points |
108 | -- having the center ON a 2d line. |
109 | |
110 | ---Category: On a 2d Circle ............................................... |
111 | |
112 | Create(Qualified1 : QualifiedCirc ; |
113 | Qualified2 : QualifiedCirc ; |
114 | OnCirc : Circ2d ; |
115 | Tolerance : Real ) returns Circ2d2TanOn |
116 | ---Purpose: This method implements the algorithms used to |
117 | -- create 2d circles TANgent to two 2d circles and |
118 | -- having the center ON a 2d circle. |
119 | raises BadQualifier from GccEnt; |
120 | |
121 | Create(Qualified1 : QualifiedCirc ; |
122 | Qualified2 : QualifiedLin ; |
123 | OnCirc : Circ2d ; |
124 | Tolerance : Real ) returns Circ2d2TanOn |
125 | ---Purpose: This method implements the algorithms used to |
126 | -- create 2d circles TANgent to a circle and a line |
127 | -- having the center ON a 2d circle. |
128 | raises BadQualifier from GccEnt; |
129 | |
130 | Create(Qualified1 : QualifiedCirc ; |
131 | Point2 : Pnt2d ; |
132 | OnCirc : Circ2d ; |
133 | Tolerance : Real ) returns Circ2d2TanOn |
134 | ---Purpose: This method implements the algorithms used to |
135 | -- create 2d circles TANgent to a circle and a point |
136 | -- having the center ON a 2d circle. |
137 | raises BadQualifier from GccEnt; |
138 | |
139 | Create(Qualified1 : QualifiedLin ; |
140 | Qualified2 : QualifiedLin ; |
141 | OnCirc : Circ2d ; |
142 | Tolerance : Real ) returns Circ2d2TanOn |
143 | ---Purpose: This method implements the algorithms used to |
144 | -- create 2d circles TANgent to two 2d lines |
145 | -- having the center ON a 2d circle. |
146 | raises BadQualifier from GccEnt; |
147 | |
148 | Create(Qualified1 : QualifiedLin ; |
149 | Point2 : Pnt2d ; |
150 | OnCirc : Circ2d ; |
151 | Tolerance : Real ) returns Circ2d2TanOn |
152 | ---Purpose: This method implements the algorithms used to |
153 | -- create 2d circles TANgent to a line and a point |
154 | -- having the center ON a 2d circle. |
155 | raises BadQualifier from GccEnt; |
156 | |
157 | Create(Point1 : Pnt2d ; |
158 | Point2 : Pnt2d ; |
159 | OnCirc : Circ2d ; |
160 | Tolerance : Real ) returns Circ2d2TanOn; |
161 | ---Purpose: This method implements the algorithms used to create |
162 | -- 2d circles TANgent to two points having the center ON |
163 | -- a 2d circle. |
164 | |
165 | -- .................................................................... |
166 | |
167 | IsDone(me) returns Boolean |
168 | is static; |
169 | ---Purpose: |
170 | -- Returns true if the construction algorithm does not fail |
171 | -- (even if it finds no solution). |
172 | -- Note: IsDone protects against a failure arising from a |
173 | -- more internal intersection algorithm, which has reached its numeric limits. |
174 | |
175 | NbSolutions(me) returns Integer |
176 | raises NotDone |
177 | is static; |
178 | ---Purpose: |
179 | -- Returns the number of circles, representing solutions |
180 | -- computed by this algorithm. |
181 | -- Exceptions |
182 | -- StdFail_NotDone if the construction fails. |
183 | |
184 | ThisSolution(me ; Index : Integer) returns Circ2d |
185 | raises OutOfRange, NotDone |
186 | is static; |
187 | ---Purpose: Returns the solution number Index and raises OutOfRange |
188 | -- exception if Index is greater than the number of solutions. |
189 | -- Be careful: the Index is only a way to get all the |
190 | -- solutions, but is not associated to those outside the context |
191 | -- of the algorithm-object. |
192 | -- Exceptions |
193 | -- Standard_OutOfRange if Index is less than zero or |
194 | -- greater than the number of solutions computed by this algorithm. |
195 | -- StdFail_NotDone if the construction fails. |
196 | |
197 | WhichQualifier(me ; |
198 | Index : Integer from Standard; |
199 | Qualif1 : out Position from GccEnt ; |
200 | Qualif2 : out Position from GccEnt ) |
201 | raises OutOfRange, NotDone |
202 | is static; |
203 | ---Purpose: Returns the qualifiers Qualif1 and Qualif2 of the |
204 | -- tangency arguments for the solution of index Index |
205 | -- computed by this algorithm. |
206 | -- The returned qualifiers are: |
207 | -- - those specified at the start of construction when the |
208 | -- solutions are defined as enclosed, enclosing or |
209 | -- outside with respect to the arguments, or |
210 | -- - those computed during construction (i.e. enclosed, |
211 | -- enclosing or outside) when the solutions are defined |
212 | -- as unqualified with respect to the arguments, or |
213 | -- - GccEnt_noqualifier if the tangency argument is a point. |
214 | -- Exceptions |
215 | -- Standard_OutOfRange if Index is less than zero or |
216 | -- greater than the number of solutions computed by this algorithm. |
217 | -- StdFail_NotDone if the construction fails. |
218 | |
219 | Tangency1(me ; |
220 | Index : Integer from Standard; |
221 | ParSol,ParArg : out Real from Standard; |
222 | PntSol : out Pnt2d from gp ) |
223 | ---Purpose: Returns the informations about the tangency point between the |
224 | -- result number Index and the first argument. |
225 | -- ParSol is the intrinsic parameter of the point PntSol on |
226 | -- the solution |
227 | -- ParArg is the intrinsic parameter of the point PntSol on |
228 | -- the first argument. Raises OutOfRange if Index is greater than the number |
229 | -- of solutions and NotDone if IsDone returns false. |
230 | raises OutOfRange, NotDone |
231 | is static; |
232 | |
233 | |
234 | Tangency2(me ; |
235 | Index : Integer from Standard; |
236 | ParSol,ParArg : out Real from Standard; |
237 | PntSol : out Pnt2d from gp ) |
238 | ---Purpose: Returns the informations about the tangency point between the |
239 | -- result number Index and the second argument. |
240 | -- ParSol is the intrinsic parameter of the point PntSol on |
241 | -- the solution. |
242 | -- ParArg is the intrinsic parameter of the point PntSol on |
243 | -- the second argument. Raises OutOfRange if Index is greater than the number |
244 | -- of solutions and NotDone if IsDone returns false. |
245 | raises OutOfRange, NotDone |
246 | is static; |
247 | |
248 | |
249 | CenterOn3 (me ; |
250 | Index : Integer from Standard; |
251 | ParArg : out Real from Standard; |
252 | PntArg : out Pnt2d from gp ) |
253 | ---Purpose: Returns the informations about the center (on the curv) of |
254 | -- the result number Index and the third argument. |
255 | -- ParArg is the intrinsic parameter of the point PntArg on |
256 | -- the third argument. |
257 | -- Exceptions |
258 | -- Standard_OutOfRange if Index is less than zero or |
259 | -- greater than the number of solutions computed by this algorithm. |
260 | -- StdFail_NotDone if the construction fails. |
261 | raises OutOfRange, NotDone |
262 | is static; |
263 | |
264 | |
265 | IsTheSame1(me ; |
266 | Index : Integer from Standard) returns Boolean from Standard |
267 | ---Purpose: True if the solution and the first argument are the same |
268 | -- (2 circles). |
269 | -- If R1 is the radius of the first argument and Rsol the radius |
270 | -- of the solution and dist the distance between the two centers, |
271 | -- we concider the two circles are identical if R1+dist-Rsol is |
272 | -- less than Tolerance. |
273 | -- False in the other cases. |
274 | -- Raises OutOfRange if Index is greater than the number |
275 | -- of solutions and NotDone if IsDone returns false. |
276 | raises OutOfRange, NotDone |
277 | is static; |
278 | |
279 | IsTheSame2(me ; |
280 | Index : Integer from Standard) returns Boolean from Standard |
281 | ---Purpose: True if the solution and the second argument are the same |
282 | -- (2 circles). |
283 | -- If R2 is the radius of the second argument and Rsol the radius |
284 | -- of the solution and dist the distance between the two centers, |
285 | -- we concider the two circles are identical if R2+dist-Rsol is |
286 | -- less than Tolerance. |
287 | -- False in the other cases. |
288 | -- Raises OutOfRange if Index is greater than the number |
289 | -- of solutions and NotDone if IsDone returns false. |
290 | raises OutOfRange, NotDone |
291 | is static; |
292 | |
293 | |
294 | fields |
295 | |
296 | WellDone : Boolean from Standard; |
297 | ---Purpose: True if the algorithm succeeded. |
298 | |
299 | NbrSol : Integer from Standard; |
300 | ---Purpose: The number of possible solutions. |
301 | |
302 | cirsol : Array1OfCirc2d from TColgp; |
303 | ---Purpose: The solutions. |
304 | |
305 | qualifier1 : Array1OfPosition from GccEnt; |
306 | ---Purpose: The qualifiers of the first argument. |
307 | |
308 | qualifier2 : Array1OfPosition from GccEnt; |
309 | ---Purpose: The qualifiers of the second argument. |
310 | |
311 | TheSame1 : Array1OfInteger from TColStd; |
312 | ---Purpose: 1 if the solution and the first argument are the same |
313 | -- (2 circles). |
314 | -- If R1 is the radius of the first argument and Rsol the radius |
315 | -- of the solution and dist the distance between the two centers, |
316 | -- we concider the two circles are identical if R1+dist-Rsol is |
317 | -- less than Tolerance. |
318 | -- 0 in the other cases. |
319 | |
320 | TheSame2 : Array1OfInteger from TColStd; |
321 | ---Purpose: 1 if the solution and the second argument are the same |
322 | -- (2 circles). |
323 | -- If R2 is the radius of the second argument and Rsol the radius |
324 | -- of the solution and dist the distance between the two centers, |
325 | -- we concider the two circles are identical if R2+dist-Rsol is |
326 | -- less than Tolerance. |
327 | -- 0 in the other cases. |
328 | |
329 | pnttg1sol : Array1OfPnt2d from TColgp; |
330 | ---Purpose: The tangency point between the solution and the first |
331 | -- argument. |
332 | |
333 | pnttg2sol : Array1OfPnt2d from TColgp; |
334 | ---Purpose: The tangency point between the solution and the second |
335 | -- argument. |
336 | |
337 | pntcen : Array1OfPnt2d from TColgp; |
338 | ---Purpose: The center point of the solution. |
339 | |
340 | par1sol : Array1OfReal from TColStd; |
341 | ---Purpose: The parameter of pnttg1sol on the solution. |
342 | -- pnttg1sol is the tangency point between the solution |
343 | -- and the first argument. |
344 | |
345 | par2sol : Array1OfReal from TColStd; |
346 | ---Purpose: The parameter of pnttg2sol on the solution. |
347 | -- pnttg2sol is the tangency point between the solution and the |
348 | -- second argument. |
349 | |
350 | pararg1 : Array1OfReal from TColStd; |
351 | ---Purpose: The parameter of pnttg1sol on the first argument. |
352 | -- pnttg1sol is the tangency point between the solution and the |
353 | -- first argument. |
354 | |
355 | pararg2 : Array1OfReal from TColStd; |
356 | ---Purpose: The parameter of pnttg2sol on the second argument. |
357 | -- pnttg2sol is the tangency point between the solution and the |
358 | -- second argument. |
359 | |
360 | parcen3 : Array1OfReal from TColStd; |
361 | ---Purpose: The parameter of the center point of the solution on the |
362 | -- third argument. |
363 | |
364 | end Circ2d2TanOn; |
365 | |