0024023: Revamp the OCCT Handle -- general
[occt.git] / src / ChFi3d / ChFi3d_FilBuilder_C2.cxx
1 // Created on: 1994-03-29
2 // Created by: Isabelle GRIGNON
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <ChFi3d_FilBuilder.jxx>
18
19 #include <ChFi3d.hxx>
20 #include <ChFi3d_Builder_0.hxx>
21
22 #include <StdFail_NotDone.hxx>
23 #include <Standard_NotImplemented.hxx>
24 #include <Standard_ErrorHandler.hxx>
25
26 #include <math_Vector.hxx>
27 #include <TColgp_Array1OfPnt.hxx>
28 #include <TColgp_Array1OfPnt2d.hxx>
29 #include <TColStd_Array1OfReal.hxx>
30 #include <TColStd_Array1OfInteger.hxx>
31 #include <TColStd_ListOfInteger.hxx>
32 #include <gp_Pnt.hxx>
33 #include <gp_Pnt2d.hxx>
34 #include <gp_Dir.hxx>
35 #include <gp_Lin.hxx>
36 #include <gp_Pln.hxx>
37 #include <gp_Ax3.hxx>
38 #include <Geom_BSplineCurve.hxx>
39 #include <Geom2d_TrimmedCurve.hxx>
40 #include <Geom2d_BSplineCurve.hxx>
41 #include <Geom_BSplineSurface.hxx>
42 #include <Law_Linear.hxx>
43 #include <BRepBlend_CSCircular.hxx>
44 #include <BRepBlend_Line.hxx>
45 #include <Geom2dConvert.hxx>
46 #include <BSplCLib.hxx>
47
48 #include <Adaptor3d_CurveOnSurface.hxx>
49 #include <Adaptor3d_HCurveOnSurface.hxx>
50 #include <BRepLProp_CLProps.hxx>
51 #include <GeomAdaptor_Curve.hxx>
52 #include <GeomAdaptor_HCurve.hxx>
53 #include <Geom2dAdaptor_Curve.hxx>
54 #include <Geom2dAdaptor_HCurve.hxx>
55 #include <GeomAdaptor_Surface.hxx>
56 #include <GeomAdaptor_HSurface.hxx>
57 #include <BRep_Tool.hxx>
58 #include <BRepAdaptor_Curve2d.hxx>
59 #include <BRepAdaptor_Curve.hxx>
60 #include <BRepAdaptor_HCurve.hxx>
61 #include <BRepAdaptor_Surface.hxx>
62 #include <BRepAdaptor_HSurface.hxx>
63 #include <BRepTopAdaptor_TopolTool.hxx> 
64 #include <GeomFill_ConstrainedFilling.hxx>
65 #include <GeomFill_SimpleBound.hxx>
66
67 #include <IntSurf_LineOn2S.hxx>
68 #include <IntSurf_Transition.hxx>
69 #include <IntSurf_TypeTrans.hxx>
70 #include <IntCurveSurface_HInter.hxx>
71 #include <IntCurveSurface_IntersectionPoint.hxx>
72
73 #include <TopoDS.hxx>
74 #include <TopoDS_Vertex.hxx>
75 #include <TopoDS_Face.hxx>
76 #include <TopOpeBRepDS_DataStructure.hxx>
77 #include <TopOpeBRepDS_ListOfInterference.hxx>
78 #include <TopAbs.hxx>
79 #include <TopAbs_Orientation.hxx>
80 #include <TopExp.hxx>
81 #include <TopTools_ListIteratorOfListOfShape.hxx>
82 #include <TopOpeBRepDS_HDataStructure.hxx>
83 #include <ChFiDS_Regul.hxx>
84 #include <ChFiDS_State.hxx>
85 #include <ChFiDS_SequenceOfSurfData.hxx>
86 #include <ChFiDS_SurfData.hxx>
87 #include <ChFiDS_FaceInterference.hxx>
88 #include <ChFiDS_ListIteratorOfListOfStripe.hxx>
89 #include <ChFiDS_Stripe.hxx>
90 #include <ChFiDS_Spine.hxx>
91 #include <ChFiDS_FilSpine.hxx>
92 #include <ChFiDS_HData.hxx>
93 #include <ChFiDS_CommonPoint.hxx>
94
95 #include <ChFiKPart_ComputeData.hxx>
96
97 #ifdef DRAW
98 #include <DrawTrSurf.hxx>
99 #endif
100 #ifdef OCCT_DEBUG
101 #include <Geom_TrimmedCurve.hxx>
102 extern Standard_Boolean ChFi3d_GettraceDRAWSPINE();
103 extern Standard_Boolean ChFi3d_GetcontextFORCEFILLING();
104 #include <OSD_Chronometer.hxx>
105
106 extern Standard_Real  t_t2cornerinit ,t_perf2cornerbyinter,t_chfikpartcompdata,
107                      t_cheminement,t_remplissage,t_t2cornerDS;
108 extern void ChFi3d_InitChron(OSD_Chronometer& ch);
109 extern void ChFi3d_ResultChron(OSD_Chronometer & ch,Standard_Real& time);
110 #endif
111
112 //=======================================================================
113 //function : ToricRotule
114 //purpose  : Test if it is a particular case of torus routine.
115 //           Three planes with two constant incident fillets
116 //           of the same radius and the third face perpendicular to  
117 //           two others are required.
118 //=======================================================================
119
120 static Standard_Boolean ToricRotule(const BRepAdaptor_Surface& fac,
121                                     const BRepAdaptor_Surface& s1,
122                                     const BRepAdaptor_Surface& s2,
123                                     const Handle(ChFiDS_Stripe)& c1,
124                                     const Handle(ChFiDS_Stripe)& c2)
125
126 {
127   Standard_Real tolesp = 1.e-7;
128
129   Handle(ChFiDS_FilSpine) sp1=Handle(ChFiDS_FilSpine)::DownCast(c1->Spine()); 
130   Handle(ChFiDS_FilSpine) sp2=Handle(ChFiDS_FilSpine)::DownCast(c2->Spine()); 
131   if(sp1.IsNull() || sp2.IsNull()) return Standard_False;
132   if (!sp1->IsConstant() || !sp2->IsConstant()) 
133     return Standard_False;
134   if ((fac.GetType() != GeomAbs_Plane) ||
135       (s1.GetType() != GeomAbs_Plane) ||
136       (s2.GetType() != GeomAbs_Plane)) return Standard_False;
137   gp_Dir df = fac.Plane().Position().Direction();
138   gp_Dir ds1 = s1.Plane().Position().Direction();
139   gp_Dir ds2 = s2.Plane().Position().Direction();
140   if ( Abs(df.Dot(ds1)) >= tolesp || Abs(df.Dot(ds2)) >= tolesp ) 
141     return Standard_False;
142   Standard_Real r1 = sp1->Radius();
143   Standard_Real r2 = sp2->Radius();
144   if(Abs(r1 - r2) >= tolesp) return Standard_False;
145   return Standard_True;
146 }
147
148 static void RemoveSD(Handle(ChFiDS_Stripe)& Stripe,
149                       const Standard_Integer num1,
150                       const Standard_Integer num2 )
151 {
152   ChFiDS_SequenceOfSurfData& Seq = 
153     Stripe->ChangeSetOfSurfData()->ChangeSequence();
154   if(Seq.IsEmpty()) return;
155   if (num1==num2) 
156     Seq.Remove(num1);
157   else
158     Seq.Remove(num1,num2);
159 }
160
161
162 //=======================================================================
163 //function : PerformTwoCorner
164 //purpose  : 
165 //=======================================================================
166
167 void ChFi3d_FilBuilder::PerformTwoCorner(const Standard_Integer Index)
168 {
169 #ifdef OCCT_DEBUG
170   OSD_Chronometer ch;
171   ChFi3d_InitChron(ch); // init perf initialisation 
172 #endif 
173   
174   done = 0;
175   const TopoDS_Vertex& Vtx = myVDataMap.FindKey(Index);
176   TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS();
177   ChFiDS_ListIteratorOfListOfStripe It;
178   It.Initialize(myVDataMap(Index));
179   Handle(ChFiDS_Stripe)  st1,st2;
180   Standard_Integer Sens1,Sens2;
181   Standard_Integer Isd1,Isd2,i1,i2;
182   Handle(ChFiDS_SurfData) sd1,sd2;
183   ChFiDS_SequenceOfSurfData SeqFil1,SeqFil2;
184   Handle(Geom_Surface) surf1,surf2;
185   Standard_Boolean  OkinterCC,Okvisavis,SameSide;
186   Standard_Integer IFaCo1,IFaCo2;
187   Standard_Real UIntPC1,UIntPC2;
188   TopoDS_Face FaCo;
189   TopoDS_Edge E1,E2,E;
190   TopoDS_Vertex V1,V2;
191 //  gp_Pnt P1,P2;
192   Standard_Integer nbsurf1,nbsurf2,deb1,fin1,deb2,fin2;
193   Standard_Real parE1,parE2;
194   //Necessary information on fillets is extracted 
195   //------------------------------------------------------
196   
197   //the first
198   //----------
199  
200   st1 = It.Value(); 
201   Isd1 = ChFi3d_IndexOfSurfData(Vtx,st1,Sens1);
202   
203   
204   //the second
205   //----------
206   It.Next();
207   st2 = It.Value();
208   if(st2 == st1) {
209     Sens2 = -1;
210     Isd2 = st2->SetOfSurfData()->Length();
211   }
212   else{ Isd2 = ChFi3d_IndexOfSurfData(Vtx,st2,Sens2); }
213   
214   // If two edges to rounded are tangent GeomPlate is called
215
216   if (Sens1==1)  E1= st1->Spine()->Edges(1);
217   else E1= st1->Spine()->Edges( st1->Spine()->NbEdges());
218   
219   if (Sens2==1)  E2= st2->Spine()->Edges(1);
220   else E2= st2->Spine()->Edges( st2->Spine()->NbEdges());
221   
222   BRepAdaptor_Curve BCurv1(E1);
223   BRepAdaptor_Curve BCurv2(E2);
224   parE1=BRep_Tool::Parameter(Vtx,E1);
225   parE2=BRep_Tool::Parameter(Vtx,E2);
226   BRepLProp_CLProps CL1(BCurv1,parE1 , 1, 1.e-4);
227   BRepLProp_CLProps CL2(BCurv2,parE2 , 1, 1.e-4);
228   gp_Dir dir1,dir2 ;
229   CL1.Tangent(dir1);
230   CL2.Tangent(dir2);
231   if (Sens1==-1)  dir1.Reverse();
232   if (Sens2==-1)  dir2.Reverse();
233   Standard_Real ang1;
234   ang1=Abs(dir1.Angle(dir2));
235   if (ang1<M_PI/180.) {
236     PerformMoreThreeCorner(Index,2);
237     done=1;
238     return;
239   }
240
241   OkinterCC = ChFi3d_IsInFront(DStr,st1,st2,Isd1,Isd2,Sens1,Sens2,
242                                UIntPC1,UIntPC2,FaCo,SameSide,
243                                IFaCo1,IFaCo2,Okvisavis,Vtx,Standard_True);
244
245   Standard_Boolean trouve=Standard_False;  
246   if (!Okvisavis) {
247
248   
249 // one is not limited to the first or the last surfdata 
250 // to find the opposing data
251     nbsurf1=st1->SetOfSurfData()->Length();
252     nbsurf2=st2->SetOfSurfData()->Length();
253     deb1=1; 
254     deb2=1;
255     fin1=1;
256     fin2=1;
257     if (nbsurf1!=1) {
258       if (Sens1==1) {
259         deb1=1;
260         fin1=2;
261       }
262       else  {
263         deb1=nbsurf1-1;
264         fin1=nbsurf1;
265       }
266     }
267     if (nbsurf2!=1) {
268       if (Sens2==1 ) {
269         deb2=1;
270         fin2=2;
271       }
272       else {
273         deb2=nbsurf2-1;
274         fin2=nbsurf2;
275       }
276     }
277   
278     for (i1=deb1;i1<=fin1 &&!trouve;i1++) {
279       Isd1=i1;
280       for (i2=deb2;i2<=fin2 &&!trouve;i2++) {
281         Isd2=i2;
282  
283         OkinterCC = ChFi3d_IsInFront(DStr,st1,st2,Isd1,Isd2,Sens1,Sens2,
284                                UIntPC1,UIntPC2,FaCo,SameSide,
285                                IFaCo1,IFaCo2,Okvisavis,Vtx,Standard_True);
286         trouve=Okvisavis;
287       }
288     } 
289     if (!trouve){
290       PerformMoreThreeCorner(Index,2);
291       done=1;
292       return;
293     }
294     else {
295       if (Sens1==1 && Isd1!=1) RemoveSD(st1,1,1);
296       if (Sens1!=1 && Isd1!=nbsurf1) RemoveSD(st1,fin1,fin1);
297       if (Sens2==1 && Isd2!=1) RemoveSD(st2,1,1);
298       if (Sens2!=1 && Isd2!=nbsurf2) RemoveSD(st2,fin2,fin2);
299
300     }
301     Isd1=ChFi3d_IndexOfSurfData(Vtx,st1,Sens1);
302     Isd2=ChFi3d_IndexOfSurfData(Vtx,st2,Sens2);
303   }
304    // StdFail_NotDone::Raise("TwoCorner : no common face");
305   Standard_Integer IFaArc1 = 3-IFaCo1, IFaArc2 = 3-IFaCo2;
306   SeqFil1 = st1->ChangeSetOfSurfData()->ChangeSequence();
307   SeqFil2 = st2->ChangeSetOfSurfData()->ChangeSequence();
308   sd1 = SeqFil1.ChangeValue(Isd1);
309   surf1 = DStr.Surface(sd1->Surf()).Surface();
310   sd2 = SeqFil2.ChangeValue(Isd2);
311   surf2 = DStr.Surface(sd2->Surf()).Surface();
312   TopAbs_Orientation OFaCo = FaCo.Orientation(); 
313   // The concavities are analyzed and the opposite face and the
314   // eventual intersection of 2 pcurves on this face are found.
315   
316   ChFiDS_State Stat1,Stat2;
317   Standard_Boolean isfirst1 = (Sens1 == 1);
318   Standard_Boolean isfirst2 = (Sens2 == 1);
319   Stat1 = st1->Spine()->Status(isfirst1);
320   Stat2 = st2->Spine()->Status(isfirst2);
321   Standard_Boolean c1biseau = (Stat1 == ChFiDS_AllSame); 
322   Standard_Boolean c1rotule = (Stat1 == ChFiDS_OnSame && Stat2 == ChFiDS_OnSame);
323   
324   // It is checked if the fillets have a commonpoint on a common arc. 
325   // This edge is the pivot of the bevel or the knee.
326   
327   ChFiDS_CommonPoint& CP1 = sd1->ChangeVertex(isfirst1,IFaArc1);
328   ChFiDS_CommonPoint& CP2 = sd2->ChangeVertex(isfirst2,IFaArc2);
329   
330   Standard_Boolean resetcp1 = 0;
331   Standard_Boolean resetcp2 = 0;
332   
333   TopoDS_Edge pivot;
334   Standard_Boolean yapiv = Standard_False;
335   if(CP1.IsOnArc()) pivot = CP1.Arc();
336   else {
337     PerformMoreThreeCorner(Index,2);
338     done=1;
339     return;
340   }
341   if(CP1.IsOnArc()&& CP2.IsOnArc()){
342     yapiv = (pivot.IsSame(CP2.Arc()));
343   }
344   Handle(BRepAdaptor_HCurve) Hpivot;
345   Standard_Boolean sameparam = Standard_False;
346   Standard_Real parCP1 = 0., parCP2 = 0.;
347   if(yapiv) {
348     Hpivot = new BRepAdaptor_HCurve(pivot);
349     parCP1 = CP1.ParameterOnArc();
350     parCP2 = CP2.ParameterOnArc();
351     gp_Pnt tst1 = Hpivot->Value(parCP1);
352     gp_Pnt tst2 = Hpivot->Value(parCP2);
353     sameparam = tst1.Distance(tst2) <= tolesp;
354   }
355   Handle(BRepAdaptor_HSurface) HFaCo = new BRepAdaptor_HSurface();
356   Handle(BRepAdaptor_HSurface) HFaPiv;
357   Handle(BRepAdaptor_HSurface) HBRS1 = new BRepAdaptor_HSurface();
358   Handle(BRepAdaptor_HSurface) HBRS2 = new BRepAdaptor_HSurface();
359   
360   BRepAdaptor_Surface& BRS1 = HBRS1->ChangeSurface();
361   BRepAdaptor_Surface& BRS2 = HBRS2->ChangeSurface();
362   BRepAdaptor_Surface& BRFaCo = HFaCo->ChangeSurface();
363   BRFaCo.Initialize(FaCo);
364   
365   TopoDS_Face FF1,FF2,F,FaPiv;
366   TopAbs_Orientation pctrans = TopAbs_FORWARD ;
367   Handle(Geom2d_BSplineCurve) PCurveOnPiv;
368   FF1 = TopoDS::Face(DStr.Shape(sd1->Index(IFaArc1)));
369   FF2 = TopoDS::Face(DStr.Shape(sd2->Index(IFaArc2)));
370   if (FF1.IsNull()||FF2.IsNull()) 
371   {PerformMoreThreeCorner(Index,2);
372    done=1;
373    return;
374   }
375   BRS1.Initialize(FF1);
376   BRS2.Initialize(FF2);
377   
378   if(yapiv ) {
379     TopTools_ListIteratorOfListOfShape Kt;
380     Standard_Boolean ok1 = Standard_False, ok2 = Standard_False;
381     for (Kt.Initialize(myEFMap(pivot)); Kt.More(); Kt.Next()){
382       F = TopoDS::Face(Kt.Value());
383       if(!ok1 && FF1.IsSame(F)){
384         ok1 = Standard_True;
385       }
386       if(!ok2 && FF2.IsSame(F)){
387         ok2 = Standard_True;
388       }
389     }
390     if(!ok1 || !ok2){
391       PerformMoreThreeCorner(Index,2);
392       done=1;
393       return;
394     }
395   }
396   
397 #ifdef OCCT_DEBUG
398   ChFi3d_ResultChron(ch ,t_t2cornerinit);//result perf initialisation 
399 #endif 
400   
401   //bevel
402   //------
403   ChFiDS_CommonPoint cp11,cp12,cp21,cp22;
404   ChFiDS_FaceInterference intf11,intf12,intf21,intf22;
405
406   if(c1biseau){
407 #ifdef OCCT_DEBUG
408     ChFi3d_InitChron(ch); // init perf PerformTwoCornerbyInter
409 #endif 
410     
411     done = PerformTwoCornerbyInter(Index);
412     
413 #ifdef OCCT_DEBUG
414     ChFi3d_ResultChron(ch , t_perf2cornerbyinter); // result perf  PerformTwoCornerbyInter
415 #endif 
416    
417     if (!done){
418       PerformMoreThreeCorner(Index,2);
419       done=1;
420       return;
421     }
422   } 
423   else if(c1rotule){//save.
424     cp11 = sd1->Vertex(isfirst1,1);
425     cp12 = sd1->Vertex(isfirst1,2);
426     cp21 = sd2->Vertex(isfirst2,1);
427     cp22 = sd2->Vertex(isfirst2,2);
428     intf11 = sd1->InterferenceOnS1();
429     intf12 = sd1->InterferenceOnS2();
430     intf21 = sd2->InterferenceOnS1();
431     intf22 = sd2->InterferenceOnS2();
432 #ifdef OCCT_DEBUG
433     ChFi3d_InitChron(ch); // init perf PerformTwoCornerbyInter
434 #endif 
435       
436     done = PerformTwoCornerbyInter(Index);
437       
438 #ifdef OCCT_DEBUG
439       ChFi3d_ResultChron(ch , t_perf2cornerbyinter); // result perf  PerformTwoCornerbyInter
440 #endif 
441     if (!done) {
442       // restore
443       sd1->ChangeVertex(isfirst1,1) = cp11;
444       sd1->ChangeVertex(isfirst1,2) = cp12;
445       sd2->ChangeVertex(isfirst2,1) = cp21;
446       sd2->ChangeVertex(isfirst2,2) = cp22;
447       sd1->ChangeInterferenceOnS1() = intf11;
448       sd1->ChangeInterferenceOnS2() = intf12;
449       sd2->ChangeInterferenceOnS1() = intf21;
450       sd2->ChangeInterferenceOnS2() = intf22;
451       done = 0;
452     }
453   }
454   
455   if(!c1biseau && !done){
456     //new cornerdata is created
457     //-------------------------------
458     Handle(ChFiDS_Stripe) corner = new ChFiDS_Stripe();
459     Handle(ChFiDS_HData)& cornerset = corner->ChangeSetOfSurfData();
460     cornerset = new ChFiDS_HData();
461     Handle(ChFiDS_SurfData) coin = new ChFiDS_SurfData();
462     cornerset->Append(coin);
463     
464     if (SameSide) {
465       if(ToricRotule(BRFaCo,BRS1,BRS2,st1,st2)){
466         // Direct construction.
467         // ---------------------
468         
469         Standard_Integer bid;
470         TopAbs_Orientation ori = OFaCo;
471         TopAbs_Orientation oriS = st1->Orientation(IFaCo1);
472         TopAbs_Orientation OFF1 = FF1.Orientation(); 
473         TopAbs_Orientation oriSFF1 = st1->Orientation(IFaArc1);
474         bid = 1;
475         bid = ChFi3d::NextSide(ori,OFF1,oriS,oriSFF1,bid);
476         TopAbs_Orientation op1 = TopAbs_FORWARD,op2 = TopAbs_FORWARD;
477         if(yapiv) bid = ChFi3d::ConcaveSide(BRS1,BRS2,pivot,op1,op2);
478         op1 = TopAbs::Reverse(op1);
479         op2 = TopAbs::Reverse(op2);
480 #ifdef OCCT_DEBUG
481         ChFi3d_InitChron(ch);// init perf ChFiKPart_ComputeData 
482 #endif 
483         Standard_Real radius = 
484           Handle(ChFiDS_FilSpine)::DownCast(st1->Spine())->Radius();
485         done = ChFiKPart_ComputeData::ComputeCorner(DStr,coin,HFaCo,HBRS1,HBRS2,
486                                                     OFaCo,ori,op1,op2,radius);
487 #ifdef OCCT_DEBUG
488         ChFi3d_ResultChron(ch , t_chfikpartcompdata);//result perf ChFiKPart_ComputeData 
489 #endif 
490       }
491       else {
492         // Construction by filling remplissage
493         // ----------------------------
494         Standard_Real  uPCArc1,  uPCArc2;
495         gp_Pnt2d p2da1,p2df1,p2da2,p2df2,p2dfac1,p2dfac2;
496         gp_Vec2d v2dfac1,v2dfac2;
497         Handle(GeomFill_Boundary) B1,B2,Bpiv,Bfac;
498         uPCArc1 = sd1->Interference(IFaArc1).Parameter(isfirst1);
499         p2da1 = sd1->Interference(IFaArc1).PCurveOnSurf()->Value(uPCArc1);
500         p2df1 = sd1->Interference(IFaCo1).PCurveOnSurf()->Value(uPCArc1);
501         sd1->Interference(IFaCo1).PCurveOnFace()->D1(uPCArc1,p2dfac1,v2dfac1);
502         uPCArc2 = sd2->Interference(IFaArc2).Parameter(isfirst2);
503         p2da2 = sd2->Interference(IFaArc2).PCurveOnSurf()->Value(uPCArc2);
504         p2df2 = sd2->Interference(IFaCo2).PCurveOnSurf()->Value(uPCArc2);
505         sd2->Interference(IFaCo2).PCurveOnFace()->D1(uPCArc2,p2dfac2,v2dfac2);
506 #ifdef OCCT_DEBUG
507         ChFi3d_InitChron(ch ); // init perf filling
508 #endif 
509         B1 = ChFi3d_mkbound(surf1,p2df1,p2da1,tolesp,2.e-4);
510         B2 = ChFi3d_mkbound(surf2,p2df2,p2da2,tolesp,2.e-4);
511         Handle(Geom2d_Curve) PCurveOnFace;
512         Bfac = ChFi3d_mkbound(HFaCo,PCurveOnFace,Sens1,p2dfac1,v2dfac1,
513                               Sens2,p2dfac2,v2dfac2,tolesp,2.e-4);
514         GeomFill_ConstrainedFilling fil(8,20);
515         if(sameparam) {
516           fil.Init(Bfac,B2,B1,1);
517         }
518         else {
519           Handle(Adaptor3d_HCurve) HPivTrim = Hpivot->ChangeCurve().
520             Trim(Min(parCP1,parCP2),Max(parCP1,parCP2),tolesp);
521           Bpiv = new GeomFill_SimpleBound(HPivTrim,tolesp,2.e-4);
522           fil.Init(Bfac,B2,Bpiv,B1,1);
523           BRepAdaptor_Curve2d pcpivot;
524           gp_Vec dArc,dcf;
525           gp_Pnt bidon;
526           Hpivot->D1(parCP1,bidon,dArc);
527           Standard_Real fb1,lb1;
528           B1->Bounds(fb1,lb1);
529           B1->D1(lb1,bidon,dcf);
530           Standard_Boolean pivotverslebas = dArc.Dot(dcf) <= 0.; 
531           Standard_Boolean pcfalenvers = (parCP1 > parCP2);
532           if((pivotverslebas && !pcfalenvers)||
533              (!pivotverslebas && pcfalenvers)) {
534             FaPiv = FF2;
535             HFaPiv = HBRS2;
536             resetcp2 = 1;
537           }
538           else {
539             FaPiv = FF1;
540             HFaPiv = HBRS1;
541             resetcp1 = 1;
542           }
543           FaPiv.Orientation(TopAbs_FORWARD);
544           pcpivot.Initialize(pivot,FaPiv);
545           TopExp_Explorer Expl;
546           for(Expl.Init(FaPiv,TopAbs_EDGE); Expl.More(); Expl.Next()){
547             if(Expl.Current().IsSame(pivot)) {
548               pctrans = Expl.Current().Orientation();
549               break;
550             }
551           }
552           if(pcpivot.GetType() != GeomAbs_BSplineCurve){
553             Handle(Geom2d_TrimmedCurve) 
554               trc = new Geom2d_TrimmedCurve(pcpivot.Curve(),
555                                             Min(parCP1,parCP2),
556                                             Max(parCP1,parCP2));
557             PCurveOnPiv = Geom2dConvert::CurveToBSplineCurve(trc);
558           }
559           else {
560             PCurveOnPiv = Geom2dConvert::SplitBSplineCurve
561               (Handle(Geom2d_BSplineCurve)::DownCast(pcpivot.Curve()),
562                Min(parCP1,parCP2),Max(parCP1,parCP2),tol2d);
563           }
564           TColStd_Array1OfReal kk(1,PCurveOnPiv->NbKnots());
565           PCurveOnPiv->Knots(kk);
566           BSplCLib::Reparametrize(0.,1.,kk);
567           PCurveOnPiv->SetKnots(kk);
568           if(pcfalenvers) {
569             PCurveOnPiv->Reverse();
570             pctrans = TopAbs::Reverse(pctrans);
571           }
572         }
573         Handle(Geom_Surface) Surfcoin = fil.Surface();
574         done = CompleteData(coin,Surfcoin,
575                             HFaCo,PCurveOnFace,
576                             HFaPiv,PCurveOnPiv,OFaCo,1,
577                             0,0,0,0);
578 #ifdef OCCT_DEBUG
579         ChFi3d_ResultChron(ch , t_remplissage);// result perf filling 
580 #endif 
581       }
582 #ifdef OCCT_DEBUG
583       ChFi3d_InitChron(ch); // init perf update DS
584 #endif 
585       if (done){
586         // Update 3 CornerData and the DS
587         // ----------------------------------------
588         if(resetcp1){
589           gp_Pnt pjyl = CP1.Point();
590           Standard_Real tolsav = CP1.Tolerance();
591           CP1.Reset();
592           CP1.SetPoint(pjyl);
593           CP1.SetTolerance(tolsav);
594         }
595         else if(resetcp2){
596           gp_Pnt pjyl = CP2.Point();
597           Standard_Real tolsav = CP2.Tolerance();
598           CP2.Reset();
599           CP2.SetPoint(pjyl);
600           CP2.SetTolerance(tolsav);
601         }
602         Standard_Real P1deb,P2deb,P1fin,P2fin;
603         Standard_Integer If1,If2,Il1,Il2,Icf,Icl;
604         const ChFiDS_CommonPoint& Pf1 = coin->VertexFirstOnS1();
605         ChFiDS_CommonPoint& Pf2 = coin->ChangeVertexFirstOnS2();
606         const ChFiDS_CommonPoint& Pl1 = coin->VertexLastOnS1();
607         ChFiDS_CommonPoint& Pl2 = coin->ChangeVertexLastOnS2();
608         Pf2 = CP1;
609         Pl2 = CP2;
610         
611         // the corner to start,
612         // -----------------------
613         ChFiDS_Regul regdeb, regfin;
614         If1 = ChFi3d_IndexPointInDS(Pf1,DStr);
615         If2 = ChFi3d_IndexPointInDS(Pf2,DStr);
616         Il1 = ChFi3d_IndexPointInDS(Pl1,DStr);
617         if(sameparam) Il2 = If2;
618         else Il2 = ChFi3d_IndexPointInDS(Pl2,DStr);
619         
620         gp_Pnt2d pp1,pp2;
621         pp1 = coin->InterferenceOnS1().PCurveOnSurf()->
622           Value(coin->InterferenceOnS1().FirstParameter());
623         pp2 = coin->InterferenceOnS2().PCurveOnSurf()->
624           Value(coin->InterferenceOnS2().FirstParameter());
625         Handle(Geom_Curve) C3d;
626         Standard_Real tolreached;
627         ChFi3d_ComputeArete(Pf1,pp1,Pf2,pp2,
628                             DStr.Surface(coin->Surf()).Surface(),C3d,
629                             corner->ChangeFirstPCurve(),P1deb,P2deb,
630                             tolesp,tol2d,tolreached,0);
631         Standard_Real par1 = sd1->Interference(IFaArc1).Parameter(isfirst1);
632         pp1 = sd1->Interference(IFaCo1).PCurveOnSurf()->Value(par1);
633         pp2 = sd1->Interference(IFaArc1).PCurveOnSurf()->Value(par1);
634         Standard_Real tolr1;
635         ChFi3d_ComputePCurv(C3d,pp1,pp2,st1->ChangePCurve(isfirst1),
636                             DStr.Surface(sd1->Surf()).Surface(),
637                             P1deb,P2deb,tolesp,tolr1);
638         tolreached = Max(tolreached,tolr1);
639         TopOpeBRepDS_Curve Tcurv1(C3d,tolreached);
640         Icf = DStr.AddCurve(Tcurv1);
641         regdeb.SetCurve(Icf);
642         regdeb.SetS1(coin->Surf(),0);
643         regdeb.SetS2(sd1->Surf(),0);
644         myRegul.Append(regdeb);
645         corner->ChangeFirstCurve(Icf);
646         corner->ChangeFirstParameters(P1deb,P2deb);
647         corner->ChangeIndexFirstPointOnS1(If1);
648         corner->ChangeIndexFirstPointOnS2(If2);
649       
650         pp1 = coin->InterferenceOnS1().PCurveOnSurf()->
651           Value(coin->InterferenceOnS1().LastParameter());
652         pp2 = coin->InterferenceOnS2().PCurveOnSurf()->
653           Value(coin->InterferenceOnS2().LastParameter());
654         ChFi3d_ComputeArete(Pl1,pp1,Pl2,pp2,
655                             DStr.Surface(coin->Surf()).Surface(),C3d,
656                             corner->ChangeLastPCurve(),P1fin,P2fin,
657                             tolesp,tol2d,tolreached,0);
658         Standard_Real par2 = sd2->Interference(IFaArc2).Parameter(isfirst2);
659         pp1 = sd2->Interference(IFaCo2).PCurveOnSurf()->Value(par2);
660         pp2 = sd2->Interference(IFaArc2).PCurveOnSurf()->Value(par2);
661         Standard_Real tolr2;
662         ChFi3d_ComputePCurv(C3d,pp1,pp2,st2->ChangePCurve(isfirst2),
663                             DStr.Surface(sd2->Surf()).Surface(),
664                             P1deb,P2deb,tolesp,tolr2);
665         tolreached = Max(tolreached,tolr2);
666         TopOpeBRepDS_Curve Tcurv2(C3d,tolreached);
667         Icl = DStr.AddCurve(Tcurv2);
668         regfin.SetCurve(Icl);
669         regfin.SetS1(coin->Surf(),0);
670         regfin.SetS2(sd2->Surf(),0);
671         myRegul.Append(regfin);
672         corner->ChangeLastCurve(Icl);
673         corner->ChangeLastParameters(P1fin,P2fin);
674         corner->ChangeIndexLastPointOnS1(Il1);
675         corner->ChangeIndexLastPointOnS2(Il2);
676         
677         coin->ChangeIndexOfS1(DStr.AddShape(FaCo));
678         if(sameparam) coin->ChangeIndexOfS2(0);
679         else {
680           coin->ChangeIndexOfS2(DStr.AddShape(FaPiv));
681           coin->ChangeInterferenceOnS2().SetTransition(pctrans);
682         }
683         corner->SetSolidIndex(st1->SolidIndex());
684         
685         // then the starting Stripe,
686         // ------------------------
687         st1->SetCurve(Icf,isfirst1);
688         st1->SetIndexPoint(If1,isfirst1,IFaCo1);
689         st1->SetIndexPoint(If2,isfirst1,IFaArc1);
690         st1->SetParameters(isfirst1,P1deb,P2deb);
691         sd1->ChangeVertex(isfirst1,IFaCo1) = Pf1;
692         sd1->ChangeVertex(isfirst1,IFaArc1) = Pf2;
693         sd1->ChangeInterference(IFaCo1).SetParameter(par1,isfirst1);
694         if (IFaCo1 == 2) st1->SetOrientation(TopAbs_REVERSED,isfirst1);
695         
696         // then the end Stripe,
697         // -------------------------
698         st2->SetCurve(Icl,isfirst2);
699         st2->SetIndexPoint(Il1,isfirst2,IFaCo2);
700         st2->SetIndexPoint(Il2,isfirst2,IFaArc2);
701         st2->SetParameters(isfirst2,P1fin,P2fin);
702         sd2->ChangeVertex(isfirst2,IFaCo2) = Pl1;
703         sd2->ChangeVertex(isfirst2,IFaArc2) = Pl2;
704         sd2->ChangeInterference(IFaCo2).SetParameter(par2,isfirst2);
705         if (IFaCo2 == 2) st2->SetOrientation(TopAbs_REVERSED,isfirst2);
706       }
707 #ifdef OCCT_DEBUG
708       ChFi3d_ResultChron(ch , t_t2cornerDS);// result perf update DS 
709 #endif 
710     }
711     else {
712       //it is necessary to make difference with
713       if(!OkinterCC) {
714         Standard_Failure::Raise("TwoCorner : No intersection pc pc");
715       }
716       Handle(ChFiDS_Stripe) stsam, stdif;
717       Handle(ChFiDS_SurfData) sdsam, sddif;
718       Standard_Real uintpcsam = 0., uintpcdif = 0.;
719       Standard_Integer ifacosam = 0, ifacodif = 0, ifaopsam = 0, ifaopdif = 0;
720       Standard_Boolean isfirstsam = Standard_False, isfirstdif = Standard_False;
721       if(Stat1 == ChFiDS_OnSame && Stat2 == ChFiDS_OnDiff){
722         stsam = st1; sdsam = sd1; uintpcsam = UIntPC1; 
723         ifacosam = IFaCo1; ifaopsam = IFaArc1; isfirstsam = isfirst1;
724         stdif = st2; sddif = sd2; uintpcdif = UIntPC2; 
725         ifacodif = IFaCo2; ifaopdif = IFaArc2; isfirstdif = isfirst2;
726       }
727       else if(Stat1 == ChFiDS_OnDiff && Stat2 == ChFiDS_OnSame){
728         stsam = st2; sdsam = sd2; uintpcsam = UIntPC2; 
729         ifacosam = IFaCo2; ifaopsam = IFaArc2; isfirstsam = isfirst2;
730         stdif = st1; sddif = sd1; uintpcdif = UIntPC1; 
731         ifacodif = IFaCo1; ifaopdif = IFaArc1; isfirstdif = isfirst1;
732       }
733       else {
734         Standard_Failure::Raise("TwoCorner : Config unknown");
735       }
736       //It is checked if surface ondiff has a point on arc from the side opposed
737       //to the common face and if this arc is connected to the base face  
738       //opposed to common face of the surface onsame.
739       ChFiDS_CommonPoint& cpopdif = sddif->ChangeVertex(isfirstdif,ifaopdif);
740       if(!cpopdif.IsOnArc()) {
741         Standard_Failure::Raise
742           ("TwoCorner : No point on restriction on surface OnDiff");
743       }
744       const TopoDS_Edge& Arcopdif = cpopdif.Arc();
745       const TopoDS_Face& Fopsam = TopoDS::Face(DStr.Shape(sdsam->Index(ifaopsam)));
746       TopExp_Explorer ex;
747       for(ex.Init(Fopsam,TopAbs_EDGE); ex.More(); ex.Next()){
748         if(ex.Current().IsSame(Arcopdif)) {
749           break;
750         }
751         else if(!ex.More()) {
752           Standard_Failure::Raise
753             ("TwoCorner : No common face to loop the contour");
754         }
755       }
756 #ifdef OCCT_DEBUG
757       ChFi3d_InitChron(ch ); // init perf filling 
758 #endif 
759       Handle(GeomFill_Boundary) Bsam,Bdif,Bfac;
760       gp_Pnt2d ppopsam = 
761         sdsam->Interference(ifaopsam).PCurveOnSurf()->Value(uintpcsam);
762       gp_Pnt2d ppcosam = 
763         sdsam->Interference(ifacosam).PCurveOnSurf()->Value(uintpcsam);
764       Handle(Geom_Surface) surfsam = DStr.Surface(sdsam->Surf()).Surface();
765       Handle(GeomAdaptor_HSurface) Hsurfsam = new GeomAdaptor_HSurface(surfsam);
766       Handle(Geom2d_Curve) pcsurfsam;
767       Bsam = ChFi3d_mkbound(Hsurfsam,pcsurfsam,ppopsam,ppcosam,tolesp,2.e-4);
768       Standard_Real upcopdif = sddif->Interference(ifaopdif).Parameter(isfirstdif);
769       gp_Pnt2d ppopdif = 
770         sddif->Interference(ifaopdif).PCurveOnSurf()->Value(upcopdif);
771       gp_Pnt2d ppcodif = 
772         sddif->Interference(ifacodif).PCurveOnSurf()->Value(uintpcdif);
773       Handle(Geom_Surface) surfdif = DStr.Surface(sddif->Surf()).Surface();
774       Handle(GeomAdaptor_HSurface) Hsurfdif = new GeomAdaptor_HSurface(surfdif);
775       Handle(Geom2d_Curve) pcsurfdif;
776       Bdif = ChFi3d_mkbound(Hsurfdif,pcsurfdif,ppcodif,ppopdif,tolesp,2.e-4);
777       gp_Pnt2d ppfacsam,ppfacdif;
778       gp_Pnt PPfacsam,PPfacdif;
779       gp_Vec VVfacsam,VVfacdif;
780       sdsam->Interference(ifaopsam).PCurveOnFace()->D0(uintpcsam,ppfacsam);
781       const Handle(Geom_Curve)& curvopsam = 
782         DStr.Curve(sdsam->Interference(ifaopsam).LineIndex()).Curve();
783       curvopsam->D1(uintpcsam,PPfacsam,VVfacsam);
784       BRepAdaptor_Curve2d PCArcFac(Arcopdif,Fopsam);
785       PCArcFac.D0(cpopdif.ParameterOnArc(),ppfacdif);
786       BRepAdaptor_Curve CArcFac(Arcopdif);
787       CArcFac.D1(cpopdif.ParameterOnArc(),PPfacdif,VVfacdif);
788       Handle(BRepAdaptor_HSurface) HBRFopsam = new BRepAdaptor_HSurface();
789       BRepAdaptor_Surface& BRFopsam = HBRFopsam->ChangeSurface();
790       BRFopsam.Initialize(Fopsam,Standard_False);
791       Handle(Geom2d_Curve) pcFopsam = ChFi3d_BuildPCurve(HBRFopsam,
792                                                          ppfacsam,VVfacsam,
793                                                          ppfacdif,VVfacdif,1);
794       Bfac = ChFi3d_mkbound(HBRFopsam,pcFopsam,tolesp,2.e-4);
795       GeomFill_ConstrainedFilling fil(8,20);
796       fil.Init(Bsam,Bdif,Bfac,1);
797 #if 0
798       for(Standard_Integer ib = 0; ib < 4; ib++){
799         if(ib == 2) continue;
800         fil.CheckCoonsAlgPatch(ib);
801         fil.CheckTgteField(ib);
802         fil.CheckApprox(ib);
803         fil.CheckResult(ib);
804       }
805 #endif
806       Handle(Geom_Surface) Surfcoin = fil.Surface();
807       TopAbs_Orientation Osurfsam = sdsam->Orientation();
808       Handle(Geom2d_Curve) pcnul;
809       done = CompleteData(coin,Surfcoin,
810                           Hsurfsam,pcsurfsam,
811                           HBRFopsam,pcnul,Osurfsam,1,
812                           0,0,0,0);
813 #ifdef OCCT_DEBUG
814       ChFi3d_ResultChron(ch , t_remplissage);// result perf filling 
815 #endif 
816       if(!done) Standard_Failure::Raise("concavites inverted : fail");
817 #ifdef OCCT_DEBUG
818       ChFi3d_InitChron(ch); // init perf update DS
819 #endif 
820       // Update 3 CornerData and the DS
821       // ----------------------------------------
822       // the corner to start,
823       // -----------------------
824       Standard_Real P1deb,P2deb,P1fin,P2fin;
825       Standard_Integer If1,If2,Il1,Il2,Icf,Icl;
826       const ChFiDS_CommonPoint& Pf1 = coin->VertexFirstOnS1();
827       ChFiDS_CommonPoint& Pf2 = coin->ChangeVertexFirstOnS2();
828       const ChFiDS_CommonPoint& Pl1 = coin->VertexLastOnS1();
829       ChFiDS_CommonPoint& Pl2 = coin->ChangeVertexLastOnS2();
830       Pf2 = Pl2 = cpopdif;
831         
832       ChFiDS_Regul regdeb, regfin;
833       If1 = ChFi3d_IndexPointInDS(Pf1,DStr);
834       If2 = ChFi3d_IndexPointInDS(Pf2,DStr);
835       Il1 = ChFi3d_IndexPointInDS(Pl1,DStr);
836       Il2 = If2;
837         
838       gp_Pnt2d pp1,pp2;
839       pp1 = coin->InterferenceOnS1().PCurveOnSurf()->
840         Value(coin->InterferenceOnS1().FirstParameter());
841       pp2 = coin->InterferenceOnS2().PCurveOnSurf()->
842         Value(coin->InterferenceOnS2().FirstParameter());
843       Handle(Geom_Curve) C3d;
844       Standard_Real tolreached;
845       ChFi3d_ComputeArete(Pf1,pp1,Pf2,pp2,
846                           DStr.Surface(coin->Surf()).Surface(),C3d,
847                           corner->ChangeFirstPCurve(),P1deb,P2deb,
848                           tolesp,tol2d,tolreached,0);
849       Standard_Real tolr1;
850       Handle(GeomAdaptor_HCurve) HC3d = new GeomAdaptor_HCurve(C3d);
851       ChFi3d_SameParameter(HC3d,pcFopsam,HBRFopsam,tolesp,tolr1);
852       tolreached = Max(tolreached,tolr1);
853       TopOpeBRepDS_Curve Tcurv1(C3d,tolreached);
854       Icf = DStr.AddCurve(Tcurv1);
855       // place the pcurve on face in the DS
856       TopAbs_Orientation OpcFopsam = sdsam->Interference(ifaopsam).Transition();
857       Standard_Integer IFopsam = sdsam->Index(ifaopsam);
858       if(isfirstsam) OpcFopsam = TopAbs::Reverse(OpcFopsam);
859       Handle(TopOpeBRepDS_SurfaceCurveInterference) 
860         interf = ChFi3d_FilCurveInDS(Icf,IFopsam,pcFopsam,OpcFopsam);
861       DStr.ChangeShapeInterferences(IFopsam).Append(interf);
862
863       regdeb.SetCurve(Icf);
864       regdeb.SetS1(coin->Surf(),0);
865       regdeb.SetS2(IFopsam,1);
866       myRegul.Append(regdeb);
867       corner->ChangeFirstCurve(Icf);
868       corner->ChangeFirstParameters(P1deb,P2deb);
869       corner->ChangeIndexFirstPointOnS1(If1);
870       corner->ChangeIndexFirstPointOnS2(If2);
871       
872       pp1 = coin->InterferenceOnS1().PCurveOnSurf()->
873         Value(coin->InterferenceOnS1().LastParameter());
874       pp2 = coin->InterferenceOnS2().PCurveOnSurf()->
875         Value(coin->InterferenceOnS2().LastParameter());
876       ChFi3d_ComputeArete(Pl1,pp1,Pl2,pp2,
877                           DStr.Surface(coin->Surf()).Surface(),C3d,
878                           corner->ChangeLastPCurve(),P1fin,P2fin,
879                           tolesp,tol2d,tolreached,0);
880       Standard_Real tolr2;
881       HC3d->ChangeCurve().Load(C3d);
882       ChFi3d_SameParameter(HC3d,pcsurfdif,Hsurfdif,tolesp,tolr2);
883       tolreached = Max(tolreached,tolr2);
884       TopOpeBRepDS_Curve Tcurv2(C3d,tolreached);
885       Icl = DStr.AddCurve(Tcurv2);
886       regfin.SetCurve(Icl);
887       regfin.SetS1(coin->Surf(),0);
888       regfin.SetS2(sddif->Surf(),0);
889       myRegul.Append(regfin);
890       corner->ChangeLastCurve(Icl);
891       corner->ChangeLastParameters(P1fin,P2fin);
892       corner->ChangeIndexLastPointOnS1(Il1);
893       corner->ChangeIndexLastPointOnS2(Il2);
894         
895       coin->ChangeIndexOfS1(-sdsam->Surf());
896       coin->ChangeIndexOfS2(0);
897
898       corner->SetSolidIndex(stsam->SolidIndex());
899         
900       // then Stripe OnSame
901       // ---------------------
902       const ChFiDS_FaceInterference& intcoin1 = coin->InterferenceOnS1();
903       stsam->SetCurve(intcoin1.LineIndex(),isfirstsam);
904       stsam->InDS(isfirstsam); // filDS already works from the corner.
905       stsam->ChangePCurve(isfirstsam) = coin->InterferenceOnS1().PCurveOnFace();
906       stsam->SetIndexPoint(If1,isfirstsam,ifaopsam);
907       stsam->SetIndexPoint(Il1,isfirstsam,ifacosam);
908       stsam->SetParameters(isfirstsam,
909                            intcoin1.FirstParameter(),
910                            intcoin1.LastParameter());
911       sdsam->ChangeVertex(isfirstsam,ifaopsam) = Pf1;
912       sdsam->ChangeVertex(isfirstsam,ifacosam) = Pl1;
913       sdsam->ChangeInterferenceOnS1().SetParameter(uintpcsam,isfirstsam);
914       sdsam->ChangeInterferenceOnS2().SetParameter(uintpcsam,isfirstsam);
915       if (ifaopsam == 2) stsam->SetOrientation(TopAbs_REVERSED,isfirstsam);
916         
917       // then Stripe OnDiff
918       // ---------------------
919       stdif->SetCurve(Icl,isfirstdif);
920       stdif->ChangePCurve(isfirstdif) = pcsurfdif;
921       stdif->SetIndexPoint(Il2,isfirstdif,ifaopdif);
922       stdif->SetIndexPoint(Il1,isfirstdif,ifacodif);
923       stdif->SetParameters(isfirstdif,P1fin,P2fin);
924       sddif->ChangeVertex(isfirstdif,ifaopdif) = Pl2;
925       sddif->ChangeVertex(isfirstdif,ifacodif) = Pl1;
926       sddif->ChangeInterference(ifacodif).SetParameter(uintpcdif,isfirstdif);
927       if (ifaopdif == 1) stdif->SetOrientation(TopAbs_REVERSED,isfirstdif);
928 #ifdef OCCT_DEBUG
929       ChFi3d_ResultChron(ch , t_t2cornerDS);// result perf update DS 
930 #endif 
931     }
932     if(!myEVIMap.IsBound(Vtx)){
933       TColStd_ListOfInteger li;
934       myEVIMap.Bind(Vtx,li);
935     }
936     myEVIMap.ChangeFind(Vtx).Append(coin->Surf());
937     myListStripe.Append(corner);
938   }
939 }  
940