1 // Created on: 1993-11-18
2 // Created by: Isabelle GRIGNON
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 #include <ChFi3d_Builder.ixx>
25 #include <Standard_Failure.hxx>
26 #include <Standard_NoSuchObject.hxx>
27 #include <Standard_NotImplemented.hxx>
28 #include <Standard_ErrorHandler.hxx>
29 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
30 #include <TColStd_MapOfInteger.hxx>
31 #include <TColStd_ListIteratorOfListOfInteger.hxx>
34 #include <TopoDS_Shape.hxx>
35 #include <TopoDS_Face.hxx>
36 #include <TopoDS_Edge.hxx>
37 #include <TopoDS_Vertex.hxx>
40 #include <TopAbs_ShapeEnum.hxx>
41 #include <TopAbs_Orientation.hxx>
42 #include <BRep_Builder.hxx>
43 #include <BRep_Tool.hxx>
45 #include <TopExp_Explorer.hxx>
46 #include <TopTools_ListOfShape.hxx>
47 #include <TopTools_ListIteratorOfListOfShape.hxx>
49 #include <TopOpeBRepDS_CurveExplorer.hxx>
50 #include <TopOpeBRepDS_CurvePointInterference.hxx>
51 #include <TopOpeBRepDS_DataStructure.hxx>
52 #include <TopOpeBRepDS_BuildTool.hxx>
53 #include <TopOpeBRepDS_Curve.hxx>
54 #include <TopOpeBRepDS_PointIterator.hxx>
55 #include <TopTools_ListIteratorOfListOfShape.hxx>
57 #include <BRep_Tool.hxx>
58 #include <ChFiDS_Stripe.hxx>
59 #include <ChFiDS_ListIteratorOfListOfStripe.hxx>
60 #include <ChFiDS_SequenceOfSurfData.hxx>
61 #include <ChFiDS_HData.hxx>
65 #include <ChFi3d_Builder_0.hxx>
66 #include <TopOpeBRepDS_ListOfInterference.hxx>
70 #include <TestTopOpeTools.hxx>
71 #include <TestTopOpe.hxx>
74 #include <OSD_Chronometer.hxx>
76 // variables for performances
79 OSD_Chronometer cl_total,cl_extent,cl_perfsetofsurf,cl_perffilletonvertex,
80 cl_filds,cl_reconstruction,cl_setregul,cl_perform1corner,cl_perform2corner,
81 cl_performatend,cl_perform3corner,cl_performmore3corner;
83 Standard_EXPORT Standard_Real t_total, t_extent,t_perfsetofsurf,
84 t_perffilletonvertex, t_filds,t_reconstruction,t_setregul, t_perfsetofkgen,
85 t_perfsetofkpart,t_makextremities,t_performatend,t_startsol,t_performsurf,
86 t_perform1corner,t_perform2corner,t_perform3corner,t_performmore3corner,
87 t_batten,t_inter,t_sameinter,t_same,t_plate,t_approxplate,t_t2cornerinit,
88 t_perf2cornerbyinter,t_chfikpartcompdata,t_cheminement,t_remplissage,
89 t_t3cornerinit ,t_spherique,t_torique, t_notfilling,t_filling,t_sameparam,
90 t_computedata,t_completedata,t_t2cornerDS,t_t3cornerDS;
92 //Standard_IMPORT extern void ChFi3d_InitChron(OSD_Chronometer& ch);
93 Standard_IMPORT void ChFi3d_InitChron(OSD_Chronometer& ch);
94 //Standard_IMPORT extern void ChFi3d_ResultChron(OSD_Chronometer & ch,
95 Standard_IMPORT void ChFi3d_ResultChron(OSD_Chronometer & ch,
97 extern Standard_Boolean ChFi3d_GettraceCHRON();
101 //=======================================================================
102 //function : CompleteDS
104 //=======================================================================
106 static void CompleteDS(TopOpeBRepDS_DataStructure& DStr,
107 const TopoDS_Shape& S)
109 ChFiDS_Map MapEW,MapFS;
110 MapEW.Fill(S,TopAbs_EDGE,TopAbs_WIRE);
111 MapFS.Fill(S,TopAbs_FACE,TopAbs_SHELL);
113 TopExp_Explorer ExpE;
114 for (ExpE.Init(S,TopAbs_EDGE); ExpE.More(); ExpE.Next()) {
115 const TopoDS_Edge& E = TopoDS::Edge(ExpE.Current());
116 Standard_Boolean hasgeom = DStr.HasGeometry(E);
118 const TopTools_ListOfShape& WireListAnc = MapEW(E);
119 TopTools_ListIteratorOfListOfShape itaW(WireListAnc);
120 while (itaW.More()) {
121 const TopoDS_Shape& WireAnc = itaW.Value();
122 DStr.AddShape(WireAnc);
128 TopExp_Explorer ExpF;
129 for (ExpF.Init(S,TopAbs_FACE); ExpF.More(); ExpF.Next()) {
130 const TopoDS_Face& F = TopoDS::Face(ExpF.Current());
131 Standard_Boolean hasgeom = DStr.HasGeometry(F);
133 const TopTools_ListOfShape& ShellListAnc = MapFS(F);
134 TopTools_ListIteratorOfListOfShape itaS(ShellListAnc);
135 while (itaS.More()) {
136 const TopoDS_Shape& ShellAnc = itaS.Value();
137 DStr.AddShape(ShellAnc);
143 // set the range on the DS Curves
144 for (Standard_Integer ic = 1; ic <= DStr.NbCurves(); ic++) {
145 Standard_Real parmin = RealLast(), parmax = RealFirst();
146 const TopOpeBRepDS_ListOfInterference& LI = DStr.CurveInterferences(ic);
147 for (TopOpeBRepDS_PointIterator it(LI);
150 Standard_Real par = it.Parameter();
151 parmin = Min (parmin,par); parmax = Max (parmax,par);
153 DStr.ChangeCurve(ic).SetRange(parmin,parmax);
157 void ChFi3d_Builder::Delete()
160 //=======================================================================
161 //function : ExtentAnalyse
163 //=======================================================================
165 void ChFi3d_Builder::ExtentAnalyse ()
167 Standard_Integer nbedges, nbs;
168 for (Standard_Integer iv = 1; iv <= myVDataMap.Extent(); iv++) {
169 nbs = myVDataMap(iv).Extent();
170 const TopoDS_Vertex& Vtx = myVDataMap.FindKey(iv);
171 nbedges = ChFi3d_NumberOfEdges(Vtx, myVEMap);
174 ExtentOneCorner(Vtx, myVDataMap.FindFromIndex(iv).First());
178 ExtentTwoCorner(Vtx, myVDataMap.FindFromIndex(iv));
182 ExtentThreeCorner(Vtx, myVDataMap.FindFromIndex(iv));
190 //=======================================================================
193 //=======================================================================
195 void ChFi3d_Builder::Compute()
199 t_total=0;t_extent=0; t_perfsetofsurf=0;t_perffilletonvertex=0;
200 t_filds=0;t_reconstruction=0;t_setregul=0;
201 t_perfsetofkpart=0; t_perfsetofkgen=0;t_makextremities=0;
202 t_performsurf=0;t_startsol=0; t_perform1corner=0;t_perform2corner=0;
203 t_perform3corner=0;t_performmore3corner=0;t_inter=0;t_same=0;t_sameinter=0;
204 t_plate=0;t_approxplate=0; t_batten=0;t_remplissage=0;t_t3cornerinit=0;
205 t_spherique=0;t_torique=0;t_notfilling=0;t_filling=0;t_performatend=0;
206 t_t2cornerinit=0; t_perf2cornerbyinter=0;t_chfikpartcompdata=0;
207 t_cheminement=0; t_sameparam=0; t_computedata=0;t_completedata=0;
208 t_t2cornerDS=0;t_t3cornerDS=0;
209 ChFi3d_InitChron(cl_total);
210 ChFi3d_InitChron(cl_extent);
213 if (myListStripe.IsEmpty())
214 Standard_Failure::Raise("There are no suitable edges for chamfer or fillet");
217 myDS = new TopOpeBRepDS_HDataStructure();
218 TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS();
219 done = Standard_True;
220 hasresult=Standard_False;
222 TestTopOpe::CurrentDS(myDS);
224 TestTopOpe::Shapes(myShape,bids);
227 // filling of myVDatatMap
228 ChFiDS_ListIteratorOfListOfStripe itel;
230 for (itel.Initialize(myListStripe);itel.More(); itel.Next()) {
231 if ((itel.Value()->Spine()->FirstStatus() <= ChFiDS_BreakPoint))
232 myVDataMap.Add(itel.Value()->Spine()->FirstVertex(),itel.Value());
233 else if (itel.Value()->Spine()->FirstStatus() == ChFiDS_FreeBoundary)
234 ExtentOneCorner(itel.Value()->Spine()->FirstVertex(),itel.Value());
235 if ((itel.Value()->Spine()->LastStatus() <= ChFiDS_BreakPoint))
236 myVDataMap.Add(itel.Value()->Spine()->LastVertex() ,itel.Value());
237 else if (itel.Value()->Spine()->LastStatus() == ChFiDS_FreeBoundary)
238 ExtentOneCorner(itel.Value()->Spine()->LastVertex(),itel.Value());
240 // preanalysis to evaluate the extensions.
245 ChFi3d_ResultChron(cl_extent,t_extent);
246 ChFi3d_InitChron(cl_perfsetofsurf);
249 // Construction of the stripe of fillet on each stripe.
250 for (itel.Initialize(myListStripe);itel.More(); itel.Next()) {
251 itel.Value()->Spine()->SetErrorStatus(ChFiDS_Ok);
254 PerformSetOfSurf(itel.Value());
256 catch(Standard_Failure) {
257 Handle(Standard_Failure) exc = Standard_Failure::Caught();
259 cout <<"EXCEPTION Stripe compute " << exc << endl;
261 badstripes.Append(itel.Value());
262 done = Standard_True;
263 if (itel.Value()->Spine()->ErrorStatus()==ChFiDS_Ok)
264 itel.Value()->Spine()->SetErrorStatus(ChFiDS_Error);
266 if (!done) badstripes.Append(itel.Value());
267 done = Standard_True;
269 done = (badstripes.IsEmpty());
272 ChFi3d_ResultChron(cl_perfsetofsurf,t_perfsetofsurf);
273 ChFi3d_InitChron(cl_perffilletonvertex);
276 //construct fillets on each vertex + feed the Ds
278 //Standard_Integer nbresult=0;
279 // for (Standard_Integer j=1;j<=myVDataMap.Extent();j++) {
282 #endif //to avoid Linux warning:<< variable `j' might be clobbered by `longjmp' or `vfork' >>
284 for (j=1;j<=myVDataMap.Extent();j++) {
287 PerformFilletOnVertex(j);
289 catch(Standard_Failure) {
290 Handle(Standard_Failure) exc = Standard_Failure::Caught();
292 cout <<"EXCEPTION Corner compute " << exc << endl;
294 badvertices.Append(myVDataMap.FindKey(j));
295 hasresult=Standard_False;
296 done = Standard_True;
298 if (!done) badvertices.Append(myVDataMap.FindKey(j));
299 done = Standard_True;
301 if (!hasresult) done = badvertices.IsEmpty();
306 ChFi3d_ResultChron(cl_perffilletonvertex,t_perffilletonvertex);
307 ChFi3d_InitChron(cl_filds);
310 TColStd_MapOfInteger MapIndSo;
311 TopExp_Explorer expso(myShape,TopAbs_SOLID);
312 for(; expso.More(); expso.Next()){
313 const TopoDS_Shape& cursol = expso.Current();
314 Standard_Integer indcursol = DStr.AddShape(cursol);
315 MapIndSo.Add(indcursol);
317 TopExp_Explorer expsh(myShape,TopAbs_SHELL,TopAbs_SOLID);
318 for(; expsh.More(); expsh.Next()){
319 const TopoDS_Shape& cursh = expsh.Current();
320 Standard_Integer indcursh = DStr.AddShape(cursh);
321 MapIndSo.Add(indcursh);
325 for (itel.Initialize(myListStripe), i1=0;
328 const Handle(ChFiDS_Stripe)& st = itel.Value();
329 // 05/02/02 akm vvv : (OCC119) First we'll check ain't there
330 // intersections between fillets
331 ChFiDS_ListIteratorOfListOfStripe itel1;
333 for (itel1.Initialize(myListStripe), i2=0;
335 itel1.Next(), i2++) {
337 // Do not twice intersect the stripes
339 Handle(ChFiDS_Stripe) aCheckStripe = itel1.Value();
342 ChFi3d_StripeEdgeInter (st, aCheckStripe, DStr, tol2d);
344 catch(Standard_Failure) {
345 Handle(Standard_Failure) exc = Standard_Failure::Caught();
347 cout <<"EXCEPTION Fillets compute " << exc << endl;
349 badstripes.Append(itel.Value());
350 hasresult=Standard_False;
351 done = Standard_False;
356 Standard_Integer solidindex = st->SolidIndex();
357 ChFi3d_FilDS(solidindex,st,DStr,myRegul,tolesp,tol2d);
362 ChFi3d_ResultChron(cl_filds,t_filds);
363 ChFi3d_InitChron(cl_reconstruction);
369 CompleteDS(DStr,myShape);
370 //Update tolerances on vertex to max adjacent edges or
371 //Update tolerances on degenerated edge to max of adjacent vertexes.
372 TopOpeBRepDS_CurveExplorer cex(DStr);
373 for(;cex.More();cex.Next()){
374 TopOpeBRepDS_Curve& c = *((TopOpeBRepDS_Curve*)(void*)&(cex.Curve()));
375 Standard_Real tolc = 0.;
376 Standard_Boolean degen = c.Curve().IsNull();
377 if(!degen) tolc = c.Tolerance();
378 Standard_Integer ic = cex.Index();
379 TopOpeBRepDS_PointIterator It(myDS->CurvePoints(ic));
380 for(;It.More();It.Next()){
381 Handle(TopOpeBRepDS_CurvePointInterference) II;
382 II = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(It.Value());
383 if (II.IsNull()) continue;
384 TopOpeBRepDS_Kind gk = II->GeometryType();
385 Standard_Integer gi = II->Geometry();
386 if(gk == TopOpeBRepDS_VERTEX){
387 const TopoDS_Vertex& v = TopoDS::Vertex(myDS->Shape(gi));
388 Standard_Real tolv = BRep_Tool::Tolerance(v);
389 if( tolv > 0.0001 ) {
391 if( tolc < tolv ) tolc = tolv + 0.00001;
393 if(degen && tolc < tolv) tolc = tolv;
394 else if(tolc>tolv) B1.UpdateVertex(v,tolc);
396 else if(gk == TopOpeBRepDS_POINT){
397 TopOpeBRepDS_Point& p = DStr.ChangePoint(gi);
398 Standard_Real tolp = p.Tolerance();
399 if(degen && tolc < tolp) tolc = tolp;
400 else if(tolc>tolp) p.Tolerance(tolc);
403 if(degen) c.Tolerance(tolc);
405 myCoup->Perform(myDS);
406 TColStd_MapIteratorOfMapOfInteger It(MapIndSo);
407 for(; It.More(); It.Next()){
408 Standard_Integer indsol = It.Key();
409 const TopoDS_Shape& curshape = DStr.Shape(indsol);
410 myCoup->MergeSolid(curshape,TopAbs_IN);
413 Standard_Integer i=1,n=DStr.NbShapes();
415 const TopoDS_Shape S = DStr.Shape(i);
416 if (S.ShapeType() != TopAbs_EDGE) continue;
417 Standard_Boolean issplitIN = myCoup->IsSplit(S,TopAbs_IN);
418 if ( !issplitIN ) continue;
419 TopTools_ListIteratorOfListOfShape it(myCoup->Splits(S,TopAbs_IN));
420 for (; it.More(); it.Next() ) {
421 const TopoDS_Edge& newE = TopoDS::Edge(it.Value());
422 Standard_Real tole = BRep_Tool::Tolerance(newE);
423 TopExp_Explorer exv(newE,TopAbs_VERTEX);
424 for (; exv.More(); exv.Next() ) {
425 const TopoDS_Vertex& v = TopoDS::Vertex(exv.Current());
426 Standard_Real tolv = BRep_Tool::Tolerance(v);
427 if (tole>tolv) B1.UpdateVertex(v,tole);
432 B1.MakeCompound(TopoDS::Compound(myShapeResult));
433 for(It.Reset(); It.More(); It.Next()){
434 Standard_Integer indsol = It.Key();
435 const TopoDS_Shape& curshape = DStr.Shape(indsol);
436 TopTools_ListIteratorOfListOfShape
437 its = myCoup->Merged(curshape,TopAbs_IN);
438 if(!its.More()) B1.Add(myShapeResult,curshape);
440 //If the old type of Shape is Shell, Shell is placed instead of Solid,
441 //However there is a problem for compound of open Shell.
443 const TopAbs_ShapeEnum letype = curshape.ShapeType();
444 if (letype == TopAbs_SHELL){
445 TopExp_Explorer expsh2(its.Value(),TopAbs_SHELL);
446 const TopoDS_Shape& cursh = expsh2.Current();
447 TopoDS_Shape tt = cursh;
448 B1.Add(myShapeResult,cursh);
452 B1.Add(myShapeResult,its.Value());
461 B1.MakeCompound(TopoDS::Compound(badShape));
462 for(It.Reset(); It.More(); It.Next()){
463 Standard_Integer indsol = It.Key();
464 const TopoDS_Shape& curshape = DStr.Shape(indsol);
465 TopTools_ListIteratorOfListOfShape
466 its = myCoup->Merged(curshape,TopAbs_IN);
467 if(!its.More()) B1.Add(badShape,curshape);
470 B1.Add(badShape,its.Value());
477 ChFi3d_ResultChron(cl_reconstruction ,t_reconstruction);
478 ChFi3d_InitChron(cl_setregul);
481 // Regularities are coded after cutting.
486 ChFi3d_ResultChron(cl_setregul ,t_setregul);
491 ChFi3d_ResultChron(cl_total,t_total);
495 // display of time for perfs
499 cout<<"COMPUTE: temps total "<<t_total<<"s dont :"<<endl;
500 cout<<"- Init + ExtentAnalyse "<<t_extent<<"s"<<endl;
501 cout<<"- PerformSetOfSurf "<<t_perfsetofsurf<<"s"<<endl;
502 cout<<"- PerformFilletOnVertex "<<t_perffilletonvertex<<"s"<<endl;
503 cout<<"- FilDS "<<t_filds<<"s"<<endl;
504 cout<<"- Reconstruction "<<t_reconstruction<<"s"<<endl;
505 cout<<"- SetRegul "<<t_setregul<<"s"<<endl<<endl;
507 if(ChFi3d_GettraceCHRON()){
509 cout <<"temps PERFORMSETOFSURF "<<t_perfsetofsurf <<"s dont : "<<endl;
510 cout <<"- SetofKPart "<<t_perfsetofkpart<<"s"<<endl;
511 cout <<"- SetofKGen "<< t_perfsetofkgen <<"s"<<endl;
512 cout <<"- MakeExtremities "<<t_makextremities<<"s"<<endl<<endl;
515 cout <<"temps SETOFKGEN "<< t_perfsetofkgen<<"s dont : "<<endl;
516 cout<<"- PerformSurf "<<t_performsurf<<"s"<<endl;
517 cout<<"- starsol "<< t_startsol <<"s"<<endl<<endl;
519 cout<<"temps PERFORMSURF "<<t_performsurf<<"s dont : " << endl;
520 cout<<"- computedata "<<t_computedata<<"s"<<endl;
521 cout<<"- completedata "<<t_completedata<<"s"<<endl<<endl;
524 cout<<"temps PERFORMFILLETVERTEX "<<t_perffilletonvertex <<"s dont : " << endl;
525 cout<<"- PerformOneCorner "<<t_perform1corner<<"s"<<endl;
526 cout<<"- PerformIntersectionAtEnd "<<t_performatend<<"s"<<endl;
527 cout<<"- PerformTwoCorner "<<t_perform2corner<<"s"<<endl;
528 cout<<"- PerformThreeCorner "<<t_perform3corner<<"s"<<endl;
529 cout<<"- PerformMoreThreeCorner "<<t_performmore3corner<<"s"<<endl<<endl;
532 cout<<"temps PerformOneCorner "<<t_perform1corner<<"s dont:"<<endl;
533 cout<<"- temps condition if (same) "<<t_same << "s "<<endl;
534 cout<<"- temps condition if (inter) "<<t_inter<<"s " <<endl;
535 cout<<"- temps condition if (same inter) "<<t_sameinter<<"s " <<endl<<endl;
537 cout<<"temps PerformTwocorner "<<t_perform2corner<<"s dont:"<<endl;
538 cout<<"- temps initialisation "<< t_t2cornerinit<<"s"<<endl;
539 cout<<"- temps PerformTwoCornerbyInter "<<t_perf2cornerbyinter<<"s"<<endl;
540 cout<<"- temps ChFiKPart_ComputeData "<<t_chfikpartcompdata <<"s"<<endl;
541 cout<<"- temps cheminement "<<t_cheminement<<"s"<<endl;
542 cout<<"- temps remplissage "<<t_remplissage<<"s"<<endl;
543 cout<<"- temps mise a jour stripes "<<t_t2cornerDS<<"s"<<endl<<endl;
545 cout<<" temps PerformThreecorner "<<t_perform3corner<<"s dont:"<<endl;
546 cout<<"- temps initialisation "<< t_t3cornerinit<<"s"<<endl;
547 cout<<"- temps cas spherique "<<t_spherique<<"s"<<endl;
548 cout<<"- temps cas torique "<<t_torique<<"s"<<endl;
549 cout<<"- temps notfilling "<<t_notfilling<<"s"<<endl;
550 cout<<"- temps filling "<<t_filling<<"s"<<endl;
551 cout<<"- temps mise a jour stripes "<<t_t3cornerDS<<"s"<<endl<<endl;
553 cout<<"temps PerformMore3Corner "<<t_performmore3corner<<"s dont:"<<endl;
554 cout<<"-temps plate "<<t_plate << "s "<<endl;
555 cout<<"-temps approxplate "<<t_approxplate<<"s " <<endl;
556 cout<<"-temps batten "<< t_batten<<"s " <<endl<<endl;
558 cout <<"TEMPS DIVERS "<<endl;
559 cout<<"-temps ChFi3d_sameparameter "<<t_sameparam<<"s"<<endl<<endl;
564 //=======================================================================
565 //function : PerformSingularCorner
566 //purpose : Load vertex and degenerated edges.
567 //=======================================================================
569 void ChFi3d_Builder::PerformSingularCorner
570 (const Standard_Integer Index){
571 ChFiDS_ListIteratorOfListOfStripe It;
572 Handle(ChFiDS_Stripe) stripe;
573 TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS();
574 const TopoDS_Vertex& Vtx = myVDataMap.FindKey(Index);
576 Handle(ChFiDS_SurfData) Fd;
577 Standard_Integer i, Icurv;
579 Standard_Integer Ivtx = 0;
581 Standard_Integer Ivtx;
583 for (It.Initialize(myVDataMap(Index)), i=0; It.More(); It.Next(),i++){
585 // SurfData concerned and its CommonPoints,
586 Standard_Integer sens = 0;
587 Standard_Integer num = ChFi3d_IndexOfSurfData(Vtx,stripe,sens);
588 Standard_Boolean isfirst = (sens == 1);
589 Fd = stripe->SetOfSurfData()->Sequence().Value(num);
590 const ChFiDS_CommonPoint& CV1 = Fd->Vertex(isfirst,1);
591 const ChFiDS_CommonPoint& CV2 = Fd->Vertex(isfirst,2);
592 // Is it always degenerated ?
593 if ( CV1.Point().IsEqual( CV2.Point(), 0) ) {
594 // if yes the vertex is stored in the stripe
595 // and the edge at end is created
596 if (i==0) Ivtx = ChFi3d_IndexPointInDS(CV1, DStr);
597 Standard_Real tolreached;
598 Standard_Real Pardeb, Parfin;
599 gp_Pnt2d VOnS1, VOnS2;
600 Handle(Geom_Curve) C3d;
601 Handle(Geom2d_Curve) PCurv;
602 TopOpeBRepDS_Curve Crv;
604 VOnS1 = Fd->InterferenceOnS1().PCurveOnSurf()->
605 Value(Fd->InterferenceOnS1().FirstParameter());
606 VOnS2 = Fd->InterferenceOnS2().PCurveOnSurf()->
607 Value(Fd->InterferenceOnS2().FirstParameter());
610 VOnS1 = Fd->InterferenceOnS1().PCurveOnSurf()->
611 Value(Fd->InterferenceOnS1().LastParameter());
612 VOnS2 = Fd->InterferenceOnS2().PCurveOnSurf()->
613 Value(Fd->InterferenceOnS2().LastParameter());
616 ChFi3d_ComputeArete(CV1, VOnS1,
618 DStr.Surface(Fd->Surf()).Surface(),
620 Pardeb,Parfin,tolapp3d,tolapp2d,tolreached,0);
621 Crv = TopOpeBRepDS_Curve(C3d,tolreached);
622 Icurv = DStr.AddCurve(Crv);
624 stripe->SetCurve(Icurv, isfirst);
625 stripe->SetParameters(isfirst, Pardeb,Parfin);
626 stripe->ChangePCurve(isfirst) = PCurv;
627 stripe->SetIndexPoint(Ivtx, isfirst, 1);
628 stripe->SetIndexPoint(Ivtx, isfirst, 2);
633 //=======================================================================
634 //function : PerformFilletOnVertex
636 //=======================================================================
638 void ChFi3d_Builder::PerformFilletOnVertex
639 (const Standard_Integer Index){
641 ChFiDS_ListIteratorOfListOfStripe It;
642 Handle(ChFiDS_Stripe) stripe;
643 Handle(ChFiDS_Spine) sp;
644 const TopoDS_Vertex& Vtx = myVDataMap.FindKey(Index);
646 Handle(ChFiDS_SurfData) Fd;
648 Standard_Boolean nondegenere = Standard_True;
649 Standard_Boolean toujoursdegenere = Standard_True;
651 Standard_Boolean isfirst = Standard_False;
653 Standard_Boolean isfirst;
655 for (It.Initialize(myVDataMap(Index)), i=0; It.More(); It.Next(),i++){
657 sp = stripe->Spine();
658 // SurfData and its CommonPoints,
659 Standard_Integer sens = 0;
660 Standard_Integer num = ChFi3d_IndexOfSurfData(Vtx,stripe,sens);
661 isfirst = (sens == 1);
662 Fd = stripe->SetOfSurfData()->Sequence().Value(num);
663 const ChFiDS_CommonPoint& CV1 = Fd->Vertex(isfirst,1);
664 const ChFiDS_CommonPoint& CV2 = Fd->Vertex(isfirst,2);
665 // Is it always degenerated ?
666 if ( CV1.Point().IsEqual( CV2.Point(), 0) )
667 nondegenere = Standard_False;
668 else toujoursdegenere = Standard_False;
671 // calcul du nombre de faces = nombre d'aretes
672 /* TopTools_ListIteratorOfListOfShape ItF,JtF,ItE;
673 Standard_Integer nbf = 0, jf = 0;
674 for (ItF.Initialize(myVFMap(Vtx)); ItF.More(); ItF.Next()){
676 Standard_Integer kf = 1;
677 const TopoDS_Shape& cur = ItF.Value();
678 for (JtF.Initialize(myVFMap(Vtx)); JtF.More() && (kf < jf); JtF.Next(), kf++){
679 if(cur.IsSame(JtF.Value())) break;
683 Standard_Integer nba=myVEMap(Vtx).Extent();
684 for (ItE.Initialize(myVEMap(Vtx)); ItE.More(); ItE.Next()){
685 const TopoDS_Edge& cur = TopoDS::Edge(ItE.Value());
686 if (BRep_Tool::Degenerated(cur)) nba--;
689 Standard_Integer nba = ChFi3d_NumberOfEdges(Vtx, myVEMap);
691 if (nondegenere) { // Normal processing
695 if(sp->Status(isfirst) == ChFiDS_FreeBoundary) return;
698 ChFi3d_InitChron(cl_performatend);
700 PerformIntersectionAtEnd(Index);
702 ChFi3d_ResultChron(cl_performatend,t_performatend);
707 ChFi3d_InitChron(cl_perform1corner);
709 if (MoreSurfdata(Index))
710 PerformMoreSurfdata(Index);
711 else PerformOneCorner(Index);
713 ChFi3d_ResultChron(cl_perform1corner,t_perform1corner);
722 ChFi3d_InitChron(cl_performmore3corner);
724 PerformMoreThreeCorner(Index, i);
726 ChFi3d_ResultChron(cl_performmore3corner,t_performmore3corner);
731 ChFi3d_InitChron(cl_perform2corner);
733 PerformTwoCorner(Index);
735 ChFi3d_ResultChron(cl_perform2corner,t_perform2corner);
744 ChFi3d_InitChron(cl_performmore3corner);
746 PerformMoreThreeCorner(Index, i);
748 ChFi3d_ResultChron(cl_performmore3corner,t_performmore3corner);
753 ChFi3d_InitChron(cl_perform3corner);
755 PerformThreeCorner(Index);
757 ChFi3d_ResultChron(cl_perform3corner,t_perform3corner);
764 ChFi3d_InitChron(cl_performmore3corner);
766 PerformMoreThreeCorner(Index, i);
768 ChFi3d_ResultChron(cl_performmore3corner,t_performmore3corner);
773 else { // Single case processing
774 if (toujoursdegenere) PerformSingularCorner(Index);
775 else PerformMoreThreeCorner(Index, i);//Last chance...
780 //=======================================================================
783 //=======================================================================
785 void ChFi3d_Builder::Reset()
787 done = Standard_False;
794 ChFiDS_ListIteratorOfListOfStripe itel;
795 for (itel.Initialize(myListStripe); itel.More(); ){
796 if(!itel.Value()->Spine().IsNull()){
797 itel.Value()->Reset();
800 else myListStripe.Remove(itel);
804 //=======================================================================
805 //function : Generated
807 //=======================================================================
809 const TopTools_ListOfShape& ChFi3d_Builder::Generated(const TopoDS_Shape& EouV)
812 if(EouV.IsNull()) return myGenerated;
813 if(EouV.ShapeType() != TopAbs_EDGE &&
814 EouV.ShapeType() != TopAbs_VERTEX) return myGenerated;
815 if(myEVIMap.IsBound(EouV)) {
816 const TColStd_ListOfInteger& L = myEVIMap.Find(EouV);
817 TColStd_ListIteratorOfListOfInteger IL;
818 for(IL.Initialize(L); IL.More(); IL.Next()){
819 Standard_Integer I = IL.Value();
820 const TopTools_ListOfShape& LS = myCoup->NewFaces(I);
821 TopTools_ListIteratorOfListOfShape ILS;
822 for(ILS.Initialize(LS); ILS.More(); ILS.Next()){
823 myGenerated.Append(ILS.Value());