summaryrefslogtreecommitdiff
path: root/src/GeomInt/GeomInt_LineConstructor.cxx
blob: fa0c6424dc29618c97ea9e866eae1772e3ea0dfd (plain)
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
// File:      GeomInt_LineConstructor.cxx
// Created:   Tue Feb  7 10:12:45 1995
// Author:    Jacques GOUSSARD
// Copyright: OPEN CASCADE 1995

#include <GeomInt_LineConstructor.ixx>

#include <GeomInt_LineTool.hxx>
#include <GeomInt_SequenceOfParameterAndOrientation.hxx>
#include <GeomInt_ParameterAndOrientation.hxx>

#include <IntPatch_Point.hxx>
#include <IntPatch_GLine.hxx>
#include <IntPatch_WLine.hxx>
#include <IntPatch_ALine.hxx>
#include <IntSurf_Transition.hxx>
#include <TopAbs_Orientation.hxx>

#include <Precision.hxx>
#include <gp_Pnt2d.hxx>
#include <Adaptor2d_HCurve2d.hxx>

#include <GeomAdaptor_HSurface.hxx>
#include <Standard_ConstructionError.hxx>
#include <IntSurf_Quadric.hxx>
#include <IntSurf_PntOn2S.hxx>
#include <ElCLib.hxx>
#include <GeomAbs_SurfaceType.hxx>


//=======================================================================
//function : Recadre
//purpose  : 
//=======================================================================
static void Recadre(const Handle(GeomAdaptor_HSurface)& myHS1,
                    const Handle(GeomAdaptor_HSurface)& myHS2,
                    Standard_Real& u1,
                    Standard_Real& v1,
                    Standard_Real& u2,
                    Standard_Real& v2)
{
  Standard_Boolean myHS1IsUPeriodic,myHS1IsVPeriodic;
  const GeomAbs_SurfaceType typs1 = myHS1->GetType();
  switch (typs1)
  {
    case GeomAbs_Cylinder:
    case GeomAbs_Cone:
    case GeomAbs_Sphere:
    { 
      myHS1IsUPeriodic = Standard_True;
      myHS1IsVPeriodic = Standard_False;
      break;
    }
    case GeomAbs_Torus:
    {
      myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_True;
      break;
    }
    default:
    {
       //-- Le cas de biparametrees periodiques est gere en amont
      myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_False;
      break;
    }
  }
  Standard_Boolean myHS2IsUPeriodic,myHS2IsVPeriodic;
  const GeomAbs_SurfaceType typs2 = myHS2->GetType();
  switch (typs2)
  {
    case GeomAbs_Cylinder:
    case GeomAbs_Cone:
    case GeomAbs_Sphere: 
    { 
      myHS2IsUPeriodic = Standard_True;
      myHS2IsVPeriodic = Standard_False;
      break;
    }
    case GeomAbs_Torus:
    {
      myHS2IsUPeriodic = myHS2IsVPeriodic = Standard_True;
      break;
    }
    default:
    {
      //-- Le cas de biparametrees periodiques est gere en amont
      myHS2IsUPeriodic = myHS2IsVPeriodic = Standard_False;
      break;
    }
  }
  if(myHS1IsUPeriodic) {
    const Standard_Real lmf = PI+PI; //-- myHS1->UPeriod();
    const Standard_Real f = myHS1->FirstUParameter();
    const Standard_Real l = myHS1->LastUParameter();
    while(u1 < f) { u1+=lmf; } 
    while(u1 > l) { u1-=lmf; }
  }
  if(myHS1IsVPeriodic) {
    const Standard_Real lmf = PI+PI; //-- myHS1->VPeriod(); 
    const Standard_Real f = myHS1->FirstVParameter();
    const Standard_Real l = myHS1->LastVParameter();
    while(v1 < f) { v1+=lmf; } 
    while(v1 > l) { v1-=lmf; }
  }
  if(myHS2IsUPeriodic) { 
    const Standard_Real lmf = PI+PI; //-- myHS2->UPeriod();
    const Standard_Real f = myHS2->FirstUParameter();
    const Standard_Real l = myHS2->LastUParameter();
    while(u2 < f) { u2+=lmf; } 
    while(u2 > l) { u2-=lmf; }
  }
  if(myHS2IsVPeriodic) { 
    const Standard_Real lmf = PI+PI; //-- myHS2->VPeriod();
    const Standard_Real f = myHS2->FirstVParameter();
    const Standard_Real l = myHS2->LastVParameter();
    while(v2 < f) { v2+=lmf; } 
    while(v2 > l) { v2-=lmf; }
  }
}


