b311480e |
1 | -- Created on: 1992-10-20 |
2 | -- Created by: Remi GILET |
3 | -- Copyright (c) 1992-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 Circ2d3Tan from Geom2dGcc |
23 | |
24 | ---Purpose: This class implements the algorithms used to |
25 | -- create 2d circles tangent to 3 points/lines/circles/ |
26 | -- curves with one curve or more. |
27 | -- The arguments of all construction methods are : |
28 | -- - The three qualifiied elements for the |
29 | -- tangency constrains (QualifiedCirc, QualifiedLine, |
30 | -- Qualifiedcurv, Points). |
31 | -- - A parameter for each QualifiedCurv. |
32 | -- Describes functions for building a 2D circle: |
33 | -- - tangential to 3 curves, or |
34 | -- - tangential to 2 curves and passing through a point, or |
35 | -- - tangential to a curve and passing through 2 points, or |
36 | -- - passing through 3 points. |
37 | -- A Circ2d3Tan object provides a framework for: |
38 | -- - defining the construction of 2D circles(s), |
39 | -- - implementing the construction algorithm, and |
40 | -- - consulting the result(s). |
41 | |
42 | -- inherits Entity from Standard |
43 | |
44 | uses QualifiedCurve from Geom2dGcc, |
45 | Integer from Standard, |
46 | Circ2d from gp, |
47 | Pnt2d from gp, |
48 | Array1OfPnt2d from TColgp, |
49 | Array1OfCirc2d from TColgp, |
50 | Boolean from Standard, |
51 | Array1OfInteger from TColStd, |
52 | Array1OfReal from TColStd, |
53 | Circ2d3Tan from GccAna, |
54 | Point from Geom2d, |
55 | MyC2d3Tan from Geom2dGcc, |
56 | Position from GccEnt, |
57 | Array1OfPosition from GccEnt |
58 | |
59 | raises NotDone from StdFail, |
60 | OutOfRange from Standard |
61 | |
62 | is |
63 | |
64 | Create(Qualified1 : QualifiedCurve from Geom2dGcc ; |
65 | Qualified2 : QualifiedCurve from Geom2dGcc ; |
66 | Qualified3 : QualifiedCurve from Geom2dGcc ; |
67 | Tolerance : Real from Standard ; |
68 | Param1 : Real from Standard ; |
69 | Param2 : Real from Standard ; |
70 | Param3 : Real from Standard ) |
71 | returns Circ2d3Tan from Geom2dGcc; |
72 | ---Purpose: Constructs one or more 2D circles |
73 | -- tangential to three curves Qualified1, Qualified2 and |
74 | -- Qualified3, where Param1, Param2 and Param3 are |
75 | -- used, respectively, as the initial values of the |
76 | -- parameters on Qualified1, Qualified2 and Qualified3 |
77 | -- of the tangency point between these arguments and |
78 | -- the solution sought, if the algorithm chooses an |
79 | -- iterative method to find the solution (i.e. if either |
80 | -- Qualified1, Qualified2 or Qualified3 is more complex |
81 | -- than a line or a circle). |
82 | |
83 | Create(Qualified1 : QualifiedCurve from Geom2dGcc ; |
84 | Qualified2 : QualifiedCurve from Geom2dGcc ; |
85 | Point : Point from Geom2d ; |
86 | Tolerance : Real from Standard ; |
87 | Param1 : Real from Standard ; |
88 | Param2 : Real from Standard ) |
89 | returns Circ2d3Tan from Geom2dGcc; |
90 | ---Purpose: Constructs one or more 2D circles |
91 | -- tangential to two curves Qualified1 and Qualified2 |
92 | -- and passing through the point Point, where Param1 |
93 | -- and Param2 are used, respectively, as the initial |
94 | -- values of the parameters on Qualified1 and |
95 | -- Qualified2 of the tangency point between this |
96 | -- argument and the solution sought, if the algorithm |
97 | -- chooses an iterative method to find the solution (i.e. if |
98 | -- either Qualified1 or Qualified2 is more complex than |
99 | -- a line or a circle). |
100 | |
101 | Create(Qualified1 : QualifiedCurve from Geom2dGcc ; |
102 | Point1 : Point from Geom2d ; |
103 | Point2 : Point from Geom2d ; |
104 | Tolerance : Real from Standard ; |
105 | Param1 : Real from Standard ) |
106 | returns Circ2d3Tan from Geom2dGcc; |
107 | ---Purpose: Constructs one or more 2D circles tangential to the curve Qualified1 and passing |
108 | -- through two points Point1 and Point2, where Param1 |
109 | -- is used as the initial value of the parameter on |
110 | -- Qualified1 of the tangency point between this |
111 | -- argument and the solution sought, if the algorithm |
112 | -- chooses an iterative method to find the solution (i.e. if |
113 | -- Qualified1 is more complex than a line or a circle) |
114 | |
115 | |
116 | Create(Point1 : Point from Geom2d ; |
117 | Point2 : Point from Geom2d ; |
118 | Point3 : Point from Geom2d ; |
119 | Tolerance : Real from Standard ) |
120 | returns Circ2d3Tan from Geom2dGcc; |
121 | ---Purpose: Constructs one or more 2D circles passing through three points Point1, Point2 and Point3. |
122 | -- Tolerance is a tolerance criterion used by the algorithm |
123 | -- to find a solution when, mathematically, the problem |
124 | -- posed does not have a solution, but where there is |
125 | -- numeric uncertainty attached to the arguments. |
126 | -- For example, take: |
127 | -- - two circles C1 and C2, such that C2 is inside C1, |
128 | -- and almost tangential to C1; there is in fact no point |
129 | -- of intersection between C1 and C2; and |
130 | -- - a circle C3 outside C1. |
131 | -- You now want to find a circle which is tangential to C1, |
132 | -- C2 and C3: a pure mathematical resolution will not find |
133 | -- a solution. This is where the tolerance criterion is used: |
134 | -- the algorithm considers that C1 and C2 are tangential if |
135 | -- the shortest distance between these two circles is less |
136 | -- than or equal to Tolerance. Thus, the algorithm finds a solution. |
137 | -- Warning |
138 | -- An iterative algorithm is used if Qualified1, Qualified2 or |
139 | -- Qualified3 is more complex than a line or a circle. In |
140 | -- such cases, the algorithm constructs only one solution. |
141 | -- Exceptions |
142 | -- GccEnt_BadQualifier if a qualifier is inconsistent with |
143 | -- the argument it qualifies (for example, enclosing for a line). |
144 | |
145 | Results(me : in out ; |
146 | Circ : Circ2d3Tan from GccAna ; |
147 | Rank1 : Integer from Standard; |
148 | Rank2 : Integer from Standard; |
149 | Rank3 : Integer from Standard) |
150 | is static; |
151 | |
152 | IsDone(me) returns Boolean from Standard |
153 | is static; |
154 | ---Purpose: Returns true if the construction algorithm does not fail (even if it finds no solution). |
155 | -- Note: IsDone protects against a failure arising from a |
156 | -- more internal intersection algorithm, which has reached its numeric limits. |
157 | |
158 | NbSolutions(me) returns Integer from Standard |
159 | raises NotDone |
160 | is static; |
161 | ---Purpose: This method returns the number of solutions. |
162 | -- NotDone is raised if the algorithm failed. |
163 | |
164 | ThisSolution(me ; Index : Integer from Standard) returns Circ2d from gp |
165 | raises OutOfRange, NotDone |
166 | is static; |
167 | ---Purpose: Returns the solution number Index and raises OutOfRange |
168 | -- exception if Index is greater than the number of solutions. |
169 | -- Be carefull: the Index is only a way to get all the |
170 | -- solutions, but is not associated to theses outside the context |
171 | -- of the algorithm-object. |
172 | |
173 | WhichQualifier(me ; |
174 | Index : Integer from Standard; |
175 | Qualif1 : out Position from GccEnt ; |
176 | Qualif2 : out Position from GccEnt ; |
177 | Qualif3 : out Position from GccEnt ) |
178 | raises OutOfRange, NotDone |
179 | is static; |
180 | ---Purpose: It returns the informations about the qualifiers of the tangency |
181 | -- arguments concerning the solution number Index. |
182 | -- It returns the real qualifiers (the qualifiers given to the |
183 | -- constructor method in case of enclosed, enclosing and outside |
184 | -- and the qualifiers computedin case of unqualified). |
185 | |
186 | Tangency1(me ; |
187 | Index : Integer from Standard; |
188 | ParSol,ParArg : out Real from Standard; |
189 | PntSol : out Pnt2d from gp ) |
190 | raises NotDone |
191 | is static; |
192 | ---Purpose: Returns informations about the tangency point between the |
193 | -- result and the first argument. |
194 | -- ParSol is the intrinsic parameter of the point PntSol on the solution curv. |
195 | -- ParArg is the intrinsic parameter of the point PntSol on the argument curv. |
196 | |
197 | Tangency2(me ; |
198 | Index : Integer from Standard; |
199 | ParSol,ParArg : out Real from Standard; |
200 | PntSol : out Pnt2d from gp ) |
201 | raises NotDone |
202 | is static; |
203 | ---Purpose: Returns informations about the tangency point between the |
204 | -- result and the second argument. |
205 | -- ParSol is the intrinsic parameter of the point PntSol on the solution curv. |
206 | -- ParArg is the intrinsic parameter of the point PntSol on the argument curv. |
207 | |
208 | Tangency3(me ; |
209 | Index : Integer from Standard; |
210 | ParSol,ParArg : out Real from Standard; |
211 | PntSol : out Pnt2d from gp ) |
212 | raises NotDone |
213 | is static; |
214 | ---Purpose: Returns informations about the tangency point between the |
215 | -- result and the third argument. |
216 | -- ParSol is the intrinsic parameter of the point PntSol on the solution curv. |
217 | -- ParArg is the intrinsic parameter of the point PntSol on the argument curv. |
218 | |
219 | IsTheSame1(me ; |
220 | Index : Integer from Standard) returns Boolean from Standard |
221 | raises NotDone |
222 | is static; |
223 | ---Purpose: Returns True if the solution is equal to the first argument. |
224 | |
225 | IsTheSame2(me ; |
226 | Index : Integer from Standard) returns Boolean from Standard |
227 | raises NotDone |
228 | is static; |
229 | ---Purpose: Returns True if the solution is equal to the second argument. |
230 | |
231 | IsTheSame3(me ; |
232 | Index : Integer from Standard) returns Boolean from Standard |
233 | raises NotDone |
234 | is static; |
235 | ---Purpose: Returns True if the solution is equal to the third argument. |
236 | -- If Rarg is the radius of the first, second or third |
237 | -- argument, Rsol is the radius of the solution and dist |
238 | -- is the distance between the two centers, we consider |
239 | -- the two circles to be identical if |Rarg - Rsol| and |
240 | -- dist are less than or equal to the tolerance criterion |
241 | -- given at the time of construction of this algorithm. |
242 | -- Exceptions |
243 | -- Standard_OutOfRange if Index is less than zero or |
244 | -- greater than the number of solutions computed by this algorithm. |
245 | -- StdFail_NotDone if the construction fails. |
246 | |
247 | fields |
248 | |
249 | cirsol : Array1OfCirc2d from TColgp; |
250 | ---Purpose: The solution. |
251 | |
252 | NbrSol : Real from Standard; |
253 | ---Purpose: number of solutions. |
254 | |
255 | WellDone : Boolean from Standard; |
256 | ---Purpose: True if the algorithm succeeded. |
257 | |
258 | qualifier1 : Array1OfPosition from GccEnt; |
259 | ---Purpose: The qualifiers of the first argument. |
260 | |
261 | qualifier2 : Array1OfPosition from GccEnt ; |
262 | ---Purpose: The qualifiers of the second argument. |
263 | |
264 | qualifier3 : Array1OfPosition from GccEnt; |
265 | ---Purpose: The qualifiers of the third argument. |
266 | |
267 | TheSame1 : Array1OfInteger from TColStd; |
268 | ---Purpose: 1 if the solution and the first argument are the same (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 | -- 0 in the other cases. |
274 | |
275 | TheSame2 : Array1OfInteger from TColStd; |
276 | ---Purpose: 1 if the solution and the second argument are the same (2 circles). |
277 | -- if R2 is the radius of the second argument and Rsol the radius |
278 | -- of the solution and dist the distance between the two centers, |
279 | -- we concider the two circles are identical if R2+dist-Rsol is |
280 | -- less than Tolerance. |
281 | -- 0 in the other cases. |
282 | |
283 | TheSame3 : Array1OfInteger from TColStd; |
284 | ---Purpose: 1 if the solution and the third argument are the same (2 circles). |
285 | -- if R3 is the radius of the third argument and Rsol the radius |
286 | -- of the solution and dist the distance between the two centers, |
287 | -- we concider the two circles are identical if R3+dist-Rsol is |
288 | -- less than Tolerance. |
289 | -- 0 in the other cases. |
290 | |
291 | pnttg1sol : Array1OfPnt2d from TColgp; |
292 | ---Purpose: The tangency point between the solution and the first argument. |
293 | |
294 | pnttg2sol : Array1OfPnt2d from TColgp; |
295 | ---Purpose: The tangency point between the solution and the second argument. |
296 | |
297 | pnttg3sol : Array1OfPnt2d from TColgp; |
298 | ---Purpose: The tangency point between the solution and the third argument. |
299 | |
300 | par1sol : Array1OfReal from TColStd; |
301 | ---Purpose: The parameter of the tangency point between the solution and the |
302 | -- first argument on the solution. |
303 | |
304 | par2sol : Array1OfReal from TColStd; |
305 | ---Purpose: The parameter of the tangency point between the solution and the |
306 | -- second argument on the solution. |
307 | |
308 | par3sol : Array1OfReal from TColStd; |
309 | ---Purpose: The parameter of the tangency point between the solution and the |
310 | -- third argument on the solution. |
311 | |
312 | pararg1 : Array1OfReal from TColStd; |
313 | ---Purpose: The parameter of the tangency point between the solution and the first |
314 | -- argument on the first argument. |
315 | |
316 | pararg2 : Array1OfReal from TColStd; |
317 | ---Purpose: The parameter of the tangency point between the solution and the second |
318 | -- argument on the second argument. |
319 | |
320 | pararg3 : Array1OfReal from TColStd; |
321 | ---Purpose: The parameter of the tangency point between the solution and the third |
322 | -- argument on the second argument. |
323 | |
324 | |
325 | -- CircAna : Circ2d2TanOn from GccAna; |
326 | -- CircIter : Circ2d2TanOn from GccIter; |
327 | -- TypeAna : Boolean; |
328 | |
329 | end Circ2d3Tan; |