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 Circ2d2TanOn from Geom2dGcc |
23 | |
24 | ---Purpose: This class implements the algorithms used to |
25 | -- create 2d circles TANgent to 2 entities and |
26 | -- having the center ON a curve. |
27 | -- The order of the tangency argument is always |
28 | -- QualifiedCirc, QualifiedLin, QualifiedCurv, Pnt2d. |
29 | -- the arguments are : |
30 | -- - The two tangency arguments. |
31 | -- - The center line. |
32 | -- - The parameter for each tangency argument which |
33 | -- is a curve. |
34 | -- - The tolerance. |
35 | |
36 | -- inherits Entity from Standard |
37 | |
38 | uses Curve from Geom2dAdaptor, |
39 | QualifiedCurve from Geom2dGcc, |
40 | Integer from Standard, |
41 | Boolean from Standard, |
42 | Array1OfInteger from TColStd, |
43 | Array1OfReal from TColStd, |
44 | Array1OfPnt2d from TColgp, |
45 | Array1OfCirc2d from TColgp, |
46 | Pnt2d from gp, |
47 | Point from Geom2d, |
48 | Circ2d from gp, |
49 | Circ2d2TanOn from GccAna, |
50 | MyCirc2d2TanOn from Geom2dGcc, |
51 | MyC2d2TanOn from Geom2dGcc, |
52 | Position from GccEnt, |
53 | Array1OfPosition from GccEnt |
54 | |
55 | raises NotDone from StdFail, |
56 | BadQualifier from GccEnt, |
57 | OutOfRange from Standard |
58 | |
59 | is |
60 | |
61 | Create(Qualified1 : QualifiedCurve from Geom2dGcc ; |
62 | Qualified2 : QualifiedCurve from Geom2dGcc ; |
63 | OnCurve : Curve from Geom2dAdaptor ; |
64 | Tolerance : Real from Standard ; |
65 | Param1 : Real from Standard ; |
66 | Param2 : Real from Standard ; |
67 | ParamOn : Real from Standard ) |
68 | returns Circ2d2TanOn from Geom2dGcc ; |
69 | ---Purpose: This method implements the algorithms used to |
70 | -- create 2d circles TANgent to two curves and |
71 | -- having the center ON a 2d curve. |
72 | -- Param1 is the initial guess on the first curve QualifiedCurv. |
73 | -- Param1 is the initial guess on the second curve QualifiedCurv. |
74 | -- ParamOn is the initial guess on the center curve OnCurv. |
75 | -- Tolerance is used for the limit cases. |
76 | |
77 | Create(Qualified1 : QualifiedCurve from Geom2dGcc ; |
78 | Point : Point from Geom2d ; |
79 | OnCurve : Curve from Geom2dAdaptor ; |
80 | Tolerance : Real from Standard ; |
81 | Param1 : Real from Standard ; |
82 | ParamOn : Real from Standard ) |
83 | returns Circ2d2TanOn from Geom2dGcc ; |
84 | ---Purpose: This method implements the algorithms used to |
85 | -- create 2d circles TANgent to one curve and one point and |
86 | -- having the center ON a 2d curve. |
87 | -- Param1 is the initial guess on the first curve QualifiedCurv. |
88 | -- ParamOn is the initial guess on the center curve OnCurv. |
89 | -- Tolerance is used for the limit cases. |
90 | |
91 | Create(Point1 : Point from Geom2d ; |
92 | Point2 : Point from Geom2d ; |
93 | OnCurve : Curve from Geom2dAdaptor ; |
94 | Tolerance : Real from Standard ) |
95 | returns Circ2d2TanOn from Geom2dGcc ; |
96 | ---Purpose: This method implements the algorithms used to |
97 | -- create 2d circles TANgent to two points and |
98 | -- having the center ON a 2d curve. |
99 | -- Tolerance is used for the limit cases. |
100 | |
101 | -- -- .................................................................... |
102 | |
103 | Results(me : in out ; |
104 | Circ : Circ2d2TanOn from GccAna) |
105 | is static; |
106 | |
107 | Results(me : in out ; |
108 | Circ : MyCirc2d2TanOn from Geom2dGcc) |
109 | is static; |
110 | |
111 | IsDone(me) returns Boolean |
112 | is static; |
113 | ---Purpose: Returns true if the construction algorithm does not fail |
114 | -- (even if it finds no solution). |
115 | -- Note: IsDone protects against a failure arising from a |
116 | -- more internal intersection algorithm, which has |
117 | -- reached its numeric limits. |
118 | |
119 | NbSolutions(me) returns Integer from Standard |
120 | raises NotDone |
121 | is static; |
122 | ---Purpose: This method returns the number of solutions. |
123 | -- NotDone is raised if the algorithm failed. |
124 | |
125 | ThisSolution(me ; Index : Integer) returns Circ2d |
126 | raises OutOfRange, NotDone |
127 | is static; |
128 | ---Purpose: Returns the solution number Index and raises OutOfRange |
129 | -- exception if Index is greater than the number of solutions. |
130 | -- Be carefull: the Index is only a way to get all the |
131 | -- solutions, but is not associated to theses outside the context |
132 | -- of the algorithm-object. |
133 | -- Exceptions |
134 | -- Standard_OutOfRange if Index is less than or equal |
135 | -- to zero or greater than the number of solutions |
136 | -- computed by this algorithm. |
137 | -- StdFail_NotDone if the construction fails. |
138 | |
139 | WhichQualifier(me ; |
140 | Index : Integer from Standard; |
141 | Qualif1 : out Position from GccEnt ; |
142 | Qualif2 : out Position from GccEnt ) |
143 | raises OutOfRange, NotDone |
144 | is static; |
145 | ---Purpose: It returns the informations about the qualifiers of |
146 | -- the tangency |
147 | -- arguments concerning the solution number Index. |
148 | -- It returns the real qualifiers (the qualifiers given to the |
149 | -- constructor method in case of enclosed, enclosing and outside |
150 | -- and the qualifiers computedin case of unqualified). |
151 | -- Exceptions |
152 | -- Standard_OutOfRange if Index is less than zero or |
153 | -- greater than the number of solutions computed by this algorithm. |
154 | -- StdFail_NotDone if the construction fails. |
155 | |
156 | Tangency1(me ; |
157 | Index : Integer from Standard; |
158 | ParSol,ParArg : out Real from Standard; |
159 | PntSol : out Pnt2d from gp ) |
160 | raises NotDone |
161 | is static; |
162 | ---Purpose: Returns informations about the tangency point between the |
163 | -- result and the first argument. |
164 | -- ParSol is the intrinsic parameter of the point PntSol on the solution curv. |
165 | -- ParArg is the intrinsic parameter of the point PntSol on the argument curv. |
166 | |
167 | Tangency2(me ; |
168 | Index : Integer from Standard; |
169 | ParSol,ParArg : out Real from Standard; |
170 | PntSol : out Pnt2d from gp ) |
171 | raises NotDone |
172 | is static; |
173 | ---Purpose: Returns informations about the tangency point between the |
174 | -- result and the second argument. |
175 | -- ParSol is the intrinsic parameter of the point PntSol on the solution curv. |
176 | -- ParArg is the intrinsic parameter of the point PntSol on the argument curv. |
177 | |
178 | CenterOn3 (me ; |
179 | Index : Integer from Standard; |
180 | ParArg : out Real from Standard; |
181 | PntSol : out Pnt2d from gp ) |
182 | raises NotDone |
183 | is static; |
184 | ---Purpose: Returns the center PntSol of the solution of index Index |
185 | -- computed by this algorithm. |
186 | -- ParArg is the parameter of the point PntSol on the third argument. |
187 | -- Exceptions |
188 | -- Standard_OutOfRange if Index is less than zero or |
189 | -- greater than the number of solutions computed by this algorithm. |
190 | -- StdFail_NotDone if the construction fails. |
191 | |
192 | IsTheSame1(me ; |
193 | Index : Integer from Standard) returns Boolean from Standard |
194 | raises NotDone |
195 | is static; |
196 | --- Purpose: Returns true if the solution of index Index and, |
197 | -- respectively, the first or second argument of this |
198 | -- algorithm are the same (i.e. there are 2 identical circles). |
199 | -- If Rarg is the radius of the first or second argument, |
200 | -- Rsol is the radius of the solution and dist is the |
201 | -- distance between the two centers, we consider the two |
202 | -- circles to be identical if |Rarg - Rsol| and dist |
203 | -- are less than or equal to the tolerance criterion given at |
204 | -- the time of construction of this algorithm. |
205 | -- Exceptions |
206 | -- Standard_OutOfRange if Index is less than zero or |
207 | -- greater than the number of solutions computed by this algorithm. |
208 | -- StdFail_NotDone if the construction fails. |
209 | |
210 | IsTheSame2(me ; |
211 | Index : Integer ) returns Boolean |
212 | raises NotDone |
213 | is static; |
214 | --- Purpose: Returns true if the solution of index Index and, |
215 | -- respectively, the first or second argument of this |
216 | -- algorithm are the same (i.e. there are 2 identical circles). |
217 | -- If Rarg is the radius of the first or second argument, |
218 | -- Rsol is the radius of the solution and dist is the |
219 | -- distance between the two centers, we consider the two |
220 | -- circles to be identical if |Rarg - Rsol| and dist |
221 | -- are less than or equal to the tolerance criterion given at |
222 | -- the time of construction of this algorithm. |
223 | -- Exceptions |
224 | -- Standard_OutOfRange if Index is less than zero or |
225 | -- greater than the number of solutions computed by this algorithm. |
226 | -- StdFail_NotDone if the construction fails. |
227 | |
228 | fields |
229 | |
230 | WellDone : Boolean from Standard; |
231 | ---Purpose: Returns True if the algorithm succeeded. |
232 | |
233 | cirsol : Array1OfCirc2d from TColgp; |
234 | -- TheSolution. |
235 | |
236 | NbrSol : Integer from Standard; |
237 | ---Purpose: Returns the number of solutions. |
238 | |
239 | qualifier1 : Array1OfPosition from GccEnt; |
240 | ---Purpose: The qualifiers of the first argument. |
241 | |
242 | qualifier2 : Array1OfPosition from GccEnt; |
243 | ---Purpose: The qualifiers of the second argument. |
244 | |
245 | TheSame1 : Array1OfInteger from TColStd; |
246 | ---Purpose: Returns 1 if the solution and the first argument are the same (2 circles). |
247 | -- if R1 is the radius of the first argument and Rsol the radius |
248 | -- of the solution and dist the distance between the two centers, |
249 | -- we concider the two circles are identical if R1+dist-Rsol is |
250 | -- less than Tolerance. |
251 | -- 0 in the other cases. |
252 | |
253 | TheSame2 : Array1OfInteger from TColStd; |
254 | ---Purpose: 1 if the solution and the second argument are the same (2 circles). |
255 | -- if R2 is the radius of the second argument and Rsol the radius |
256 | -- of the solution and dist the distance between the two centers, |
257 | -- we concider the two circles are identical if R2+dist-Rsol is |
258 | -- less than Tolerance. |
259 | -- 0 in the other cases. |
260 | |
261 | pnttg1sol : Array1OfPnt2d from TColgp; |
262 | ---Purpose: The tangency point between the solution and the first argument. |
263 | |
264 | pnttg2sol : Array1OfPnt2d from TColgp; |
265 | ---Purpose: The tangency point between the solution and the second argument. |
266 | |
267 | pntcen : Array1OfPnt2d from TColgp; |
268 | ---Purpose: The center point of the solution. |
269 | |
270 | par1sol : Array1OfReal from TColStd; |
271 | ---Purpose: The parameter of pnttg1sol on the solution. |
272 | -- pnttg1sol is the tangency point between the solution and the first argument. |
273 | |
274 | par2sol : Array1OfReal from TColStd; |
275 | ---Purpose: The parameter of pnttg2sol on the solution. |
276 | -- pnttg2sol is the tangency point between the solution and the second argument. |
277 | |
278 | pararg1 : Array1OfReal from TColStd; |
279 | ---Purpose: The parameter of pnttg1sol on the first argument. |
280 | -- pnttg1sol is the tangency point between the solution and the first argument. |
281 | |
282 | pararg2 : Array1OfReal from TColStd; |
283 | ---Purpose: The parameter of pnttg2sol on the second argument. |
284 | -- pnttg2sol is the tangency point between the solution and the second argument. |
285 | |
286 | parcen3 : Array1OfReal from TColStd; |
287 | ---Purpose: The parameter of the center point of the solution on the third argument. |
288 | |
289 | Invert : Boolean from Standard; |
290 | |
291 | -- CircAna : Circ2d2TanOn from GccAna; |
292 | -- CircGeo : MyCirc2d2TanOn from Geom2dGcc; |
293 | -- CircIter : MyC2d2TanOn from Geom2dGcc; |
294 | -- TypeAna : Boolean; |
295 | |
296 | end Circ2d2TanOn; |