1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
|
// File: IntPatch_GLine.cxx
// Created: Mon Apr 6 11:17:45 1992
// Author: Jacques GOUSSARD
// Copyright: OPEN CASCADE 1992
#include <IntPatch_GLine.ixx>
#define DEBUG 0
// modified by Edward AGAPOV (eap) Wed Mar 6 2002 (bug occ212)
// -- case: points with equal params == PI/2
//-- Precision::PConfusion()*1000.0 -> 1e-6
//#define PrecisionPConfusion ( Precision::PConfusion()*1000.0 )
#include <gp_Pln.hxx>
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates a Line as intersection line
// when the transitions are In or Out.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Lin& L,
const Standard_Boolean Tang,
const IntSurf_TypeTrans Trans1,
const IntSurf_TypeTrans Trans2) :
IntPatch_Line(Tang,Trans1,Trans2),
par1(0.0), par2(0.0),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Lin;
pos = gp_Pln(L.Location(),L.Direction()).Position().Ax2();
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates a Line as intersection line
// when the transitions are Touch.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Lin& L,
const Standard_Boolean Tang,
const IntSurf_Situation Situ1,
const IntSurf_Situation Situ2) :
IntPatch_Line(Tang,Situ1,Situ2),
par1(0.0), par2(0.0),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Lin;
pos = gp_Pln(L.Location(),L.Direction()).Position().Ax2();
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates a Line as intersection line
// when the transitions are Undecided.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Lin& L,
const Standard_Boolean Tang) :
IntPatch_Line(Tang),
par1(0.0), par2(0.0),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Lin;
pos = gp_Pln(L.Location(),L.Direction()).Position().Ax2();
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates a circle as intersection line
// when the transitions are In or Out.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Circ& C,
const Standard_Boolean Tang,
const IntSurf_TypeTrans Trans1,
const IntSurf_TypeTrans Trans2) :
IntPatch_Line(Tang,Trans1,Trans2),
pos(C.Position()),
par1(C.Radius()), par2(0.0),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Circle;
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates a circle as intersection line
// when the transitions are Touch.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Circ& C,
const Standard_Boolean Tang,
const IntSurf_Situation Situ1,
const IntSurf_Situation Situ2) :
IntPatch_Line(Tang,Situ1,Situ2),
pos(C.Position()),
par1(C.Radius()), par2(0.0),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Circle;
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates a circle as intersection line
// when the transitions are Undecided.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Circ& C,
const Standard_Boolean Tang) :
IntPatch_Line(Tang),
pos(C.Position()),
par1(C.Radius()), par2(0.0),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Circle;
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates an ellipse as intersection line
// when the transitions are In or Out.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Elips& E,
const Standard_Boolean Tang,
const IntSurf_TypeTrans Trans1,
const IntSurf_TypeTrans Trans2) :
IntPatch_Line(Tang,Trans1,Trans2),
pos(E.Position()),
par1(E.MajorRadius()),
par2(E.MinorRadius()),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Ellipse;
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates an ellispe as intersection line
// when the transitions are Touch.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Elips& E,
const Standard_Boolean Tang,
const IntSurf_Situation Situ1,
const IntSurf_Situation Situ2) :
IntPatch_Line(Tang,Situ1,Situ2),
pos(E.Position()),
par1(E.MajorRadius()),
par2(E.MinorRadius()),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Ellipse;
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates an ellipse as intersection line
// when the transitions are Undecided.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Elips& E,
const Standard_Boolean Tang) :
IntPatch_Line(Tang),
pos(E.Position()),
par1(E.MajorRadius()),
par2(E.MinorRadius()),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Ellipse;
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates a parabola as intersection line
// when the transitions are In or Out.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Parab& P,
const Standard_Boolean Tang,
const IntSurf_TypeTrans Trans1,
const IntSurf_TypeTrans Trans2) :
IntPatch_Line(Tang,Trans1,Trans2),
pos(P.Position()),
par1(P.Focal()), par2(0.0),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Parabola;
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates a parabola as intersection line
// when the transitions are Touch.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Parab& P,
const Standard_Boolean Tang,
const IntSurf_Situation Situ1,
const IntSurf_Situation Situ2) :
IntPatch_Line(Tang,Situ1,Situ2),
pos(P.Position()),
par1(P.Focal()), par2(0.0),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Parabola;
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates a parabola as intersection line
// when the transitions are Undecided.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Parab& P,
const Standard_Boolean Tang) :
IntPatch_Line(Tang),
pos(P.Position()),
par1(P.Focal()), par2(0.0),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Parabola;
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates an hyperbola as intersection line
// when the transitions are In or Out.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Hypr& H,
const Standard_Boolean Tang,
const IntSurf_TypeTrans Trans1,
const IntSurf_TypeTrans Trans2) :
IntPatch_Line(Tang,Trans1,Trans2),
pos(H.Position()),
par1(H.MajorRadius()),
par2(H.MinorRadius()),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Hyperbola;
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates an hyperbola as intersection line
// when the transitions are Touch.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Hypr& H,
const Standard_Boolean Tang,
const IntSurf_Situation Situ1,
const IntSurf_Situation Situ2) :
IntPatch_Line(Tang,Situ1,Situ2),
pos(H.Position()),
par1(H.MajorRadius()),
par2(H.MinorRadius()),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Hyperbola;
}
//=======================================================================
//function : IntPatch_GLine
//purpose : Creates an hyperbola as intersection line
// when the transitions are Undecided.
//=======================================================================
IntPatch_GLine::IntPatch_GLine (const gp_Hypr& H,
const Standard_Boolean Tang) :
IntPatch_Line(Tang),
pos(H.Position()),
par1(H.MajorRadius()),
par2(H.MinorRadius()),
fipt(Standard_False),lapt(Standard_False),
indf(0), indl(0)
{
typ = IntPatch_Hyperbola;
}
//=======================================================================
//function : Replace
//purpose : To replace the element of range Index in the list
// of points.
//=======================================================================
void IntPatch_GLine::Replace (const Standard_Integer /*Index*/,
const IntPatch_Point& Pnt)
{
svtx.Append(Pnt);
//-- svtx(Index) = Pnt;
}
//=======================================================================
//function : AddVertex
//purpose : To add a vertex in the list.
//=======================================================================
void IntPatch_GLine::AddVertex (const IntPatch_Point& Pnt)
{
//-- On detecte le cas de 2 points 3d identiques
//-- pour les ramener au meme parametre sur la
//-- GLine
if (NbVertex())
{
const Standard_Real pf = (fipt? svtx.Value(indf).ParameterOnLine() : 0.0);
const Standard_Real pl = (lapt? svtx.Value(indl).ParameterOnLine() : 0.0);
Standard_Real par = Pnt.ParameterOnLine();
if(ArcType()==IntPatch_Circle || ArcType()==IntPatch_Ellipse)
{
if(fipt && lapt) {
while(par<pf) par+=PI+PI;
while(par>pl) par-=PI+PI;
if(par<pf) {
const Standard_Real PrecisionPConfusion ( Precision::PConfusion()*1000.0 );
if((pf-par)>PrecisionPConfusion) {
return;
}
}
IntPatch_Point ParModif = Pnt;
ParModif.SetParameter(par);
svtx.Append(ParModif);
return;
}
}
else
{
if(fipt && lapt) {
if(pl<par || par<pf)
return;
}
}
}
svtx.Append(Pnt);
}
//=======================================================================
//function : ComputeVertexParameters
//purpose : Set the parameters of all the vertex on the line.
// if a vertex is already in the line,
// its parameter is modified
// else a new point in the line is inserted.
//=======================================================================
void IntPatch_GLine::ComputeVertexParameters(const Standard_Real /*Tol*/)
{
Standard_Boolean SortIsOK,APointDeleted;
Standard_Boolean SortAgain = Standard_True;
Standard_Integer i,j;
const Standard_Real ParamMinOnLine = (fipt? Vertex(indf).ParameterOnLine() : -100000.0);
const Standard_Real ParamMaxOnLine = (lapt? Vertex(indl).ParameterOnLine() : 100000.0);
//----------------------------------------------------------
//-- F i l t r e s u r r e s t r i c t i o n s --
//----------------------------------------------------------
//-- deux vertex sur la meme restriction et seulement
//-- sur celle ci ne doivent pas avoir le meme parametre
//==========================================================
//-- 2 vertices on the same restriction and only
//-- on that one must not have the same parametres
Standard_Integer nbvtx = NbVertex();
const Standard_Real PrecisionPConfusion ( Precision::PConfusion()*1000.0 );
do {
APointDeleted = Standard_False;
for(i=1; (i<=nbvtx) && (!APointDeleted); i++)
{
const IntPatch_Point& VTXi = svtx.Value(i);
if(VTXi.IsOnDomS1() || VTXi.IsOnDomS2())
{
for(j=1; (j<=nbvtx) && (!APointDeleted); j++)
{
if(i!=j)
{
const IntPatch_Point& VTXj = svtx.Value(j);
if((!VTXj.IsOnDomS1()) && (!VTXj.IsOnDomS2()))
{
if(Abs(VTXi.ParameterOnLine()-VTXj.ParameterOnLine())<=PrecisionPConfusion)
{
svtx.Remove(j);
nbvtx--;
if(lapt) { if(indl>j) indl--; }
if(fipt) { if(indf>j) indf--; }
APointDeleted = Standard_True;
}
}
}
}
}
}
}
while(APointDeleted && nbvtx > 2);
do {
APointDeleted = Standard_False;
for(i=1; (i<=nbvtx) && (!APointDeleted); i++)
{
const IntPatch_Point& VTXi = svtx.Value(i);
if(VTXi.IsOnDomS1() && (!VTXi.IsOnDomS2()))
{
for(j=1; (j<=nbvtx) && (!APointDeleted); j++)
{
if(i!=j)
{
const IntPatch_Point& VTXj = svtx.Value(j);
if(VTXj.IsOnDomS1() && (!VTXj.IsOnDomS2()))
{
if(Abs(VTXi.ParameterOnArc1()-VTXj.ParameterOnArc1())<=PrecisionPConfusion)
{
if(VTXi.ArcOnS1() == VTXj.ArcOnS1())
{
if(VTXi.IsVertexOnS1())
{
svtx.Remove(j);
nbvtx--;
if(lapt) { if(indl>j) indl--; }
if(fipt) { if(indf>j) indf--; }
}
else
{
svtx.Remove(i);
nbvtx--;
if(lapt) { if(indl>i) indl--; }
if(fipt) { if(indf>i) indf--; }
}
APointDeleted = Standard_True;
}
}
}
}
}
}
}
}
while(APointDeleted);
do {
APointDeleted = Standard_False;
for(i=1; (i<=nbvtx) && (!APointDeleted); i++)
{
const IntPatch_Point& VTXi = svtx.Value(i);
if(VTXi.IsOnDomS2() && (!VTXi.IsOnDomS1()))
{
for(j=1; (j<=nbvtx) && (!APointDeleted); j++)
{
if(i!=j)
{
const IntPatch_Point& VTXj = svtx.Value(j);
if(VTXj.IsOnDomS2() && (!VTXj.IsOnDomS1()))
{
if(Abs(VTXi.ParameterOnArc2()-VTXj.ParameterOnArc2())<=PrecisionPConfusion)
{
if(VTXi.ArcOnS2() == VTXj.ArcOnS2())
{
if(VTXi.IsVertexOnS1())
{
svtx.Remove(j);
nbvtx--;
if(lapt) { if(indl>j) indl--; }
if(fipt) { if(indf>j) indf--; }
}
else
{
svtx.Remove(i);
nbvtx--;
if(lapt) { if(indl>i) indl--; }
if(fipt) { if(indf>i) indf--; }
}
APointDeleted = Standard_True;
}
}
}
}
}
}
}
}
while(APointDeleted);
//----------------------------------------------------------
//-- Tri des vertex et suppression des Vtx superflus
//--
//// modified by jgv, 2.11.01 for BUC61033 ////
Standard_Real u1min = RealLast(), u1max = RealFirst();
Standard_Real u2min = RealLast(), u2max = RealFirst();
Standard_Boolean ToBreak = Standard_False;
///////////////////////////////////////////////
do {
nbvtx = NbVertex();
if(SortAgain)
{
do
{
SortIsOK = Standard_True;
for(i=2; i<=nbvtx; i++)
{
if(svtx.Value(i-1).ParameterOnLine() > svtx.Value(i).ParameterOnLine())
{
SortIsOK = Standard_False;
svtx.Exchange(i-1,i);
if(fipt) { if(indf==i) indf=i-1; else if(indf==i-1) indf=i; }
if(lapt) { if(indl==i) indl=i-1; else if(indl==i-1) indl=i; }
}
}
}
while(!SortIsOK);
}
//// modified by jgv, 2.11.01 for BUC61033 ////
if (ToBreak)
break;
///////////////////////////////////////////////
SortAgain = Standard_False;
SortIsOK = Standard_True;
for(i=2; i<=nbvtx && SortIsOK; i++) {
IntPatch_Point& VTX = svtx.ChangeValue(i);
for(j=1; j<=nbvtx && SortIsOK; j++) {
if(i!=j) {
IntPatch_Point& VTXM1 = svtx.ChangeValue(j);
Standard_Boolean kill = Standard_False;
Standard_Boolean killm1 = Standard_False;
if(Abs(VTXM1.ParameterOnLine()-VTX.ParameterOnLine())<PrecisionPConfusion) {
if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()) { //-- OnS1 OnS1
if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) { //-- OnS1 == OnS1
if(VTXM1.IsOnDomS2()) { //-- OnS1 == OnS1 OnS2
if(VTX.IsOnDomS2()==Standard_False) { //-- OnS1 == OnS1 OnS2 PasOnS2
kill=Standard_True;
}
else {
if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) { //-- OnS1 == OnS1 OnS2 == OnS2
if(VTXM1.IsVertexOnS2()) {
kill=Standard_True;
}
else {
killm1=Standard_True;
}
}
}
}
else { //-- OnS1 == OnS1 PasOnS2
if(VTX.IsOnDomS2()) { //-- OnS1 == OnS1 PasOnS2 OnS2
killm1=Standard_True;
}
}
}
}
else { //-- Pas OnS1 et OnS1
if(VTXM1.IsOnDomS2()==Standard_False && VTX.IsOnDomS2()==Standard_False) {
if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()==Standard_False) {
kill=Standard_True;
}
else if(VTX.IsOnDomS1() && VTXM1.IsOnDomS1()==Standard_False) {
killm1=Standard_True;
}
}
}
if(!(kill || killm1)) {
if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()) { //-- OnS2 OnS2
if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) { //-- OnS2 == OnS2
if(VTXM1.IsOnDomS1()) { //-- OnS2 == OnS2 OnS1
if(VTX.IsOnDomS1()==Standard_False) { //-- OnS2 == OnS2 OnS1 PasOnS1
kill=Standard_True;
}
else {
if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) { //-- OnS2 == OnS2 OnS1 == OnS1
if(VTXM1.IsVertexOnS1()) {
kill=Standard_True; //-- OnS2 == OnS2 OnS1 == OnS1 Vtx PasVtx
}
else {
killm1=Standard_True; //-- OnS2 == OnS2 OnS1 == OnS1 PasVtx Vtx
}
}
}
}
else { //-- OnS2 == OnS2 PasOnS1
if(VTX.IsOnDomS1()) { //-- OnS2 == OnS2 PasOnS1 OnS1
killm1=Standard_True;
}
}
}
}
else { //-- Pas OnS2 et OnS2
if(VTXM1.IsOnDomS1()==Standard_False && VTX.IsOnDomS1()==Standard_False) {
if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()==Standard_False) {
kill=Standard_True;
}
else if(VTX.IsOnDomS2() && VTXM1.IsOnDomS2()==Standard_False) {
killm1=Standard_True;
}
}
}
}
//-- On a j < i
if(kill) {
SortIsOK = Standard_False;
if(lapt) { if(indl>i) indl--; else if(indl==i) indl=j; }
if(fipt) { if(indf>i) indf--; else if(indf==i) indf=j; }
svtx.Remove(i);
nbvtx--;
}
else if(killm1) {
SortIsOK = Standard_False;
if(lapt) { if(indl>j) indl--; else if(indl==j) indl=i-1;}
if(fipt) { if(indf>j) indf--; else if(indf==j) indf=i-1;}
svtx.Remove(j);
nbvtx--;
}
// else
else if(ArcType()==IntPatch_Circle || ArcType()==IntPatch_Ellipse) { // eap
//-- deux points de meme parametre qui ne peuvent etre confondus
//-- On change les parametres d un des points si les points UV sont
//-- differents. Ceci distingue le cas des aretes de couture.
// ==========================================================
//-- 2 points with the same parameters
//-- Change parametres of one point if points UV are
//-- different. This is the case of seam edge
Standard_Real ponline = VTX.ParameterOnLine();
// eap, =>>
Standard_Real newParam = ponline;
const Standard_Real PiPi = PI+PI;
Standard_Boolean is2PI = ( Abs(ponline-PiPi) <= PrecisionPConfusion );
if (nbvtx > 2 && // do this check if seam edge only gives vertices
!is2PI) // but always change 2PI -> 0
continue;
if (is2PI)
newParam = 0;
else if (Abs(ponline) <= PrecisionPConfusion)
newParam = PiPi;
else
newParam -= PiPi;
// if( (Abs(ponline)<=PrecisionPConfusion)
// ||(Abs(ponline-PI-PI) <=PrecisionPConfusion))
// eap, <<=
Standard_Real u1a,v1a,u2a,v2a,u1b,v1b,u2b,v2b;
VTXM1.Parameters(u1a,v1a,u2a,v2a);
VTX.Parameters(u1b,v1b,u2b,v2b);
Standard_Integer flag = 0;
if( (Abs(u1a-u1b)<=PrecisionPConfusion) ) flag|=1;
if( (Abs(v1a-v1b)<=PrecisionPConfusion) ) flag|=2;
if( (Abs(u2a-u2b)<=PrecisionPConfusion) ) flag|=4;
if( (Abs(v2a-v2b)<=PrecisionPConfusion) ) flag|=8;
Standard_Boolean TestOn1 = Standard_False;
Standard_Boolean TestOn2 = Standard_False;
switch(flag) {
case 3: //-- meme point U1 V1
case 7: //-- meme point U1 V1 meme U2
case 12: //-- meme U2 V2
case 13: //-- meme point U1 meme U2 V2
case 10: //-- meme point V1 meme V2 Test si U1a=U1b Mod 2PI et Test si U2a=U2b Mod 2PI
break;
case 11: //-- meme point U1 V1 meme V2 Test si U2a=U2b Mod 2PI
{ TestOn2 = Standard_True; break; }
case 14: //-- meme point V1 meme U2 V2 Test si U1a=U1b Mod 2PI
{ TestOn1 = Standard_True; break; }
default: break;
};
// eap
//if(ArcType()==IntPatch_Circle || ArcType()==IntPatch_Ellipse) {}
if(TestOn1) {
//// modified by jgv, 2.11.01 for BUC61033 ////
Standard_Real U1A = (u1a < u1b)? u1a : u1b;
Standard_Real U1B = (u1a < u1b)? u1b : u1a;
if (u1min == RealLast())
{
u1min = U1A;
u1max = U1B;
}
else
{
if (Abs(U1A-u1min) > PrecisionPConfusion)
ToBreak = Standard_True;
if (Abs(U1B-u1max) > PrecisionPConfusion)
ToBreak = Standard_True;
}
///////////////////////////////////////////////
// eap, =>>
// if (Abs(ponline) <= PrecisionPConfusion) {
// const Standard_Real PiPi = PI+PI;
if(newParam >= ParamMinOnLine && newParam <= ParamMaxOnLine
/*PiPi >= ParamMinOnLine && PiPi<=ParamMaxOnLine*/) {
SortAgain = Standard_True;
SortIsOK = Standard_False;
if (newParam > ponline)
if(u1a < u1b) { VTX.SetParameter(newParam); }
else { VTXM1.SetParameter(newParam); }
else
if(u1a > u1b) { VTX.SetParameter(newParam); }
else { VTXM1.SetParameter(newParam); }
}
// }
// else {
// if(0.0 >= ParamMinOnLine && 0.0<=ParamMaxOnLine) {
// SortAgain = Standard_True;
// SortIsOK = Standard_False;
// if(u1a > u1b) { VTX.SetParameter(0.0); }
// else { VTXM1.SetParameter(0.0); }
// }
// }
// eap, <<=
}
if(TestOn2) {
//// modified by jgv, 2.11.01 for BUC61033 ////
Standard_Real U2A = (u2a < u2b)? u2a : u2b;
Standard_Real U2B = (u2a < u2b)? u2b : u2a;
if (u2min == RealLast())
{
u2min = U2A;
u2max = U2B;
}
else
{
if (Abs(U2A-u2min) > PrecisionPConfusion)
ToBreak = Standard_True;
if (Abs(U2B-u2max) > PrecisionPConfusion)
ToBreak = Standard_True;
}
///////////////////////////////////////////////
// eap, =>>
// if (Abs(ponline) <= PrecisionPConfusion) {
// const Standard_Real PiPi = PI+PI;
if(newParam >= ParamMinOnLine && newParam <= ParamMaxOnLine
/*PiPi >= ParamMinOnLine && PiPi<=ParamMaxOnLine*/) {
SortAgain = Standard_True;
SortIsOK = Standard_False;
if (newParam > ponline)
if(u2a < u2b) { VTX.SetParameter(newParam); }
else { VTXM1.SetParameter(newParam); }
else
if(u2a > u2b) { VTX.SetParameter(newParam); }
else { VTXM1.SetParameter(newParam); }
}
// }
// else {
// if(0.0 >= ParamMinOnLine && 0.0<=ParamMaxOnLine) {
// SortAgain = Standard_True;
// SortIsOK = Standard_False;
// if(u2a > u2b) { VTX.SetParameter(0.0); }
// else { VTXM1.SetParameter(0.0); }
// }
// }
// }
// }
// eap, <<=
}
}
}
}
} //-- if(i!=j)
}
}
while(!SortIsOK);
//-- Recalcul de fipt et lapt
//--
nbvtx=NbVertex();
if(nbvtx)
{
do {
SortIsOK = Standard_True;
for(i=2; i<=nbvtx; i++)
{
if(svtx.Value(i-1).ParameterOnLine() > svtx.Value(i).ParameterOnLine())
{
SortIsOK = Standard_False;
svtx.Exchange(i-1,i);
}
}
}
while(!SortIsOK);
indl=nbvtx;
indf=1;
}
}
|