1 // Copyright (c) 1997-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #include <FilletSurf_InternalBuilder.ixx>
16 #include <FilletSurf_StatusDone.hxx>
17 #include <FilletSurf_ErrorTypeStatus.hxx>
18 #include <FilletSurf_StatusType.hxx>
20 #include <ChFi3d_FilBuilder.hxx>
21 #include <ChFi3d_Builder_0.hxx>
23 #include <ChFiDS_HData.hxx>
24 #include <ChFiDS_FilSpine.hxx>
25 #include <ChFiDS_HElSpine.hxx>
26 #include <ChFiDS_Stripe.hxx>
27 #include <ChFiDS_ListOfStripe.hxx>
28 #include <ChFiDS_ListIteratorOfListOfStripe.hxx>
29 #include <ChFiDS_SurfData.hxx>
30 #include <ChFiDS_SequenceOfSurfData.hxx>
31 #include <ChFiDS_FaceInterference.hxx>
32 #include <ChFiDS_CommonPoint.hxx>
33 #include <ChFiDS_CircSection.hxx>
34 #include <ChFiDS_SecHArray1.hxx>
36 #include <BRepBlend_Line.hxx>
37 #include <BRepBlend_ConstRad.hxx>
38 #include <BRepBlend_ConstRadInv.hxx>
41 #include <TopTools_ListIteratorOfListOfShape.hxx>
43 #include <BRep_Tool.hxx>
45 #include <BRepAdaptor_HCurve.hxx>
46 #include <GeomAdaptor_HSurface.hxx>
47 #include <GeomAdaptor_Surface.hxx>
48 #include <GeomAbs_Shape.hxx>
50 #include <TopOpeBRepDS_HDataStructure.hxx>
52 #include <Geom_Surface.hxx>
53 #include <Geom_Plane.hxx>
54 #include <Geom_Curve.hxx>
55 #include <Geom_TrimmedCurve.hxx>
56 #include <Geom_Circle.hxx>
57 #include <GeomAdaptor_HCurve.hxx>
61 #include <gp_Circ.hxx>
64 #include <IntCurveSurface_HInter.hxx>
65 #include <IntCurveSurface_IntersectionPoint.hxx>
66 #include <BRepExtrema_DistShapeShape.hxx>
68 #include <Standard_ConstructionError.hxx>
69 #include <Precision.hxx>
71 static Standard_Boolean isinlist(const TopoDS_Shape& E,
72 const TopTools_ListOfShape& L){
73 TopTools_ListIteratorOfListOfShape It;
74 for (It.Initialize(L); It.More(); It.Next()){
75 if(E.IsSame(It.Value())) return 1;
80 static Standard_Boolean IntPlanEdge(Handle(BRepAdaptor_HCurve)& Ed,
83 const Standard_Real tol3d)
85 Standard_Boolean done = 0;
86 Standard_Real f = Ed->FirstParameter();
87 Standard_Real l = Ed->LastParameter();
88 gp_Pnt Or = P.Location();
89 Handle(Geom_Plane) Pln = new Geom_Plane(P);
90 Handle(GeomAdaptor_HSurface)
91 Plan = new GeomAdaptor_HSurface(GeomAdaptor_Surface(Pln));
93 IntCurveSurface_HInter Intersection;
94 Standard_Integer nbp ,iip;
95 IntCurveSurface_IntersectionPoint IP;
96 Standard_Real dist = RealLast();
98 Intersection.Perform(Ed,Plan);
100 if(Intersection.IsDone()){
101 nbp = Intersection.NbPoints();
102 for (iip = 1; iip <= nbp; iip++){
103 IP = Intersection.Point(iip);
104 gp_Pnt pint = IP.Pnt();
105 Standard_Real d = pint.Distance(Or);
113 gp_Pnt pdeb = Ed->Value(f);
114 gp_Pnt pfin = Ed->Value(l);
116 //check if the extremities are not solution
117 ElSLib::Parameters(P,pdeb,u,v);
118 gp_Pnt projdeb = ElSLib::Value(u,v,P);
119 Standard_Real dprojdeb = pdeb.Distance(projdeb);
121 Standard_Real d = pdeb.Distance(Or);
128 ElSLib::Parameters(P,pfin,u,v);
129 gp_Pnt projfin = ElSLib::Value(u,v,P);
130 Standard_Real dprojfin = pfin.Distance(projfin);
132 Standard_Real d = pfin.Distance(Or);
142 static Standard_Boolean ComputeEdgeParameter(const Handle(ChFiDS_Spine)& Spine,
143 const Standard_Integer ind,
144 const Standard_Real pelsp,
146 const Standard_Real tol3d)
148 Handle(ChFiDS_HElSpine) Guide = Spine->ElSpine(ind);
150 Guide->D1(pelsp,P,V);
152 Handle(BRepAdaptor_HCurve) ed = new BRepAdaptor_HCurve();
153 ed->ChangeCurve() = Spine->CurrentElementarySpine(ind);
154 return IntPlanEdge(ed,pln,ped,tol3d);
157 //=======================================================================
158 //function : FilletSurf_InternalBuilder
160 //=======================================================================
162 FilletSurf_InternalBuilder::FilletSurf_InternalBuilder
163 (const TopoDS_Shape& S,
164 const ChFi3d_FilletShape FShape,
165 const Standard_Real Ta,
166 const Standard_Real Tapp3d,
167 const Standard_Real Tapp2d):ChFi3d_FilBuilder(S,FShape,Ta)
169 SetParams(Ta,Tapp3d,Tapp2d,
170 Tapp3d,Tapp2d,1.e-3);
171 SetContinuity(GeomAbs_C2,Ta);
174 //=======================================================================
176 //purpose : creation of spine on a set of edges
181 // 3 : non G1 adjacent faces
182 // 4 : edge is not on the shape
183 // 5 : edge is not alive
184 //=======================================================================
186 Standard_Integer FilletSurf_InternalBuilder::Add(const TopTools_ListOfShape& E,
187 const Standard_Real R)
189 if(E.IsEmpty()) return 1;
190 TopTools_ListIteratorOfListOfShape It;
191 for(It.Initialize(E); It.More(); It.Next()){
192 TopoDS_Edge cured = TopoDS::Edge(It.Value());
193 if(cured.IsNull()) return 4;
194 if(!myEFMap.Contains(cured)) return 4;
195 //check if the edge is a fracture edge
197 for(It.Initialize(myEFMap(cured));It.More();It.Next()){
199 ff1 = TopoDS::Face(It.Value());
202 ff2 = TopoDS::Face(It.Value());
203 if(!ff2.IsSame(ff1)){
208 if(ff1.IsNull() || ff2.IsNull()) return 5;
209 if(ff1.IsSame(ff2)) return 5;
210 if(BRep_Tool::Continuity(cured,ff1,ff2) != GeomAbs_C0) return 5;
212 TopoDS_Edge ed = TopoDS::Edge(E.First());
213 ed.Orientation(TopAbs_FORWARD);
214 ChFi3d_FilBuilder::Add(R,ed);
215 Handle(ChFiDS_Stripe) st = myListStripe.First();
216 Handle(ChFiDS_Spine)& sp = st->ChangeSpine();
217 Standard_Boolean periodic = sp->IsPeriodic();
219 //It is checked if edges of list E are in the contour,
220 //the edges that arenot in the list are removed from the contour,
221 //it is checked that the remainder is monoblock.
223 for(It.Initialize(E); It.More(); It.Next()){
224 TopoDS_Edge cured = TopoDS::Edge(It.Value());
225 if(!Contains(cured)) return 2;
228 Handle(ChFiDS_FilSpine) newsp = new ChFiDS_FilSpine();
229 Standard_Boolean debut = 0;
230 Standard_Integer premierquinyestpas = 0;
231 Standard_Integer yatrou = 0;
232 for(Standard_Integer i = 1; i <= sp->NbEdges(); i++){
233 TopoDS_Edge cured = sp->Edges(i);
234 if(isinlist(cured,E)){
236 if(premierquinyestpas) {
240 newsp->SetEdges(cured);
242 else if(debut && !premierquinyestpas) premierquinyestpas = i;
244 if(!periodic && yatrou) return 2;
245 if(periodic && yatrou){
246 Standard_Boolean vraitrou = 0, debut = 0;
247 for(Standard_Integer i = sp->NbEdges(); i > yatrou; i--){
248 TopoDS_Edge cured = sp->Edges(i);
249 if(isinlist(cured,E)){
250 if(vraitrou) return 2;
251 newsp->PutInFirst(cured);
253 else if(debut) vraitrou = 1;
258 if(newsp->NbEdges() != sp->NbEdges()) {
264 //ElSpine is immediately constructed
265 Handle(ChFiDS_HElSpine) hels = new ChFiDS_HElSpine();
268 sp->D1(sp->FirstParameter(),PFirst,TFirst);
269 sp->D1(sp->LastParameter(),PLast,TLast);
270 hels->ChangeCurve().FirstParameter(sp->FirstParameter());
271 hels->ChangeCurve().SetFirstPointAndTgt(PFirst,TFirst);
272 hels->ChangeCurve().LastParameter(sp->LastParameter());
273 hels->ChangeCurve().SetLastPointAndTgt(PLast,TLast);
274 ChFi3d_PerformElSpine(hels,sp,myConti,tolesp);
275 sp->AppendElSpine(hels);
276 sp->SplitDone(Standard_True);
280 //=======================================================================
283 //=======================================================================
285 void FilletSurf_InternalBuilder::Perform()
287 //PerformSetOfSurfOnElSpine is enough.
289 Handle(ChFiDS_Stripe) Stripe = myListStripe.First();
290 Handle(ChFiDS_HData)& HData = Stripe->ChangeSetOfSurfData();
291 HData = new ChFiDS_HData();
292 Handle(ChFiDS_Spine)& Spine = Stripe->ChangeSpine();
293 TopAbs_Orientation RefOr1,RefOr2;
294 Standard_Integer RefChoix;
295 StripeOrientations(Spine,RefOr1,RefOr2,RefChoix);
296 Stripe->OrientationOnFace1(RefOr1);
297 Stripe->OrientationOnFace2(RefOr2);
298 Stripe->Choix(RefChoix);
299 PerformSetOfKGen(Stripe,0);
302 //=======================================================================
303 //function : PerformSurf
305 //=======================================================================
308 FilletSurf_InternalBuilder::PerformSurf(ChFiDS_SequenceOfSurfData& SeqData,
309 const Handle(ChFiDS_HElSpine)& Guide,
310 const Handle(ChFiDS_Spine)& Spine,
311 const Standard_Integer Choix,
312 const Handle(BRepAdaptor_HSurface)& S1,
313 const Handle(Adaptor3d_TopolTool)& I1,
314 const Handle(BRepAdaptor_HSurface)& S2,
315 const Handle(Adaptor3d_TopolTool)& I2,
316 const Standard_Real MaxStep,
317 const Standard_Real Fleche,
318 const Standard_Real TolGuide,
319 Standard_Real& First,
321 const Standard_Boolean Inside,
322 const Standard_Boolean Appro,
323 const Standard_Boolean Forward,
324 const Standard_Boolean RecOnS1,
325 const Standard_Boolean RecOnS2,
326 const math_Vector& Soldep,
327 Standard_Boolean& Intf,
328 Standard_Boolean& Intl)
330 Handle(ChFiDS_SurfData) Data = SeqData(1);
331 Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
332 if(fsp.IsNull()) Standard_ConstructionError::Raise
333 ("PerformSurf : this is not the spine of a fillet");
334 Handle(BRepBlend_Line) lin;
335 TopAbs_Orientation Or = S1->ChangeSurface().Face().Orientation();
336 if(!fsp->IsConstant()) Standard_ConstructionError::Raise
337 ("PerformSurf : no variable radiuses");
338 // Standard_Boolean maybesingular; //pour scinder les Surfdata singulieres
340 BRepBlend_ConstRad Func(S1,S2,Guide);
341 BRepBlend_ConstRadInv FInv(S1,S2,Guide);
342 Func.Set(fsp->Radius(),Choix);
343 FInv.Set(fsp->Radius(),Choix);
344 switch (GetFilletShape()) {
345 case ChFi3d_Rational:
346 Func.Set(BlendFunc_Rational);
348 case ChFi3d_QuasiAngular:
349 Func.Set(BlendFunc_QuasiAngular);
351 case ChFi3d_Polynomial:
352 Func.Set(BlendFunc_Polynomial);
354 Standard_Real PFirst = First;
355 done = SimulData(Data,Guide,lin,S1,I1,
356 S2,I2,Func,FInv,PFirst,MaxStep,Fleche,
357 TolGuide,First,Last,Inside,Appro,Forward,Soldep,
359 if(!done) return Standard_False;
360 if(lin->StartPointOnFirst().NbPointOnRst() !=0){
361 ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
362 Standard_True, Data->ChangeVertexFirstOnS1(), tolesp);
364 if(lin->EndPointOnFirst().NbPointOnRst() !=0){
365 ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
366 Standard_False,Data->ChangeVertexLastOnS1(), tolesp);
368 if(lin->StartPointOnSecond().NbPointOnRst() !=0){
369 ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
370 Standard_True, Data->ChangeVertexFirstOnS2(), tolesp);
372 if(lin->EndPointOnSecond().NbPointOnRst() !=0){
373 ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
374 Standard_False, Data->ChangeVertexLastOnS2(), tolesp);
376 done = CompleteData(Data,Func,lin,S1,S2,Or,0,0,0,0);
377 if(!done) Standard_Failure::Raise("PerformSurf : Failed approximation!");
378 // maybesingular = (Func.GetMinimalDistance()<=100*tolapp3d);
379 Standard_Boolean ok = 0;
382 const ChFiDS_CommonPoint& cpf1 = Data->VertexFirstOnS1();
384 TopoDS_Face F1 = S1->ChangeSurface().Face();
386 ok = Intf = !SearchFace(Spine,cpf1,F1,bid);
388 const ChFiDS_CommonPoint& cpf2 = Data->VertexFirstOnS2();
389 if(cpf2.IsOnArc() && !ok){
390 TopoDS_Face F2 = S2->ChangeSurface().Face();
392 Intf = !SearchFace(Spine,cpf2,F2,bid);
397 const ChFiDS_CommonPoint& cpl1 = Data->VertexLastOnS1();
399 TopoDS_Face F1 = S1->ChangeSurface().Face();
401 ok = Intl = !SearchFace(Spine,cpl1,F1,bid);
403 const ChFiDS_CommonPoint& cpl2 = Data->VertexLastOnS2();
404 if(cpl2.IsOnArc() && !ok){
405 TopoDS_Face F2 = S2->ChangeSurface().Face();
407 Intl = !SearchFace(Spine,cpl2,F2,bid);
409 Data->FirstSpineParam(First);
410 Data->LastSpineParam (Last);
412 // if (maybesingular) SplitSurf(SeqData, lin);
413 // Necessite de trimer resultats : A faire
414 return Standard_True;
417 void FilletSurf_InternalBuilder::PerformSurf(ChFiDS_SequenceOfSurfData&, const Handle_ChFiDS_HElSpine&, const Handle_ChFiDS_Spine&, const int, const Handle_BRepAdaptor_HSurface&, const Handle_Adaptor3d_TopolTool&, const Handle_BRepAdaptor_HCurve2d&, const Handle_BRepAdaptor_HSurface&, const Handle_BRepAdaptor_HCurve2d&, unsigned int&, const Handle_BRepAdaptor_HSurface&, const Handle_Adaptor3d_TopolTool&, const TopAbs_Orientation, const double, const double, const double, double&, double&, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const math_Vector&)
419 Standard_DomainError::Raise("BlendFunc_CSConstRad::Section : Not implemented");
422 void FilletSurf_InternalBuilder::PerformSurf(ChFiDS_SequenceOfSurfData&, const Handle_ChFiDS_HElSpine&, const Handle_ChFiDS_Spine&, const int, const Handle_BRepAdaptor_HSurface&, const Handle_Adaptor3d_TopolTool&, const Handle_BRepAdaptor_HCurve2d&, const Handle_BRepAdaptor_HSurface&, const Handle_BRepAdaptor_HCurve2d&, unsigned int&, const TopAbs_Orientation, const Handle_BRepAdaptor_HSurface&, const Handle_Adaptor3d_TopolTool&, const Handle_BRepAdaptor_HCurve2d&, const Handle_BRepAdaptor_HSurface&, const Handle_BRepAdaptor_HCurve2d&, unsigned int&, const TopAbs_Orientation, const double, const double, const double, double&, double&, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const math_Vector&)
424 Standard_DomainError::Raise("BlendFunc_CSConstRad::Section : Not implemented");
427 void FilletSurf_InternalBuilder::PerformSurf(ChFiDS_SequenceOfSurfData&, const Handle_ChFiDS_HElSpine&, const Handle_ChFiDS_Spine&, const int, const Handle_BRepAdaptor_HSurface&, const Handle_Adaptor3d_TopolTool&, const TopAbs_Orientation, const Handle_BRepAdaptor_HSurface&, const Handle_Adaptor3d_TopolTool&, const Handle_BRepAdaptor_HCurve2d&, const Handle_BRepAdaptor_HSurface&, const Handle_BRepAdaptor_HCurve2d&, unsigned int&, const double, const double, const double, double&, double&, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const math_Vector&)
429 Standard_DomainError::Raise("BlendFunc_CSConstRad::Section : Not implemented");
432 Standard_Boolean FilletSurf_InternalBuilder::Done() const
436 //=======================================================================
437 //function : NbSurface
438 //purpose : gives the number of NUBS surfaces of the Fillet
439 //=======================================================================
441 Standard_Integer FilletSurf_InternalBuilder::NbSurface() const
443 return myListStripe.First()->SetOfSurfData()->Length();
446 //=======================================================================
447 //function : SurfaceFillet
448 //purpose : gives the NUBS surface of index Index
449 //=======================================================================
451 const Handle(Geom_Surface)& FilletSurf_InternalBuilder::SurfaceFillet(const Standard_Integer Index) const
453 Standard_Integer isurf = myListStripe.First()->SetOfSurfData()->Value(Index)->Surf();
455 return myDS->Surface(isurf).Surface();
458 //=======================================================================
459 //function : TolApp3d
460 //purpose : gives the 3d tolerance reached during approximation
461 //=======================================================================
463 Standard_Real FilletSurf_InternalBuilder::TolApp3d(const Standard_Integer Index) const
465 Standard_Integer isurf = myListStripe.First()->SetOfSurfData()->Value(Index)->Surf();
467 return myDS->Surface(isurf).Tolerance();
470 //=======================================================================
471 //function : SupportFace1
472 //purpose : gives the first support face relative to SurfaceFillet(Index)
473 //=======================================================================
474 const TopoDS_Face& FilletSurf_InternalBuilder::SupportFace1(const Standard_Integer Index) const
476 Standard_Integer isurf = myListStripe.First()->SetOfSurfData()->Value(Index)->IndexOfS1();
478 return TopoDS::Face(myDS->Shape(isurf));
480 //=======================================================================
481 //function : SupportFace2
482 //purpose : gives the second support face relative to SurfaceFillet(Index)
483 //=======================================================================
484 const TopoDS_Face& FilletSurf_InternalBuilder::SupportFace2(const Standard_Integer Index) const
486 Standard_Integer isurf = myListStripe.First()->SetOfSurfData()->Value(Index)->IndexOfS2();
488 return TopoDS::Face(myDS->Shape(isurf));
490 //===============================================================================
491 //function : CurveOnSup1
492 //purpose : gives the 3d curve of SurfaceFillet(Index) on SupportFace1(Index)
493 //===============================================================================
495 const Handle(Geom_Curve)& FilletSurf_InternalBuilder::CurveOnFace1(const Standard_Integer Index) const
497 Standard_Integer icurv = myListStripe.First()->SetOfSurfData()->Value(Index)->
498 InterferenceOnS1().LineIndex();
499 return myDS->Curve(icurv).Curve();
502 //=======================================================================
503 //function : CurveOnSup2
504 //purpose : gives the 3d curve of SurfaceFillet(Index) on SupportFace2(Index
505 //=======================================================================
507 const Handle(Geom_Curve)& FilletSurf_InternalBuilder::CurveOnFace2(const Standard_Integer Index) const
509 Standard_Integer icurv=myListStripe.First()->SetOfSurfData()->Value(Index)->
510 InterferenceOnS2().LineIndex();
511 return myDS->Curve(icurv).Curve();
513 //=======================================================================
514 //function : PCurveOnFace1
515 //purpose : gives the PCurve associated to CurvOnSup1(Index) on the support face
516 //=======================================================================
517 const Handle(Geom2d_Curve)& FilletSurf_InternalBuilder::PCurveOnFace1(const Standard_Integer Index) const
519 return myListStripe.First()->SetOfSurfData()->Value(Index)->
520 InterferenceOnS1().PCurveOnFace();
524 //=======================================================================
525 //function : PCurveOnFillet1
526 //purpose : gives the PCurve associated to CurveOnFace1(Index) on the Fillet
527 //=======================================================================
529 const Handle(Geom2d_Curve)& FilletSurf_InternalBuilder::PCurve1OnFillet(const Standard_Integer Index) const
530 {return myListStripe.First()->SetOfSurfData()->Value(Index)->
531 InterferenceOnS1().PCurveOnSurf();
535 //=======================================================================
536 //function : PCurveOnFace2
537 //purpose : gives the PCurve associated to CurvOnSup2(Index) on the support face
538 //=======================================================================
539 const Handle(Geom2d_Curve)& FilletSurf_InternalBuilder::PCurveOnFace2(const Standard_Integer Index) const
541 return myListStripe.First()->SetOfSurfData()->Value(Index)->
542 InterferenceOnS2().PCurveOnFace();
545 //=======================================================================
546 //function : PCurveOnFillet2
547 //purpose : gives the PCurve associated to CurveOnFace2(Index) on the Fillet
548 //=======================================================================
549 const Handle(Geom2d_Curve)& FilletSurf_InternalBuilder::PCurve2OnFillet(const Standard_Integer Index) const
550 {return myListStripe.First()->SetOfSurfData()->Value(Index)->
551 InterferenceOnS2().PCurveOnSurf();
555 //=======================================================================
556 //function : FirstParameter
557 //purpose : gives the parameter of the fillet on the first edge
558 //=======================================================================
560 Standard_Real FilletSurf_InternalBuilder::FirstParameter() const
562 const Handle(ChFiDS_Stripe)& st = myListStripe.First();
563 const Handle(ChFiDS_Spine)& sp = st->Spine();
564 const Handle(ChFiDS_SurfData)& sd = st->SetOfSurfData()->Value(1);
565 Standard_Real p = sd->FirstSpineParam();
566 Standard_Integer ind = 1;
567 if(sp->IsPeriodic()) ind = sp->Index(p);
569 if(ComputeEdgeParameter(sp,ind,p,ep,tolesp)) return ep;
572 //=======================================================================
573 //function : LastParameter
574 //purpose : gives the parameter of the fillet on the last edge
575 //=======================================================================
576 Standard_Real FilletSurf_InternalBuilder::LastParameter() const
578 const Handle(ChFiDS_Stripe)& st = myListStripe.First();
579 const Handle(ChFiDS_Spine)& sp = st->Spine();
580 const Handle(ChFiDS_SurfData)& sd = st->SetOfSurfData()->Value(NbSurface());
581 Standard_Real p = sd->LastSpineParam();
582 Standard_Integer ind = sp->NbEdges();
583 if(sp->IsPeriodic()) ind = sp->Index(p);
585 if(ComputeEdgeParameter(sp,ind,p,ep,tolesp)) return ep;
589 //=======================================================================
590 //function : StatusStartSection
592 // twoExtremityonEdge: each extremity of start section of the Fillet is
593 // on the edge of the corresponding support face.
594 // OneExtremityOnEdge: only one of the extremities of start section of the Fillet
595 // is on the edge of the corresponding support face.
596 // NoExtremityOnEdge: any extremity of start section of the fillet is on
597 // the edge of the corresponding support face.
598 //=======================================================================
601 FilletSurf_StatusType FilletSurf_InternalBuilder::StartSectionStatus() const
604 Standard_Boolean isonedge1 = myListStripe.First()->SetOfSurfData()->Value(1)->
605 VertexFirstOnS1().IsOnArc();
606 Standard_Boolean isonedge2= myListStripe.First()->SetOfSurfData()->Value(1)->
607 VertexFirstOnS2().IsOnArc();;
609 if (isonedge1 && isonedge2)
610 {return FilletSurf_TwoExtremityOnEdge;}
611 else if ((!isonedge1)&& (!isonedge2))
612 {return FilletSurf_NoExtremityOnEdge ;}
614 {return FilletSurf_OneExtremityOnEdge;}
616 //=======================================================================
617 //function : StatusEndSection()
619 // twoExtremityonEdge: each extremity of end section of the Fillet is
620 // on the edge of the corresponding support face.
621 // OneExtremityOnEdge: only one of the extremities of end section of the Fillet
622 // is on the edge of the corresponding support face.
623 // NoExtremityOnEdge: any extremity of end section of the fillet is on
624 // the edge of the corresponding support face.
625 //=======================================================================
626 FilletSurf_StatusType FilletSurf_InternalBuilder::EndSectionStatus() const
628 Standard_Boolean isonedge1 = myListStripe.First()->SetOfSurfData()->Value(NbSurface())->
629 VertexLastOnS1().IsOnArc();
630 Standard_Boolean isonedge2= myListStripe.First()->SetOfSurfData()->Value(NbSurface())->
631 VertexLastOnS2().IsOnArc();
633 if (isonedge1 && isonedge2)
634 { return FilletSurf_TwoExtremityOnEdge;}
635 else if ((!isonedge1)&& (!isonedge2))
636 { return FilletSurf_NoExtremityOnEdge;}
638 { return FilletSurf_OneExtremityOnEdge;}
642 //=======================================================================
643 //function : Simulate
644 //purpose : computes only the sections used in the computation of the fillet
645 //=======================================================================
646 void FilletSurf_InternalBuilder::Simulate()
648 //ChFi3d_FilBuilder::Simulate(1);
649 Handle(ChFiDS_Stripe) Stripe = myListStripe.First();
650 Handle(ChFiDS_HData)& HData = Stripe->ChangeSetOfSurfData();
651 HData = new ChFiDS_HData();
652 Handle(ChFiDS_Spine)& Spine = Stripe->ChangeSpine();
653 TopAbs_Orientation RefOr1,RefOr2;
654 Standard_Integer RefChoix;
655 StripeOrientations(Spine,RefOr1,RefOr2,RefChoix);
656 Stripe->OrientationOnFace1(RefOr1);
657 Stripe->OrientationOnFace2(RefOr2);
658 Stripe->Choix(RefChoix);
659 PerformSetOfKGen(Stripe,1);
663 //=======================================================================
664 //function : NbSection
665 //purpose : gives the number of sections relative to SurfaceFillet(IndexSurf)
666 //=======================================================================
667 Standard_Integer FilletSurf_InternalBuilder::NbSection(const Standard_Integer IndexSurf) const
669 return Sect(1,IndexSurf)->Length();
672 //=======================================================================
674 //purpose : gives the arc of circle corresponding to section number
675 // IndexSec of SurfaceFillet(IndexSurf) (The basis curve of the
676 // trimmed curve is a Geom_Circle)
677 //=======================================================================
678 void FilletSurf_InternalBuilder::Section(const Standard_Integer IndexSurf, const Standard_Integer IndexSec, Handle(Geom_TrimmedCurve)& Circ) const
681 Standard_Real deb,fin;
682 Sect(1,IndexSurf)->Value(IndexSec).Get(c,deb,fin);
683 Handle(Geom_Circle) Gc = new Geom_Circle(c);
684 Circ= new Geom_TrimmedCurve(Gc,deb,fin);