0028966: Coding Rules - remove Adaptor2d_HCurve2d, Adaptor3d_HCurve and Adaptor3d_HSu...
[occt.git] / src / ChFi3d / ChFi3d_FilBuilder.cxx
CommitLineData
b311480e 1// Created on: 1995-04-25
2// Created by: Modelistation
3// Copyright (c) 1995-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
b311480e 16
7fd59977 17// Modified: MPS : (10-04-97) portage WNT pour GetFilletShape
7fd59977 18
42cf5bc1 19#include <Adaptor3d_TopolTool.hxx>
7fd59977 20#include <Blend_Point.hxx>
c22b52d6 21#include <BRepAdaptor_Curve2d.hxx>
22#include <BRepAdaptor_Surface.hxx>
7fd59977 23#include <BRepBlend_ConstRad.hxx>
24#include <BRepBlend_ConstRadInv.hxx>
42cf5bc1 25#include <BRepBlend_CurvPointRadInv.hxx>
7fd59977 26#include <BRepBlend_EvolRad.hxx>
27#include <BRepBlend_EvolRadInv.hxx>
42cf5bc1 28#include <BRepBlend_Line.hxx>
7fd59977 29#include <BRepBlend_RstRstConstRad.hxx>
30#include <BRepBlend_RstRstEvolRad.hxx>
31#include <BRepBlend_SurfCurvConstRadInv.hxx>
32#include <BRepBlend_SurfCurvEvolRadInv.hxx>
33#include <BRepBlend_SurfPointConstRadInv.hxx>
34#include <BRepBlend_SurfPointEvolRadInv.hxx>
42cf5bc1 35#include <BRepBlend_SurfRstConstRad.hxx>
36#include <BRepBlend_SurfRstEvolRad.hxx>
37#include <BRepBlend_Walking.hxx>
38#include <ChFi3d_Builder_0.hxx>
39#include <ChFi3d_FilBuilder.hxx>
40#include <ChFi3d_SearchSing.hxx>
41#include <ChFiDS_ErrorStatus.hxx>
7fd59977 42#include <ChFiDS_FilSpine.hxx>
42cf5bc1 43#include <ChFiDS_HData.hxx>
c22b52d6 44#include <ChFiDS_ElSpine.hxx>
7fd59977 45#include <ChFiDS_ListIteratorOfListOfStripe.hxx>
46#include <ChFiDS_ListIteratorOfRegularities.hxx>
42cf5bc1 47#include <ChFiDS_ListOfStripe.hxx>
7fd59977 48#include <ChFiDS_Regul.hxx>
42cf5bc1 49#include <ChFiDS_SecHArray1.hxx>
50#include <ChFiDS_Spine.hxx>
51#include <ChFiDS_Stripe.hxx>
52#include <ChFiDS_SurfData.hxx>
7fd59977 53#include <ElSLib.hxx>
42cf5bc1 54#include <Geom_Curve.hxx>
c22b52d6 55#include <GeomAdaptor_Curve.hxx>
42cf5bc1 56#include <gp_XY.hxx>
57#include <Law_Composite.hxx>
58#include <Law_Function.hxx>
7fd59977 59#include <math_FunctionRoot.hxx>
7fd59977 60#include <Precision.hxx>
7fd59977 61#include <Standard_ConstructionError.hxx>
62#include <Standard_Failure.hxx>
42cf5bc1 63#include <TColStd_SequenceOfReal.hxx>
64#include <TopoDS_Edge.hxx>
65#include <TopoDS_Shape.hxx>
66#include <TopoDS_Vertex.hxx>
67#include <TopOpeBRepBuild_HBuilder.hxx>
68#include <TopOpeBRepDS_Curve.hxx>
69#include <TopOpeBRepDS_HDataStructure.hxx>
70#include <TopOpeBRepDS_Surface.hxx>
71#include <TopTools_ListIteratorOfListOfShape.hxx>
72
0797d9d3 73#ifdef OCCT_DEBUG
742cc8b0 74#include <OSD_Chronometer.hxx>
7fd59977 75extern Standard_Boolean ChFi3d_GettraceCHRON();
76extern Standard_Real t_computedata ,t_completedata;
77
78extern void ChFi3d_InitChron(OSD_Chronometer& ch);
79extern void ChFi3d_ResultChron(OSD_Chronometer & ch,Standard_Real& time);
80#endif
81
82static Standard_Real MaxRad(const Handle(ChFiDS_FilSpine)& fsp,
83
84 const TopoDS_Edge& E)
85{
86 Standard_Integer IE = fsp->Index(E);
87
88 // 1: case of constant R
89 if (fsp->IsConstant(IE))
90 return (fsp->Radius(IE));
91 else // 2,3: case of sequence ParAndRad and(or) Laws
92 return (fsp->MaxRadFromSeqAndLaws());
93
94/*
c22b52d6 95 Handle(ChFiDS_ElSpine) HGuide = fsp->ElSpine(IE);
7fd59977 96 Standard_Real la = HGuide->LastParameter(), fi = HGuide->FirstParameter();
97 Standard_Real longueur = la - fi, temp, w;
0797d9d3 98//#ifndef OCCT_DEBUG
7fd59977 99 Standard_Real radiussect = 0.;
100//#else
101// Standard_Real radiussect;
102//#endif
103 Handle(Law_Composite) lc = fsp->Law(HGuide);
104 for(Standard_Integer i = 0; i <= 5; i++){
105 w = fi + i*longueur*0.2;
106 temp = lc->Value(w);
107 if(temp>radiussect) radiussect = temp;
108 }
109 return radiussect;
110*/
111}
112
c22b52d6 113static void SimulParams(const Handle(ChFiDS_ElSpine)& HGuide,
7fd59977 114 const Handle(ChFiDS_FilSpine)& fsp,
115 Standard_Real& MaxStep,
116 Standard_Real& Fleche)
117{
118 Standard_Real la = HGuide->LastParameter(), fi = HGuide->FirstParameter();
119 Standard_Real longueur = la - fi;
120 MaxStep = longueur * 0.05;
121 Standard_Real w;
122 //gp_Pnt Pbid;
123 //gp_Vec d1,d2;
124 Standard_Real radiussect;
125 if(fsp->IsConstant()) radiussect = fsp->Radius();
126 else {
127 radiussect = 0.;
128 Handle(Law_Composite) lc = fsp->Law(HGuide);
129 for(Standard_Integer i = 0; i <= 5; i++){
130 w = fi + i*longueur*0.2;
131 Standard_Real temp = lc->Value(w);
132 if(temp>radiussect) radiussect = temp;
133 }
134 }
135 Fleche = radiussect * 0.05;
136}
137
138//=======================================================================
139//function : ChFi3d_FilBuilder
140//purpose :
141//=======================================================================
142
143ChFi3d_FilBuilder::ChFi3d_FilBuilder(const TopoDS_Shape& S,
144 const ChFi3d_FilletShape FShape,
145 const Standard_Real Ta):
146 ChFi3d_Builder(S, Ta)
147{
148 SetFilletShape(FShape);
149}
150
151//=======================================================================
152//function : SetFilletShape
153//purpose :
154//=======================================================================
155
156void ChFi3d_FilBuilder::SetFilletShape(const ChFi3d_FilletShape FShape)
157{
158 switch (FShape) {
159 case ChFi3d_Rational:
160 myShape = BlendFunc_Rational;
161 break;
162 case ChFi3d_QuasiAngular:
163 myShape = BlendFunc_QuasiAngular;
164 break;
165 case ChFi3d_Polynomial:
166 myShape = BlendFunc_Polynomial;
167 break;
168 }
169}
170
171//=======================================================================
172//function : GetFilletShape
173//purpose :
174//=======================================================================
175
176ChFi3d_FilletShape ChFi3d_FilBuilder::GetFilletShape() const
177{
7fd59977 178 ChFi3d_FilletShape filshape = ChFi3d_Rational; // need to set default value
7fd59977 179 switch (myShape) {
180 case BlendFunc_Rational:
181 filshape= ChFi3d_Rational;
182 break;
183 case BlendFunc_QuasiAngular:
184 filshape= ChFi3d_QuasiAngular;
185 break;
186 case BlendFunc_Polynomial:
187 filshape= ChFi3d_Polynomial;
188 break;
189 default:
190 break;
191 }
192 return filshape;
193}
194
195//=======================================================================
196//function : Add
197//purpose :
198//=======================================================================
199
200void ChFi3d_FilBuilder::Add(const TopoDS_Edge& E)
201{
1d54b807 202 TopoDS_Face dummy;
203
7fd59977 204 if(!Contains(E) && myEFMap.Contains(E)){
205 Handle(ChFiDS_Stripe) Stripe = new ChFiDS_Stripe();
206 Handle(ChFiDS_Spine)& Sp = Stripe->ChangeSpine();
207 Sp = new ChFiDS_FilSpine(tolesp);
208 Handle(ChFiDS_FilSpine) Spine = Handle(ChFiDS_FilSpine)::DownCast(Sp);
209
210 TopoDS_Edge E_wnt = E;
211 E_wnt.Orientation(TopAbs_FORWARD);
212 Spine->SetEdges(E_wnt);
1d54b807 213 if(PerformElement(Spine, -1, dummy)){
7fd59977 214 PerformExtremity(Spine);
215 Spine->Load();
216 myListStripe.Append(Stripe);
217 }
218 }
219}
220
221//=======================================================================
222//function : Add
223//purpose :
224//=======================================================================
225
226void ChFi3d_FilBuilder::Add(const Standard_Real Radius, const TopoDS_Edge& E)
227{
228 Add(E);
229 Standard_Integer IC = Contains(E);
230 if (IC)
231 SetRadius( Radius, IC, E );
232}
233
234//=======================================================================
235//function : SetRadius
236//purpose :
237//=======================================================================
238
239void ChFi3d_FilBuilder::SetRadius(const Handle(Law_Function)& C,
240 const Standard_Integer IC,
241 const Standard_Integer IinC)
242{
243 if(IC <= NbElements()) {
244 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
245 fsp->SetRadius(C, IinC);
246 }
247}
248
249//=======================================================================
250//function : IsConstant
251//purpose :
252//=======================================================================
253
254Standard_Boolean ChFi3d_FilBuilder::IsConstant(const Standard_Integer IC)
255{
256 if(IC <= NbElements()) {
257 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
258 return fsp->IsConstant();
259 }
260 return 0;
261}
262
263//=======================================================================
264//function : Radius
265//purpose :
266//=======================================================================
267
268Standard_Real ChFi3d_FilBuilder::Radius(const Standard_Integer IC)
269{
270 if(IC <= NbElements()) {
271 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
272 return fsp->Radius();
273 }
274 return -1.;
275}
276
277//=======================================================================
278//function : ResetContour
279//purpose :
280//=======================================================================
281
282void ChFi3d_FilBuilder::ResetContour(const Standard_Integer IC)
283{
284 if(IC <= NbElements()) {
285 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
286 fsp->Reset(Standard_True);
287 }
288}
289
290//=======================================================================
291//function : SetRadius
292//purpose :
293//=======================================================================
294
295void ChFi3d_FilBuilder::SetRadius(const Standard_Real Radius,
296 const Standard_Integer IC,
297 const TopoDS_Edge& E)
298{
299 if(IC <= NbElements()) {
300 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
301 fsp->SetRadius(Radius, E);
302 }
303}
304
305//=======================================================================
306//function : UnSet
307//purpose :
308//=======================================================================
309
310void ChFi3d_FilBuilder::UnSet(const Standard_Integer IC,
311 const TopoDS_Edge& E)
312{
313 if(IC <= NbElements()) {
314 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
315 fsp->UnSetRadius(E);
316 }
317}
318
319//=======================================================================
320//function : SetRadius
321//purpose :
322//=======================================================================
323
324void ChFi3d_FilBuilder::SetRadius(const Standard_Real Radius,
325 const Standard_Integer IC,
326 const TopoDS_Vertex& V)
327{
328 if(IC <= NbElements()) {
329 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
330 fsp->SetRadius(Radius, V);
331 }
332}
333
334//=======================================================================
335//function : UnSet
336//purpose :
337//=======================================================================
338
339void ChFi3d_FilBuilder::UnSet(const Standard_Integer IC,
340 const TopoDS_Vertex& V)
341{
342 if(IC <= NbElements()) {
343 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
344 fsp->UnSetRadius(V);
345 }
346}
347
348//=======================================================================
349//function : SetRadius
350//purpose :
351//=======================================================================
352
353void ChFi3d_FilBuilder::SetRadius(const gp_XY& UandR,
354 const Standard_Integer IC,
355 const Standard_Integer IinC)
356{
357 if(IC <= NbElements()) {
358 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
359 fsp->SetRadius( UandR, IinC );
360 }
361}
362
363//=======================================================================
364//function : IsConstant
365//purpose :
366//=======================================================================
367
368Standard_Boolean ChFi3d_FilBuilder::IsConstant(const Standard_Integer IC,
369 const TopoDS_Edge& E)
370{
371 if(IC <= NbElements()) {
372 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
373 return fsp->IsConstant(fsp->Index(E));
374 }
375 return 0;
376}
377
378//=======================================================================
379//function : Radius
380//purpose :
381//=======================================================================
382
383Standard_Real ChFi3d_FilBuilder::Radius(const Standard_Integer IC,
384 const TopoDS_Edge& E)
385{
386 if(IC <= NbElements()) {
387 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
388 return fsp->Radius(E);
389 }
390 return -1.;
391}
392
393//=======================================================================
394//function : GetBounds
395//purpose :
396//=======================================================================
397
398Standard_Boolean ChFi3d_FilBuilder::GetBounds(const Standard_Integer IC,
399 const TopoDS_Edge& E,
400 Standard_Real& F,
401 Standard_Real& L)
402{
403 if(IC <= NbElements()) {
404 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
405 Handle(Law_Function)& loi = fsp->ChangeLaw(E);
406 if(!loi.IsNull()){
407 loi->Bounds(F,L);
408 return Standard_True;
409 }
410 }
411 return Standard_False;
412}
413
414//=======================================================================
415//function : GetLaw
416//purpose :
417//=======================================================================
418
419Handle(Law_Function) ChFi3d_FilBuilder::GetLaw(const Standard_Integer IC,
420 const TopoDS_Edge& E)
421{
422 if(IC <= NbElements()) {
423 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
424 return fsp->ChangeLaw(E);
425 }
426 return Handle(Law_Function)();
427}
428
429//=======================================================================
430//function : SetLaw
431//purpose :
432//=======================================================================
433
434void ChFi3d_FilBuilder::SetLaw(const Standard_Integer IC,
435 const TopoDS_Edge& E,
436 const Handle(Law_Function)& L)
437{
81bba717 438 // Check if it is necessary to check borders!
7fd59977 439 if(IC <= NbElements()) {
440 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Value(IC));
441 fsp->ChangeLaw(E) = L;
442 }
443}
444
445//=======================================================================
446//function : Simulate
447//purpose :
448//=======================================================================
449
450void ChFi3d_FilBuilder::Simulate (const Standard_Integer IC)
451{
0797d9d3 452#ifdef OCCT_DEBUG
7fd59977 453 if(ChFi3d_GettraceCHRON()){
454 simul.Reset();elspine.Reset();chemine.Reset();
455 simul.Start();
456 }
457#endif
458 ChFiDS_ListIteratorOfListOfStripe itel;
459 Standard_Integer i = 1;
460 for (itel.Initialize(myListStripe);itel.More(); itel.Next(), i++) {
461 if(i == IC){
462 PerformSetOfSurf(itel.Value(), Standard_True);
463 break;
464 }
465 }
0797d9d3 466#ifdef OCCT_DEBUG
7fd59977 467 if(ChFi3d_GettraceCHRON()){
468 simul.Stop();
04232180 469 std::cout<<"Total simulation time : ";
7fd59977 470 simul.Show();
04232180 471 std::cout<<"Spine construction time : ";
7fd59977 472 elspine.Show();
04232180 473 std::cout<<"and process time : ";
7fd59977 474 chemine.Show();
475 }
476#endif
477}
478
479//=======================================================================
480//function : NbSurf
481//purpose :
482//=======================================================================
483
484Standard_Integer ChFi3d_FilBuilder::NbSurf (const Standard_Integer IC) const
485{
486 ChFiDS_ListIteratorOfListOfStripe itel;
487 Standard_Integer i = 1;
488 for (itel.Initialize(myListStripe);itel.More(); itel.Next(), i++) {
489 if(i == IC){
490 return itel.Value()->SetOfSurfData()->Length();
491 }
492 }
493 return 0;
494}
495
496//=======================================================================
497//function : Sect
498//purpose :
499//=======================================================================
500
501Handle(ChFiDS_SecHArray1) ChFi3d_FilBuilder::Sect (const Standard_Integer IC,
502 const Standard_Integer IS) const
503{
504 ChFiDS_ListIteratorOfListOfStripe itel;
505 Standard_Integer i = 1;
506 Handle(ChFiDS_SecHArray1) res;
507 for (itel.Initialize(myListStripe);itel.More(); itel.Next(), i++) {
508 if(i == IC){
25e59720 509 Handle(Standard_Transient) bid = itel.Value()->SetOfSurfData()->Value(IS)->Simul();
7fd59977 510 res = Handle(ChFiDS_SecHArray1)::DownCast(bid);
511 return res;
512 }
513 }
514 return Handle(ChFiDS_SecHArray1)();
515}
516
517//=======================================================================
518//function : SimulKPart
519//purpose :
520//=======================================================================
521
522void ChFi3d_FilBuilder::SimulKPart(const Handle(ChFiDS_SurfData)& SD) const
523{
524 TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS();
525 Handle(Geom_Surface) S = DStr.Surface(SD->Surf()).Surface();
526 gp_Pnt2d p1f = SD->InterferenceOnS1().PCurveOnSurf()->
527 Value(SD->InterferenceOnS1().FirstParameter());
528 gp_Pnt2d p1l = SD->InterferenceOnS1().PCurveOnSurf()->
529 Value(SD->InterferenceOnS1().LastParameter());
530 gp_Pnt2d p2f = SD->InterferenceOnS2().PCurveOnSurf()->
531 Value(SD->InterferenceOnS2().FirstParameter());
532 gp_Pnt2d p2l = SD->InterferenceOnS2().PCurveOnSurf()->
533 Value(SD->InterferenceOnS2().LastParameter());
534 GeomAdaptor_Surface AS(S);
535 Handle(ChFiDS_SecHArray1) sec;
536 Standard_Real u1,v1,u2,v2;
537 GeomAbs_SurfaceType typ = AS.GetType();
538 switch (typ){
539 case GeomAbs_Cylinder:
540 {
541 u1 = p1f.X();
542 u2 = p2f.X();
543 v1 = Max(p1f.Y(),p2f.Y());
544 v2 = Min(p1l.Y(),p2l.Y());
545 sec = new ChFiDS_SecHArray1(1,2);
546 gp_Cylinder Cy = AS.Cylinder();
547 ChFiDS_CircSection& sec1 = sec->ChangeValue(1);
548 ChFiDS_CircSection& sec2 = sec->ChangeValue(2);
549 sec1.Set(ElSLib::CylinderVIso(Cy.Position(), Cy.Radius(), v1), u1, u2);
550 sec2.Set(ElSLib::CylinderVIso(Cy.Position(), Cy.Radius(), v2), u1, u2);
551 }
552 break;
553 case GeomAbs_Torus:
554 {
555 v1 = p1f.Y();
556 v2 = p2f.Y();
557 u1 = Max(p1f.X(),p2f.X());
558 u2 = Min(p1l.X(),p2l.X());
559 Standard_Real ang = (u2-u1);
560 gp_Torus To = AS.Torus();
561 Standard_Real majr = To.MajorRadius(), minr = To.MinorRadius();
c6541a0c 562 Standard_Integer n = (Standard_Integer) (36.*ang/M_PI + 1);
7fd59977 563 if(n<2) n = 2;
564 sec = new ChFiDS_SecHArray1(1, n);
565 for (Standard_Integer i = 1; i <= n; i++) {
566 ChFiDS_CircSection& isec = sec->ChangeValue(i);
567 Standard_Real u = u1 + (i - 1)*(u2 - u1)/(n-1);
568 isec.Set(ElSLib::TorusUIso(To.Position(), majr, minr, u), v1, v2);
569 }
570 }
571 break;
572 case GeomAbs_Sphere:
573 {
574 v1 = p1f.Y();
575 v2 = p2f.Y();
576 u1 = Max(p1f.X(),p2f.X());
577 u2 = Min(p1l.X(),p2l.X());
578 Standard_Real ang = (u2-u1);
579 gp_Sphere Sp = AS.Sphere();
580 Standard_Real rad = Sp.Radius();
c6541a0c 581 Standard_Integer n = (Standard_Integer) (36.*ang/M_PI + 1);
7fd59977 582 if(n<2) n = 2;
583 sec = new ChFiDS_SecHArray1(1, n);
584 for (Standard_Integer i = 1; i <= n; i++) {
585 ChFiDS_CircSection& isec = sec->ChangeValue(i);
586 Standard_Real u = u1 + (i - 1)*(u2 - u1)/(n-1);
587 isec.Set(ElSLib::SphereUIso(Sp.Position(), rad, u), v1, v2);
588 }
589 }
590 break;
591 default:
592 break;
593 }
594 SD->SetSimul(sec);
595}
596
597
598//=======================================================================
599//function : SimulSurf
600//purpose :
601//=======================================================================
602
603Standard_Boolean
604ChFi3d_FilBuilder::SimulSurf(Handle(ChFiDS_SurfData)& Data,
c22b52d6 605 const Handle(ChFiDS_ElSpine)& HGuide,
7fd59977 606 const Handle(ChFiDS_Spine)& Spine,
607 const Standard_Integer Choix,
c22b52d6 608 const Handle(BRepAdaptor_Surface)& S1,
7fd59977 609 const Handle(Adaptor3d_TopolTool)& I1,
c22b52d6 610 const Handle(BRepAdaptor_Surface)& S2,
7fd59977 611 const Handle(Adaptor3d_TopolTool)& I2,
612 const Standard_Real TolGuide,
613 Standard_Real& First,
614 Standard_Real& Last,
615 const Standard_Boolean Inside,
616 const Standard_Boolean Appro,
617 const Standard_Boolean Forward,
618 const Standard_Boolean RecOnS1,
619 const Standard_Boolean RecOnS2,
620 const math_Vector& Soldep,
dde68833 621 Standard_Integer& intf,
622 Standard_Integer& intl)
7fd59977 623{
624 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
9775fa61 625 if(fsp.IsNull()) throw Standard_ConstructionError("SimulSurf : this is not the spine of the fillet");
7fd59977 626 Handle(BRepBlend_Line) lin;
0797d9d3 627#ifdef OCCT_DEBUG
c22b52d6 628// TopAbs_Orientation Or = S1->Face().Orientation();
7fd59977 629#endif
81bba717 630 // Flexible parameters!!!
7fd59977 631 Standard_Real locfleche, MaxStep;
632 SimulParams(HGuide,fsp,MaxStep,locfleche);
633 Handle(ChFiDS_SecHArray1) sec;
634 gp_Pnt2d pf1,pl1,pf2,pl2;
635
c22b52d6 636 Handle(ChFiDS_ElSpine) EmptyHGuide;
1d54b807 637
7fd59977 638 Standard_Real PFirst = First;
639 if(intf) First = fsp->FirstParameter(1);
640 if(intl) Last = fsp->LastParameter(fsp->NbEdges());
641 if (fsp->IsConstant()) {
642 BRepBlend_ConstRad Func(S1,S2,HGuide);
643 BRepBlend_ConstRadInv FInv(S1,S2,HGuide);
644 Func.Set(fsp->Radius(),Choix);
645 FInv.Set(fsp->Radius(),Choix);
646 Func.Set(myShape);
1d54b807 647 done = SimulData(Data,HGuide,EmptyHGuide,lin,S1,I1 ,
7fd59977 648 S2,I2,Func,FInv,PFirst,MaxStep,locfleche,
649 TolGuide,First,Last,Inside,Appro,Forward,
650 Soldep,4,RecOnS1,RecOnS2);
651 if(!done) return Standard_False;
652 Standard_Integer nbp = lin->NbPoints();
653 sec = new ChFiDS_SecHArray1(1,nbp);
654 for(Standard_Integer i = 1; i <= nbp; i++){
655 ChFiDS_CircSection& isec = sec->ChangeValue(i);
656 Standard_Real u1,v1,u2,v2,w,p1,p2;
657 gp_Circ ci;
658 const Blend_Point& p = lin->Point(i);
659 p.ParametersOnS1(u1,v1);
660 p.ParametersOnS2(u2,v2);
661 w = p.Parameter();
662 Func.Section(w,u1,v1,u2,v2,p1,p2,ci);
663 isec.Set(ci,p1,p2);
664 if(i == 1) {pf1.SetCoord(u1,v1); pf2.SetCoord(u2,v2);}
665 if(i == nbp) {pl1.SetCoord(u1,v1); pl2.SetCoord(u2,v2);}
666 }
667 }
668 else{
669 BRepBlend_EvolRad Func(S1,S2,HGuide,fsp->Law(HGuide));
670 BRepBlend_EvolRadInv FInv(S1,S2,HGuide,fsp->Law(HGuide));
671 Func.Set(Choix);
672 FInv.Set(Choix);
673 Func.Set(myShape);
1d54b807 674 done = SimulData(Data,HGuide,EmptyHGuide,lin,S1,I1 ,
7fd59977 675 S2,I2,Func,FInv,PFirst,MaxStep,locfleche,
676 TolGuide,First,Last,Inside,Appro,Forward,
677 Soldep,4,RecOnS1,RecOnS2);
678 if(!done) return Standard_False;
679 Standard_Integer nbp = lin->NbPoints();
680 sec = new ChFiDS_SecHArray1(1,nbp);
681 for(Standard_Integer i = 1; i <= nbp; i++){
682 ChFiDS_CircSection& isec = sec->ChangeValue(i);
683 Standard_Real u1,v1,u2,v2,w,p1,p2;
684 gp_Circ ci;
685 const Blend_Point& p = lin->Point(i);
686 p.ParametersOnS1(u1,v1);
687 p.ParametersOnS2(u2,v2);
688 w = p.Parameter();
689 Func.Section(w,u1,v1,u2,v2,p1,p2,ci);
690 isec.Set(ci,p1,p2);
691 if(i == 1) {pf1.SetCoord(u1,v1); pf2.SetCoord(u2,v2);}
692 if(i == nbp) {pl1.SetCoord(u1,v1); pl2.SetCoord(u2,v2);}
693 }
694 }
695 Data->SetSimul(sec);
696 Data->Set2dPoints(pf1,pl1,pf2,pl2);
697 ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
698 Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
699 ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
700 Standard_False,Data->ChangeVertexLastOnS1(),tolesp);
701 ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
702 Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
703 ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
704 Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
705 Standard_Boolean reverse = (!Forward || Inside);
706 if(intf && reverse){
dde68833 707 Standard_Boolean ok = Standard_False;
7fd59977 708 const ChFiDS_CommonPoint& cp1 = Data->VertexFirstOnS1();
709 if(cp1.IsOnArc()){
c22b52d6 710 TopoDS_Face F1 = S1->Face();
7fd59977 711 TopoDS_Face bid;
dde68833 712 intf = !SearchFace(Spine,cp1,F1,bid);
713 ok = intf != 0;
7fd59977 714 }
715 const ChFiDS_CommonPoint& cp2 = Data->VertexFirstOnS2();
716 if(cp2.IsOnArc() && !ok){
c22b52d6 717 TopoDS_Face F2 = S2->Face();
7fd59977 718 TopoDS_Face bid;
719 intf = !SearchFace(Spine,cp2,F2,bid);
720 }
721 }
722 if(intl){
723 Standard_Boolean ok = 0;
724 const ChFiDS_CommonPoint& cp1 = Data->VertexLastOnS1();
725 if(cp1.IsOnArc()){
c22b52d6 726 TopoDS_Face F1 = S1->Face();
7fd59977 727 TopoDS_Face bid;
dde68833 728 intl = !SearchFace(Spine,cp1,F1,bid);
729 ok = intl != 0;
7fd59977 730 }
731 const ChFiDS_CommonPoint& cp2 = Data->VertexLastOnS2();
732 if(cp2.IsOnArc() && !ok){
c22b52d6 733 TopoDS_Face F2 = S2->Face();
7fd59977 734 TopoDS_Face bid;
735 intl = !SearchFace(Spine,cp2,F2,bid);
736 }
737 }
738 return Standard_True;
739}
740
741//=======================================================================
742//function : SimulSurf
743//purpose :
744//=======================================================================
745
746void ChFi3d_FilBuilder::SimulSurf(Handle(ChFiDS_SurfData)& Data,
c22b52d6 747 const Handle(ChFiDS_ElSpine)& HGuide,
7fd59977 748 const Handle(ChFiDS_Spine)& Spine,
749 const Standard_Integer Choix,
c22b52d6 750 const Handle(BRepAdaptor_Surface)& HS1,
7fd59977 751 const Handle(Adaptor3d_TopolTool)& I1,
c22b52d6 752 const Handle(BRepAdaptor_Curve2d)& PC1,
753 const Handle(BRepAdaptor_Surface)& HSref1,
754 const Handle(BRepAdaptor_Curve2d)& PCref1,
7fd59977 755 Standard_Boolean& Decroch1,
c22b52d6 756 const Handle(BRepAdaptor_Surface)& HS2,
7fd59977 757 const Handle(Adaptor3d_TopolTool)& I2,
758 const TopAbs_Orientation Or2,
759 const Standard_Real /*Fleche*/,
760 const Standard_Real TolGuide,
761 Standard_Real& First,
762 Standard_Real& Last,
763 const Standard_Boolean Inside,
764 const Standard_Boolean Appro,
765 const Standard_Boolean Forward,
766 const Standard_Boolean RecP,
767 const Standard_Boolean RecS,
768 const Standard_Boolean RecRst,
769 const math_Vector& Soldep)
770{
771 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
9775fa61 772 if(fsp.IsNull()) throw Standard_ConstructionError("PerformSurf : this is not the spine of the fillet");
7fd59977 773 Handle(BRepBlend_Line) lin;
774
81bba717 775 // Flexible parameters!
7fd59977 776 Standard_Real locfleche, MaxStep;
777 SimulParams(HGuide,fsp,MaxStep,locfleche);
778 Handle(ChFiDS_SecHArray1) sec;
779 gp_Pnt2d pf,pl,ppcf,ppcl;
780
781 Standard_Real PFirst = First;
782 if(fsp->IsConstant()){
783 BRepBlend_SurfRstConstRad func(HS2,HS1,PC1,HGuide);
784 func.Set(HSref1,PCref1);
c22b52d6 785 Handle(Adaptor3d_CurveOnSurface) HC = new Adaptor3d_CurveOnSurface();
786 HC->Load(PC1, HS1);
7fd59977 787 BRepBlend_SurfCurvConstRadInv finvc(HS2,HC,HGuide);
788 BRepBlend_SurfPointConstRadInv finvp(HS2,HGuide);
789 BRepBlend_ConstRadInv finv(HS2,HSref1,HGuide);
790 finv.Set(Standard_False,PCref1);
791
792 Standard_Real rad = fsp->Radius();
793 Standard_Integer petitchoix = 1;
794 if(Or2 == TopAbs_REVERSED) petitchoix = 3;
795 if(Choix%2 == 0) petitchoix++;
796 finv.Set(rad,Choix);
797 finvc.Set(rad,petitchoix);
798 finvp.Set(rad,petitchoix);
799 func.Set(rad,petitchoix);
800 func.Set(myShape);
801
802 done = SimulData(Data,HGuide,lin,HS2,I2,HS1,PC1,I1,Decroch1,
803 func,finv,finvp,finvc,
804 PFirst,MaxStep,locfleche,TolGuide,First,Last,
805 Soldep,4,Inside,Appro,Forward,RecP,RecS,RecRst);
806 if(!done) {
9775fa61 807 throw Standard_Failure("SimulSurf : Failed process!");
7fd59977 808 }
809 Standard_Integer nbp = lin->NbPoints();
810 sec = new ChFiDS_SecHArray1(1,nbp);
811 for(Standard_Integer i = 1; i <= nbp; i++){
812 ChFiDS_CircSection& isec = sec->ChangeValue(i);
813 Standard_Real u,v,w,param,p1,p2;
814 gp_Circ ci;
815 const Blend_Point& p = lin->Point(i);
816 p.ParametersOnS(u,v);
817 w = p.ParameterOnC();
818 param = p.Parameter();
819 func.Section(param,u,v,w,p1,p2,ci);
820 isec.Set(ci,p1,p2);
821 if(i == 1) {pf.SetCoord(u,v);p.ParametersOnS2(u,v);ppcf.SetCoord(u,v);}
822 if(i == nbp) {pl.SetCoord(u,v);p.ParametersOnS2(u,v);ppcl.SetCoord(u,v);}
823 }
824 }
825 else {
826 BRepBlend_SurfRstEvolRad func(HS2,HS1,PC1,HGuide,fsp->Law(HGuide));
c22b52d6 827 Handle(Adaptor3d_CurveOnSurface) HC = new Adaptor3d_CurveOnSurface();
828 HC->Load(PC1, HS1);
7fd59977 829 BRepBlend_SurfCurvEvolRadInv finvc(HS2,HC,HGuide,fsp->Law(HGuide));
830 BRepBlend_SurfPointEvolRadInv finvp(HS2,HGuide,fsp->Law(HGuide));
831 BRepBlend_EvolRadInv finv(HS2,HSref1,HGuide,fsp->Law(HGuide));
832 finv.Set(Standard_False,PCref1);
833 Standard_Integer petitchoix = 1;
834 if(Or2 == TopAbs_REVERSED) petitchoix = 3;
835 if(Choix%2 == 0) petitchoix++;
836 finv.Set(Choix);
837 finvc.Set(petitchoix);
838 finvp.Set(petitchoix);
839 func.Set(petitchoix);
840 func.Set(myShape);
841 done = SimulData(Data,HGuide,lin,HS2,I2,HS1,PC1,I1,Decroch1,
842 func,finv,finvp,finvc,
843 PFirst,MaxStep,locfleche,TolGuide,First,Last,
844 Soldep,4,Inside,Appro,Forward,RecP,RecS,RecRst);
9775fa61 845 if(!done) throw Standard_Failure("SimulSurf : Fail !");
7fd59977 846 Standard_Integer nbp = lin->NbPoints();
847 sec = new ChFiDS_SecHArray1(1,nbp);
848 for(Standard_Integer i = 1; i <= nbp; i++){
849 ChFiDS_CircSection& isec = sec->ChangeValue(i);
850 Standard_Real u,v,w,param,p1,p2;
851 gp_Circ ci;
852 const Blend_Point& p = lin->Point(i);
853 p.ParametersOnS(u,v);
854 w = p.ParameterOnC();
855 param = p.Parameter();
856 func.Section(param,u,v,w,p1,p2,ci);
857 isec.Set(ci,p1,p2);
858 if(i == 1) {pf.SetCoord(u,v);p.ParametersOnS2(u,v);ppcf.SetCoord(u,v);}
859 if(i == nbp) {pl.SetCoord(u,v);p.ParametersOnS2(u,v);ppcl.SetCoord(u,v);}
860 }
861 }
862 Data->SetSimul(sec);
863// gp_Pnt2d pbid;
864 Data->Set2dPoints(ppcf,ppcl,pf,pl);
865 ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
866 Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
867 ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
868 Standard_False,Data->ChangeVertexLastOnS2(),tolesp);
869 ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
870 Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
871 ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
872 Standard_False, Data->ChangeVertexLastOnS1(),tolesp);
873}
874
875//=======================================================================
876//function : SimulSurf
877//purpose :
878//=======================================================================
879
880void ChFi3d_FilBuilder::SimulSurf(Handle(ChFiDS_SurfData)& Data,
c22b52d6 881 const Handle(ChFiDS_ElSpine)& HGuide,
7fd59977 882 const Handle(ChFiDS_Spine)& Spine,
883 const Standard_Integer Choix,
c22b52d6 884 const Handle(BRepAdaptor_Surface)& HS1,
7fd59977 885 const Handle(Adaptor3d_TopolTool)& I1,
886 const TopAbs_Orientation Or1,
c22b52d6 887 const Handle(BRepAdaptor_Surface)& HS2,
7fd59977 888 const Handle(Adaptor3d_TopolTool)& I2,
c22b52d6 889 const Handle(BRepAdaptor_Curve2d)& PC2,
890 const Handle(BRepAdaptor_Surface)& HSref2,
891 const Handle(BRepAdaptor_Curve2d)& PCref2,
7fd59977 892 Standard_Boolean& Decroch2,
81bba717 893 const Standard_Real /*Arrow*/,
7fd59977 894 const Standard_Real TolGuide,
895 Standard_Real& First,
896 Standard_Real& Last,
897 const Standard_Boolean Inside,
898 const Standard_Boolean Appro,
899 const Standard_Boolean Forward,
900 const Standard_Boolean RecP,
901 const Standard_Boolean RecS,
902 const Standard_Boolean RecRst,
903 const math_Vector& Soldep)
904{
905 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
9775fa61 906 if(fsp.IsNull()) throw Standard_ConstructionError("PerformSurf : it is not the spine of a fillet");
7fd59977 907 Handle(BRepBlend_Line) lin;
908
81bba717 909 // Flexible parameters!
7fd59977 910 Standard_Real locfleche, MaxStep;
911 SimulParams(HGuide,fsp,MaxStep,locfleche);
912 Handle(ChFiDS_SecHArray1) sec;
913 gp_Pnt2d pf,pl,ppcf,ppcl;
914
915 Standard_Real PFirst = First;
916 if(fsp->IsConstant()){
917 BRepBlend_SurfRstConstRad func(HS1,HS2,PC2,HGuide);
918 func.Set(HSref2,PCref2);
c22b52d6 919 Handle(Adaptor3d_CurveOnSurface) HC = new Adaptor3d_CurveOnSurface();
920 HC->Load(PC2, HS2);
7fd59977 921 BRepBlend_SurfCurvConstRadInv finvc(HS1,HC,HGuide);
922 BRepBlend_SurfPointConstRadInv finvp(HS1,HGuide);
923 BRepBlend_ConstRadInv finv(HS1,HSref2,HGuide);
924 finv.Set(Standard_False,PCref2);
925
926 Standard_Real rad = fsp->Radius();
927 Standard_Integer petitchoix = 1;
928 if(Or1 == TopAbs_REVERSED) petitchoix = 3;
929 if(Choix%2 == 0) petitchoix++;
930 finv.Set(rad,Choix);
931 finvc.Set(rad,petitchoix);
932 finvp.Set(rad,petitchoix);
933 func.Set(rad,petitchoix);
934 func.Set(myShape);
935
936 done = SimulData(Data,HGuide,lin,HS1,I1,HS2,PC2,I2,Decroch2,
937 func,finv,finvp,finvc,
938 PFirst,MaxStep,locfleche,TolGuide,First,Last,
939 Soldep,4,Inside,Appro,Forward,RecP,RecS,RecRst);
9775fa61 940 if(!done) throw Standard_Failure("SimulSurf : Failed Processing!");
7fd59977 941 Standard_Integer nbp = lin->NbPoints();
942 sec = new ChFiDS_SecHArray1(1,nbp);
943 for(Standard_Integer i = 1; i <= nbp; i++){
944 ChFiDS_CircSection& isec = sec->ChangeValue(i);
945 Standard_Real u,v,w,param,p1,p2;
946 gp_Circ ci;
947 const Blend_Point& p = lin->Point(i);
948 p.ParametersOnS(u,v);
949 w = p.ParameterOnC();
950 param = p.Parameter();
951 func.Section(param,u,v,w,p1,p2,ci);
952 isec.Set(ci,p1,p2);
953 if(i == 1) {pf.SetCoord(u,v);p.ParametersOnS2(u,v);ppcf.SetCoord(u,v);}
954 if(i == nbp) {pl.SetCoord(u,v);p.ParametersOnS2(u,v);ppcl.SetCoord(u,v);}
955 }
956 }
957 else {
958 BRepBlend_SurfRstEvolRad func(HS1,HS2,PC2,HGuide,fsp->Law(HGuide));
c22b52d6 959 Handle(Adaptor3d_CurveOnSurface) HC = new Adaptor3d_CurveOnSurface();
960 HC->Load(PC2, HS2);
7fd59977 961 BRepBlend_SurfCurvEvolRadInv finvc(HS1,HC,HGuide,fsp->Law(HGuide));
962 BRepBlend_SurfPointEvolRadInv finvp(HS1,HGuide,fsp->Law(HGuide));
963 BRepBlend_EvolRadInv finv(HS1,HSref2,HGuide,fsp->Law(HGuide));
964 finv.Set(Standard_False,PCref2);
965 Standard_Integer petitchoix = 1;
966 if(Or1 == TopAbs_REVERSED) petitchoix = 3;
967 if(Choix%2 == 0) petitchoix++;
968 finv.Set(Choix);
969 finvc.Set(petitchoix);
970 finvp.Set(petitchoix);
971 func.Set(petitchoix);
972 func.Set(myShape);
973 done = SimulData(Data,HGuide,lin,HS1,I1,HS2,PC2,I2,Decroch2,
974 func,finv,finvp,finvc,
975 PFirst,MaxStep,locfleche,TolGuide,First,Last,
976 Soldep,4,Inside,Appro,Forward,RecP,RecS,RecRst);
9775fa61 977 if(!done) throw Standard_Failure("SimulSurf : Fail !");
7fd59977 978 Standard_Integer nbp = lin->NbPoints();
979 sec = new ChFiDS_SecHArray1(1,nbp);
980 for(Standard_Integer i = 1; i <= nbp; i++){
981 ChFiDS_CircSection& isec = sec->ChangeValue(i);
982 Standard_Real u,v,w,param,p1,p2;
983 gp_Circ ci;
984 const Blend_Point& p = lin->Point(i);
985 p.ParametersOnS(u,v);
986 w = p.ParameterOnC();
987 param = p.Parameter();
988 func.Section(param,u,v,w,p1,p2,ci);
989 isec.Set(ci,p1,p2);
990 if(i == 1) {pf.SetCoord(u,v);p.ParametersOnS2(u,v);ppcf.SetCoord(u,v);}
991 if(i == nbp) {pl.SetCoord(u,v);p.ParametersOnS2(u,v);ppcl.SetCoord(u,v);}
992 }
993 }
994 Data->SetSimul(sec);
995 //gp_Pnt2d pbid;
996 Data->Set2dPoints(pf,pl,ppcf,ppcl);
997 ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
998 Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
999 ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
1000 Standard_False,Data->ChangeVertexLastOnS1(),tolesp);
1001 ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
1002 Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
1003 ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
1004 Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
1005}
1006
1007
1008
1009//=======================================================================
1010//function : SimulSurf
1011//purpose :
1012//=======================================================================
1013
1014void ChFi3d_FilBuilder::SimulSurf(Handle(ChFiDS_SurfData)& Data,
c22b52d6 1015 const Handle(ChFiDS_ElSpine)& HGuide,
7fd59977 1016 const Handle(ChFiDS_Spine)& Spine,
1017 const Standard_Integer Choix,
c22b52d6 1018 const Handle(BRepAdaptor_Surface)& HS1,
7fd59977 1019 const Handle(Adaptor3d_TopolTool)& I1,
c22b52d6 1020 const Handle(BRepAdaptor_Curve2d)& PC1,
1021 const Handle(BRepAdaptor_Surface)& HSref1,
1022 const Handle(BRepAdaptor_Curve2d)& PCref1,
7fd59977 1023 Standard_Boolean& Decroch1,
1024 const TopAbs_Orientation Or1,
c22b52d6 1025 const Handle(BRepAdaptor_Surface)& HS2,
7fd59977 1026 const Handle(Adaptor3d_TopolTool)& I2,
c22b52d6 1027 const Handle(BRepAdaptor_Curve2d)& PC2,
1028 const Handle(BRepAdaptor_Surface)& HSref2,
1029 const Handle(BRepAdaptor_Curve2d)& PCref2,
7fd59977 1030 Standard_Boolean& Decroch2,
1031 const TopAbs_Orientation Or2,
1032 const Standard_Real /*Fleche*/,
1033 const Standard_Real TolGuide,
1034 Standard_Real& First,
1035 Standard_Real& Last,
1036 const Standard_Boolean Inside,
1037 const Standard_Boolean Appro,
1038 const Standard_Boolean Forward,
1039 const Standard_Boolean RecP1,
1040 const Standard_Boolean RecRst1,
1041 const Standard_Boolean RecP2,
1042 const Standard_Boolean RecRst2,
1043 const math_Vector& Soldep)
1044{
1045 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
9775fa61 1046 if(fsp.IsNull()) throw Standard_ConstructionError("PerformSurf : it is not the spine of a fillet");
7fd59977 1047 Handle(BRepBlend_Line) lin;
1048
81bba717 1049 // Flexible parameters!
7fd59977 1050 Standard_Real locfleche, MaxStep;
1051 SimulParams(HGuide,fsp,MaxStep,locfleche);
1052 Handle(ChFiDS_SecHArray1) sec;
1053// gp_Pnt2d pf,pl;
1054
1055 Standard_Integer ch1 = 1, ch2 = 2;
1056 Standard_Real PFirst = First;
1057
1058 if(fsp->IsConstant()){
1059 BRepBlend_RstRstConstRad func(HS1, PC1, HS2, PC2, HGuide);
1060 func.Set(HSref1, PCref1, HSref2, PCref2);
c22b52d6 1061 Handle(Adaptor3d_CurveOnSurface) HC1 = new Adaptor3d_CurveOnSurface();
1062 HC1->Load(PC1, HS1);
1063 Handle(Adaptor3d_CurveOnSurface) HC2 = new Adaptor3d_CurveOnSurface();
1064 HC2->Load(PC2, HS2);
7fd59977 1065 BRepBlend_SurfCurvConstRadInv finv1(HSref1, HC2, HGuide);
1066 BRepBlend_CurvPointRadInv finvp1(HGuide, HC2);
1067 BRepBlend_SurfCurvConstRadInv finv2(HSref2, HC1, HGuide);
1068 BRepBlend_CurvPointRadInv finvp2(HGuide, HC1);
1069
1070 finv1.Set(PCref1);
1071 finv2.Set(PCref2);
1072
1073
1074 Standard_Real rad = fsp->Radius();
1075 if(Or1 == TopAbs_REVERSED) ch1 = 3;
1076 if(Or2 == TopAbs_REVERSED) ch2 = 3;
1077
1078 finv1.Set(rad, ch1);
1079 finvp1.Set(Choix);
1080 finv2.Set(rad, ch2);
1081 finvp2.Set(Choix);
1082 func.Set(rad, Choix);
1083 func.Set(myShape);
1084
1085 done = SimulData(Data, HGuide, lin, HS1, PC1, I1, Decroch1, HS2, PC2, I2, Decroch2,
1086 func, finv1, finvp1, finv2, finvp2,
1087 PFirst, MaxStep, locfleche, TolGuide, First, Last,
1088 Soldep, 4, Inside, Appro, Forward, RecP1, RecRst1, RecP2, RecRst2);
9775fa61 1089 if(!done) throw Standard_Failure("SimulSurf : Failed processing!");
7fd59977 1090 Standard_Integer nbp = lin->NbPoints();
1091 sec = new ChFiDS_SecHArray1(1,nbp);
1092 for(Standard_Integer i = 1; i <= nbp; i++){
1093 ChFiDS_CircSection& isec = sec->ChangeValue(i);
1094 Standard_Real u, v, param, p1, p2;
1095 gp_Circ ci;
1096 const Blend_Point& p = lin->Point(i);
1097 u = p.ParameterOnC1();
1098 v = p.ParameterOnC2();
1099 param = p.Parameter();
1100 func.Section(param, u, v, p1, p2, ci);
1101 isec.Set(ci, p1, p2);
1102// if(i == 1) {pf.SetCoord(u,v);}
1103// if(i == nbp) {pl.SetCoord(u,v);}
1104 }
1105 }
1106 else {
1107 BRepBlend_RstRstEvolRad func(HS1,PC1, HS2, PC2, HGuide, fsp->Law(HGuide));
1108 func.Set(HSref1, PCref1, HSref2, PCref2);
c22b52d6 1109 Handle(Adaptor3d_CurveOnSurface) HC1 = new Adaptor3d_CurveOnSurface();
1110 HC1->Load(PC1, HS1);
1111 Handle(Adaptor3d_CurveOnSurface) HC2 = new Adaptor3d_CurveOnSurface();
1112 HC2->Load(PC2, HS2);
7fd59977 1113
1114 BRepBlend_SurfCurvEvolRadInv finv1(HSref1, HC2, HGuide, fsp->Law(HGuide));
1115 BRepBlend_CurvPointRadInv finvp1(HGuide, HC2);
1116 BRepBlend_SurfCurvEvolRadInv finv2(HSref2, HC1, HGuide, fsp->Law(HGuide));
1117 BRepBlend_CurvPointRadInv finvp2(HGuide, HC1);
1118
1119 finv1.Set(PCref1);
1120 finv2.Set(PCref2);
1121
1122 Standard_Integer ch11 = 1, ch22 = 2;
1123
1124 if(Or1 == TopAbs_REVERSED) ch11 = 3;
1125 if(Or2 == TopAbs_REVERSED) ch22 = 3;
1126
1127
1128 finv1.Set(ch11);
1129 finvp1.Set(Choix);
1130 finv2.Set(ch22);
1131 finvp2.Set(Choix);
1132 func.Set(Choix);
1133 func.Set(myShape);
1134
1135 done = SimulData(Data, HGuide, lin, HS1, PC1, I1, Decroch1, HS2, PC2, I2, Decroch2,
1136 func, finv1, finvp1, finv2, finvp2,
1137 PFirst, MaxStep, locfleche, TolGuide, First, Last,
1138 Soldep, 4, Inside, Appro, Forward, RecP1, RecRst1, RecP2, RecRst2);
1139
9775fa61 1140 if(!done) throw Standard_Failure("SimulSurf : Fail !");
7fd59977 1141 Standard_Integer nbp = lin->NbPoints();
1142 sec = new ChFiDS_SecHArray1(1, nbp);
1143 for(Standard_Integer i = 1; i <= nbp; i++){
1144 ChFiDS_CircSection& isec = sec->ChangeValue(i);
1145 Standard_Real u, v, param, p1, p2;
1146 gp_Circ ci;
1147 const Blend_Point& p = lin->Point(i);
1148 u = p.ParameterOnC1();
1149 v = p.ParameterOnC2();
1150 param = p.Parameter();
1151 func.Section(param, u, v, p1, p2, ci);
1152 isec.Set(ci, p1, p2);
1153// if(i == 1) {pf.SetCoord(u,v);}
1154// if(i == nbp) {pl.SetCoord(u,v);}
1155 }
1156 }
1157 Data->SetSimul(sec);
1158// gp_Pnt2d pbid;
1159// Data->Set2dPoints(pf,pl,pbid,pbid);
1160
1161 ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
1162 Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
1163 ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
1164 Standard_False,Data->ChangeVertexLastOnS1(),tolesp);
1165 ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
1166 Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
1167 ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
1168 Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
1169}
1170
1171
1172
1173
1174
1175
1176
1177//=======================================================================
1178//function : PerformFirstSection
1179//purpose :
1180//=======================================================================
1181
1182Standard_Boolean ChFi3d_FilBuilder::PerformFirstSection
1183(const Handle(ChFiDS_Spine)& Spine,
c22b52d6 1184 const Handle(ChFiDS_ElSpine)& HGuide,
7fd59977 1185 const Standard_Integer Choix,
c22b52d6 1186 Handle(BRepAdaptor_Surface)& S1,
1187 Handle(BRepAdaptor_Surface)& S2,
7fd59977 1188 const Handle(Adaptor3d_TopolTool)& I1,
1189 const Handle(Adaptor3d_TopolTool)& I2,
1190 const Standard_Real Par,
1191 math_Vector& SolDep,
1192 TopAbs_State& Pos1,
1193 TopAbs_State& Pos2) const
1194{
1195 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
9775fa61 1196 if(fsp.IsNull()) throw Standard_ConstructionError("PerformSurf : this is not the spine of a fillet");
7fd59977 1197 Standard_Real TolGuide = HGuide->Resolution(tolesp);
1198 if(fsp->IsConstant()){
1199 BRepBlend_ConstRad Func(S1,S2,HGuide);
1200 Func.Set(fsp->Radius(),Choix);
1201 Func.Set(myShape);
af99433e 1202 BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
7fd59977 1203 return TheWalk.PerformFirstSection(Func,Par,SolDep,
1204 tolesp,TolGuide,Pos1,Pos2);
1205 }
1206 else {
1207 BRepBlend_EvolRad Func(S1,S2,HGuide,fsp->Law(HGuide));
1208 Func.Set(Choix);
1209 Func.Set(myShape);
af99433e 1210 BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
7fd59977 1211 return TheWalk.PerformFirstSection(Func,Par,SolDep,
1212 tolesp,TolGuide,Pos1,Pos2);
1213 }
1214}
1215
1216//=======================================================================
1217//function : PerformSurf
1218//purpose :
1219//=======================================================================
1220
1221Standard_Boolean
1222ChFi3d_FilBuilder::PerformSurf(ChFiDS_SequenceOfSurfData& SeqData,
c22b52d6 1223 const Handle(ChFiDS_ElSpine)& HGuide,
7fd59977 1224 const Handle(ChFiDS_Spine)& Spine,
1225 const Standard_Integer Choix,
c22b52d6 1226 const Handle(BRepAdaptor_Surface)& S1,
7fd59977 1227 const Handle(Adaptor3d_TopolTool)& I1,
c22b52d6 1228 const Handle(BRepAdaptor_Surface)& S2,
7fd59977 1229 const Handle(Adaptor3d_TopolTool)& I2,
1230 const Standard_Real MaxStep,
1231 const Standard_Real Fleche,
1232 const Standard_Real TolGuide,
1233 Standard_Real& First,
1234 Standard_Real& Last,
1235 const Standard_Boolean Inside,
1236 const Standard_Boolean Appro,
1237 const Standard_Boolean Forward,
1238 const Standard_Boolean RecOnS1,
1239 const Standard_Boolean RecOnS2,
1240 const math_Vector& Soldep,
dde68833 1241 Standard_Integer& intf,
1242 Standard_Integer& intl)
7fd59977 1243{
0797d9d3 1244#ifdef OCCT_DEBUG
7fd59977 1245 OSD_Chronometer ch;
1246#endif
1247 Handle(ChFiDS_SurfData) Data = SeqData(1);
1248 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
9775fa61 1249 if(fsp.IsNull()) throw Standard_ConstructionError("PerformSurf : this is not the spine of a fillet");
7fd59977 1250 Standard_Boolean gd1,gd2,gf1,gf2, maybesingular;
1251 Handle(BRepBlend_Line) lin;
c22b52d6 1252 TopAbs_Orientation Or = S1->Face().Orientation();
7fd59977 1253 Standard_Real PFirst = First;
1254 if(intf) First = fsp->FirstParameter(1);
1255 if(intl) Last = fsp->LastParameter(fsp->NbEdges());
1256 if(fsp->IsConstant()){
1257 BRepBlend_ConstRad Func(S1,S2,HGuide);
1258 BRepBlend_ConstRadInv FInv(S1,S2,HGuide);
1259 Func.Set(fsp->Radius(),Choix);
1260 FInv.Set(fsp->Radius(),Choix);
1261 Func.Set(myShape);
1262
0797d9d3 1263#ifdef OCCT_DEBUG
7fd59977 1264 ChFi3d_InitChron(ch); //init perf ComputeData
1265#endif
1266
1267 done = ComputeData(Data,HGuide,Spine,lin,S1,I1,S2,I2,Func,FInv,
1268 PFirst,MaxStep,Fleche,TolGuide,First,Last,
1269 Inside,Appro,Forward,Soldep,intf,intl,
1270 gd1,gd2,gf1,gf2,RecOnS1,RecOnS2);
1271
0797d9d3 1272#ifdef OCCT_DEBUG
7fd59977 1273 ChFi3d_ResultChron(ch , t_computedata);// result perf ComputeData
1274#endif
1275
81bba717 1276 if(!done) return Standard_False; // recovery is possible PMN 14/05/1998
7fd59977 1277
0797d9d3 1278#ifdef OCCT_DEBUG
7fd59977 1279 ChFi3d_InitChron(ch);// init perf CompleteData
1280#endif
1281
1282 done = CompleteData(Data,Func,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
1283
0797d9d3 1284#ifdef OCCT_DEBUG
7fd59977 1285 ChFi3d_ResultChron(ch , t_completedata);// result perf CompleteData
1286#endif
1287
9775fa61 1288 if(!done) throw Standard_Failure("PerformSurf : Failed approximation!");
7fd59977 1289 maybesingular = (Func.GetMinimalDistance()<=100*tolapp3d);
1290 }
1291 else {
1292 BRepBlend_EvolRad Func(S1, S2, HGuide, fsp->Law(HGuide));
1293 BRepBlend_EvolRadInv FInv(S1, S2, HGuide, fsp->Law(HGuide));
1294 Func.Set(Choix);
1295 FInv.Set(Choix);
1296 Func.Set(myShape);
1297
0797d9d3 1298#ifdef OCCT_DEBUG
7fd59977 1299 ChFi3d_InitChron(ch);// init perf ComputeData
1300#endif
1301
1302 done = ComputeData(Data,HGuide,Spine,lin,S1,I1,S2,I2,Func,FInv,
1303 PFirst,MaxStep,Fleche,TolGuide,First,Last,
1304 Inside,Appro,Forward,Soldep,intf,intl,
1305 gd1,gd2,gf1,gf2,RecOnS1,RecOnS2);
0797d9d3 1306#ifdef OCCT_DEBUG
7fd59977 1307 ChFi3d_ResultChron(ch , t_computedata); //result perf ComputeData
1308#endif
1309
1310 if(!done) return Standard_False;
1311
0797d9d3 1312#ifdef OCCT_DEBUG
7fd59977 1313 ChFi3d_InitChron(ch);// init perf CompleteData
1314#endif
1315
1316 done = CompleteData(Data,Func,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
1317
0797d9d3 1318#ifdef OCCT_DEBUG
7fd59977 1319 ChFi3d_ResultChron(ch , t_completedata);// result perf CompleteData
1320#endif
1321
9775fa61 1322 if(!done) throw Standard_Failure("PerformSurf : Failed approximation!");
7fd59977 1323 maybesingular = (Func.GetMinimalDistance()<=100*tolapp3d);
1324 }
1325 if (maybesingular) SplitSurf(SeqData, lin);
1326 return Standard_True;
1327}
1328
1329//=======================================================================
1330//function : PerformSurf
1331//purpose :
1332//=======================================================================
1333
1334void ChFi3d_FilBuilder::PerformSurf(ChFiDS_SequenceOfSurfData& SeqData,
c22b52d6 1335 const Handle(ChFiDS_ElSpine)& HGuide,
7fd59977 1336 const Handle(ChFiDS_Spine)& Spine,
1337 const Standard_Integer Choix,
c22b52d6 1338 const Handle(BRepAdaptor_Surface)& HS1,
7fd59977 1339 const Handle(Adaptor3d_TopolTool)& I1,
c22b52d6 1340 const Handle(BRepAdaptor_Curve2d)& PC1,
1341 const Handle(BRepAdaptor_Surface)& HSref1,
1342 const Handle(BRepAdaptor_Curve2d)& PCref1,
7fd59977 1343 Standard_Boolean& Decroch1,
c22b52d6 1344 const Handle(BRepAdaptor_Surface)& HS2,
7fd59977 1345 const Handle(Adaptor3d_TopolTool)& I2,
1346 const TopAbs_Orientation Or2,
1347 const Standard_Real MaxStep,
1348 const Standard_Real Fleche,
1349 const Standard_Real TolGuide,
1350 Standard_Real& First,
1351 Standard_Real& Last,
1352 const Standard_Boolean Inside,
1353 const Standard_Boolean Appro,
1354 const Standard_Boolean Forward,
1355 const Standard_Boolean RecP,
1356 const Standard_Boolean RecS,
1357 const Standard_Boolean RecRst,
1358 const math_Vector& Soldep)
1359{
1360 Handle(ChFiDS_SurfData) Data = SeqData(1);
1361 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
9775fa61 1362 if(fsp.IsNull()) throw Standard_ConstructionError("PerformSurf : this is not the spine of a fillet");
7fd59977 1363 Handle(BRepBlend_Line) lin;
1364 Standard_Real PFirst = First;
1365 Standard_Boolean maybesingular;
1366
1367 if(fsp->IsConstant()){
1368 BRepBlend_SurfRstConstRad func(HS2,HS1,PC1,HGuide);
1369 func.Set(HSref1,PCref1);
c22b52d6 1370 Handle(Adaptor3d_CurveOnSurface) HC = new Adaptor3d_CurveOnSurface();
1371 HC->Load(PC1, HS1);
7fd59977 1372 BRepBlend_SurfCurvConstRadInv finvc(HS2,HC,HGuide);
1373 BRepBlend_SurfPointConstRadInv finvp(HS2,HGuide);
1374 BRepBlend_ConstRadInv finv(HS2,HSref1,HGuide);
1375 finv.Set(Standard_False,PCref1);
1376
1377 Standard_Real rad = fsp->Radius();
1378 Standard_Integer petitchoix = 1;
1379 if(Or2 == TopAbs_REVERSED) petitchoix = 3;
1380 if(Choix%2 == 0) petitchoix++;
1381 finv.Set(rad,Choix);
1382 finvc.Set(rad,petitchoix);
1383 finvp.Set(rad,petitchoix);
1384 func.Set(rad,petitchoix);
1385 func.Set(myShape);
1386
1387 done = ComputeData(Data,HGuide,lin,HS2,I2,HS1,PC1,I1,Decroch1,
1388 func,finv,finvp,finvc,
1389 PFirst,MaxStep,Fleche,TolGuide,First,Last,
1390 Soldep,Inside,Appro,Forward,RecP,RecS,RecRst);
1391 if(!done) {
1392 Spine->SetErrorStatus(ChFiDS_WalkingFailure);
9775fa61 1393 throw Standard_Failure("PerformSurf : Failed processing!");
7fd59977 1394 }
c22b52d6 1395 TopAbs_Orientation Or = HS2->Face().Orientation();
7fd59977 1396 done = CompleteData(Data,func,lin,HS1,HS2,Or,1);
9775fa61 1397 if(!done) throw Standard_Failure("PerformSurf : Failed approximation!");
7fd59977 1398 maybesingular = (func.GetMinimalDistance()<=100*tolapp3d);
1399 }
1400 else {
7fd59977 1401 BRepBlend_SurfRstEvolRad func(HS2,HS1,PC1,HGuide,fsp->Law(HGuide));
1402 func.Set(HSref1,PCref1);
c22b52d6 1403 Handle(Adaptor3d_CurveOnSurface) HC = new Adaptor3d_CurveOnSurface();
1404 HC->Load(PC1, HS1);
7fd59977 1405 BRepBlend_SurfCurvEvolRadInv finvc(HS2,HC,HGuide,fsp->Law(HGuide));
1406 BRepBlend_SurfPointEvolRadInv finvp(HS2,HGuide,fsp->Law(HGuide));
1407 BRepBlend_EvolRadInv finv(HS2,HSref1,HGuide,fsp->Law(HGuide));
1408 finv.Set(Standard_False,PCref1);
1409 Standard_Integer petitchoix = 1;
1410 if(Or2 == TopAbs_REVERSED) petitchoix = 3;
1411 if(Choix%2 == 0) petitchoix++;
1412 finv.Set(Choix);
1413 finvc.Set(petitchoix);
1414 finvp.Set(petitchoix);
1415 func.Set(petitchoix);
1416 func.Set(myShape);
7fd59977 1417 done = ComputeData(Data,HGuide,lin,HS2,I2,HS1,PC1,I1,Decroch1,
1418 func,finv,finvp,finvc,
1419 PFirst,MaxStep,Fleche,TolGuide,First,Last,
1420 Soldep,Inside,Appro,Forward,RecP,RecS,RecRst);
1421 if(!done) {
1422 Spine->SetErrorStatus(ChFiDS_WalkingFailure);
9775fa61 1423 throw Standard_Failure("PerformSurf : Failed processing!");
7fd59977 1424 }
c22b52d6 1425 TopAbs_Orientation Or = HS2->Face().Orientation();
7fd59977 1426 done = CompleteData(Data,func,lin,HS1,HS2,Or,1);
9775fa61 1427 if(!done) throw Standard_Failure("PerformSurf : Failed approximation!");
7fd59977 1428 maybesingular = (func.GetMinimalDistance()<=100*tolapp3d);
1429 }
1430 if (maybesingular) SplitSurf(SeqData, lin);
1431}
1432
1433//=======================================================================
1434//function : PerformSurf
1435//purpose :
1436//=======================================================================
1437
1438void ChFi3d_FilBuilder::PerformSurf(ChFiDS_SequenceOfSurfData& SeqData,
c22b52d6 1439 const Handle(ChFiDS_ElSpine)& HGuide,
7fd59977 1440 const Handle(ChFiDS_Spine)& Spine,
1441 const Standard_Integer Choix,
c22b52d6 1442 const Handle(BRepAdaptor_Surface)& HS1,
7fd59977 1443 const Handle(Adaptor3d_TopolTool)& I1,
1444 const TopAbs_Orientation Or1,
c22b52d6 1445 const Handle(BRepAdaptor_Surface)& HS2,
7fd59977 1446 const Handle(Adaptor3d_TopolTool)& I2,
c22b52d6 1447 const Handle(BRepAdaptor_Curve2d)& PC2,
1448 const Handle(BRepAdaptor_Surface)& HSref2,
1449 const Handle(BRepAdaptor_Curve2d)& PCref2,
7fd59977 1450 Standard_Boolean& Decroch2,
1451 const Standard_Real MaxStep,
1452 const Standard_Real Fleche,
1453 const Standard_Real TolGuide,
1454 Standard_Real& First,
1455 Standard_Real& Last,
1456 const Standard_Boolean Inside,
1457 const Standard_Boolean Appro,
1458 const Standard_Boolean Forward,
1459 const Standard_Boolean RecP,
1460 const Standard_Boolean RecS,
1461 const Standard_Boolean RecRst,
1462 const math_Vector& Soldep)
1463{
8c2d3314 1464 Handle(ChFiDS_SurfData) Data = SeqData(1);
7fd59977 1465 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
9775fa61 1466 if(fsp.IsNull()) throw Standard_ConstructionError("PerformSurf : this is not the spine of a fillet");
7fd59977 1467 Handle(BRepBlend_Line) lin;
1468 Standard_Real PFirst = First;
1469 Standard_Boolean maybesingular;
1470
1471 if(fsp->IsConstant()){
1472 BRepBlend_SurfRstConstRad func(HS1,HS2,PC2,HGuide);
1473 func.Set(HSref2,PCref2);
c22b52d6 1474 Handle(Adaptor3d_CurveOnSurface) HC = new Adaptor3d_CurveOnSurface();
1475 HC->Load(PC2, HS2);
7fd59977 1476 BRepBlend_SurfCurvConstRadInv finvc(HS1,HC,HGuide);
1477 BRepBlend_SurfPointConstRadInv finvp(HS1,HGuide);
1478 BRepBlend_ConstRadInv finv(HS1,HSref2,HGuide);
1479 finv.Set(Standard_False,PCref2);
1480
1481 Standard_Real rad = fsp->Radius();
1482 Standard_Integer petitchoix = 1;
1483 if(Or1 == TopAbs_REVERSED) petitchoix = 3;
1484 if(Choix%2 == 0) petitchoix++;
1485 finv.Set(rad,Choix);
1486 finvc.Set(rad,petitchoix);
1487 finvp.Set(rad,petitchoix);
1488 func.Set(rad,petitchoix);
1489 func.Set(myShape);
1490
1491 done = ComputeData(Data,HGuide,lin,HS1,I1,HS2,PC2,I2,Decroch2,
1492 func,finv,finvp,finvc,
1493 PFirst,MaxStep,Fleche,TolGuide,First,Last,
1494 Soldep,Inside,Appro,Forward,RecP,RecS,RecRst);
1495 if(!done) {
1496 Spine->SetErrorStatus(ChFiDS_WalkingFailure);
9775fa61 1497 throw Standard_Failure("PerformSurf : Failed processing!");
7fd59977 1498 }
c22b52d6 1499 TopAbs_Orientation Or = HS1->Face().Orientation();
7fd59977 1500 done = CompleteData(Data,func,lin,HS1,HS2,Or,0);
9775fa61 1501 if(!done) throw Standard_Failure("PerformSurf : Failed approximation!");
7fd59977 1502 maybesingular = (func.GetMinimalDistance()<=100*tolapp3d);
1503 }
1504 else {
1505 BRepBlend_SurfRstEvolRad func(HS1,HS2,PC2,HGuide,fsp->Law(HGuide));
1506 func.Set(HSref2,PCref2);
c22b52d6 1507 Handle(Adaptor3d_CurveOnSurface) HC = new Adaptor3d_CurveOnSurface();
1508 HC->Load(PC2, HS2);
7fd59977 1509 BRepBlend_SurfCurvEvolRadInv finvc(HS1,HC,HGuide,fsp->Law(HGuide));
1510 BRepBlend_SurfPointEvolRadInv finvp(HS1,HGuide,fsp->Law(HGuide));
1511 BRepBlend_EvolRadInv finv(HS1,HSref2,HGuide,fsp->Law(HGuide));
1512 finv.Set(Standard_False,PCref2);
1513 Standard_Integer petitchoix = 1;
1514 if(Or1 == TopAbs_REVERSED) petitchoix = 3;
1515 if(Choix%2 == 0) petitchoix++;
1516 finv.Set(Choix);
1517 finvc.Set(petitchoix);
1518 finvp.Set(petitchoix);
1519 func.Set(petitchoix);
1520 func.Set(myShape);
1521
1522 done = ComputeData(Data,HGuide,lin,HS1,I1,HS2,PC2,I2,Decroch2,
1523 func,finv,finvp,finvc,
1524 PFirst,MaxStep,Fleche,TolGuide,First,Last,
1525 Soldep,Inside,Appro,Forward,RecP,RecS,RecRst);
1526 if(!done) {
1527 Spine->SetErrorStatus(ChFiDS_WalkingFailure);
9775fa61 1528 throw Standard_Failure("PerformSurf : Failed processing!");
7fd59977 1529 }
c22b52d6 1530 TopAbs_Orientation Or = HS1->Face().Orientation();
7fd59977 1531 done = CompleteData(Data,func,lin,HS1,HS2,Or,0);
9775fa61 1532 if(!done) throw Standard_Failure("PerformSurf : Failed approximation!");
7fd59977 1533 maybesingular = (func.GetMinimalDistance()<=100*tolapp3d);
1534 }
1535 if (maybesingular) SplitSurf(SeqData, lin);
1536}
1537
1538
1539
1540
1541
1542
1543//=======================================================================
1544//function : PerformSurf
1545//purpose :
1546//=======================================================================
1547
1548void ChFi3d_FilBuilder::PerformSurf(ChFiDS_SequenceOfSurfData& SeqData,
c22b52d6 1549 const Handle(ChFiDS_ElSpine)& HGuide,
7fd59977 1550 const Handle(ChFiDS_Spine)& Spine,
1551 const Standard_Integer Choix,
c22b52d6 1552 const Handle(BRepAdaptor_Surface)& HS1,
7fd59977 1553 const Handle(Adaptor3d_TopolTool)& I1,
c22b52d6 1554 const Handle(BRepAdaptor_Curve2d)& PC1,
1555 const Handle(BRepAdaptor_Surface)& HSref1,
1556 const Handle(BRepAdaptor_Curve2d)& PCref1,
7fd59977 1557 Standard_Boolean& Decroch1,
1558 const TopAbs_Orientation Or1,
c22b52d6 1559 const Handle(BRepAdaptor_Surface)& HS2,
7fd59977 1560 const Handle(Adaptor3d_TopolTool)& I2,
c22b52d6 1561 const Handle(BRepAdaptor_Curve2d)& PC2,
1562 const Handle(BRepAdaptor_Surface)& HSref2,
1563 const Handle(BRepAdaptor_Curve2d)& PCref2,
7fd59977 1564 Standard_Boolean& Decroch2,
1565 const TopAbs_Orientation Or2,
1566 const Standard_Real MaxStep,
1567 const Standard_Real Fleche,
1568 const Standard_Real TolGuide,
1569 Standard_Real& First,
1570 Standard_Real& Last,
1571 const Standard_Boolean Inside,
1572 const Standard_Boolean Appro,
1573 const Standard_Boolean Forward,
1574 const Standard_Boolean RecP1,
1575 const Standard_Boolean RecRst1,
1576 const Standard_Boolean RecP2,
1577 const Standard_Boolean RecRst2,
1578 const math_Vector& Soldep)
1579{
8c2d3314 1580 Handle(ChFiDS_SurfData) Data = SeqData(1);
7fd59977 1581 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
9775fa61 1582 if(fsp.IsNull()) throw Standard_ConstructionError("PerformSurf : this is not the spine of a fillet");
7fd59977 1583 Handle(BRepBlend_Line) lin;
1584 Standard_Real PFirst = First;
1585 Standard_Boolean maybesingular;
1586
1587 if(fsp->IsConstant()){
1588 BRepBlend_RstRstConstRad func(HS1, PC1, HS2, PC2, HGuide);
1589 func.Set(HSref1, PCref1, HSref2, PCref2);
c22b52d6 1590 Handle(Adaptor3d_CurveOnSurface) HC1 = new Adaptor3d_CurveOnSurface();
1591 HC1->Load(PC1, HS1);
1592 Handle(Adaptor3d_CurveOnSurface) HC2 = new Adaptor3d_CurveOnSurface();
1593 HC2->Load(PC2, HS2);
7fd59977 1594 BRepBlend_SurfCurvConstRadInv finv1(HSref1, HC2, HGuide);
1595 BRepBlend_CurvPointRadInv finvp1(HGuide, HC2);
1596 BRepBlend_SurfCurvConstRadInv finv2(HSref2, HC1, HGuide);
1597 BRepBlend_CurvPointRadInv finvp2(HGuide, HC1);
1598
1599 finv1.Set(PCref1);
1600 finv2.Set(PCref2);
1601
1602 Standard_Integer ch1 = 1, ch2 = 2;
1603 Standard_Real rad = fsp->Radius();
1604 if(Or1 == TopAbs_REVERSED) ch1 = 3;
1605 if(Or2 == TopAbs_REVERSED) ch2 = 3;
1606
1607 finv1.Set(rad, ch1);
1608 finvp1.Set(Choix);
1609 finv2.Set(rad, ch2);
1610 finvp2.Set(Choix);
1611 func.Set(rad, Choix);
1612 func.Set(myShape);
1613
1614 done = ComputeData(Data, HGuide, lin, HS1, PC1, I1, Decroch1, HS2, PC2, I2, Decroch2,
1615 func, finv1, finvp1, finv2, finvp2,
1616 PFirst, MaxStep, Fleche, TolGuide, First, Last,
1617 Soldep, Inside, Appro, Forward, RecP1, RecRst1, RecP2, RecRst2);
1618 if(!done) {
1619 Spine->SetErrorStatus(ChFiDS_WalkingFailure);
9775fa61 1620 throw Standard_Failure("PerformSurf : Failed processing!");
7fd59977 1621 }
c22b52d6 1622 TopAbs_Orientation Or = HS1->Face().Orientation();
7fd59977 1623 done = CompleteData(Data, func, lin, HS1, HS2, Or);
9775fa61 1624 if(!done) throw Standard_Failure("PerformSurf : Failed approximation!");
7fd59977 1625 maybesingular = (func.GetMinimalDistance()<=100*tolapp3d);
1626 }
1627 else {
1628 BRepBlend_RstRstEvolRad func(HS1,PC1, HS2, PC2, HGuide, fsp->Law(HGuide));
1629 func.Set(HSref1, PCref1, HSref2, PCref2);
c22b52d6 1630 Handle(Adaptor3d_CurveOnSurface) HC1 = new Adaptor3d_CurveOnSurface();
1631 HC1->Load(PC1, HS1);
1632 Handle(Adaptor3d_CurveOnSurface) HC2 = new Adaptor3d_CurveOnSurface();
1633 HC2->Load(PC2, HS2);
7fd59977 1634
1635 BRepBlend_SurfCurvEvolRadInv finv1(HSref1, HC2, HGuide, fsp->Law(HGuide));
1636 BRepBlend_CurvPointRadInv finvp1(HGuide, HC2);
1637 BRepBlend_SurfCurvEvolRadInv finv2(HSref2, HC1, HGuide, fsp->Law(HGuide));
1638 BRepBlend_CurvPointRadInv finvp2(HGuide, HC1);
1639
1640 finv1.Set(PCref1);
1641 finv2.Set(PCref2);
1642
1643 Standard_Integer ch1 = 1, ch2 = 2;
1644
1645 if(Or1 == TopAbs_REVERSED) ch1 = 3;
1646 if(Or2 == TopAbs_REVERSED) ch2 = 3;
1647
1648
1649 finv1.Set(ch1);
1650 finvp1.Set(Choix);
1651 finv2.Set(ch2);
1652 finvp2.Set(Choix);
1653 func.Set(Choix);
1654 func.Set(myShape);
1655
1656 done = ComputeData(Data, HGuide, lin, HS1, PC1, I1, Decroch1, HS2, PC2,I2, Decroch2,
1657 func, finv1, finvp1, finv2, finvp2,
1658 PFirst, MaxStep, Fleche, TolGuide, First, Last,
1659 Soldep, Inside, Appro, Forward, RecP1, RecRst1, RecP2, RecRst2);
1660
1661 if(!done) {
1662 Spine->SetErrorStatus(ChFiDS_WalkingFailure);
9775fa61 1663 throw Standard_Failure("PerformSurf : Failed processing!");
7fd59977 1664 }
c22b52d6 1665 TopAbs_Orientation Or = HS1->Face().Orientation();
7fd59977 1666 done = CompleteData(Data, func, lin, HS1, HS2, Or);
9775fa61 1667 if(!done) throw Standard_Failure("PerformSurf : Failed approximation!");
7fd59977 1668 maybesingular = (func.GetMinimalDistance()<=100*tolapp3d);
1669
1670
1671 }
1672 if (maybesingular) SplitSurf(SeqData, lin);
1673}
1674
1675
1676
1677
1678//=======================================================================
1679//function : SplitSurf
1680//purpose :
1681//=======================================================================
1682
1683void ChFi3d_FilBuilder::SplitSurf(ChFiDS_SequenceOfSurfData& SeqData,
1684 const Handle(BRepBlend_Line)& Line)
1685{
1686 Standard_Integer ii, Nbpnt=Line->NbPoints();
1687 if (Nbpnt <3) return;
1688 Standard_Real UFirst,ULast,VFirst,VLast;
1689 TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS();
1690 Standard_Integer ISurf;
1691 Handle(ChFiDS_SurfData) ref = SeqData(1);
1692 Blend_Point P;
1693
1694 ISurf= ref->Surf();
1695 Handle(Geom_Surface) Surf = DStr.Surface(ISurf).Surface();
1696 Surf->Bounds(UFirst,ULast,VFirst,VLast);
1697 Handle(Geom_Curve) Courbe1 = Surf->UIso(UFirst);
1698 Handle(Geom_Curve) Courbe2 = Surf->UIso(ULast);
1699 ChFi3d_SearchSing Fonc(Courbe1, Courbe2);
1700
1701 TColStd_SequenceOfReal LesVi;
1702 Standard_Real precedant, suivant, courant;
1703 Standard_Real a, b, c;
1704
81bba717 1705 // (1) Finds vi so that iso v=vi is punctual
7fd59977 1706 VFirst = Min( ref->InterferenceOnS1().FirstParameter(),
1707 ref->InterferenceOnS2().FirstParameter() );
1708 VLast = Max( ref->InterferenceOnS1().LastParameter(),
1709 ref->InterferenceOnS2().LastParameter() );
1710
81bba717 1711 // (1.1) Finds the first point inside
7fd59977 1712 for (ii=1; ii<=Nbpnt && Line->Point(ii).Parameter()<VFirst; ii++) {}
1713 if (ii==1) ii++;
1714 P = Line->Point(ii);
1715 b = P.Parameter();
1716 courant = P.PointOnS1().Distance(P.PointOnS2());
1717 P = Line->Point(ii-1);
1718 a = P.Parameter();
1719 precedant = P.PointOnS1().Distance(P.PointOnS2());
1720 ii ++;
1721
81bba717 1722 // (1.2) Find a minimum by "points"
7fd59977 1723 for ( ; ii<=Nbpnt && Line->Point(ii).Parameter()<=VLast; ii++) {
1724 for (;ii<=Nbpnt &&
1725 Line->Point(ii).Parameter()<VLast &&
1726 Line->Point(ii).Parameter()-b<Precision::PConfusion(); ii++) {}
1727
1728 const Blend_Point& pnt = Line->Point(ii);
1729 c = pnt.Parameter();
1730 suivant = pnt.PointOnS1().Distance(pnt.PointOnS2());
1731 if ( (courant < precedant) && (courant < suivant) ) {
81bba717 1732 // (1.3) Find the exact minimum
7fd59977 1733 math_FunctionRoot Resol(Fonc, (a+c)/2,
1734 tol2d,//Surf->VResolution(toleps),
1735 a, c,
1736 50);
1737 if (Resol.IsDone()) {
1738 Standard_Real Val, racine=Resol.Root();
1739
1740 Fonc.Value(Resol.Root(), Val);
1741 if (Val< tolapp3d) {
81bba717 1742 // the solution (avoiding the risks of confusion)
7fd59977 1743 if (LesVi.Length()==0) {
1744 if ( (racine > VFirst+tol2d) &&
1745 (racine < VLast -tol2d) ) {
1746 LesVi.Append(racine);
1747 }
1748 }
1749 else {
1750 if ( (racine > LesVi(LesVi.Length()) + tol2d) &&
1751 (racine < VLast-tol2d) ) {
1752 LesVi.Append(racine);
1753 }
1754 }
1755 }
1756 }
1757 else {
63c629aa 1758# if CHFI3D_DEB
04232180 1759 std::cout << "Failed calculation of the minimum length" << std::endl;
7fd59977 1760# endif
1761 }
1762 }
81bba717 1763 // update if non duplication
7fd59977 1764 a = b;
1765 precedant = courant;
1766 b = c;
1767 courant = suivant;
1768 }
1769
81bba717 1770 // (2) Update of the sequence of SurfData
7fd59977 1771 if (LesVi.Length()>0) {
1772 TopOpeBRepDS_DataStructure& DStru = myDS->ChangeDS();
1773 Handle(ChFiDS_SurfData) SD;
1774 TopOpeBRepDS_Surface S;
1775 TopOpeBRepDS_Curve C1, C2;
1776 Standard_Real T, VertexTol;
1777 gp_Pnt P3d, P1, P2;
1778 ChFiDS_CommonPoint LePoint;
1779 for (ii=1 ; ii<=LesVi.Length(); ii++) {
1780
1781 T = LesVi(ii);
81bba717 1782 // (2.0) copy and insertion
7fd59977 1783 SD = new (ChFiDS_SurfData);
1784 SD->Copy(ref);
1785 SeqData.InsertBefore(ii, SD);
1786 S = DStru.Surface(ref->Surf());
1787 SD->ChangeSurf(DStru.AddSurface(S));
1788 C1 = DStru.Curve(SD->InterferenceOnS1().LineIndex());
1789 SD->ChangeInterferenceOnS1().SetLineIndex( DStru.AddCurve(C1));
1790 C2 = DStru.Curve(SD->InterferenceOnS2().LineIndex());
1791 SD->ChangeInterferenceOnS2().SetLineIndex(DStru.AddCurve(C2));
1792
81bba717 1793 // (2.1) Modification of common Point
7fd59977 1794 SD-> ChangeVertexLastOnS1().Reset();
1795 SD-> ChangeVertexLastOnS2().Reset();
1796 ref->ChangeVertexFirstOnS1().Reset();
1797 ref->ChangeVertexFirstOnS2().Reset();
1798 Courbe1->D0(T, P1);
1799 Courbe2->D0(T, P2);
1800 P3d.SetXYZ((P1.XYZ()+ P2.XYZ())/2);
1801 VertexTol = P1.Distance(P2);
1802 VertexTol += Max(C1.Tolerance(), C2.Tolerance());
1803
1804 SD->ChangeVertexLastOnS1().SetPoint(P3d);
1805 SD->ChangeVertexLastOnS2().SetPoint(P3d);
1806 ref->ChangeVertexFirstOnS1().SetPoint(P3d);
1807 ref->ChangeVertexFirstOnS2().SetPoint(P3d);
1808 SD->ChangeVertexLastOnS1().SetTolerance(VertexTol);
1809 SD->ChangeVertexLastOnS2().SetTolerance(VertexTol);
1810 ref->ChangeVertexFirstOnS1().SetTolerance(VertexTol);
1811 ref->ChangeVertexFirstOnS2().SetTolerance(VertexTol);
1812
81bba717 1813 // (2.2) Modification of interferences
7fd59977 1814 SD->ChangeInterferenceOnS1().SetLastParameter(T);
1815 SD->ChangeInterferenceOnS2().SetLastParameter(T);
1816 ref->ChangeInterferenceOnS1().SetFirstParameter(T);
1817 ref->ChangeInterferenceOnS2().SetFirstParameter(T);
1818
81bba717 1819 // Parameters on ElSpine
7fd59977 1820 SD->LastSpineParam(T);
1821 ref->FirstSpineParam(T);
1822 }
1823 }
1824}
1825
1826//=======================================================================
1827//function : ExtentOneCorner
1828//purpose :
1829//=======================================================================
1830
1831void ChFi3d_FilBuilder::ExtentOneCorner(const TopoDS_Vertex& V,
1832 const Handle(ChFiDS_Stripe)& S)
1833{
81bba717 1834 // review by using the data at end of fillets (point, radius, normal
1835 // to the faces and tangents of the guideline).
7fd59977 1836 Standard_Integer Sens = 0;
7fd59977 1837 Standard_Real Coeff = 0.5;
1838 Handle(ChFiDS_Spine) Spine = S->Spine();
1839 ChFi3d_IndexOfSurfData(V,S,Sens);
1840 Standard_Real dU = Spine->LastParameter(Spine->NbEdges());
1841 if (Spine->IsTangencyExtremity((Sens == 1)))
81bba717 1842 return; //No extension in the queue
7fd59977 1843
1844 if (Spine->Status((Sens == 1)) == ChFiDS_FreeBoundary) {
81bba717 1845 Coeff *= 2; // It is necessary to go to the end and to evaluate the length
7fd59977 1846 }
1847
1848 if (Sens == 1) {
1849 Spine->SetFirstParameter(-dU*Coeff);
1850 Spine->SetFirstTgt(0.);
1851 }
1852 else{
1853 Spine->SetLastParameter(dU*(1.+Coeff));
1854 Spine->SetLastTgt(dU);
1855 }
1856}
1857
1858//=======================================================================
1859//function : ExtentTwoCorner
1860//purpose :
1861//=======================================================================
1862
1863void ChFi3d_FilBuilder::ExtentTwoCorner(const TopoDS_Vertex& V,
1864 const ChFiDS_ListOfStripe& LS)
1865{
81bba717 1866 // Review by using the data at end of fillets (point, radius, normal
1867 // to faces and tangents to the guideline.
7fd59977 1868 Standard_Integer Sens;
1869 Standard_Real Coeff = 0.3, Eval=0.0, dU, rad;
7fd59977 1870 ChFiDS_ListIteratorOfListOfStripe itel(LS);
1871 Standard_Boolean FF = Standard_True;
1872 Handle(ChFiDS_Stripe) Stripe;
1873 Handle(ChFiDS_Spine) Spine;
1874
81bba717 1875 // A value of symetric extension is calculated
7fd59977 1876 for ( ; itel.More(); itel.Next()) {
1877 Stripe = itel.Value();
1878 Spine = Stripe->Spine();
1879 dU = Spine->LastParameter(Spine->NbEdges())*Coeff;
1880 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
1881 if (fsp->IsConstant())
1882 rad = fsp->Radius();
1883 else
1884 {
1885 TopoDS_Edge E = ChFi3d_EdgeFromV1( V, itel.Value(), Sens);
1886 rad = MaxRad( fsp, E );
1887 /*
1888 IE = ChFi3d_IndexOfSurfData(V,itel.Value(),Sens);
1889 rad = MaxRad(fsp, IE);
1890 */
1891 }
1892 rad *= 1.5;
1893 if (rad > dU) dU = rad;
1894 if (dU > Eval) Eval = dU;
1895 }
1896
81bba717 1897 // One applies
7fd59977 1898 for (itel.Initialize(LS) ; itel.More(); itel.Next()) {
96a95605 1899 ChFi3d_IndexOfSurfData(V,itel.Value(),Sens);
7fd59977 1900 if (!FF && Stripe == itel.Value()) Sens = -Sens;
1901 Stripe = itel.Value();
1902 Spine = Stripe->Spine();
81bba717 1903 if (! Spine->IsTangencyExtremity((Sens == 1))) { //No extension on queue
7fd59977 1904 if (Sens == 1){
1905 Spine->SetFirstParameter(-Eval);
1906 Spine->SetFirstTgt(0.);
1907 }
1908 else{
1909 dU = Spine->LastParameter(Spine->NbEdges());
1910 Spine->SetLastParameter(dU+Eval);
1911 Spine->SetLastTgt(dU);
1912 }
1913 FF = Standard_False;
1914 }
1915 }
1916}
1917
1918
1919//=======================================================================
1920//function : ExtentThreeCorner
1921//purpose :
1922//=======================================================================
1923
1924void ChFi3d_FilBuilder::ExtentThreeCorner(const TopoDS_Vertex& V,
1925 const ChFiDS_ListOfStripe& LS)
1926{
81bba717 1927 // Review by using the data at end of fillets (point, radius, normal
1928 // to faces and tangents to the guideline.
7fd59977 1929 Standard_Integer Sens = 0;
7fd59977 1930 Standard_Real Coeff = 0.1;
1931 ChFiDS_ListOfStripe check;
1932// Standard_Boolean FF = Standard_True;
1933 for(ChFiDS_ListIteratorOfListOfStripe itel(LS); itel.More(); itel.Next()) {
1934 Handle(ChFiDS_Stripe) Stripe = itel.Value();
1935 ChFi3d_IndexOfSurfData(V,Stripe,Sens);
1936 for(ChFiDS_ListIteratorOfListOfStripe ich(check); ich.More(); ich.Next()){
1937 if(Stripe == ich.Value()){
1938 Sens = -Sens;
1939 break;
1940 }
1941 }
1942 Handle(ChFiDS_Spine) Spine = Stripe->Spine();
81bba717 1943 if (Spine->IsTangencyExtremity((Sens == 1))) return; //No extension on queue
7fd59977 1944 Standard_Real dU = Spine->LastParameter(Spine->NbEdges());
eff3eff9 1945 if (Sens == 1){
1946 if (!(Spine->GetTypeOfConcavity() == ChFiDS_Convex &&
1947 Spine->FirstStatus() == ChFiDS_OnSame))
1948 {
1949 Spine->SetFirstParameter(-dU*Coeff);
1950 Spine->SetFirstTgt(0.);
1951 }
7fd59977 1952 }
1953 else{
eff3eff9 1954 if (!(Spine->GetTypeOfConcavity() == ChFiDS_Convex &&
1955 Spine->LastStatus() == ChFiDS_OnSame))
1956 {
1957 Spine->SetLastParameter(dU*(1.+Coeff));
1958 Spine->SetLastTgt(dU);
1959 }
7fd59977 1960 }
1961 check.Append(Stripe);
1962 }
1963}
1964
1965
1966//=======================================================================
1967//function : SetRegul
1968//purpose :
1969//=======================================================================
1970
1971void ChFi3d_FilBuilder::SetRegul()
1972
1973{
1974 ChFiDS_ListIteratorOfRegularities it;
1975 TopTools_ListIteratorOfListOfShape itc;
1976 TopTools_ListIteratorOfListOfShape its1;
1977 TopTools_ListIteratorOfListOfShape its2;
1978 BRep_Builder B;
1979 for (it.Initialize(myRegul); it.More(); it.Next()){
1980 const ChFiDS_Regul& reg = it.Value();
1981 itc.Initialize(myCoup->NewEdges(reg.Curve()));
1982 if(itc.More()){
1983 TopoDS_Edge E = TopoDS::Edge(itc.Value());
1984 if(reg.IsSurface1()) its1.Initialize(myCoup->NewFaces(reg.S1()));
1985 else its1.Initialize(myCoup->Merged(myDS->Shape(reg.S1()),TopAbs_IN));
1986 if(reg.IsSurface2()) its2.Initialize(myCoup->NewFaces(reg.S2()));
1987 else its2.Initialize(myCoup->Merged(myDS->Shape(reg.S2()),TopAbs_IN));
1988 if(its1.More() && its2.More()){
1989 TopoDS_Face F1 = TopoDS::Face(its1.Value());
1990 TopoDS_Face F2 = TopoDS::Face(its2.Value());
1991 GeomAbs_Shape cont = ChFi3d_evalconti(E,F1,F2);
1992 B.Continuity(E,F1,F2,cont);
1993 }
1994 }
1995 }
1996}