//=======================================================================
//function : Parameters
//purpose  : 
//=======================================================================
static void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
                       const Handle(GeomAdaptor_HSurface)& myHS2,
                       const gp_Pnt& Ptref,
                       Standard_Real& U1,
                       Standard_Real& V1,
                       Standard_Real& U2,
                       Standard_Real& V2)
{
  IntSurf_Quadric quad1,quad2;
  switch (myHS1->Surface().GetType())
  {
    case GeomAbs_Plane:    quad1.SetValue(myHS1->Surface().Plane()); break;
    case GeomAbs_Cylinder: quad1.SetValue(myHS1->Surface().Cylinder()); break;
    case GeomAbs_Cone:     quad1.SetValue(myHS1->Surface().Cone()); break;
    case GeomAbs_Sphere:   quad1.SetValue(myHS1->Surface().Sphere()); break;
    default: Standard_ConstructionError::Raise("GeomInt_LineConstructor::Parameters");
  }
  switch (myHS2->Surface().GetType())
  {
    case GeomAbs_Plane:    quad2.SetValue(myHS2->Surface().Plane()); break;
    case GeomAbs_Cylinder: quad2.SetValue(myHS2->Surface().Cylinder()); break;
    case GeomAbs_Cone:     quad2.SetValue(myHS2->Surface().Cone()); break;
    case GeomAbs_Sphere:   quad2.SetValue(myHS2->Surface().Sphere()); break;
    default: Standard_ConstructionError::Raise("GeomInt_LineConstructor::Parameters");
  }
  quad1.Parameters(Ptref,U1,V1);
  quad2.Parameters(Ptref,U2,V2);
}


