7fd59977 |
1 | // File: IntPatch_ALine.cxx |
2 | // Created: Mon Apr 6 11:17:45 1992 |
3 | // Author: Jacques GOUSSARD |
4 | // Copyright: OPEN CASCADE 1992 |
5 | |
6 | #include <IntPatch_ALine.ixx> |
7 | |
8 | #define DEBUG 0 |
9 | |
10 | IntPatch_ALine::IntPatch_ALine (const IntAna_Curve& C, |
11 | const Standard_Boolean Tang, |
12 | const IntSurf_TypeTrans Trans1, |
13 | const IntSurf_TypeTrans Trans2) : |
14 | IntPatch_Line(Tang,Trans1,Trans2), |
15 | fipt(Standard_False),lapt(Standard_False) |
16 | |
17 | { |
18 | typ = IntPatch_Analytic; |
19 | curv = C; |
20 | } |
21 | |
22 | |
23 | IntPatch_ALine::IntPatch_ALine (const IntAna_Curve& C, |
24 | const Standard_Boolean Tang, |
25 | const IntSurf_Situation Situ1, |
26 | const IntSurf_Situation Situ2) : |
27 | IntPatch_Line(Tang,Situ1,Situ2), |
28 | fipt(Standard_False),lapt(Standard_False) |
29 | |
30 | { |
31 | typ = IntPatch_Analytic; |
32 | curv = C; |
33 | } |
34 | |
35 | |
36 | IntPatch_ALine::IntPatch_ALine (const IntAna_Curve& C, |
37 | const Standard_Boolean Tang) : |
38 | IntPatch_Line(Tang), |
39 | fipt(Standard_False),lapt(Standard_False) |
40 | |
41 | { |
42 | typ = IntPatch_Analytic; |
43 | curv = C; |
44 | } |
45 | |
46 | const IntAna_Curve& IntPatch_ALine::Curve() const { |
47 | return(curv); |
48 | } |
49 | |
50 | |
51 | #define PCONFUSION 0.00001 |
52 | |
53 | |
54 | void IntPatch_ALine::AddVertex (const IntPatch_Point& VTXj) { |
55 | #if 0 |
56 | Standard_Integer n = NbVertex(); |
57 | if(n>=1) { |
58 | Standard_Real par = VTXj.ParameterOnLine(); |
59 | |
60 | for(int i=1; i<=n ;i++) { |
61 | const IntPatch_Point& VTXi = svtx.Value(i); |
62 | if((VTXj.IsOnDomS1()==Standard_False) && (VTXj.IsOnDomS2()==Standard_False)) { |
63 | if((VTXi.IsOnDomS1()==Standard_False) && (VTXi.IsOnDomS2()==Standard_False)) { |
64 | if(Abs(par-VTXi.ParameterOnLine())<=PCONFUSION) { |
65 | #if DEBUG |
66 | cout<<" Rejet IntPatch_ALine::AddVertex (0) "<<endl; |
67 | #endif |
68 | return; |
69 | } |
70 | } |
71 | } |
72 | } |
73 | for(i=1; i<=n ;i++) { |
74 | const IntPatch_Point& VTXi = svtx.Value(i); |
75 | if((VTXj.IsOnDomS1()==Standard_True) && (VTXj.IsOnDomS2()==Standard_False)) { |
76 | if((VTXi.IsOnDomS1()==Standard_True) && (VTXi.IsOnDomS2()==Standard_False)) { |
77 | if(Abs(VTXi.ParameterOnArc1()-VTXj.ParameterOnArc1())<=PCONFUSION) { |
78 | if(VTXi.ArcOnS1() == VTXj.ArcOnS1()) { |
79 | #if DEBUG |
80 | cout<<" Rejet IntPatch_ALine::AddVertex (1) "<<endl; |
81 | #endif |
82 | return; |
83 | } |
84 | } |
85 | } |
86 | } |
87 | } |
88 | for(i=1; i<=n ;i++) { |
89 | const IntPatch_Point& VTXi = svtx.Value(i); |
90 | if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_False)) { |
91 | if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_False)) { |
92 | if(Abs(VTXi.ParameterOnArc2()-VTXj.ParameterOnArc2())<=PCONFUSION) { |
93 | if(VTXi.ArcOnS2() == VTXj.ArcOnS2()) { |
94 | #if DEBUG |
95 | cout<<" Rejet IntPatch_ALine::AddVertex (2) "<<endl; |
96 | #endif |
97 | return; |
98 | } |
99 | } |
100 | } |
101 | } |
102 | } |
103 | for(i=1; i<=n ;i++) { |
104 | const IntPatch_Point& VTXi = svtx.Value(i); |
105 | if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_True)) { |
106 | if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_True)) { |
107 | if(Abs(VTXi.ParameterOnArc2()-VTXj.ParameterOnArc2())<=PCONFUSION) { |
108 | if(Abs(VTXi.ParameterOnArc1()-VTXj.ParameterOnArc1())<=PCONFUSION) { |
109 | if(VTXi.ArcOnS2() == VTXj.ArcOnS2()) { |
110 | if(VTXi.ArcOnS1() == VTXj.ArcOnS1()) { |
111 | #if DEBUG |
112 | cout<<" Rejet IntPatch_ALine::AddVertex (3) "<<endl; |
113 | #endif |
114 | return; |
115 | } |
116 | } |
117 | } |
118 | } |
119 | } |
120 | } |
121 | } |
122 | |
123 | //-- Est ce que VTXj present sur 1 et 2 remplace un point VTXi present sur 1 |
124 | for(i=1; i<=n ;i++) { |
125 | const IntPatch_Point& VTXi = svtx.Value(i); |
126 | if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_True)) { |
127 | if((VTXi.IsOnDomS2()==Standard_False) && (VTXi.IsOnDomS1()==Standard_True)) { |
128 | Standard_Real p = Abs(VTXi.ParameterOnArc1()-VTXj.ParameterOnArc1()); |
129 | #if DEBUG |
130 | cout<<" Est ce que VTXj present sur 1 et 2 remplace un point VTXi present sur 1 : "<<p<<endl; |
131 | #endif |
132 | if(p<=PCONFUSION) { |
133 | if(VTXi.ArcOnS1() == VTXj.ArcOnS1()) { |
134 | #if DEBUG |
135 | cout<<" Replace IntPatch_ALine::AddVertex (1) "<<endl; |
136 | #endif |
137 | Replace(i,VTXj); |
138 | return; |
139 | } |
140 | } |
141 | } |
142 | } |
143 | } |
144 | //-- Est ce que VTXj present sur 1 et 2 remplace un point VTXi present sur 2 |
145 | for(i=1; i<=n ;i++) { |
146 | const IntPatch_Point& VTXi = svtx.Value(i); |
147 | if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_True)) { |
148 | if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_False)) { |
149 | Standard_Real p = Abs(VTXi.ParameterOnArc2()-VTXj.ParameterOnArc2()); |
150 | #if DEBUG |
151 | cout<<" Est ce que VTXj present sur 1 et 2 remplace un point VTXi present sur 2 : "<<p<<endl; |
152 | #endif |
153 | if(p<=PCONFUSION) { |
154 | if(VTXi.ArcOnS2() == VTXj.ArcOnS2()) { |
155 | #if DEBUG |
156 | cout<<" Replace IntPatch_ALine::AddVertex (2) "<<endl; |
157 | #endif |
158 | Replace(i,VTXj); |
159 | return; |
160 | } |
161 | } |
162 | } |
163 | } |
164 | } |
165 | |
166 | |
167 | //-- Est ce que VTXi deja present sur 1 et 2 et un point VTXj present sur 1 |
168 | for(i=1; i<=n ;i++) { |
169 | const IntPatch_Point& VTXi = svtx.Value(i); |
170 | if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_True)) { |
171 | if((VTXj.IsOnDomS2()==Standard_False) && (VTXj.IsOnDomS1()==Standard_True)) { |
172 | Standard_Real p = Abs(VTXi.ParameterOnArc1()-VTXj.ParameterOnArc1()); |
173 | if(p<=PCONFUSION) { |
174 | if(VTXi.ArcOnS1() == VTXj.ArcOnS1()) { |
175 | #if DEBUG |
176 | cout<<" Replace IntPatch_ALine::AddVertex (1) -> RIEN "<<endl; |
177 | #endif |
178 | return; |
179 | } |
180 | } |
181 | } |
182 | } |
183 | } |
184 | //-- Est ce que VTXj present sur 1 et 2 remplace un point VTXi present sur 2 |
185 | for(i=1; i<=n ;i++) { |
186 | const IntPatch_Point& VTXi = svtx.Value(i); |
187 | if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_True)) { |
188 | if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_False)) { |
189 | Standard_Real p = Abs(VTXi.ParameterOnArc2()-VTXj.ParameterOnArc2()); |
190 | if(p<=PCONFUSION) { |
191 | if(VTXi.ArcOnS2() == VTXj.ArcOnS2()) { |
192 | return; |
193 | } |
194 | } |
195 | } |
196 | } |
197 | } |
198 | svtx.Append(VTXj); |
199 | |
200 | } |
201 | else { |
202 | svtx.Append(VTXj); |
203 | } |
204 | #else |
205 | svtx.Append(VTXj); |
206 | #endif |
207 | } |
208 | |
209 | |
210 | |
211 | |
212 | |
213 | void IntPatch_ALine::ComputeVertexParameters(const Standard_Real Tol) { |
214 | Standard_Boolean SortIsOK,APointDeleted; |
215 | Standard_Boolean SortAgain = Standard_True; |
216 | Standard_Integer nbvtx,i,j; |
217 | Standard_Real ParamMinOnLine,ParamMaxOnLine; |
218 | Standard_Boolean OpenFirst,OpenLast; |
219 | |
220 | ParamMinOnLine = FirstParameter(OpenFirst); |
221 | ParamMaxOnLine = LastParameter(OpenLast); |
222 | |
223 | |
224 | //---------------------------------------------------------- |
225 | //-- F i l t r e s u r r e s t r i c t i o n s -- |
226 | //---------------------------------------------------------- |
227 | //-- deux vertex sur la meme restriction et seulement |
228 | //-- sur celle ci ne doivent pas avoir le meme parametre |
229 | //-- |
230 | //-- |
231 | |
232 | //-- Le tri est necessaire si suppression du first ou du last point |
233 | nbvtx = NbVertex(); |
234 | |
235 | |
236 | //-- On verifie qu un vertex a bien toute ses representations : |
237 | //-- Cas tres rare : point de tangence sur un debut de ligne |
238 | //-- et la ligne fait 2 * 2 PI de parametrage. |
239 | |
240 | for(i=1; i<=nbvtx; i++) { |
241 | IntPatch_Point& VTX = svtx.ChangeValue(i); |
242 | Standard_Real p=VTX.ParameterOnLine(); |
243 | Standard_Real pmpimpi=p-PI-PI; |
244 | if(pmpimpi >= ParamMinOnLine) { |
245 | gp_Pnt P1 = Value(pmpimpi); |
246 | Standard_Real d1 = P1.Distance(VTX.Value()); |
247 | if(d1<Tol) { |
248 | IntPatch_Point OVTX(VTX); |
249 | OVTX.SetParameter(pmpimpi); |
250 | svtx.Append(OVTX); |
251 | } |
252 | } |
253 | pmpimpi=p+PI+PI; |
254 | if(pmpimpi <= ParamMaxOnLine) { |
255 | gp_Pnt P1 = Value(pmpimpi); |
256 | Standard_Real d1 = P1.Distance(VTX.Value()); |
257 | if(d1<Tol) { |
258 | IntPatch_Point OVTX(VTX); |
259 | OVTX.SetParameter(pmpimpi); |
260 | svtx.Append(OVTX); |
261 | } |
262 | } |
263 | } |
264 | |
265 | |
266 | nbvtx=NbVertex(); |
267 | |
268 | |
269 | |
270 | if(nbvtx<=0) return; |
271 | do { |
272 | SortIsOK = Standard_True; |
273 | for(i=2; i<=nbvtx; i++) { |
274 | if(svtx.Value(i-1).ParameterOnLine() > svtx.Value(i).ParameterOnLine()) { |
275 | SortIsOK = Standard_False; |
276 | svtx.Exchange(i-1,i); |
277 | if(fipt) { if(indf==i) indf=i-1; else if(indf==i-1) indf=i; } |
278 | if(lapt) { if(indl==i) indl=i-1; else if(indl==i-1) indl=i; } |
279 | } |
280 | } |
281 | } |
282 | while(!SortIsOK); |
283 | |
284 | do { |
285 | APointDeleted = Standard_False; |
286 | for(i=1; (i<=nbvtx) && (APointDeleted==Standard_False) ;i++) { |
287 | const IntPatch_Point& VTXi = svtx.Value(i); |
288 | if((VTXi.IsOnDomS1()==Standard_True) && (VTXi.IsOnDomS2()==Standard_False)) { |
289 | for(j=1; (j<=nbvtx) && (APointDeleted==Standard_False) ;j++) { |
290 | if(i!=j) { |
291 | const IntPatch_Point& VTXj = svtx.Value(j); |
292 | if((VTXj.IsOnDomS1()==Standard_True) && (VTXj.IsOnDomS2()==Standard_False)) { |
293 | if(Abs(VTXi.ParameterOnArc1()-VTXj.ParameterOnArc1())<=PCONFUSION) { |
294 | if(Abs(VTXi.ParameterOnLine()-VTXj.ParameterOnLine())<=PCONFUSION) { |
295 | if(VTXi.ArcOnS1() == VTXj.ArcOnS1()) { |
296 | svtx.Remove(j); |
297 | nbvtx--; |
298 | if(lapt) { if(indl>=j) indl--; } |
299 | if(fipt) { if(indf>=j) indf--; } |
300 | APointDeleted = Standard_True; |
301 | } |
302 | } |
303 | } |
304 | } |
305 | } |
306 | } |
307 | } |
308 | } |
309 | } |
310 | while(APointDeleted == Standard_True); |
311 | |
312 | do { |
313 | APointDeleted = Standard_False; |
314 | for(i=1; (i<=nbvtx) && (APointDeleted==Standard_False) ;i++) { |
315 | const IntPatch_Point& VTXi = svtx.Value(i); |
316 | if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_False)) { |
317 | for(j=1; (j<=nbvtx) && (APointDeleted==Standard_False) ;j++) { |
318 | if(i!=j) { |
319 | const IntPatch_Point& VTXj = svtx.Value(j); |
320 | if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_False)) { |
321 | if(Abs(VTXi.ParameterOnArc2()-VTXj.ParameterOnArc2())<=PCONFUSION) { |
322 | if(Abs(VTXi.ParameterOnLine()-VTXj.ParameterOnLine())<=PCONFUSION) { |
323 | if(VTXi.ArcOnS2() == VTXj.ArcOnS2()) { |
324 | svtx.Remove(j); |
325 | nbvtx--; |
326 | if(lapt) { if(indl>=j) indl--; } |
327 | if(fipt) { if(indf>=j) indf--; } |
328 | APointDeleted = Standard_True; |
329 | } |
330 | } |
331 | } |
332 | } |
333 | } |
334 | } |
335 | } |
336 | } |
337 | } |
338 | while(APointDeleted == Standard_True); |
339 | |
340 | |
341 | //---------------------------------------------------------- |
342 | //-- Tri des vertex et suppression des Vtx superflus |
343 | //-- |
344 | do { |
345 | nbvtx = NbVertex(); |
346 | if(SortAgain) { |
347 | do { |
348 | SortIsOK = Standard_True; |
349 | for(i=2; i<=nbvtx; i++) { |
350 | if(svtx.Value(i-1).ParameterOnLine() > svtx.Value(i).ParameterOnLine()) { |
351 | SortIsOK = Standard_False; |
352 | svtx.Exchange(i-1,i); |
353 | if(fipt) { if(indf==i) indf=i-1; else if(indf==i-1) indf=i; } |
354 | if(lapt) { if(indl==i) indl=i-1; else if(indl==i-1) indl=i; } |
355 | } |
356 | } |
357 | } |
358 | while(!SortIsOK); |
359 | } |
360 | SortAgain = Standard_False; |
361 | SortIsOK = Standard_True; |
362 | for(i=2; i<=nbvtx && SortIsOK; i++) { |
363 | IntPatch_Point& VTX = svtx.ChangeValue(i); |
364 | for(j=1; j<i && SortIsOK; j++) { |
365 | IntPatch_Point& VTXM1 = svtx.ChangeValue(j); |
366 | Standard_Boolean kill = Standard_False; |
367 | Standard_Boolean killm1 = Standard_False; |
368 | if(Abs(VTXM1.ParameterOnLine()-VTX.ParameterOnLine())<PCONFUSION) { |
369 | if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()) { //-- OnS1 OnS1 |
370 | if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) { //-- OnS1 == OnS1 |
371 | if(VTXM1.IsOnDomS2()) { //-- OnS1 == OnS1 OnS2 |
372 | if(VTX.IsOnDomS2()==Standard_False) { //-- OnS1 == OnS1 OnS2 PasOnS2 |
373 | kill=Standard_True; |
374 | } |
375 | else { |
376 | if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) { //-- OnS1 == OnS1 OnS2 == OnS2 |
377 | kill=Standard_True; |
378 | } |
379 | } |
380 | } |
381 | else { //-- OnS1 == OnS1 PasOnS2 |
382 | if(VTX.IsOnDomS2()) { //-- OnS1 == OnS1 PasOnS2 OnS2 |
383 | killm1=Standard_True; |
384 | } |
385 | } |
386 | } |
387 | } |
388 | else { //-- Pas OnS1 et OnS1 |
389 | if(VTXM1.IsOnDomS2()==Standard_False && VTX.IsOnDomS2()==Standard_False) { |
390 | if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()==Standard_False) { |
391 | kill=Standard_True; |
392 | } |
393 | else if(VTX.IsOnDomS1() && VTXM1.IsOnDomS1()==Standard_False) { |
394 | killm1=Standard_True; |
395 | } |
396 | } |
397 | } |
398 | |
399 | if(!(kill || killm1)) { |
400 | if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()) { //-- OnS2 OnS2 |
401 | if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) { //-- OnS2 == OnS2 |
402 | if(VTXM1.IsOnDomS1()) { //-- OnS2 == OnS2 OnS1 |
403 | if(VTX.IsOnDomS1()==Standard_False) { //-- OnS2 == OnS2 OnS1 PasOnS1 |
404 | kill=Standard_True; |
405 | } |
406 | else { |
407 | if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) { //-- OnS2 == OnS2 OnS1 == OnS1 |
408 | kill=Standard_True; |
409 | } |
410 | } |
411 | } |
412 | else { //-- OnS2 == OnS2 PasOnS1 |
413 | if(VTX.IsOnDomS1()) { //-- OnS2 == OnS2 PasOnS1 OnS1 |
414 | killm1=Standard_True; |
415 | } |
416 | } |
417 | } |
418 | } |
419 | else { //-- Pas OnS2 et OnS2 |
420 | if(VTXM1.IsOnDomS1()==Standard_False && VTX.IsOnDomS1()==Standard_False) { |
421 | if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()==Standard_False) { |
422 | kill=Standard_True; |
423 | } |
424 | else if(VTX.IsOnDomS2() && VTXM1.IsOnDomS2()==Standard_False) { |
425 | killm1=Standard_True; |
426 | } |
427 | } |
428 | } |
429 | } |
430 | //-- On a j < i |
431 | if(kill) { |
432 | SortIsOK = Standard_False; |
433 | if(lapt) { if(indl>i) indl--; else if(indl==i) indl=j; } |
434 | if(fipt) { if(indf>i) indf--; else if(indf==i) indf=j; } |
435 | svtx.Remove(i); |
436 | nbvtx--; |
437 | } |
438 | else if(killm1) { |
439 | SortIsOK = Standard_False; |
440 | if(lapt) { if(indl>j) indl--; else if(indl==j) indl=i-1;} |
441 | if(fipt) { if(indf>j) indf--; else if(indf==j) indf=i-1;} |
442 | svtx.Remove(j); |
443 | nbvtx--; |
444 | } |
445 | } |
446 | } |
447 | } |
448 | } |
449 | while(!SortIsOK); |
450 | |
451 | |
452 | //---------------------------------------------------------- |
453 | //-- Traitement des lignes periodiques -- |
454 | //---------------------------------------------------------- |
455 | if(OpenFirst == Standard_False && OpenLast == Standard_False) { |
456 | nbvtx = NbVertex(); |
457 | |
458 | IntPatch_Point& VTX0 = svtx.ChangeValue(1); |
459 | IntPatch_Point& VTXN = svtx.ChangeValue(nbvtx); |
460 | if(VTX0.ParameterOnLine() == ParamMinOnLine) { |
461 | if(VTXN.ParameterOnLine() !=ParamMaxOnLine) { |
462 | gp_Pnt PN=Value(ParamMaxOnLine); |
463 | Standard_Real d = PN.Distance(VTX0.Value()); |
464 | if(d<=Tol) { |
465 | IntPatch_Point OVTX(VTX0); |
466 | OVTX.SetParameter(ParamMaxOnLine); |
467 | svtx.Append(OVTX); |
468 | } |
469 | } |
470 | else { |
471 | if(VTXN.ParameterOnLine() == ParamMaxOnLine) { |
472 | if(VTX0.ParameterOnLine() !=ParamMinOnLine) { |
473 | gp_Pnt P0=Value(ParamMinOnLine); |
474 | Standard_Real d = P0.Distance(VTX0.Value()); |
475 | if(d<=Tol) { |
476 | IntPatch_Point OVTX(VTXN); |
477 | OVTX.SetParameter(ParamMinOnLine); |
478 | svtx.Prepend(OVTX); |
479 | } |
480 | } |
481 | } |
482 | } |
483 | } |
484 | } |
485 | //--------------------------------------------------------- |
486 | //-- Faut il supprimer le premier et le dernier point |
487 | //-- |
488 | nbvtx = NbVertex(); |
489 | if(nbvtx>1) { |
490 | IntPatch_Point& VTX0 = svtx.ChangeValue(1); |
491 | #ifdef DEB |
492 | //Standard_Real d; |
493 | IntPatch_Point& VTX1 = |
494 | #endif |
495 | svtx.ChangeValue(2); |
496 | if( (VTX0.IsOnDomS1() == Standard_False) |
497 | && (VTX0.IsOnDomS2() == Standard_False)) { |
498 | svtx.Remove(1); |
499 | nbvtx--; |
500 | if(lapt) { |
501 | indl--; |
502 | } |
503 | } |
504 | } |
505 | if(nbvtx>1) { |
506 | IntPatch_Point& VTX0 = svtx.ChangeValue(nbvtx); |
507 | #ifdef DEB |
508 | IntPatch_Point& VTX1 = |
509 | #endif |
510 | svtx.ChangeValue(nbvtx-1); |
511 | if( (VTX0.IsOnDomS1() == Standard_False) |
512 | && (VTX0.IsOnDomS2() == Standard_False)) { |
513 | svtx.Remove(nbvtx); |
514 | #ifndef DEB |
515 | if((signed)lapt == nbvtx) { |
516 | #else |
517 | if(lapt == nbvtx) { |
518 | #endif |
519 | indl--; |
520 | } |
521 | } |
522 | } |
523 | |
524 | //-- Si 2 vertex ont le meme parametre on identifie le p3d |
525 | nbvtx = NbVertex(); |
526 | do { |
527 | SortIsOK = Standard_True; |
528 | for(i=2; i<=nbvtx; i++) { |
529 | IntPatch_Point& VTX = svtx.ChangeValue(i); |
530 | IntPatch_Point& VTXm1 = svtx.ChangeValue(i-1); |
531 | if(Abs(VTX.ParameterOnLine()-VTXm1.ParameterOnLine())<PCONFUSION) { |
532 | if(VTX.IsOnDomS1() && VTXm1.IsOnDomS1()==Standard_False) { |
533 | VTXm1.SetArc(Standard_True, |
534 | VTX.ArcOnS1(), |
535 | VTX.ParameterOnArc1(), |
536 | VTX.TransitionLineArc1(), |
537 | VTX.TransitionOnS1()); |
538 | } |
539 | else if(VTXm1.IsOnDomS1() && VTX.IsOnDomS1()==Standard_False) { |
540 | VTX.SetArc(Standard_True, |
541 | VTXm1.ArcOnS1(), |
542 | VTXm1.ParameterOnArc1(), |
543 | VTXm1.TransitionLineArc1(), |
544 | VTXm1.TransitionOnS1()); |
545 | } |
546 | if(VTX.IsVertexOnS1() && VTXm1.IsVertexOnS1()==Standard_False) { |
547 | VTXm1.SetVertex(Standard_True, VTX.VertexOnS1()); |
548 | VTXm1.SetArc(Standard_True, |
549 | VTX.ArcOnS1(), |
550 | VTX.ParameterOnArc1(), |
551 | VTX.TransitionLineArc1(), |
552 | VTX.TransitionOnS1()); |
553 | } |
554 | else if(VTXm1.IsVertexOnS1() && VTX.IsVertexOnS1()==Standard_False) { |
555 | VTX.SetVertex(Standard_True, VTXm1.VertexOnS1()); |
556 | VTX.SetArc(Standard_True, |
557 | VTXm1.ArcOnS1(), |
558 | VTXm1.ParameterOnArc1(), |
559 | VTXm1.TransitionLineArc1(), |
560 | VTXm1.TransitionOnS1()); |
561 | } |
562 | |
563 | if(VTX.IsOnDomS2() && VTXm1.IsOnDomS2()==Standard_False) { |
564 | VTXm1.SetArc(Standard_False, |
565 | VTX.ArcOnS2(), |
566 | VTX.ParameterOnArc2(), |
567 | VTX.TransitionLineArc2(), |
568 | VTX.TransitionOnS2()); |
569 | } |
570 | else if(VTXm1.IsOnDomS2() && VTX.IsOnDomS2()==Standard_False) { |
571 | VTX.SetArc(Standard_False, |
572 | VTXm1.ArcOnS2(), |
573 | VTXm1.ParameterOnArc2(), |
574 | VTXm1.TransitionLineArc2(), |
575 | VTXm1.TransitionOnS2()); |
576 | } |
577 | if(VTX.IsVertexOnS2() && VTXm1.IsVertexOnS2()==Standard_False) { |
578 | VTXm1.SetVertex(Standard_False, VTX.VertexOnS2()); |
579 | VTXm1.SetArc(Standard_False, |
580 | VTX.ArcOnS2(), |
581 | VTX.ParameterOnArc2(), |
582 | VTX.TransitionLineArc2(), |
583 | VTX.TransitionOnS2()); |
584 | } |
585 | else if(VTXm1.IsVertexOnS2() && VTX.IsVertexOnS2()==Standard_False) { |
586 | VTX.SetVertex(Standard_False, VTXm1.VertexOnS2()); |
587 | VTX.SetArc(Standard_False, |
588 | VTXm1.ArcOnS2(), |
589 | VTXm1.ParameterOnArc2(), |
590 | VTXm1.TransitionLineArc2(), |
591 | VTXm1.TransitionOnS2()); |
592 | } |
593 | |
594 | if(VTX.Value().SquareDistance(VTXm1.Value()) > 1e-12) { |
595 | IntPatch_Point CopyVtx = VTXm1; |
596 | VTXm1.SetParameter(VTX.ParameterOnLine()); |
597 | VTXm1.SetValue(VTX.Value(),VTX.Tolerance(),VTX.IsTangencyPoint()); |
598 | Standard_Real u1,v1,u2,v2; |
599 | VTX.Parameters(u1,v1,u2,v2); |
600 | VTXm1.SetParameters(u1,v1,u2,v2); |
601 | if(CopyVtx.IsOnDomS1()) { |
602 | VTXm1.SetArc(Standard_True, |
603 | CopyVtx.ArcOnS1(), |
604 | CopyVtx.ParameterOnArc1(), |
605 | CopyVtx.TransitionLineArc1(), |
606 | CopyVtx.TransitionOnS1()); |
607 | } |
608 | if(CopyVtx.IsOnDomS2()) { |
609 | VTXm1.SetArc(Standard_False, |
610 | CopyVtx.ArcOnS2(), |
611 | CopyVtx.ParameterOnArc2(), |
612 | CopyVtx.TransitionLineArc2(), |
613 | CopyVtx.TransitionOnS2()); |
614 | } |
615 | if(CopyVtx.IsVertexOnS1()) { |
616 | VTXm1.SetVertex(Standard_True,CopyVtx.VertexOnS1()); |
617 | VTXm1.SetArc(Standard_True, |
618 | CopyVtx.ArcOnS1(), |
619 | CopyVtx.ParameterOnArc1(), |
620 | CopyVtx.TransitionLineArc1(), |
621 | CopyVtx.TransitionOnS1()); |
622 | } |
623 | if(CopyVtx.IsVertexOnS2()) { |
624 | VTXm1.SetVertex(Standard_False,CopyVtx.VertexOnS2()); |
625 | VTXm1.SetArc(Standard_False, |
626 | CopyVtx.ArcOnS2(), |
627 | CopyVtx.ParameterOnArc2(), |
628 | CopyVtx.TransitionLineArc2(), |
629 | CopyVtx.TransitionOnS2()); |
630 | } |
631 | |
632 | |
633 | SortIsOK=Standard_False; |
634 | //-- cout<<" IntPatch_ALine : ComputeVertexParameters : Ajust "<<endl; |
635 | } |
636 | } |
637 | } |
638 | } |
639 | while(!SortIsOK); |
640 | |
641 | /*nbvtx = NbVertex(); |
642 | for(Standard_Integer opopo = 1; opopo<=nbvtx; opopo++) { |
643 | svtx.Value(opopo).Dump(); |
644 | }*/ |
645 | } |