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