//=======================================================================
//function : Perform
//purpose  : 
//=======================================================================
void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
{
  Standard_Integer i,nbvtx;
  Standard_Real firstp,lastp;
  const Standard_Real Tol = Precision::PConfusion() * 35.0;
  
  const IntPatch_IType typl = L->ArcType();
  if(typl == IntPatch_Analytic)
  {
    Standard_Real u1,v1,u2,v2;
    Handle(IntPatch_ALine)& ALine =  *((Handle(IntPatch_ALine) *)&L);
    seqp.Clear();
    nbvtx = GeomInt_LineTool::NbVertex(L);
    for(i=1;i<nbvtx;i++)
    {
      firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
      lastp =  GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
      if(firstp!=lastp)
	  { 
        const Standard_Real pmid = (firstp+lastp)*0.5;
        const gp_Pnt Pmid = ALine->Value(pmid);
        Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
        Recadre(myHS1,myHS2,u1,v1,u2,v2);
        const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
        if(in1 !=  TopAbs_OUT) { 
          const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
          if(in2 != TopAbs_OUT) { 
            seqp.Append(firstp);
            seqp.Append(lastp);
          }
        }
      }
    }
    done = Standard_True;
    return;
  }
  else if(typl == IntPatch_Walking)
  { 
    Standard_Real u1,v1,u2,v2;
    Handle(IntPatch_WLine)& WLine =  *((Handle(IntPatch_WLine) *)&L);
    seqp.Clear();
    nbvtx = GeomInt_LineTool::NbVertex(L);
    for(i=1;i<nbvtx;i++)
	{
      firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
      lastp =  GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
      if(firstp!=lastp)
      {  
        const Standard_Integer pmid = (Standard_Integer )( (firstp+lastp)/2);
        const IntSurf_PntOn2S& Pmid = WLine->Point(pmid);
        Pmid.Parameters(u1,v1,u2,v2);
        Recadre(myHS1,myHS2,u1,v1,u2,v2);
        const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
        if(in1 !=  TopAbs_OUT) {  //-- !=ON donne Pb 
          const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
          if(in2 != TopAbs_OUT) { //-- !=ON  
            seqp.Append(firstp);
            seqp.Append(lastp);
          }
        }
      }
    }
    done = Standard_True;
    return;
  }
  else if (typl != IntPatch_Restriction)
  {
    Standard_Real u1,v1,u2,v2;
    Handle(IntPatch_GLine)& GLine =  *((Handle(IntPatch_GLine) *)&L);
    seqp.Clear();
    nbvtx = GeomInt_LineTool::NbVertex(L);
    Standard_Boolean intrvtested = Standard_False;
    for(i=1;i<nbvtx;i++)
    {
      firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
      lastp =  GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
      if(Abs(firstp-lastp)>Precision::PConfusion())
      {
        intrvtested = Standard_True;
        const Standard_Real pmid = (firstp+lastp)*0.5;
        gp_Pnt Pmid;
        switch (typl)
        {
          case IntPatch_Lin:       Pmid = ElCLib::Value(pmid,GLine->Line()); break;
          case IntPatch_Circle:    Pmid = ElCLib::Value(pmid,GLine->Circle()); break;
          case IntPatch_Ellipse:   Pmid = ElCLib::Value(pmid,GLine->Ellipse()); break;
          case IntPatch_Hyperbola: Pmid = ElCLib::Value(pmid,GLine->Hyperbola()); break;
          case IntPatch_Parabola:  Pmid = ElCLib::Value(pmid,GLine->Parabola()); break;
          default: /* Do nothing */ break;
        }
        Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
        Recadre(myHS1,myHS2,u1,v1,u2,v2);
        const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
        if(in1 !=  TopAbs_OUT) { 
          const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
          if(in2 != TopAbs_OUT) { 
            seqp.Append(firstp);
            seqp.Append(lastp);
          }
        }
      }
    }
    if(typl == IntPatch_Circle || typl == IntPatch_Ellipse)
    { 
      firstp = GeomInt_LineTool::Vertex(L,nbvtx).ParameterOnLine();
      lastp  = PI + PI + GeomInt_LineTool::Vertex(L,1).ParameterOnLine();
      const Standard_Real cadrinf = GeomInt_LineTool::FirstParameter(L);
      const Standard_Real cadrsup = GeomInt_LineTool::LastParameter(L);
      Standard_Real acadr = (firstp+lastp)*0.5;
      while(acadr < cadrinf) { acadr+=PI+PI; }
      while(acadr > cadrsup) { acadr-=PI+PI; } 
      if(acadr>=cadrinf && acadr<=cadrsup)
      { 
        if(Abs(firstp-lastp)>Precision::PConfusion())
        {
          intrvtested = Standard_True;
          const Standard_Real pmid = (firstp+lastp)*0.5;
          gp_Pnt Pmid;
          if (typl == IntPatch_Circle)
            Pmid = ElCLib::Value(pmid,GLine->Circle());
          else
            Pmid = ElCLib::Value(pmid,GLine->Ellipse());
          Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
          Recadre(myHS1,myHS2,u1,v1,u2,v2);
          const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
          if(in1 !=  TopAbs_OUT) { 
            const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
            if(in2 != TopAbs_OUT) { 
              seqp.Append(firstp);
              seqp.Append(lastp);
            }
          }
        }
      }
    }      
    if (!intrvtested) {
      // on garde a priori. Il faudrait un point 2d sur chaque
      // surface pour prendre la decision. Sera fait dans 
      // l`appelant
      seqp.Append(GeomInt_LineTool::FirstParameter(L));
      seqp.Append(GeomInt_LineTool::LastParameter(L));
    }
    done = Standard_True;
    return;
  }

  done = Standard_False;
  seqp.Clear();
  nbvtx = GeomInt_LineTool::NbVertex(L);
  if (nbvtx == 0) { // on garde a priori. Il faudrait un point 2d sur chaque
                    // surface pour prendre la decision. Sera fait dans 
                    // l`appelant
    seqp.Append(GeomInt_LineTool::FirstParameter(L));
    seqp.Append(GeomInt_LineTool::LastParameter(L));
    done = Standard_True;
    return;
  }

  GeomInt_SequenceOfParameterAndOrientation seqpss;
  TopAbs_Orientation or1=TopAbs_FORWARD,or2=TopAbs_FORWARD;

  for (i=1; i<=nbvtx; i++)
  {
    const IntPatch_Point& thevtx = GeomInt_LineTool::Vertex(L,i);
    const Standard_Real prm = thevtx.ParameterOnLine();
    if (thevtx.IsOnDomS1())
    {
      switch (thevtx.TransitionLineArc1().TransitionType())
      {
        case IntSurf_In: or1 = TopAbs_FORWARD; break;  
        case IntSurf_Out: or1 = TopAbs_REVERSED; break;  
        case IntSurf_Touch: or1 = TopAbs_INTERNAL; break;  
        case IntSurf_Undecided: or1 = TopAbs_INTERNAL; break;  
      }
    }
    else
      or1 = TopAbs_INTERNAL;

    if (thevtx.IsOnDomS2())
    {
      switch (thevtx.TransitionLineArc2().TransitionType())
      {
        case IntSurf_In: or2 = TopAbs_FORWARD; break;  
        case IntSurf_Out: or2 = TopAbs_REVERSED; break;  
        case IntSurf_Touch: or2 = TopAbs_INTERNAL; break;  
        case IntSurf_Undecided: or2 = TopAbs_INTERNAL; break;  
      }
    }
    else
      or2 = TopAbs_INTERNAL;

    const Standard_Integer nbinserted = seqpss.Length();
    Standard_Boolean inserted = Standard_False;
    for (Standard_Integer j=1; j<=nbinserted;j++)
    {
      if (Abs(prm-seqpss(j).Parameter()) <= Tol)
      {
        // on cumule
        GeomInt_ParameterAndOrientation& valj = seqpss.ChangeValue(j);
        if (or1 != TopAbs_INTERNAL) {
          if (valj.Orientation1() != TopAbs_INTERNAL) {
            if (or1 != valj.Orientation1()) {
              valj.SetOrientation1(TopAbs_INTERNAL);
            }
          }
          else {
            valj.SetOrientation1(or1);
          }
        }
	
        if (or2 != TopAbs_INTERNAL) {
          if (valj.Orientation2() != TopAbs_INTERNAL) {
            if (or2 != valj.Orientation2()) {
              valj.SetOrientation2(TopAbs_INTERNAL);
            }
          }
          else {
            valj.SetOrientation2(or2);
          }
		}

        inserted = Standard_True;
        break;
      }
      
      if (prm < seqpss(j).Parameter()-Tol ) {
        // on insere avant la position j
        seqpss.InsertBefore(j,GeomInt_ParameterAndOrientation(prm,or1,or2));
        inserted = Standard_True;
        break;
      }
    }
    if (!inserted) {
      seqpss.Append(GeomInt_ParameterAndOrientation(prm,or1,or2));
    }
  }

  // on determine l`etat en debut de ligne
  Standard_Boolean trim = Standard_False;
  Standard_Boolean dansS1 = Standard_False;
  Standard_Boolean dansS2 = Standard_False;

  nbvtx = seqpss.Length();
  for (i=1; i<= nbvtx; i++)
  {
    or1 = seqpss(i).Orientation1();
    if (or1 != TopAbs_INTERNAL)
    {
      trim = Standard_True;
      dansS1 = (or1 != TopAbs_FORWARD);
      break;
    }
  }

  if (i > nbvtx)
  {
    Standard_Real U,V;
    for (i=1; i<=GeomInt_LineTool::NbVertex(L); i++ )
    {
      if (!GeomInt_LineTool::Vertex(L,i).IsOnDomS1() )
      {
        GeomInt_LineTool::Vertex(L,i).ParametersOnS1(U,V);
        gp_Pnt2d PPCC(U,V);
        if (myDom1->Classify(PPCC,Tol) == TopAbs_OUT) {
          done = Standard_True;
          return;
        }
        break;
      }
    }
    dansS1 = Standard_True; // on garde dans le doute
  }

  for (i=1; i<= nbvtx; i++)
  {
    or2 = seqpss(i).Orientation2();
    if (or2 != TopAbs_INTERNAL)
    {
      trim = Standard_True;
      dansS2 = (or2 != TopAbs_FORWARD);
      break;
    }
  }
  
  if (i > nbvtx)
  {
    Standard_Real U,V;
    for (i=1; i<=GeomInt_LineTool::NbVertex(L); i++ )
    {
      if (!GeomInt_LineTool::Vertex(L,i).IsOnDomS2() )
      {
        GeomInt_LineTool::Vertex(L,i).ParametersOnS2(U,V);
        if (myDom2->Classify(gp_Pnt2d(U,V),Tol) == TopAbs_OUT) {
          done = Standard_True;
          return;
        }
        break;
      }
    }
    dansS2 = Standard_True; // on garde dans le doute
  }

  if (!trim) { // on a necessairement dansS1 == dansS2 == Standard_True
    seqp.Append(GeomInt_LineTool::FirstParameter(L));
    seqp.Append(GeomInt_LineTool::LastParameter(L));
    done = Standard_True;
    return;
  }

  // On epluche la sequence seqpss pour constituer les bouts valides
  // et les stocker dans seqp(2*i+1) et seqp(2*i+2)
  Standard_Real thefirst = GeomInt_LineTool::FirstParameter(L);
  Standard_Real thelast = GeomInt_LineTool::LastParameter(L);
  firstp = thefirst;

  for (i=1; i<=nbvtx; i++)
  {
    or1 = seqpss(i).Orientation1(); 
    or2 = seqpss(i).Orientation2(); 
    if (dansS1 && dansS2)
    {
      if (or1 == TopAbs_REVERSED)
        dansS1 = Standard_False;
      /*else if (or1 == TopAbs_FORWARD) {
      }*/
      if (or2 == TopAbs_REVERSED)
        dansS2 = Standard_False;
      /*else if (or2 == TopAbs_FORWARD) {
      }*/
      if (!dansS1 || !dansS2)
      {
        lastp = seqpss(i).Parameter();
        Standard_Real stofirst = Max(firstp, thefirst);
        Standard_Real stolast  = Min(lastp,  thelast) ;
        if (stolast > stofirst) {
          seqp.Append(stofirst);
          seqp.Append(stolast);
        }
        if (lastp > thelast)
          break;
      }
    }
    else
    {
      if (dansS1)
      {
        if (or1 == TopAbs_REVERSED)
          dansS1 = Standard_False;
        /*else if (or1 == TopAbs_FORWARD) {
        }*/
      }
      else
      {
        if (or1 == TopAbs_FORWARD)
          dansS1 = Standard_True;
        /*else if (or1 == TopAbs_REVERSED) {
        }*/
      }
      if (dansS2)
      {
        if (or2 == TopAbs_REVERSED)
          dansS2 = Standard_False;
        /*else if (or2 == TopAbs_FORWARD) {
        }*/
      }
      else
      {
        if (or2 == TopAbs_FORWARD)
          dansS2 = Standard_True;
        /*else if (or2 == TopAbs_REVERSED) {
        }*/
      }
      if (dansS1 && dansS2)
        firstp = seqpss(i).Parameter();
    }
  }

  // le petit dernier a rajouter
  if (dansS1 && dansS2)
  {
    lastp  = thelast;
    firstp = Max(firstp,thefirst);
    if (lastp > firstp) {
      seqp.Append(firstp);
      seqp.Append(lastp);
    }
  }
  done = Standard_True;
}


