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