b311480e |
1 | // Created on: 1992-10-21 |
2 | // Created by: Remi GILET |
3 | // Copyright (c) 1992-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 | |
42cf5bc1 |
17 | |
18 | #include <GccAna_Circ2d3Tan.hxx> |
7fd59977 |
19 | #include <GccEnt_QualifiedCirc.hxx> |
20 | #include <GccEnt_QualifiedLin.hxx> |
42cf5bc1 |
21 | #include <Geom2d_Circle.hxx> |
22 | #include <Geom2d_Line.hxx> |
23 | #include <Geom2d_Point.hxx> |
24 | #include <Geom2dAdaptor_Curve.hxx> |
25 | #include <Geom2dGcc_Circ2d3Tan.hxx> |
26 | #include <Geom2dGcc_Circ2d3TanIter.hxx> |
27 | #include <Geom2dGcc_QCurve.hxx> |
28 | #include <Geom2dGcc_QualifiedCurve.hxx> |
29 | #include <gp_Circ2d.hxx> |
30 | #include <gp_Pnt2d.hxx> |
31 | #include <Standard_OutOfRange.hxx> |
7fd59977 |
32 | #include <StdFail_NotDone.hxx> |
33 | |
34 | Geom2dGcc_Circ2d3Tan:: |
35 | Geom2dGcc_Circ2d3Tan (const Geom2dGcc_QualifiedCurve& Qualified1 , |
36 | const Geom2dGcc_QualifiedCurve& Qualified2 , |
37 | const Geom2dGcc_QualifiedCurve& Qualified3 , |
38 | const Standard_Real Tolerance , |
39 | const Standard_Real Param1 , |
40 | const Standard_Real Param2 , |
41 | const Standard_Real Param3 ): |
42 | cirsol(1,16) , |
43 | qualifier1(1,16), |
44 | qualifier2(1,16), |
45 | qualifier3(1,16), |
46 | TheSame1(1,16) , |
47 | TheSame2(1,16) , |
48 | TheSame3(1,16) , |
49 | pnttg1sol(1,16), |
50 | pnttg2sol(1,16), |
51 | pnttg3sol(1,16), |
52 | par1sol(1,16) , |
53 | par2sol(1,16) , |
54 | par3sol(1,16) , |
55 | pararg1(1,16) , |
56 | pararg2(1,16) , |
57 | pararg3(1,16) |
58 | { |
59 | Geom2dAdaptor_Curve C1 = Qualified1.Qualified(); |
60 | Geom2dAdaptor_Curve C2 = Qualified2.Qualified(); |
61 | Geom2dAdaptor_Curve C3 = Qualified3.Qualified(); |
62 | Handle(Geom2d_Curve) CC1 = C1.Curve(); |
63 | Handle(Geom2d_Curve) CC2 = C2.Curve(); |
64 | Handle(Geom2d_Curve) CC3 = C3.Curve(); |
65 | GeomAbs_CurveType Type1 = C1.GetType(); |
66 | GeomAbs_CurveType Type2 = C2.GetType(); |
67 | GeomAbs_CurveType Type3 = C3.GetType(); |
68 | |
69 | //============================================================================= |
70 | // Appel a GccAna. + |
71 | //============================================================================= |
72 | |
73 | NbrSol = 0; |
74 | if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle) && |
75 | (Type2 == GeomAbs_Line || Type2 == GeomAbs_Circle) && |
76 | (Type3 == GeomAbs_Line || Type3 == GeomAbs_Circle)) { |
77 | if (Type1 == GeomAbs_Circle) { |
78 | Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1); |
79 | gp_Circ2d c1(CCC1->Circ2d()); |
80 | GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,Qualified1.Qualifier()); |
81 | if (Type2 == GeomAbs_Circle) { |
82 | Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2); |
83 | gp_Circ2d c2(CCC2->Circ2d()); |
84 | GccEnt_QualifiedCirc Qc2=GccEnt_QualifiedCirc(c2, |
85 | Qualified2.Qualifier()); |
86 | if (Type3 == GeomAbs_Circle) { |
87 | Handle(Geom2d_Circle) CCC3 = Handle(Geom2d_Circle)::DownCast(CC3); |
88 | gp_Circ2d c3(CCC3->Circ2d()); |
89 | GccEnt_QualifiedCirc Qc3=GccEnt_QualifiedCirc(c3, |
90 | Qualified3.Qualifier()); |
91 | GccAna_Circ2d3Tan Circ(Qc1,Qc2,Qc3,Tolerance); |
92 | WellDone = Circ.IsDone(); |
93 | NbrSol = Circ.NbSolutions(); |
94 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
95 | Circ.WhichQualifier(i,qualifier1(i), |
96 | qualifier2(i),qualifier3(i)); |
97 | } |
98 | Results(Circ,1,2,3); |
99 | } |
100 | else { |
101 | Handle(Geom2d_Line) LL3 = Handle(Geom2d_Line)::DownCast(CC3); |
102 | gp_Lin2d l3(LL3->Lin2d()); |
103 | GccEnt_QualifiedLin Ql3=GccEnt_QualifiedLin(l3, |
104 | Qualified3.Qualifier()); |
105 | GccAna_Circ2d3Tan Circ(Qc1,Qc2,Ql3,Tolerance); |
106 | WellDone = Circ.IsDone(); |
107 | NbrSol = Circ.NbSolutions(); |
108 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
109 | Circ.WhichQualifier(i,qualifier1(i), |
110 | qualifier2(i),qualifier3(i)); |
111 | } |
112 | Results(Circ,1,2,3); |
113 | } |
114 | } |
115 | else { |
116 | Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2); |
117 | gp_Lin2d l2(LL2->Lin2d()); |
118 | GccEnt_QualifiedLin Ql2(l2,Qualified2.Qualifier()); |
119 | if (Type3 == GeomAbs_Circle) { |
120 | Handle(Geom2d_Circle) CCC3 = Handle(Geom2d_Circle)::DownCast(CC3); |
121 | gp_Circ2d c3(CCC3->Circ2d()); |
122 | GccEnt_QualifiedCirc Qc3(c3,Qualified3.Qualifier()); |
123 | GccAna_Circ2d3Tan Circ(Qc1,Qc3,Ql2,Tolerance); |
124 | WellDone = Circ.IsDone(); |
125 | NbrSol = Circ.NbSolutions(); |
126 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
127 | Circ.WhichQualifier(i,qualifier1(i), |
128 | qualifier3(i),qualifier2(i)); |
129 | } |
130 | Results(Circ,1,3,2); |
131 | } |
132 | else { |
133 | Handle(Geom2d_Line) LL3 = Handle(Geom2d_Line)::DownCast(CC3); |
134 | gp_Lin2d l3(LL3->Lin2d()); |
135 | GccEnt_QualifiedLin Ql3=GccEnt_QualifiedLin(l3, |
136 | Qualified3.Qualifier()); |
137 | GccAna_Circ2d3Tan Circ(Qc1,Ql2,Ql3,Tolerance); |
138 | WellDone = Circ.IsDone(); |
139 | NbrSol = Circ.NbSolutions(); |
140 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
141 | Circ.WhichQualifier(i,qualifier1(i), |
142 | qualifier2(i),qualifier3(i)); |
143 | } |
144 | Results(Circ,1,2,3); |
145 | } |
146 | } |
147 | } |
148 | else { |
149 | Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1); |
150 | gp_Lin2d l1(LL1->Lin2d()); |
151 | GccEnt_QualifiedLin Ql1=GccEnt_QualifiedLin(l1,Qualified1.Qualifier()); |
152 | if (Type2 == GeomAbs_Circle) { |
153 | Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2); |
154 | gp_Circ2d c2(CCC2->Circ2d()); |
155 | GccEnt_QualifiedCirc Qc2=GccEnt_QualifiedCirc(c2, |
156 | Qualified2.Qualifier()); |
157 | if (Type3 == GeomAbs_Circle) { |
158 | Handle(Geom2d_Circle) CCC3 = Handle(Geom2d_Circle)::DownCast(CC3); |
159 | gp_Circ2d c3(CCC3->Circ2d()); |
160 | GccEnt_QualifiedCirc Qc3=GccEnt_QualifiedCirc(c3, |
161 | Qualified3.Qualifier()); |
162 | GccAna_Circ2d3Tan Circ(Qc2,Qc3,Ql1,Tolerance); |
163 | WellDone = Circ.IsDone(); |
164 | NbrSol = Circ.NbSolutions(); |
165 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
166 | Circ.WhichQualifier(i,qualifier3(i), |
167 | qualifier1(i),qualifier2(i)); |
168 | } |
169 | Results(Circ,3,1,2); |
170 | } |
171 | else { |
172 | Handle(Geom2d_Line) LL3 = Handle(Geom2d_Line)::DownCast(CC3); |
173 | gp_Lin2d l3(LL3->Lin2d()); |
174 | GccEnt_QualifiedLin Ql3=GccEnt_QualifiedLin(l3, |
175 | Qualified3.Qualifier()); |
176 | GccAna_Circ2d3Tan Circ(Qc2,Ql1,Ql3,Tolerance); |
177 | WellDone = Circ.IsDone(); |
178 | NbrSol = Circ.NbSolutions(); |
179 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
180 | Circ.WhichQualifier(i,qualifier2(i), |
181 | qualifier1(i),qualifier3(i)); |
182 | } |
183 | Results(Circ,2,1,3); |
184 | } |
185 | } |
186 | else { |
187 | Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2); |
188 | gp_Lin2d l2(LL2->Lin2d()); |
189 | GccEnt_QualifiedLin Ql2=GccEnt_QualifiedLin(l2,Qualified2.Qualifier()); |
190 | if (Type3 == GeomAbs_Circle) { |
191 | Handle(Geom2d_Circle) CCC3 = Handle(Geom2d_Circle)::DownCast(CC3); |
192 | gp_Circ2d c3(CCC3->Circ2d()); |
193 | GccEnt_QualifiedCirc Qc3=GccEnt_QualifiedCirc(c3, |
194 | Qualified3.Qualifier()); |
195 | GccAna_Circ2d3Tan Circ(Qc3,Ql2,Ql1,Tolerance); |
196 | WellDone = Circ.IsDone(); |
197 | NbrSol = Circ.NbSolutions(); |
198 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
199 | Circ.WhichQualifier(i,qualifier3(i), |
200 | qualifier2(i),qualifier1(i)); |
201 | } |
202 | Results(Circ,3,2,1); |
203 | } |
204 | else { |
205 | Handle(Geom2d_Line) LL3 = Handle(Geom2d_Line)::DownCast(CC3); |
206 | gp_Lin2d l3(LL3->Lin2d()); |
207 | GccEnt_QualifiedLin Ql3=GccEnt_QualifiedLin(l3, |
208 | Qualified3.Qualifier()); |
209 | GccAna_Circ2d3Tan Circ(Ql1,Ql2,Ql3,Tolerance); |
210 | WellDone = Circ.IsDone(); |
211 | NbrSol = Circ.NbSolutions(); |
212 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
213 | Circ.WhichQualifier(i,qualifier1(i), |
214 | qualifier2(i),qualifier3(i)); |
215 | } |
216 | Results(Circ,1,2,3); |
217 | } |
218 | } |
219 | } |
220 | } |
221 | else { |
0b85f9a6 |
222 | Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier()); |
223 | Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier()); |
224 | Geom2dGcc_QCurve Qc3(C3,Qualified3.Qualifier()); |
54e37688 |
225 | Geom2dGcc_Circ2d3TanIter Circ(Qc1,Qc2,Qc3,Param1,Param2,Param3,Tolerance); |
7fd59977 |
226 | WellDone = Circ.IsDone(); |
227 | NbrSol = 1; |
228 | if (WellDone) { |
229 | cirsol(1) = Circ.ThisSolution(); |
230 | if (Circ.IsTheSame1()) { TheSame1(1) = 1; } |
231 | else {TheSame1(1) = 0; } |
232 | if (Circ.IsTheSame2()) { TheSame2(1) = 1; } |
233 | else {TheSame2(1) = 0; } |
234 | if (Circ.IsTheSame3()) { TheSame3(1) = 1; } |
235 | else {TheSame3(1) = 0; } |
236 | Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1)); |
237 | Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1)); |
238 | Circ.Tangency3(par3sol(1),pararg3(1),pnttg3sol(1)); |
239 | Circ.WhichQualifier(qualifier1(1),qualifier2(1),qualifier3(1)); |
240 | } |
241 | } |
242 | } |
243 | |
244 | Geom2dGcc_Circ2d3Tan:: |
245 | Geom2dGcc_Circ2d3Tan (const Geom2dGcc_QualifiedCurve& Qualified1 , |
246 | const Geom2dGcc_QualifiedCurve& Qualified2 , |
247 | const Handle(Geom2d_Point)& Point , |
248 | const Standard_Real Tolerance , |
249 | const Standard_Real Param1 , |
250 | const Standard_Real Param2 ): |
251 | cirsol(1,16) , |
252 | qualifier1(1,16), |
253 | qualifier2(1,16), |
254 | qualifier3(1,16), |
255 | TheSame1(1,16) , |
256 | TheSame2(1,16) , |
257 | TheSame3(1,16) , |
258 | pnttg1sol(1,16), |
259 | pnttg2sol(1,16), |
260 | pnttg3sol(1,16), |
261 | par1sol(1,16) , |
262 | par2sol(1,16) , |
263 | par3sol(1,16) , |
264 | pararg1(1,16) , |
265 | pararg2(1,16) , |
266 | pararg3(1,16) |
267 | { |
268 | Geom2dAdaptor_Curve C1 = Qualified1.Qualified(); |
269 | Geom2dAdaptor_Curve C2 = Qualified2.Qualified(); |
270 | Handle(Geom2d_Curve) CC1 = C1.Curve(); |
271 | Handle(Geom2d_Curve) CC2 = C2.Curve(); |
272 | GeomAbs_CurveType Type1 = C1.GetType(); |
273 | GeomAbs_CurveType Type2 = C2.GetType(); |
274 | |
275 | //============================================================================= |
276 | // Appel a GccAna. + |
277 | //============================================================================= |
278 | |
279 | NbrSol = 0; |
280 | if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle) && |
281 | (Type2 == GeomAbs_Line || Type2 == GeomAbs_Circle)) { |
282 | if (Type1 == GeomAbs_Circle) { |
283 | Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1); |
284 | gp_Circ2d c1(CCC1->Circ2d()); |
285 | GccEnt_QualifiedCirc Qc1(c1,Qualified1.Qualifier()); |
286 | if (Type2 == GeomAbs_Circle) { |
287 | Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2); |
288 | gp_Circ2d c2(CCC2->Circ2d()); |
289 | GccEnt_QualifiedCirc Qc2(c2,Qualified2.Qualifier()); |
290 | GccAna_Circ2d3Tan Circ(Qc1,Qc2,Point->Pnt2d(),Tolerance); |
291 | WellDone = Circ.IsDone(); |
292 | NbrSol = Circ.NbSolutions(); |
293 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
294 | Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i)); |
295 | } |
296 | Results(Circ,1,2,3); |
297 | } |
298 | else { |
299 | Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2); |
300 | gp_Lin2d l2(LL2->Lin2d()); |
301 | GccEnt_QualifiedLin Ql2(l2,Qualified2.Qualifier()); |
302 | GccAna_Circ2d3Tan Circ(Qc1,Ql2,Point->Pnt2d(),Tolerance); |
303 | WellDone = Circ.IsDone(); |
304 | NbrSol = Circ.NbSolutions(); |
305 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
306 | Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i)); |
307 | } |
308 | Results(Circ,1,2,3); |
309 | } |
310 | } |
311 | else { |
312 | Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1); |
313 | gp_Lin2d l1(LL1->Lin2d()); |
314 | GccEnt_QualifiedLin Ql1(l1,Qualified1.Qualifier()); |
315 | if (Type2 == GeomAbs_Circle) { |
316 | Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2); |
317 | gp_Circ2d c2(CCC2->Circ2d()); |
318 | GccEnt_QualifiedCirc Qc2(c2,Qualified2.Qualifier()); |
319 | GccAna_Circ2d3Tan Circ(Qc2,Ql1,Point->Pnt2d(),Tolerance); |
320 | WellDone = Circ.IsDone(); |
321 | NbrSol = Circ.NbSolutions(); |
322 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
323 | Circ.WhichQualifier(i,qualifier2(i),qualifier1(i),qualifier3(i)); |
324 | } |
325 | Results(Circ,2,1,3); |
326 | } |
327 | else { |
328 | Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2); |
329 | gp_Lin2d l2(LL2->Lin2d()); |
330 | GccEnt_QualifiedLin Ql2(l2,Qualified2.Qualifier()); |
331 | GccAna_Circ2d3Tan Circ(Ql1,Ql2,Point->Pnt2d(),Tolerance); |
332 | WellDone = Circ.IsDone(); |
333 | NbrSol = Circ.NbSolutions(); |
334 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
335 | Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i)); |
336 | } |
337 | Results(Circ,1,2,3); |
338 | } |
339 | } |
340 | } |
341 | else { |
0b85f9a6 |
342 | Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier()); |
343 | Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier()); |
54e37688 |
344 | Geom2dGcc_Circ2d3TanIter Circ(Qc1,Qc2,Point->Pnt2d(),Param1,Param2,Tolerance); |
7fd59977 |
345 | WellDone = Circ.IsDone(); |
346 | NbrSol = 1; |
347 | if (WellDone) { |
348 | cirsol(1) = Circ.ThisSolution(); |
349 | if (Circ.IsTheSame1()) { TheSame1(1) = 1; } |
350 | else {TheSame1(1) = 0; } |
351 | if (Circ.IsTheSame2()) { TheSame2(1) = 1; } |
352 | else {TheSame2(1) = 0; } |
353 | if (Circ.IsTheSame3()) { TheSame3(1) = 1; } |
354 | else {TheSame3(1) = 0; } |
355 | Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1)); |
356 | Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1)); |
357 | Circ.Tangency3(par3sol(1),pararg3(1),pnttg3sol(1)); |
358 | Circ.WhichQualifier(qualifier1(1),qualifier2(1),qualifier3(1)); |
359 | } |
360 | } |
361 | } |
362 | |
363 | Geom2dGcc_Circ2d3Tan:: |
364 | Geom2dGcc_Circ2d3Tan (const Geom2dGcc_QualifiedCurve& Qualified1 , |
365 | const Handle(Geom2d_Point)& Point1 , |
366 | const Handle(Geom2d_Point)& Point2 , |
367 | const Standard_Real Tolerance , |
368 | const Standard_Real Param1 ): |
369 | cirsol(1,16) , |
370 | qualifier1(1,16), |
371 | qualifier2(1,16), |
372 | qualifier3(1,16), |
373 | TheSame1(1,16) , |
374 | TheSame2(1,16) , |
375 | TheSame3(1,16) , |
376 | pnttg1sol(1,16), |
377 | pnttg2sol(1,16), |
378 | pnttg3sol(1,16), |
379 | par1sol(1,16) , |
380 | par2sol(1,16) , |
381 | par3sol(1,16) , |
382 | pararg1(1,16) , |
383 | pararg2(1,16) , |
384 | pararg3(1,16) |
385 | { |
386 | Geom2dAdaptor_Curve C1 = Qualified1.Qualified(); |
387 | Handle(Geom2d_Curve) CC1 = C1.Curve(); |
388 | GeomAbs_CurveType Type1 = C1.GetType(); |
389 | |
390 | //============================================================================= |
391 | // Appel a GccAna. + |
392 | //============================================================================= |
393 | |
394 | NbrSol = 0; |
395 | if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle)) { |
396 | if (Type1 == GeomAbs_Circle) { |
397 | Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1); |
398 | gp_Circ2d c1(CCC1->Circ2d()); |
399 | GccEnt_QualifiedCirc Qc1(c1,Qualified1.Qualifier()); |
400 | GccAna_Circ2d3Tan Circ(Qc1,Point1->Pnt2d(),Point2->Pnt2d(),Tolerance); |
401 | WellDone = Circ.IsDone(); |
402 | NbrSol = Circ.NbSolutions(); |
403 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
404 | Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i)); |
405 | } |
406 | Results(Circ,1,2,3); |
407 | } |
408 | else { |
409 | Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1); |
410 | gp_Lin2d l1(LL1->Lin2d()); |
411 | GccEnt_QualifiedLin Ql1(l1,Qualified1.Qualifier()); |
412 | GccAna_Circ2d3Tan Circ(Ql1,Point1->Pnt2d(),Point2->Pnt2d(),Tolerance); |
413 | WellDone = Circ.IsDone(); |
414 | NbrSol = Circ.NbSolutions(); |
415 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
416 | Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i)); |
417 | } |
418 | Results(Circ,1,2,3); |
419 | } |
420 | } |
421 | else { |
0b85f9a6 |
422 | Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier()); |
54e37688 |
423 | Geom2dGcc_Circ2d3TanIter Circ(Qc1,Point1->Pnt2d(),Point2->Pnt2d(), |
7fd59977 |
424 | Param1,Tolerance); |
425 | WellDone = Circ.IsDone(); |
426 | NbrSol = 1; |
427 | if (WellDone) { |
428 | cirsol(1) = Circ.ThisSolution(); |
429 | if (Circ.IsTheSame1()) { TheSame1(1) = 1; } |
430 | else {TheSame1(1) = 0; } |
431 | if (Circ.IsTheSame2()) { TheSame2(1) = 1; } |
432 | else {TheSame2(1) = 0; } |
433 | if (Circ.IsTheSame3()) { TheSame3(1) = 1; } |
434 | else {TheSame3(1) = 0; } |
435 | Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1)); |
436 | Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1)); |
437 | Circ.Tangency3(par3sol(1),pararg3(1),pnttg3sol(1)); |
438 | Circ.WhichQualifier(qualifier1(1),qualifier2(1),qualifier3(1)); |
439 | } |
440 | } |
441 | } |
442 | |
443 | Geom2dGcc_Circ2d3Tan:: |
444 | Geom2dGcc_Circ2d3Tan (const Handle(Geom2d_Point)& Point1 , |
445 | const Handle(Geom2d_Point)& Point2 , |
446 | const Handle(Geom2d_Point)& Point3 , |
447 | const Standard_Real Tolerance ): |
448 | cirsol(1,2) , |
449 | qualifier1(1,2), |
450 | qualifier2(1,2), |
451 | qualifier3(1,2), |
452 | TheSame1(1,2) , |
453 | TheSame2(1,2) , |
454 | TheSame3(1,2) , |
455 | pnttg1sol(1,2), |
456 | pnttg2sol(1,2), |
457 | pnttg3sol(1,2), |
458 | par1sol(1,2) , |
459 | par2sol(1,2) , |
460 | par3sol(1,2) , |
461 | pararg1(1,2) , |
462 | pararg2(1,2) , |
463 | pararg3(1,2) |
464 | { |
465 | |
466 | //============================================================================= |
467 | // Appel a GccAna. + |
468 | //============================================================================= |
469 | |
470 | NbrSol = 0; |
471 | GccAna_Circ2d3Tan Circ(Point1->Pnt2d(),Point2->Pnt2d(),Point3->Pnt2d(), |
472 | Tolerance); |
473 | WellDone = Circ.IsDone(); |
474 | NbrSol = Circ.NbSolutions(); |
475 | for(Standard_Integer i=1; i<=NbrSol; i++) { |
476 | Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i)); |
477 | } |
478 | Results(Circ,1,2,3); |
479 | } |
480 | |
481 | |
482 | void Geom2dGcc_Circ2d3Tan::Results(const GccAna_Circ2d3Tan& Circ , |
483 | const Standard_Integer Rank1, |
484 | const Standard_Integer Rank2, |
485 | const Standard_Integer Rank3) |
486 | { |
487 | for (Standard_Integer j = 1; j <= NbrSol; j++) { |
488 | cirsol(j) = Circ.ThisSolution(j); |
489 | Standard_Integer i1 = 0, i2 = 0, i3 = 0; |
490 | if (Circ.IsTheSame1(j)) { i1 = 1; } |
491 | if (Circ.IsTheSame2(j)) { i2 = 1; } |
492 | if (Circ.IsTheSame3(j)) { i3 = 1; } |
493 | if (Rank1 == 1) { |
494 | TheSame1(j) = i1; |
495 | if ( i1 == 0) |
496 | Circ.Tangency1(j,par1sol(j),pararg1(j),pnttg1sol(j)); |
497 | } |
498 | else if (Rank1 == 2) { |
499 | TheSame1(j) = i2; |
500 | if ( i2 == 0) |
501 | Circ.Tangency2(j,par1sol(j),pararg1(j),pnttg1sol(j)); |
502 | } |
503 | else if (Rank1 == 3) { |
504 | TheSame1(j) = i3; |
505 | if ( i3 == 0) |
506 | Circ.Tangency3(j,par1sol(j),pararg1(j),pnttg1sol(j)); |
507 | } |
508 | if (Rank2 == 1) { |
509 | TheSame2(j) = i1; |
510 | if ( i1 == 0) |
511 | Circ.Tangency1(j,par2sol(j),pararg2(j),pnttg2sol(j)); |
512 | } |
513 | else if (Rank2 == 2) { |
514 | TheSame2(j) = i2; |
515 | if ( i2 == 0) |
516 | Circ.Tangency2(j,par2sol(j),pararg2(j),pnttg2sol(j)); |
517 | } |
518 | else if (Rank2 == 3) { |
519 | TheSame2(j) = i3; |
520 | if ( i3 == 0) |
521 | Circ.Tangency3(j,par2sol(j),pararg2(j),pnttg2sol(j)); |
522 | } |
523 | if (Rank3 == 1) { |
524 | TheSame3(j) = i1; |
525 | if ( i1 == 0) |
526 | Circ.Tangency1(j,par3sol(j),pararg3(j),pnttg3sol(j)); |
527 | } |
528 | else if (Rank3 == 2) { |
529 | TheSame3(j) = i2; |
530 | if ( i2 == 0) |
531 | Circ.Tangency2(j,par3sol(j),pararg3(j),pnttg3sol(j)); |
532 | } |
533 | else if (Rank3 == 3) { |
534 | TheSame3(j) = i3; |
535 | if ( i3 == 0) |
536 | Circ.Tangency3(j,par3sol(j),pararg3(j),pnttg3sol(j)); |
537 | } |
538 | } |
539 | } |
540 | |
541 | Standard_Boolean Geom2dGcc_Circ2d3Tan:: |
542 | IsDone () const { return WellDone; } |
543 | |
544 | Standard_Integer Geom2dGcc_Circ2d3Tan:: |
545 | NbSolutions () const |
546 | { |
547 | return (Standard_Integer ) NbrSol; |
548 | } |
549 | |
550 | gp_Circ2d Geom2dGcc_Circ2d3Tan:: |
551 | ThisSolution (const Standard_Integer Index) const |
552 | { |
9775fa61 |
553 | if (!WellDone) { throw StdFail_NotDone(); } |
554 | if (Index <= 0 ||Index > NbrSol) { throw Standard_OutOfRange(); } |
7fd59977 |
555 | return cirsol(Index); |
556 | } |
557 | |
558 | void Geom2dGcc_Circ2d3Tan:: |
559 | WhichQualifier (const Standard_Integer Index , |
560 | GccEnt_Position& Qualif1 , |
561 | GccEnt_Position& Qualif2 , |
562 | GccEnt_Position& Qualif3) const |
563 | { |
9775fa61 |
564 | if (!WellDone) { throw StdFail_NotDone(); } |
565 | else if (Index <= 0 ||Index > NbrSol) { throw Standard_OutOfRange(); } |
7fd59977 |
566 | else { |
567 | Qualif1 = qualifier1(Index); |
568 | Qualif2 = qualifier2(Index); |
569 | Qualif3 = qualifier3(Index); |
570 | } |
571 | } |
572 | |
573 | void Geom2dGcc_Circ2d3Tan:: |
574 | Tangency1 (const Standard_Integer Index, |
575 | Standard_Real& ParSol, |
576 | Standard_Real& ParArg, |
577 | gp_Pnt2d& PntSol) const |
578 | { |
9775fa61 |
579 | if (!WellDone) { throw StdFail_NotDone(); } |
580 | else if (Index <= 0 ||Index > NbrSol) { throw Standard_OutOfRange(); } |
7fd59977 |
581 | else { |
582 | if (TheSame1(Index) == 0) { |
583 | ParSol = par1sol(Index); |
584 | ParArg = pararg1(Index); |
585 | PntSol = pnttg1sol(Index); |
586 | } |
9775fa61 |
587 | else { throw StdFail_NotDone(); } |
7fd59977 |
588 | } |
589 | } |
590 | |
591 | void Geom2dGcc_Circ2d3Tan:: |
592 | Tangency2 (const Standard_Integer Index, |
593 | Standard_Real& ParSol, |
594 | Standard_Real& ParArg, |
595 | gp_Pnt2d& PntSol) const |
596 | { |
9775fa61 |
597 | if (!WellDone) { throw StdFail_NotDone(); } |
598 | else if (Index <= 0 ||Index > NbrSol) { throw Standard_OutOfRange(); } |
7fd59977 |
599 | else { |
600 | if (TheSame2(Index) == 0) { |
601 | ParSol = par2sol(Index); |
602 | ParArg = pararg2(Index); |
603 | PntSol = pnttg2sol(Index); |
604 | } |
9775fa61 |
605 | else { throw StdFail_NotDone(); } |
7fd59977 |
606 | } |
607 | } |
608 | |
609 | void Geom2dGcc_Circ2d3Tan:: |
610 | Tangency3 (const Standard_Integer Index, |
611 | Standard_Real& ParSol, |
612 | Standard_Real& ParArg, |
613 | gp_Pnt2d& PntSol) const |
614 | { |
9775fa61 |
615 | if (!WellDone) { throw StdFail_NotDone(); } |
616 | else if (Index <= 0 ||Index > NbrSol) { throw Standard_OutOfRange(); } |
7fd59977 |
617 | else { |
618 | if (TheSame3(Index) == 0) { |
619 | ParSol = par3sol(Index); |
620 | ParArg = pararg3(Index); |
621 | PntSol = pnttg3sol(Index); |
622 | } |
9775fa61 |
623 | else { throw StdFail_NotDone(); } |
7fd59977 |
624 | } |
625 | } |
626 | |
627 | Standard_Boolean Geom2dGcc_Circ2d3Tan::IsTheSame1 (const Standard_Integer Index) const |
628 | { |
9775fa61 |
629 | if (!WellDone) { throw StdFail_NotDone(); } |
630 | if (Index <= 0 ||Index > NbrSol) { throw Standard_OutOfRange(); } |
7fd59977 |
631 | if (TheSame1(Index) == 0) { return Standard_False; } |
632 | return Standard_True; |
633 | } |
634 | |
635 | Standard_Boolean Geom2dGcc_Circ2d3Tan:: |
636 | IsTheSame2 (const Standard_Integer Index) const |
637 | { |
9775fa61 |
638 | if (!WellDone) { throw StdFail_NotDone(); } |
639 | if (Index <= 0 ||Index > NbrSol) { throw Standard_OutOfRange(); } |
7fd59977 |
640 | if (TheSame2(Index) == 0) { return Standard_False; } |
641 | return Standard_True; |
642 | } |
643 | |
644 | Standard_Boolean Geom2dGcc_Circ2d3Tan:: |
645 | IsTheSame3 (const Standard_Integer Index) const |
646 | { |
9775fa61 |
647 | if (!WellDone) { throw StdFail_NotDone(); } |
648 | if (Index <= 0 ||Index > NbrSol) { throw Standard_OutOfRange(); } |
7fd59977 |
649 | if (TheSame3(Index) == 0) { return Standard_False; } |
650 | return Standard_True; |
651 | } |
652 | |
653 | |
654 | |