//=======================================================================
//function : PeriodicLine
//purpose  : 
//=======================================================================
void GeomInt_LineConstructor::PeriodicLine (const Handle(IntPatch_Line)& L) const
{
  const IntPatch_IType typl = L->ArcType();
  if (typl != IntPatch_Circle && typl != IntPatch_Ellipse)
    return;

  const Standard_Real Tol = Precision::PConfusion();
  Handle(IntPatch_GLine) glin = Handle(IntPatch_GLine)::DownCast(L);
  Standard_Integer i,j,nbvtx = glin->NbVertex();
  for (i=1; i<=nbvtx; i++)
  {
    IntPatch_Point thevtx = glin->Vertex(i);
    const Standard_Real prm = thevtx.ParameterOnLine();
    Standard_Boolean changevtx = Standard_False;
    if (thevtx.IsOnDomS1() || thevtx.IsOnDomS2())
    {
      for (j=1; j<=nbvtx; j++)
      {
        if (j!=i)
        {
          const IntPatch_Point& thevtxbis = glin->Vertex(j);
          const Standard_Real prmbis = thevtxbis.ParameterOnLine();
          if (Abs(prm-prmbis) <= Tol)
          {
            Standard_Real u,v;
            gp_Pnt2d p2d;
            if (thevtx.IsOnDomS1() && thevtxbis.IsOnDomS1() &&
                thevtxbis.TransitionLineArc1().TransitionType()==IntSurf_In)
            {
              p2d = thevtx.ArcOnS1()->Value(thevtx.ParameterOnArc1());
              u = p2d.X(); v = p2d.Y();
              p2d = thevtxbis.ArcOnS1()->Value(thevtxbis.ParameterOnArc1());
              if (Abs(u-p2d.X()) > Tol || Abs(v-p2d.Y()) > Tol)
              {
                changevtx = Standard_True;
                break;
              }
            }
            if (thevtx.IsOnDomS2() && thevtxbis.IsOnDomS2() &&
                thevtxbis.TransitionLineArc2().TransitionType()==IntSurf_In)
            {
              p2d = thevtx.ArcOnS2()->Value(thevtx.ParameterOnArc2());
              u = p2d.X(); v = p2d.Y();
              p2d = thevtxbis.ArcOnS2()->Value(thevtxbis.ParameterOnArc2());
              if (Abs(u-p2d.X()) > Tol || Abs(v-p2d.Y()) > Tol)
              {
                changevtx = Standard_True;
                break;
              }
            }
          }
        }
      }
    }
    if (changevtx) {
      thevtx.SetParameter(prm + 2.*PI);
      glin->Replace(i,thevtx);
    }
  }
}