333727e1e49c60dbb22cee22590ff8c35d2df376
[occt.git] / src / BRep / BRep_Builder.cxx
1 // Created on: 1991-07-02
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1991-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
21
22 #include <BRep_Builder.ixx>
23
24 #include <BRep_TEdge.hxx>
25 #include <BRep_Curve3D.hxx>
26 #include <BRep_GCurve.hxx>
27 #include <BRep_CurveOnClosedSurface.hxx>
28 #include <BRep_CurveOn2Surfaces.hxx>
29 #include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
30
31 #include <BRep_PointOnCurve.hxx>
32 #include <BRep_PointOnCurveOnSurface.hxx>
33 #include <BRep_PointOnSurface.hxx>
34 #include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
35
36 #include <TopoDS.hxx>
37 #include <TopoDS_Iterator.hxx>
38
39 #include <Precision.hxx>
40
41 #include <BRep_Polygon3D.hxx>
42 #include <BRep_PolygonOnSurface.hxx>
43 #include <BRep_PolygonOnClosedSurface.hxx>
44 #include <BRep_PolygonOnTriangulation.hxx>
45 #include <BRep_PolygonOnClosedTriangulation.hxx>
46
47 #include <Standard_NullObject.hxx>
48
49 //=======================================================================
50 //function : Auxiliary methods
51 //purpose  : 
52 //=======================================================================
53
54 //=======================================================================
55 //function : UpdateCurves
56 //purpose  : Insert a 3d curve <C> with location <L> 
57 //           in a list of curve representations <lcr>
58 //=======================================================================
59
60 static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
61                          const Handle(Geom_Curve)&       C,
62                          const TopLoc_Location&          L)
63 {
64   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
65   Handle(BRep_GCurve) GC;
66   Standard_Real f,l;
67
68   while (itcr.More()) {
69     GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
70     if (!GC.IsNull()) {
71       GC->Range(f, l);
72       if (GC->IsCurve3D()) break;
73
74     }
75     itcr.Next();
76   }
77
78   if (itcr.More()) {
79     itcr.Value()->Curve3D(C);
80     itcr.Value()->Location(L);
81   }
82   else {
83     Handle(BRep_Curve3D) C3d = new BRep_Curve3D(C,L);
84     // test if there is already a range
85     if (!GC.IsNull()) {
86       C3d->SetRange(f,l);
87     }
88     lcr.Append(C3d);
89   }
90   
91 }
92
93 //=======================================================================
94 //function : UpdateCurves
95 //purpose  : Insert a pcurve <C> on surface <S> with location <L> 
96 //           in a list of curve representations <lcr>
97 //           Remove the pcurve on <S> from <lcr> if <C> is null
98 //=======================================================================
99
100 static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
101                          const Handle(Geom2d_Curve)& C,
102                          const Handle(Geom_Surface)& S,
103                          const TopLoc_Location& L)
104 {
105   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
106   Handle(BRep_CurveRepresentation) cr;
107   Handle(BRep_GCurve) GC;
108   Standard_Real f,l;
109   Standard_Boolean rangeFound = Standard_False;
110
111   // search the range of the 3d curve
112   // and remove any existing representation
113
114   while (itcr.More()) {
115     GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
116     if (!GC.IsNull()) {
117       if (GC->IsCurve3D()) {
118 #ifdef DEB
119         const Handle(Geom_Curve)& Crv =
120 #endif
121                                       GC->Curve3D();
122 //      if (!C.IsNull()) { //xpu031198, edge degeneree
123
124         // xpu151298 : parameters can be setted for null curves
125         //             see lbo & flo, to determine whether range is defined
126         //             compare first and last parameters with default values.
127         GC->Range(f, l);
128         //lvt 15/6/99: On enleve la comparaison de reels infinis.
129         Standard_Boolean undefined = (Precision::IsPositiveInfinite(l) ||
130                                       Precision::IsNegativeInfinite(f));
131         
132         if (!undefined) {
133           rangeFound = Standard_True;
134         }
135       }
136       if (GC->IsCurveOnSurface(S,L)) {
137         // remove existing curve on surface
138         // cr is used to keep a reference on the curve representation
139         // this avoid deleting it as its content may be referenced by C or S
140         cr = itcr.Value();
141         lcr.Remove(itcr);
142       }
143       else {
144         itcr.Next();
145       }
146     }
147     else {
148       itcr.Next();
149     }
150   }
151
152   if (! C.IsNull()) {
153     Handle(BRep_CurveOnSurface) COS = new BRep_CurveOnSurface(C,S,L);
154     // test if there is already a range
155     if (rangeFound) {
156       COS->SetRange(f,l);
157     }
158     lcr.Append(COS);
159   }
160 }
161
162 //=======================================================================
163 //function : UpdateCurves
164 //purpose  : Insert a pcurve <C> on surface <S> with location <L> 
165 //           in a list of curve representations <lcr>
166 //           Remove the pcurve on <S> from <lcr> if <C> is null
167 //=======================================================================
168 static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
169                          const Handle(Geom2d_Curve)& C,
170                          const Handle(Geom_Surface)& S,
171                          const TopLoc_Location& L,
172                          const gp_Pnt2d& Pf,
173                          const gp_Pnt2d& Pl)
174 {
175   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
176   Handle(BRep_CurveRepresentation) cr;
177   Handle(BRep_GCurve) GC;
178   Standard_Real f,l;
179   Standard_Boolean rangeFound = Standard_False;
180
181   // search the range of the 3d curve
182   // and remove any existing representation
183
184   while (itcr.More()) {
185     GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
186     if (!GC.IsNull()) {
187       if (GC->IsCurve3D()) {
188 #ifdef DEB
189         const Handle(Geom_Curve)& Crv =
190 #endif
191                                       GC->Curve3D();
192 //      if (!C.IsNull()) { //xpu031198, edge degeneree
193
194         // xpu151298 : parameters can be setted for null curves
195         //             see lbo & flo, to determine whether range is defined
196         //             compare first and last parameters with default values.
197         GC->Range(f, l);
198         //lvt 15/6/99: On enleve la comparaison de reels infinis.
199         Standard_Boolean undefined = (Precision::IsPositiveInfinite(l) ||
200                                       Precision::IsNegativeInfinite(f));
201         
202         if (!undefined) {
203           rangeFound = Standard_True;
204         }
205       }
206       if (GC->IsCurveOnSurface(S,L)) {
207         // remove existing curve on surface
208         // cr is used to keep a reference on the curve representation
209         // this avoid deleting it as its content may be referenced by C or S
210         cr = itcr.Value();
211         lcr.Remove(itcr);
212       }
213       else {
214         itcr.Next();
215       }
216     }
217     else {
218       itcr.Next();
219     }
220   }
221
222   if (! C.IsNull()) {
223     Handle(BRep_CurveOnSurface) COS = new BRep_CurveOnSurface(C,S,L);
224     // test if there is already a range
225     if (rangeFound) {
226       COS->SetRange(f,l);
227     }
228     COS->SetUVPoints(Pf,Pl);
229     lcr.Append(COS);
230   }
231 }
232
233 //=======================================================================
234 //function : UpdateCurves
235 //purpose  : Insert two pcurves <C1,C2> on surface <S> with location <L> 
236 //           in a list of curve representations <lcr>
237 //           Remove the pcurves on <S> from <lcr> if <C1> or <C2> is null
238 //=======================================================================
239
240 static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
241                          const Handle(Geom2d_Curve)& C1,
242                          const Handle(Geom2d_Curve)& C2,
243                          const Handle(Geom_Surface)& S,
244                          const TopLoc_Location& L)
245 {
246   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
247   Handle(BRep_CurveRepresentation) cr;
248   Handle(BRep_GCurve) GC;
249   Standard_Real f,l;
250
251   while (itcr.More()) {
252     GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
253     if ( !GC.IsNull() ) {
254       GC->Range(f,l);
255       Standard_Boolean iscos = GC->IsCurveOnSurface(S,L);
256       if (iscos) break;
257     }
258     itcr.Next();
259   }
260
261   if (itcr.More())  {
262     // cr is used to keep a reference on the curve representation
263     // this avoid deleting it as its content may be referenced by C or S
264     cr = itcr.Value();
265     lcr.Remove(itcr);
266   }
267
268   if ( !C1.IsNull() && !C2.IsNull() ) {
269     Handle(BRep_CurveOnClosedSurface) COS =
270       new BRep_CurveOnClosedSurface(C1,C2,S,L,GeomAbs_C0);
271     // test if there is already a range
272     if (!GC.IsNull()) {
273       COS->SetRange(f,l);
274     }
275     lcr.Append(COS);
276   }
277 }
278
279 //=======================================================================
280 //function : UpdateCurves
281 //purpose  : Insert two pcurves <C1,C2> on surface <S> with location <L> 
282 //           in a list of curve representations <lcr>
283 //           Remove the pcurves on <S> from <lcr> if <C1> or <C2> is null
284 //=======================================================================
285 static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
286                          const Handle(Geom2d_Curve)& C1,
287                          const Handle(Geom2d_Curve)& C2,
288                          const Handle(Geom_Surface)& S,
289                          const TopLoc_Location& L,
290                          const gp_Pnt2d& Pf,
291                          const gp_Pnt2d& Pl)
292 {
293   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
294   Handle(BRep_CurveRepresentation) cr;
295   Handle(BRep_GCurve) GC;
296   Standard_Real f,l;
297
298   while (itcr.More()) {
299     GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
300     if ( !GC.IsNull() ) {
301       GC->Range(f,l);
302       Standard_Boolean iscos = GC->IsCurveOnSurface(S,L);
303       if (iscos) break;
304     }
305     itcr.Next();
306   }
307
308   if (itcr.More())  {
309     // cr is used to keep a reference on the curve representation
310     // this avoid deleting it as its content may be referenced by C or S
311     cr = itcr.Value();
312     lcr.Remove(itcr);
313   }
314
315   if ( !C1.IsNull() && !C2.IsNull() ) {
316     Handle(BRep_CurveOnClosedSurface) COS =
317       new BRep_CurveOnClosedSurface(C1,C2,S,L,GeomAbs_C0);
318     // test if there is already a range
319     if (!GC.IsNull()) {
320       COS->SetRange(f,l);
321     }
322     COS->SetUVPoints2(Pf,Pl);
323     lcr.Append(COS);
324   }
325 }
326
327
328 static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
329                          const Handle(Geom_Surface)& S1,
330                          const Handle(Geom_Surface)& S2,
331                          const TopLoc_Location& L1,
332                          const TopLoc_Location& L2,
333                          const GeomAbs_Shape C)
334 {
335   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
336   while (itcr.More()) {
337     const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
338     Standard_Boolean isregu = cr->IsRegularity(S1,S2,L1,L2);
339     if (isregu) break;
340     itcr.Next();
341   }
342   
343   if (itcr.More()) {
344     Handle(BRep_CurveRepresentation)& cr = itcr.Value();
345     cr->Continuity(C);
346   }
347   else {
348     Handle(BRep_CurveOn2Surfaces) COS = new BRep_CurveOn2Surfaces
349       (S1,S2,L1,L2,C);
350     lcr.Append(COS);
351   }
352 }
353
354 static void UpdatePoints(BRep_ListOfPointRepresentation& lpr,
355                          Standard_Real p,
356                          const Handle(Geom_Curve)& C,
357                          const TopLoc_Location& L)
358 {
359   BRep_ListIteratorOfListOfPointRepresentation itpr(lpr);
360   while (itpr.More()) {
361     const Handle(BRep_PointRepresentation)& pr = itpr.Value();
362     Standard_Boolean isponc = pr->IsPointOnCurve(C,L);
363     if (isponc) break;
364     itpr.Next();
365   }
366
367   if (itpr.More()) {
368     Handle(BRep_PointRepresentation)& pr = itpr.Value();
369     pr->Parameter(p);
370   }
371   else {
372     Handle(BRep_PointOnCurve) POC = new BRep_PointOnCurve(p,C,L);
373     lpr.Append(POC);
374   }
375 }
376
377 static void UpdatePoints(BRep_ListOfPointRepresentation& lpr,
378                          Standard_Real p,
379                          const Handle(Geom2d_Curve)& PC,
380                          const Handle(Geom_Surface)& S,
381                          const TopLoc_Location& L)
382 {
383   BRep_ListIteratorOfListOfPointRepresentation itpr(lpr);
384   while (itpr.More()) {
385     const Handle(BRep_PointRepresentation)& pr = itpr.Value();
386     Standard_Boolean isponcons = pr->IsPointOnCurveOnSurface(PC,S,L);
387     if (isponcons) break;
388     itpr.Next();
389   }
390
391   if (itpr.More()) {
392     Handle(BRep_PointRepresentation)& pr = itpr.Value();
393     pr->Parameter(p);
394   }
395   else {
396     Handle(BRep_PointOnCurveOnSurface) POCS = 
397       new BRep_PointOnCurveOnSurface(p,PC,S,L);
398     lpr.Append(POCS);
399   }
400 }
401
402
403 static void UpdatePoints(BRep_ListOfPointRepresentation& lpr,
404                          Standard_Real p1,
405                          Standard_Real p2,
406                          const Handle(Geom_Surface)& S,
407                          const TopLoc_Location& L)
408 {
409   BRep_ListIteratorOfListOfPointRepresentation itpr(lpr);
410   while (itpr.More()) {
411     const Handle(BRep_PointRepresentation)& pr = itpr.Value();
412     Standard_Boolean ispons = pr->IsPointOnSurface(S,L);
413     if (ispons) break;
414     itpr.Next();
415   }
416
417   if (itpr.More()) {
418     Handle(BRep_PointRepresentation)& pr = itpr.Value();
419     pr->Parameter(p1);
420 //    pr->Parameter(p2); // skv
421     pr->Parameter2(p2); // skv
422   }
423   else {
424     Handle(BRep_PointOnSurface) POS = new BRep_PointOnSurface(p1,p2,S,L);
425     lpr.Append(POS);
426   }
427 }
428
429
430 //=======================================================================
431 //function : MakeFace
432 //purpose  : 
433 //=======================================================================
434
435 void  BRep_Builder::MakeFace(TopoDS_Face& F,
436                              const Handle(Geom_Surface)& S,
437                              const Standard_Real Tol) const 
438 {
439   Handle(BRep_TFace) TF = new BRep_TFace();
440   TF->Surface(S);
441   TF->Tolerance(Tol);
442   MakeShape(F,TF);
443 }
444
445
446 //=======================================================================
447 //function : MakeFace
448 //purpose  : 
449 //=======================================================================
450
451 void  BRep_Builder::MakeFace(TopoDS_Face&                      F,
452                              const Handle(Poly_Triangulation)& T) const
453 {
454   Handle(BRep_TFace) TF = new BRep_TFace();
455   TF->Triangulation(T);
456   MakeShape(F, TF);
457 }
458
459
460 //=======================================================================
461 //function : MakeFace
462 //purpose  : 
463 //=======================================================================
464
465 void  BRep_Builder::MakeFace(TopoDS_Face& F,
466                              const Handle(Geom_Surface)& S,
467                              const TopLoc_Location& L,
468                              const Standard_Real Tol) const 
469 {
470   Handle(BRep_TFace) TF = new BRep_TFace();
471   TF->Surface(S);
472   TF->Tolerance(Tol);
473   TF->Location(L);
474   MakeShape(F,TF);
475 }
476
477
478 //=======================================================================
479 //function : UpdateFace
480 //purpose  : 
481 //=======================================================================
482
483 void  BRep_Builder::UpdateFace(const TopoDS_Face& F,
484                                const Handle(Geom_Surface)& S,
485                                const TopLoc_Location& L,
486                                const Standard_Real Tol) const
487 {
488   const Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &F.TShape());
489   TF->Surface(S);
490   TF->Tolerance(Tol);
491   TF->Location(L.Predivided(F.Location()));
492   F.TShape()->Modified(Standard_True);
493 }
494
495
496 //=======================================================================
497 //function : UpdateFace
498 //purpose  : 
499 //=======================================================================
500
501 void  BRep_Builder::UpdateFace(const TopoDS_Face& F,
502                                const Handle(Poly_Triangulation)& T) const
503 {
504   (*((Handle(BRep_TFace)*) &F.TShape()))->Triangulation(T);
505   F.TShape()->Modified(Standard_True);
506 }
507
508
509 //=======================================================================
510 //function : UpdateFace
511 //purpose  : 
512 //=======================================================================
513
514 void  BRep_Builder::UpdateFace(const TopoDS_Face& F,
515                                const Standard_Real Tol) const 
516 {
517   (*((Handle(BRep_TFace)*) &F.TShape()))->Tolerance(Tol);
518   F.TShape()->Modified(Standard_True);
519 }
520
521
522 //=======================================================================
523 //function : NaturalRestriction
524 //purpose  : 
525 //=======================================================================
526
527 void  BRep_Builder::NaturalRestriction(const TopoDS_Face& F,
528                                        const Standard_Boolean N) const 
529 {
530   (*((Handle(BRep_TFace)*) &F.TShape()))->NaturalRestriction(N);
531   F.TShape()->Modified(Standard_True);
532 }
533
534
535 //=======================================================================
536 //function : MakeEdge
537 //purpose  : make undefined edge
538 //=======================================================================
539
540 void  BRep_Builder::MakeEdge(TopoDS_Edge& E) const
541 {
542   Handle(BRep_TEdge) TE = new BRep_TEdge();
543   TE->Closed(Standard_False);
544   MakeShape(E,TE);
545 }
546
547
548 //=======================================================================
549 //function : UpdateEdge
550 //purpose  : 
551 //=======================================================================
552
553 void  BRep_Builder::UpdateEdge(const TopoDS_Edge& E, 
554                                const Handle(Geom_Curve)& C, 
555                                const TopLoc_Location& L,
556                                const Standard_Real Tol) const
557 {
558   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
559   const TopLoc_Location l = L.Predivided(E.Location());
560
561   UpdateCurves(TE->ChangeCurves(),C,l);
562   if (!C.IsNull()) TE->Closed(C->IsClosed());
563
564   TE->UpdateTolerance(Tol);
565   TE->Modified(Standard_True);
566 }
567
568
569 //=======================================================================
570 //function : UpdateEdge
571 //purpose  : 
572 //=======================================================================
573
574 void  BRep_Builder::UpdateEdge(const TopoDS_Edge& E, 
575                                const Handle(Geom2d_Curve)& C, 
576                                const Handle(Geom_Surface)& S, 
577                                const TopLoc_Location& L,
578                                const Standard_Real Tol) const
579 {
580   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
581   const TopLoc_Location l = L.Predivided(E.Location());
582
583   UpdateCurves(TE->ChangeCurves(),C,S,l);
584   
585   TE->UpdateTolerance(Tol);
586   TE->Modified(Standard_True);
587 }
588
589
590 //=======================================================================
591 //function : UpdateEdge
592 //purpose  : for the second format (for XML Persistence)
593 //=======================================================================
594
595 void  BRep_Builder::UpdateEdge(const TopoDS_Edge& E, 
596                                const Handle(Geom2d_Curve)& C, 
597                                const Handle(Geom_Surface)& S, 
598                                const TopLoc_Location& L,
599                                const Standard_Real Tol,
600                                const gp_Pnt2d& Pf,
601                                const gp_Pnt2d& Pl) const
602 {
603   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
604   const TopLoc_Location l = L.Predivided(E.Location());
605
606   UpdateCurves(TE->ChangeCurves(),C,S,l,Pf,Pl);
607   
608   TE->UpdateTolerance(Tol);
609   TE->Modified(Standard_True);
610 }
611
612
613 //=======================================================================
614 //function : UpdateEdge
615 //purpose  : 
616 //=======================================================================
617
618 void  BRep_Builder::UpdateEdge(const TopoDS_Edge& E, 
619                                const Handle(Geom2d_Curve)& C1, 
620                                const Handle(Geom2d_Curve)& C2, 
621                                const Handle(Geom_Surface)& S, 
622                                const TopLoc_Location& L, 
623                                const Standard_Real Tol) const
624 {
625   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
626   const TopLoc_Location l = L.Predivided(E.Location());
627
628   UpdateCurves(TE->ChangeCurves(),C1,C2,S,l);
629   if (!C1.IsNull() && !C2.IsNull()) 
630     TE->Closed(C1->IsClosed() && C2->IsClosed());
631
632   TE->UpdateTolerance(Tol);
633   TE->Modified(Standard_True);
634 }
635
636
637 //=======================================================================
638 //function : UpdateEdge
639 //purpose  : for the second format (for XML Persistence)
640 //=======================================================================
641
642 void  BRep_Builder::UpdateEdge(const TopoDS_Edge& E, 
643                                const Handle(Geom2d_Curve)& C1, 
644                                const Handle(Geom2d_Curve)& C2, 
645                                const Handle(Geom_Surface)& S, 
646                                const TopLoc_Location& L, 
647                                const Standard_Real Tol,
648                                const gp_Pnt2d& Pf,
649                                const gp_Pnt2d& Pl) const
650 {
651   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
652   const TopLoc_Location l = L.Predivided(E.Location());
653
654   UpdateCurves(TE->ChangeCurves(),C1,C2,S,l,Pf,Pl);
655   if (!C1.IsNull() && !C2.IsNull()) 
656     TE->Closed(C1->IsClosed() && C2->IsClosed());
657   
658   TE->UpdateTolerance(Tol);
659   TE->Modified(Standard_True);
660 }
661
662
663 //=======================================================================
664 //function : UpdateEdge
665 //purpose  : 
666 //=======================================================================
667
668 void  BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
669                                const Handle(Poly_Polygon3D)& P,
670                                const TopLoc_Location& L) const
671 {
672   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
673
674   BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
675   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
676
677   while (itcr.More())
678   {
679     if (itcr.Value()->IsPolygon3D())
680     {
681       if (P.IsNull())
682         lcr.Remove(itcr);
683       else
684         itcr.Value()->Polygon3D(P);
685       TE->Modified(Standard_True);
686       return;
687     }
688     itcr.Next();
689   }
690
691   const TopLoc_Location l = L.Predivided(E.Location());
692   Handle(BRep_Polygon3D) P3d = new BRep_Polygon3D(P,l);
693   lcr.Append(P3d);
694
695   TE->Modified(Standard_True);
696 }
697
698
699 //=======================================================================
700 //function : UpdateEdge
701 //purpose  : 
702 //=======================================================================
703
704 void  BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
705                                const Handle(Poly_PolygonOnTriangulation)& P,
706                                const Handle(Poly_Triangulation)& T,
707                                const TopLoc_Location& L) const
708 {
709   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
710   const TopLoc_Location l = L.Predivided(E.Location());
711
712   Standard_Boolean isModified = Standard_False;
713
714   BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
715   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
716   Handle(BRep_CurveRepresentation) cr;
717
718   while (itcr.More())
719   {
720     if (itcr.Value()->IsPolygonOnTriangulation(T,l))
721         {
722       // cr is used to keep a reference on the curve representation
723       // this avoid deleting it as its content may be referenced by T
724       cr = itcr.Value();
725       lcr.Remove(itcr);
726       isModified = Standard_True;
727       break;
728         }
729     itcr.Next();
730   }
731
732   if (!P.IsNull())
733   {
734     Handle(BRep_PolygonOnTriangulation) PT =
735       new BRep_PolygonOnTriangulation(P,T,l);
736     lcr.Append(PT);
737     isModified = Standard_True;
738   }
739   
740   if (isModified)
741     TE->Modified(Standard_True);
742 }
743
744
745 //=======================================================================
746 //function : UpdateEdge
747 //purpose  : 
748 //=======================================================================
749
750 void  BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
751                                const Handle(Poly_PolygonOnTriangulation)& P1,
752                                const Handle(Poly_PolygonOnTriangulation)& P2,
753                                const Handle(Poly_Triangulation)& T,
754                                const TopLoc_Location& L) const
755 {
756   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
757   const TopLoc_Location l = L.Predivided(E.Location());
758
759   Standard_Boolean isModified = Standard_False;
760
761   BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
762   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
763   Handle(BRep_CurveRepresentation) cr;
764
765   while (itcr.More())
766   {
767     if (itcr.Value()->IsPolygonOnTriangulation(T,l)) //szv:was L
768     {
769       // cr is used to keep a reference on the curve representation
770       // this avoid deleting it as its content may be referenced by T
771       cr = itcr.Value();
772       lcr.Remove(itcr);
773       isModified = Standard_True;
774       break;
775     }
776     itcr.Next();
777   }
778
779   if (!P1.IsNull() && !P2.IsNull())
780   {
781     Handle(BRep_PolygonOnClosedTriangulation) PT =
782       new BRep_PolygonOnClosedTriangulation(P1,P2,T,l);
783     lcr.Append(PT);
784     isModified = Standard_True;
785   }
786
787   if (isModified)
788     TE->Modified(Standard_True);
789 }
790
791 //=======================================================================
792 //function : UpdateEdge
793 //purpose  : 
794 //=======================================================================
795
796 void  BRep_Builder::UpdateEdge(const TopoDS_Edge&            E,
797                                const Handle(Poly_Polygon2D)& P,
798                                const TopoDS_Face&            F) const
799 {
800   TopLoc_Location l;
801   const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,l);
802   UpdateEdge(E, P, S, l);
803 }
804
805 //=======================================================================
806 //function : UpdateEdge
807 //purpose  : 
808 //=======================================================================
809
810 void  BRep_Builder::UpdateEdge(const TopoDS_Edge&            E,
811                                const Handle(Poly_Polygon2D)& P,
812                                const Handle(Geom_Surface)&   S,
813                                const TopLoc_Location&        L) const
814 {
815   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
816   TopLoc_Location l = L.Predivided(E.Location());
817
818   BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
819   Handle(BRep_CurveRepresentation) cr;
820
821   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
822   while (itcr.More()) {
823     if (itcr.Value()->IsPolygonOnSurface(S, l)) break;
824     itcr.Next();
825   }
826
827   if (itcr.More()) {
828     // cr is used to keep a reference on the curve representation
829     // this avoid deleting it as its content may be referenced by T
830     cr = itcr.Value();
831     lcr.Remove(itcr);
832   }
833
834   if (!P.IsNull()) {
835     Handle(BRep_PolygonOnSurface) PS =
836       new BRep_PolygonOnSurface(P, S, l);
837     lcr.Append(PS);
838   }
839
840   TE->Modified(Standard_True);
841 }
842
843 //=======================================================================
844 //function : UpdateEdge
845 //purpose  : 
846 //=======================================================================
847
848 void  BRep_Builder::UpdateEdge(const TopoDS_Edge&            E,
849                                const Handle(Poly_Polygon2D)& P1,
850                                const Handle(Poly_Polygon2D)& P2,
851                                const TopoDS_Face&            F) const
852 {
853   TopLoc_Location l;
854   const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,l);
855   UpdateEdge(E, P1, P2, S, l);
856 }
857
858 //=======================================================================
859 //function : UpdateEdge
860 //purpose  : 
861 //=======================================================================
862
863 void  BRep_Builder::UpdateEdge(const TopoDS_Edge&            E,
864                                const Handle(Poly_Polygon2D)& P1,
865                                const Handle(Poly_Polygon2D)& P2,
866                                const Handle(Geom_Surface)&   S,
867                                const TopLoc_Location&        L) const
868 {
869   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
870   TopLoc_Location l = L.Predivided(E.Location());
871   
872   BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
873   Handle(BRep_CurveRepresentation) cr;
874
875   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
876   while (itcr.More()) {
877     if (itcr.Value()->IsPolygonOnSurface(S, l)) break;
878     itcr.Next();
879   }
880
881   if (itcr.More()) {
882     // cr is used to keep a reference on the curve representation
883     // this avoid deleting it as its content may be referenced by T
884     cr = itcr.Value();
885     lcr.Remove(itcr);
886   }
887
888   if (!P1.IsNull() && !P2.IsNull()) {
889     Handle(BRep_PolygonOnClosedSurface) PS =
890       new BRep_PolygonOnClosedSurface(P1, P2, S, TopLoc_Location());
891     lcr.Append(PS);
892   }
893   
894   TE->Modified(Standard_True);
895 }
896
897 //=======================================================================
898 //function : UpdateEdge
899 //purpose  : 
900 //=======================================================================
901
902 void  BRep_Builder::UpdateEdge(const TopoDS_Edge& E, 
903                                const Standard_Real Tol) const
904 {
905   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
906   TE->UpdateTolerance(Tol);
907   TE->Modified(Standard_True);
908 }
909
910
911 //=======================================================================
912 //function : Continuity
913 //purpose  : 
914 //=======================================================================
915
916 void  BRep_Builder::Continuity(const TopoDS_Edge& E, 
917                                const TopoDS_Face& F1, 
918                                const TopoDS_Face& F2, 
919                                const GeomAbs_Shape C) const 
920 {
921   TopLoc_Location l1,l2;
922   const Handle(Geom_Surface)& S1 = BRep_Tool::Surface(F1,l1);
923   const Handle(Geom_Surface)& S2 = BRep_Tool::Surface(F2,l2);
924   Continuity(E,S1,S2,l1,l2,C);
925 }
926
927 //=======================================================================
928 //function : Continuity
929 //purpose  : 
930 //=======================================================================
931
932 void  BRep_Builder::Continuity(const TopoDS_Edge& E, 
933                                const Handle(Geom_Surface)& S1,
934                                const Handle(Geom_Surface)& S2, 
935                                const TopLoc_Location& L1,
936                                const TopLoc_Location& L2, 
937                                const GeomAbs_Shape C)const 
938 {
939   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
940
941   const TopLoc_Location l1 = L1.Predivided(E.Location());
942   const TopLoc_Location l2 = L2.Predivided(E.Location());
943
944   UpdateCurves(TE->ChangeCurves(),S1,S2,l1,l2,C);
945   
946   TE->Modified(Standard_True);
947 }
948
949 //=======================================================================
950 //function : SameParameter
951 //purpose  : 
952 //=======================================================================
953
954 void  BRep_Builder::SameParameter(const TopoDS_Edge& E, 
955                                   const Standard_Boolean S) const 
956 {
957   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
958   TE->SameParameter(S);
959   TE->Modified(Standard_True);
960 }
961
962 //=======================================================================
963 //function : SameRange
964 //purpose  : 
965 //=======================================================================
966
967 void  BRep_Builder::SameRange(const TopoDS_Edge& E, 
968                               const Standard_Boolean S) const 
969 {
970   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
971   TE->SameRange(S);
972   TE->Modified(Standard_True);
973 }
974
975 //=======================================================================
976 //function : Degenerated
977 //purpose  : 
978 //=======================================================================
979
980 void  BRep_Builder::Degenerated(const TopoDS_Edge& E, 
981                                 const Standard_Boolean D) const 
982 {
983   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
984   TE->Degenerated(D);
985   if (D) {
986     // set a null 3d curve
987     UpdateCurves(TE->ChangeCurves(),Handle(Geom_Curve)(),E.Location());
988   }
989   TE->Modified(Standard_True);
990 }
991
992
993 //=======================================================================
994 //function : Range
995 //purpose  : 
996 //=======================================================================
997
998 void  BRep_Builder::Range(const TopoDS_Edge&  E, 
999                           const Standard_Real First, 
1000                           const Standard_Real Last,
1001                           const Standard_Boolean Only3d) const
1002 {
1003   //  set the range to all the representations if Only3d=FALSE
1004   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
1005   
1006   BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
1007   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
1008   Handle(BRep_GCurve) GC;
1009   
1010   while (itcr.More()) {
1011     GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
1012     if (!GC.IsNull()) {
1013       if (!Only3d || GC->IsCurve3D())
1014         GC->SetRange(First,Last);
1015       if (GC->IsCurve3D()) {
1016         // Set the closedness flag to the correct value.
1017         Handle(Geom_Curve) C = GC->Curve3D();
1018         
1019         //fixing a bug PRO18577 to avoid infinite values of First and Last 
1020         if ( !C.IsNull() && 
1021             !Precision::IsNegativeInfinite(First) && 
1022             !Precision::IsPositiveInfinite(Last) )   {
1023           Standard_Boolean closed = 
1024             C->Value(First).IsEqual(C->Value(Last),BRep_Tool::Tolerance(E));
1025           TE->Closed(closed);
1026         }
1027       }
1028     }
1029     itcr.Next();
1030   }
1031   
1032   TE->Modified(Standard_True);
1033 }
1034
1035
1036 //=======================================================================
1037 //function : Range
1038 //purpose  : 
1039 //=======================================================================
1040
1041 void  BRep_Builder::Range(const TopoDS_Edge& E, 
1042                           const Handle(Geom_Surface)& S,
1043                           const TopLoc_Location& L,
1044                           const Standard_Real First, 
1045                           const Standard_Real Last) const
1046 {
1047   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
1048   const TopLoc_Location l = L.Predivided(E.Location());
1049
1050   BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
1051   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
1052   Handle(BRep_GCurve) GC;
1053
1054   while (itcr.More()) {
1055     GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
1056     if (!GC.IsNull()) {
1057       if (GC->IsCurveOnSurface(S,l)) {
1058         GC->SetRange(First,Last);
1059
1060         // Set the closedness flag to the correct value.
1061         Handle(Geom2d_Curve) PC = GC->PCurve();
1062         gp_Pnt2d P1 = PC->Value(First);
1063         gp_Pnt2d P2 = PC->Value(Last);
1064         gp_Pnt   PP1 = S->Value(P1.X(),P1.Y());
1065         gp_Pnt   PP2 = S->Value(P2.X(),P2.Y());
1066         Standard_Boolean closed = PP1.IsEqual(PP2,BRep_Tool::Tolerance(E));
1067         TE->Closed(closed);
1068         break;
1069       }
1070     }
1071     itcr.Next();
1072   }
1073   
1074   if (!itcr.More())
1075     Standard_DomainError::Raise("BRep_Builder::Range, no pcurve");
1076   
1077   TE->Modified(Standard_True);
1078 }
1079
1080
1081 //=======================================================================
1082 //function : Transfert
1083 //purpose  : 
1084 //=======================================================================
1085
1086 void  BRep_Builder::Transfert(const TopoDS_Edge& Ein, 
1087                               const TopoDS_Edge& Eout) const
1088 {
1089   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &Ein.TShape());
1090
1091   const Standard_Real tol = TE->Tolerance();
1092   
1093   BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
1094   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
1095   
1096   while (itcr.More()) {
1097     
1098     const Handle(BRep_CurveRepresentation)& CR = itcr.Value();
1099     
1100     if (CR->IsCurveOnSurface()) {
1101       UpdateEdge(Eout,
1102                  CR->PCurve(),
1103                  CR->Surface(),
1104                  Ein.Location() * CR->Location(),tol);
1105     }
1106
1107     else if (CR->IsCurveOnClosedSurface()) {
1108       UpdateEdge(Eout,
1109                  CR->PCurve(),
1110                  CR->PCurve2(),
1111                  CR->Surface(),
1112                  Ein.Location() * CR->Location(),tol);
1113     }
1114     
1115     if (CR->IsRegularity()) {
1116       Continuity(Eout,
1117                  CR->Surface(),
1118                  CR->Surface2(),
1119                  Ein.Location() * CR->Location(),
1120                  Ein.Location() * CR->Location2(),
1121                  CR->Continuity());
1122     }
1123     
1124     itcr.Next();
1125   }
1126 }
1127
1128
1129 //=======================================================================
1130 //function : UpdateVertex
1131 //purpose  : update vertex with 3d point
1132 //=======================================================================
1133
1134 void  BRep_Builder::UpdateVertex(const TopoDS_Vertex& V, 
1135                                  const gp_Pnt& P, 
1136                                  const Standard_Real Tol) const 
1137 {
1138   const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
1139
1140   TV->Pnt(P.Transformed(V.Location().Inverted().Transformation()));
1141   TV->UpdateTolerance(Tol);
1142   TV->Modified(Standard_True);
1143 }
1144
1145
1146 //=======================================================================
1147 //function : UpdateVertex
1148 //purpose  : update vertex with parameter on edge
1149 //=======================================================================
1150
1151 void  BRep_Builder::UpdateVertex(const TopoDS_Vertex& V, 
1152                                  const Standard_Real Par, 
1153                                  const TopoDS_Edge& E,
1154                                  const Standard_Real Tol) const
1155 {
1156   if (Precision::IsPositiveInfinite(Par) ||
1157       Precision::IsNegativeInfinite(Par))
1158     Standard_DomainError::Raise("BRep_Builder::Infinite parameter");
1159   
1160   const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
1161   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
1162
1163   TopLoc_Location L = E.Location().Predivided(V.Location());
1164
1165   // Search the vertex in the edge
1166   TopAbs_Orientation ori = TopAbs_INTERNAL;
1167
1168   TopoDS_Iterator itv(E.Oriented(TopAbs_FORWARD));
1169
1170   // if the edge has no vertices
1171   // and is degenerated use the vertex orientation
1172   // RLE, june 94
1173
1174   if (!itv.More() && TE->Degenerated())
1175     ori = V.Orientation();
1176
1177   while (itv.More()) {
1178     const TopoDS_Shape& Vcur = itv.Value();
1179     if (V.IsSame(Vcur)) {
1180       ori = Vcur.Orientation();
1181       if (ori == V.Orientation()) break;
1182     }
1183     itv.Next();
1184   }
1185
1186   BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
1187   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
1188   Handle(BRep_GCurve) GC;
1189
1190   while (itcr.More()) {
1191     GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
1192     if (!GC.IsNull()) {
1193       if (ori == TopAbs_FORWARD) 
1194         GC->First(Par);
1195       else if (ori == TopAbs_REVERSED)
1196         GC->Last(Par);
1197       else {
1198         BRep_ListOfPointRepresentation& lpr = TV->ChangePoints();
1199         const TopLoc_Location& GCloc = GC->Location();
1200         TopLoc_Location LGCloc = L*GCloc; 
1201         if (GC->IsCurve3D()) {
1202           const Handle(Geom_Curve)& GC3d = GC->Curve3D();
1203           UpdatePoints(lpr,Par,GC3d,LGCloc);
1204         }
1205         else if (GC->IsCurveOnSurface()) {
1206           const Handle(Geom2d_Curve)& GCpc = GC->PCurve();
1207           const Handle(Geom_Surface)& GCsu = GC->Surface();
1208           UpdatePoints(lpr,Par,GCpc,GCsu,LGCloc);
1209         }
1210       }
1211     }
1212     itcr.Next();
1213   }
1214
1215   if ((ori != TopAbs_FORWARD) && (ori != TopAbs_REVERSED))
1216     TV->Modified(Standard_True);
1217   TV->UpdateTolerance(Tol);
1218   TE->Modified(Standard_True);
1219 }
1220
1221
1222 //=======================================================================
1223 //function : UpdateVertex
1224 //purpose  : update vertex with parameter on edge on face
1225 //=======================================================================
1226
1227 void  BRep_Builder::UpdateVertex(const TopoDS_Vertex& V,
1228                                  const Standard_Real  Par,
1229                                  const TopoDS_Edge&   E,
1230                                  const Handle(Geom_Surface)& S,
1231                                  const TopLoc_Location& L,
1232                                  const Standard_Real  Tol) const
1233 {
1234   if (Precision::IsPositiveInfinite(Par) ||
1235       Precision::IsNegativeInfinite(Par))
1236     Standard_DomainError::Raise("BRep_Builder::Infinite parameter");
1237   
1238   // Find the curve representation
1239   TopLoc_Location l = L.Predivided(V.Location());
1240   
1241   const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
1242   const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
1243   
1244   
1245   // Search the vertex in the edge
1246   TopAbs_Orientation ori = TopAbs_INTERNAL;
1247   
1248   TopoDS_Iterator itv(E.Oriented(TopAbs_FORWARD));
1249
1250   // if the edge has no vertices
1251   // and is degenerated use the vertex orientation
1252   // RLE, june 94
1253
1254   if (!itv.More() && TE->Degenerated())
1255     ori = V.Orientation();
1256
1257   while (itv.More()) {
1258     const TopoDS_Shape& Vcur = itv.Value();
1259     if (V.IsSame(Vcur)) {
1260       ori = Vcur.Orientation();
1261       if (ori == V.Orientation()) break;
1262     }
1263     itv.Next();
1264   }
1265
1266   BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
1267   BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
1268   Handle(BRep_GCurve) GC;
1269
1270   while (itcr.More()) {
1271     GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
1272     if (!GC.IsNull()) {
1273 //      if (GC->IsCurveOnSurface(S,l)) {
1274       if (GC->IsCurveOnSurface(S,L)) { //xpu020198 : BUC60407
1275         if (ori == TopAbs_FORWARD) 
1276           GC->First(Par);
1277         else if (ori == TopAbs_REVERSED)
1278           GC->Last(Par);
1279         else {
1280           BRep_ListOfPointRepresentation& lpr = TV->ChangePoints();
1281           const Handle(Geom2d_Curve)& GCpc = GC->PCurve();
1282           UpdatePoints(lpr,Par,GCpc,S,l);
1283           TV->Modified(Standard_True);
1284         }
1285         break;
1286       }
1287     }
1288     itcr.Next();
1289   }
1290   
1291   if (!itcr.More())
1292     Standard_DomainError::Raise("BRep_Builder:: no pcurve");
1293   
1294   TV->UpdateTolerance(Tol);
1295   TE->Modified(Standard_True);
1296 }
1297
1298 //=======================================================================
1299 //function : UpdateVertex
1300 //purpose  : update vertex with parameters on face
1301 //=======================================================================
1302
1303 void  BRep_Builder::UpdateVertex(const TopoDS_Vertex& Ve, 
1304                                  const Standard_Real U, 
1305                                  const Standard_Real V,
1306                                  const TopoDS_Face& F, 
1307                                  const Standard_Real Tol) const
1308 {
1309   const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &Ve.TShape());
1310   
1311   TopLoc_Location L;
1312   const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,L);
1313   L = L.Predivided(Ve.Location());
1314   BRep_ListOfPointRepresentation& lpr = TV->ChangePoints(); 
1315   UpdatePoints(lpr,U,V,S,L);
1316   
1317   TV->UpdateTolerance(Tol);
1318   TV->Modified(Standard_True);
1319 }
1320
1321 //=======================================================================
1322 //function : UpdateVertex
1323 //purpose  : update vertex with 3d point
1324 //=======================================================================
1325
1326 void  BRep_Builder::UpdateVertex(const TopoDS_Vertex& V, 
1327                                  const Standard_Real Tol) const
1328 {
1329   const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
1330   TV->UpdateTolerance(Tol);
1331   TV->Modified(Standard_True);
1332 }
1333
1334
1335 //=======================================================================
1336 //function : Transfert
1337 //purpose  : 
1338 //=======================================================================
1339
1340 void  BRep_Builder::Transfert(const TopoDS_Edge& Ein,
1341                               const TopoDS_Edge& Eout,
1342                               const TopoDS_Vertex& Vin,
1343                               const TopoDS_Vertex& Vout) const
1344 {
1345   const Standard_Real tol = BRep_Tool::Tolerance(Vin);
1346   const Standard_Real parin = BRep_Tool::Parameter(Vin,Ein);
1347   UpdateVertex(Vout,parin,Eout,tol);
1348 }