1 // Created on: 1995-10-26
2 // Created by: Laurent BOURESCHE
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 // Modified by skv - Fri Jun 18 12:52:54 2004 OCC6129
19 #include <GeomFill_ConstrainedFilling.ixx>
21 #include <Standard_Failure.hxx>
22 #include <Standard_NotImplemented.hxx>
23 #include <TColStd_HArray1OfReal.hxx>
24 #include <TColgp_Array1OfPnt.hxx>
27 #include <BSplCLib.hxx>
28 #include <AdvApprox_ApproxAFunction.hxx>
30 #include <Law_Linear.hxx>
31 #include <Law_BSpline.hxx>
32 #include <GeomFill_DegeneratedBound.hxx>
33 #include <GeomFill_TgtOnCoons.hxx>
37 #include <Draw_Appli.hxx>
38 #include <Draw_Display.hxx>
40 #include <Draw_Segment3D.hxx>
41 #include <Draw_Segment2D.hxx>
42 #include <Draw_Marker2D.hxx>
43 #include <Draw_ColorKind.hxx>
44 #include <Draw_MarkerShape.hxx>
45 static Standard_Boolean dodraw = 0;
46 static Standard_Real drawfac = 0.1;
49 Standard_IMPORT void Law_draw1dcurve(const TColStd_Array1OfReal& pol,
50 const TColStd_Array1OfReal& knots,
51 const TColStd_Array1OfInteger& mults,
52 const Standard_Integer deg,
54 const Standard_Real scal);
55 Standard_IMPORT void Law_draw1dcurve(const Handle(Law_BSpline)& bs,
57 const Standard_Real scal);
61 #include <OSD_Chronometer.hxx>
62 static OSD_Chronometer totclock, parclock, appclock, cstclock;
65 static Standard_Integer inqadd(const Standard_Real d1,
66 const Standard_Real d2,
69 const Standard_Integer deg,
70 const Standard_Real tolk)
72 Standard_Integer nbadd = 0;
73 m[0] = m[1] = deg - 2;
74 if (d1 != 1. && d2 != 1.){
75 if(Abs(d1+d2-1.) < tolk) {
76 k[0] = 0.5 * (d1 + 1. - d2);
81 k[0] = Min(d1,1. - d2);
82 k[1] = Max(d1,1. - d2);
96 static Handle(Law_Linear) mklin(const Handle(Law_Function)& func)
98 Handle(Law_Linear) fu = Handle(Law_Linear)::DownCast(func);
100 fu = new Law_Linear();
103 fu->Set(d,func->Value(d),f,func->Value(f));
108 static void sortbounds(const Standard_Integer nb,
109 Handle(GeomFill_Boundary)* bound,
110 Standard_Boolean* rev,
111 GeomFill_CornerState* stat)
113 // trier les bords (facon bourinos),
114 // flaguer ceux a renverser,
115 // flaguer les baillements au coins.
116 Standard_Integer i,j;
117 Handle(GeomFill_Boundary) temp;
121 for (i = 0; i < nb-1; i++){
122 if(!rev[i]) bound[i]->Points(pf,pl);
123 else bound[i]->Points(pl,pf);
124 for (j = i+1; j <= nb-1; j++){
125 bound[j]->Points(qf,ql);
126 // Modified by skv - Fri Jun 18 12:52:54 2004 OCC6129 Begin
127 Standard_Real df = qf.Distance(pl);
128 Standard_Real dl = ql.Distance(pl);
130 if(df < stat[i+1].Gap()){
132 bound[i+1] = bound[j];
135 rev[i+1] = Standard_False;
138 if(dl < stat[i+1].Gap()){
140 bound[i+1] = bound[j];
143 rev[i+1] = Standard_True;
146 // Modified by skv - Fri Jun 18 12:52:54 2004 OCC6129 End
149 if(!rev[nb-1]) bound[nb-1]->Points(pf,pl);
150 else bound[nb-1]->Points(pl,pf);
151 bound[0]->Points(qf,ql);
152 stat[0].Gap(pl.Distance(qf));
154 // flaguer les angles entre tangentes au coins et entre les normales au
155 // coins pour les bords contraints.
157 gp_Vec tgi, nori, tgn, norn;
158 Standard_Real fi, fn, li, ln;
159 for (i = 0; i < nb; i++){
160 Standard_Integer next = (i+1)%nb;
161 if(!rev[i]) bound[i]->Bounds(fi,li);
162 else bound[i]->Bounds(li,fi);
163 bound[i]->D1(li,pbid,tgi);
164 if(rev[i]) tgi.Reverse();
165 if(!rev[next]) bound[next]->Bounds(fn,ln);
166 else bound[next]->Bounds(ln,fn);
167 bound[next]->D1(fn,pbid,tgn);
168 if(rev[next]) tgn.Reverse();
169 Standard_Real ang = M_PI - tgi.Angle(tgn);
170 stat[next].TgtAng(ang);
171 if(bound[i]->HasNormals() && bound[next]->HasNormals()){
172 stat[next].Constraint();
173 nori = bound[i]->Norm(li);
174 norn = bound[next]->Norm(fn);
175 ang = nori.Angle(norn);
176 stat[next].NorAng(ang);
180 static void coonscnd(const Standard_Integer nb,
181 Handle(GeomFill_Boundary)* bound,
182 Standard_Boolean* rev,
183 GeomFill_CornerState* stat,
184 // Handle(GeomFill_TgtField)* tga,
185 Handle(GeomFill_TgtField)* ,
186 Standard_Real* mintg)
188 Standard_Real fact_normalization = 100.;
190 // Pour chaque coin contraint, on controle les bounds adjascents.
191 for(i = 0; i < nb; i++){
192 if(stat[i].HasConstraint()){
193 Standard_Integer ip = (i-1+nb)%nb;
194 Standard_Real tolang = Min(bound[ip]->Tolang(),bound[i]->Tolang());
195 Standard_Real an = stat[i].NorAng();
196 Standard_Boolean twist = Standard_False;
197 if(an >= 0.5*M_PI) { twist = Standard_True; an = M_PI-an; }
198 if(an > tolang) stat[i].DoKill(0.);
200 Standard_Real fact = 0.5*27./4;
201 tolang *= (Min(mintg[ip],mintg[i])*fact*fact_normalization);
202 gp_Vec tgp, dnorp, tgi, dnori, vbid;
204 Standard_Real fp,lp,fi,li;
205 if(!rev[ip]) bound[ip]->Bounds(fp,lp);
206 else bound[ip]->Bounds(lp,fp);
207 bound[ip]->D1(lp,pbid,tgp);
208 bound[ip]->D1Norm(lp,vbid,dnorp);
209 if(!rev[i]) bound[i]->Bounds(fi,li);
210 else bound[i]->Bounds(li,fi);
211 bound[i]->D1(fi,pbid,tgi);
212 bound[i]->D1Norm(fi,vbid,dnori);
213 Standard_Real scal1 = tgp.Dot(dnori);
214 Standard_Real scal2 = tgi.Dot(dnorp);
215 if(!twist) scal2 *= -1.;
216 scal1 = Abs(scal1+scal2);
218 Standard_Real killfactor = tolang/scal1;
219 stat[i].DoKill(killfactor);
221 cout<<"pb coons cnd coin : "<<i<<" fact = "<<killfactor<<endl;
228 static void killcorners(const Standard_Integer nb,
229 Handle(GeomFill_Boundary)* bound,
230 Standard_Boolean* rev,
231 Standard_Boolean* nrev,
232 GeomFill_CornerState* stat,
233 Handle(GeomFill_TgtField)* tga)
236 // Pour chaque bound, on controle l etat des extremites et on flingue
237 // eventuellement le champ tangent et les derivees du bound.
238 for(i = 0; i < nb; i++){
239 Standard_Integer inext = (i+1)%nb;
240 Standard_Boolean fnul, lnul;
241 Standard_Real fscal, lscal;
243 fnul = stat[i].IsToKill(fscal);
244 lnul = stat[inext].IsToKill(lscal);
247 lnul = stat[i].IsToKill(lscal);
248 fnul = stat[inext].IsToKill(fscal);
254 bound[i]->Reparametrize(0.,1.,fnul,lnul,fscal,lscal,rev[i]);
258 if(bound[i]->HasNormals() && tga[i]->IsScalable()) {
259 Handle(Law_BSpline) bs = Law::ScaleCub(0.,1.,fnul,lnul,fscal,lscal);
262 if(dodraw) Law_draw1dcurve(bs,gp_Vec2d(1.,0.),1.);
269 //=======================================================================
270 //class : GeomFill_ConstrainedFilling_Eval
271 //purpose: The evaluator for curve approximation
272 //=======================================================================
274 class GeomFill_ConstrainedFilling_Eval : public AdvApprox_EvaluatorFunction
277 GeomFill_ConstrainedFilling_Eval (GeomFill_ConstrainedFilling& theTool)
280 virtual void Evaluate (Standard_Integer *Dimension,
281 Standard_Real StartEnd[2],
282 Standard_Real *Parameter,
283 Standard_Integer *DerivativeRequest,
284 Standard_Real *Result, // [Dimension]
285 Standard_Integer *ErrorCode);
288 GeomFill_ConstrainedFilling& curfil;
291 void GeomFill_ConstrainedFilling_Eval::Evaluate (Standard_Integer *,/*Dimension*/
292 Standard_Real /*StartEnd*/[2],
293 Standard_Real *Parameter,
294 Standard_Integer *DerivativeRequest,
295 Standard_Real *Result,// [Dimension]
296 Standard_Integer *ErrorCode)
298 *ErrorCode = curfil.Eval(*Parameter, *DerivativeRequest, Result[0]);
301 //=======================================================================
302 //function : GeomFill_ConstrainedFilling
304 //=======================================================================
306 GeomFill_ConstrainedFilling::GeomFill_ConstrainedFilling
307 (const Standard_Integer MaxDeg,
308 const Standard_Integer MaxSeg) :
309 degmax(MaxDeg),segmax(MaxSeg),appdone(Standard_False)
311 dom[0] = dom[1] = dom[2] = dom[3] = 1.;
315 //=======================================================================
318 //=======================================================================
320 void GeomFill_ConstrainedFilling::Init(const Handle(GeomFill_Boundary)& B1,
321 const Handle(GeomFill_Boundary)& B2,
322 const Handle(GeomFill_Boundary)& B3,
323 const Standard_Boolean NoCheck)
332 Standard_Boolean rev[3];
333 rev[0] = rev[1] = rev[2] = Standard_False;
334 Handle(GeomFill_Boundary) bound[3];
335 bound[0] = B1; bound[1] = B2; bound[2] = B3;
337 sortbounds(3,bound,rev,stcor);
342 // on reparamettre tout le monde entre 0. et 1.
346 for (i = 0; i <= 2; i++){
347 bound[i]->Reparametrize(0.,1.,0,0,1.,1.,rev[i]);
353 // On cree le carreau algorithmique (u,(1-u)) et les champs tangents
355 // On cree donc le bord manquant.
356 gp_Pnt p1 = bound[1]->Value(1.);
357 gp_Pnt p2 = bound[2]->Value(1.);
358 gp_Pnt ppp(0.5*(p1.XYZ()+p2.XYZ()));
359 Standard_Real t3 = Max(bound[1]->Tol3d(),bound[2]->Tol3d());
360 Handle(GeomFill_DegeneratedBound)
361 DB = new GeomFill_DegeneratedBound(ppp,0.,1.,t3,10.);
363 ptch = new GeomFill_CoonsAlgPatch(bound[0],bound[1],DB,bound[2]);
365 Handle(GeomFill_TgtField) ttgalg[3];
366 if(bound[0]->HasNormals())
367 ttgalg[0] = tgalg[0] = new GeomFill_TgtOnCoons(ptch,0);
368 if(bound[1]->HasNormals())
369 ttgalg[1] = tgalg[1] = new GeomFill_TgtOnCoons(ptch,1);
370 if(bound[2]->HasNormals())
371 ttgalg[2] = tgalg[3] = new GeomFill_TgtOnCoons(ptch,3);
373 for (i = 0; i <= 3; i++){
375 if(!tgalg[i].IsNull()) MinTgte(i);
379 // On verifie enfin les conditions de compatibilites sur les derivees
380 // aux coins maintenant qu on a quelque chose a quoi les comparer.
381 Standard_Boolean nrev[3];
382 nrev[0] = nrev[1] = 0;
385 coonscnd(3,bound,nrev,stcor,ttgalg,mig);
386 killcorners(3,bound,rev,nrev,stcor,ttgalg);
388 // on remet les coins en place (on duplique la pointe).
391 for (i = 0; i <= 3; i++){
393 if(!tgalg[i].IsNull()) {
395 Handle(Law_Function) fu1,fu2;
397 fu1 = Law::MixBnd(*((Handle(Law_Linear)*) &fu1));
398 fu2 = Law::MixBnd(*((Handle(Law_Linear)*) &fu2));
409 //=======================================================================
412 //=======================================================================
414 void GeomFill_ConstrainedFilling::Init(const Handle(GeomFill_Boundary)& B1,
415 const Handle(GeomFill_Boundary)& B2,
416 const Handle(GeomFill_Boundary)& B3,
417 const Handle(GeomFill_Boundary)& B4,
418 const Standard_Boolean NoCheck)
427 Standard_Boolean rev[4];
428 rev[0] = rev[1] = rev[2] = rev[3] = Standard_False;
429 Handle(GeomFill_Boundary) bound[4];
430 bound[0] = B1; bound[1] = B2; bound[2] = B3; bound[3] = B4;
432 sortbounds(4,bound,rev,stcor);
438 // on reparamettre tout le monde entre 0. et 1.
442 for (i = 0; i <= 3; i++){
443 bound[i]->Reparametrize(0.,1.,0,0,1.,1.,rev[i]);
449 // On cree le carreau algorithmique (u,(1-u)) et les champs tangents
451 ptch = new GeomFill_CoonsAlgPatch(bound[0],bound[1],bound[2],bound[3]);
452 for (i = 0; i <= 3; i++){
453 if(bound[i]->HasNormals()) tgalg[i] = new GeomFill_TgtOnCoons(ptch,i);
455 // on calcule le min de chacun des champs tangents pour l evaluation
457 for (i = 0; i <= 3; i++){
459 if(!tgalg[i].IsNull()) MinTgte(i);
463 // On verifie enfin les conditions de compatibilites sur les derivees
464 // aux coins maintenant qu on a quelque chose a quoi les comparer.
465 Standard_Boolean nrev[4];
466 nrev[0] = nrev[1] = 0;
467 nrev[2] = nrev[3] = 1;
468 coonscnd(4,bound,nrev,stcor,tgalg,mig);
469 killcorners(4,bound,rev,nrev,stcor,tgalg);
471 // On verifie les champs tangents ne changent pas de direction.
472 for (i = 0; i <= 3; i++){
474 if(!tgalg[i].IsNull()) {
476 Handle(Law_Function) fu1,fu2;
478 Handle(Law_Function) ffu1 = Law::MixBnd(*((Handle(Law_Linear)*) &fu1));
479 Handle(Law_Function) ffu2 = Law::MixBnd(*((Handle(Law_Linear)*) &fu2));
480 ptch->SetFunc(ffu1,ffu2);
490 //=======================================================================
491 //function : SetDomain
493 //=======================================================================
495 void GeomFill_ConstrainedFilling::SetDomain
496 (const Standard_Real l, const Handle(GeomFill_BoundWithSurf)& B)
498 if(B == ptch->Bound(0)) dom[0] = Min(1.,Abs(l));
499 else if(B == ptch->Bound(1)) dom[1] = Min(1.,Abs(l));
500 else if(B == ptch->Bound(2)) dom[2] = Min(1.,Abs(l));
501 else if(B == ptch->Bound(3)) dom[3] = Min(1.,Abs(l));
505 //=======================================================================
508 //=======================================================================
510 void GeomFill_ConstrainedFilling::ReBuild()
512 if(!appdone) Standard_Failure::Raise
513 ("GeomFill_ConstrainedFilling::ReBuild Approx non faite");
521 //=======================================================================
522 //function : Boundary
524 //=======================================================================
526 Handle(GeomFill_Boundary) GeomFill_ConstrainedFilling::Boundary
527 (const Standard_Integer I) const
529 return ptch->Bound(I);
533 //=======================================================================
536 //=======================================================================
538 Handle(Geom_BSplineSurface) GeomFill_ConstrainedFilling::Surface() const
544 //=======================================================================
547 //=======================================================================
549 void GeomFill_ConstrainedFilling::Build()
551 for (Standard_Integer count = 0; count < 2; count++){
552 ibound[0] = count; ibound[1] = count+2;
553 ctr[0] = ctr[1] = nbd3 = 0;
554 Standard_Integer ii ;
555 for ( ii = 0; ii < 2; ii++){
556 if (ptch->Bound(ibound[ii])->HasNormals()) {
559 else if (!ptch->Bound(ibound[ii])->IsDegenerated()){
567 if(nbd3) PerformApprox();
572 appdone = Standard_True;
583 Standard_Real tottime, apptime, partime, csttime;
584 totclock.Show(tottime);
585 parclock.Show(partime);
586 appclock.Show(apptime);
587 cstclock.Show(csttime);
588 cout<<"temp total : "<<tottime<<" secondes"<<endl;
592 cout<<"reparametrage : "<<partime<<" secondes"<<endl;
593 cout<<"approximation : "<<apptime<<" secondes"<<endl;
594 cout<<"construction formelle : "<<csttime<<" secondes"<<endl;
600 //=======================================================================
601 //function : PerformApprox
603 //=======================================================================
605 void GeomFill_ConstrainedFilling::PerformApprox()
607 Standard_Integer ii ;
608 Handle(TColStd_HArray1OfReal) tol3d, tol2d, tol1d;
609 if(nbd3) tol3d = new TColStd_HArray1OfReal(1,nbd3);
610 Standard_Integer i3d = 0;
611 for( ii = 0; ii <= 1; ii++){
612 if (ctr[ii]) {tol3d->SetValue((++i3d),ptch->Bound(ibound[ii])->Tol3d());}
614 tol3d->SetValue(++i3d,0.5* mig[ibound[ii]] * ptch->Bound(ibound[ii])->Tolang());
618 ptch->Bound(ibound[0])->Bounds(f,l);
620 GeomFill_ConstrainedFilling_Eval ev (*this);
621 AdvApprox_ApproxAFunction app(0,
634 if (app.IsDone() || app.HasResult()){
635 Standard_Integer imk = Min(ibound[0],ibound[1]);
636 Standard_Integer nbpol = app.NbPoles();
637 degree[imk] = app.Degree();
638 mults[imk] = app.Multiplicities();
639 knots[imk] = app.Knots();
641 for(ii = 0; ii <= 1; ii++){
642 curvpol[ibound[ii]] = new TColgp_HArray1OfPnt(1,nbpol);
643 TColgp_Array1OfPnt& cp = curvpol[ibound[ii]]->ChangeArray1();
648 gp_Pnt ppp = ptch->Bound(ibound[ii])->Value(0.5*(f+l));
649 for(Standard_Integer ij = 1; ij <= nbpol; ij++){
654 tgtepol[ibound[ii]] = new TColgp_HArray1OfPnt(1,nbpol);
655 app.Poles(++i3d,tgtepol[ibound[ii]]->ChangeArray1());
662 //=======================================================================
663 //function : MatchKnots
665 //=======================================================================
667 void GeomFill_ConstrainedFilling::MatchKnots()
669 // on n insere rien si les domaines valent 1.
670 Standard_Integer i, j, l;
671 Standard_Integer ind[4];
672 nm[0] = mults[0]; nm[1] = mults[1];
673 nk[0] = knots[0]; nk[1] = knots[1];
674 ind[0] = nk[1]->Length(); ind[2] = 1;
675 ind[1] = 1; ind[3] = nk[0]->Length();
676 ncpol[0] = curvpol[0]; ncpol[1] = curvpol[1];
677 ncpol[2] = curvpol[2]; ncpol[3] = curvpol[3];
678 ntpol[0] = tgtepol[0]; ntpol[1] = tgtepol[1];
679 ntpol[2] = tgtepol[2]; ntpol[3] = tgtepol[3];
680 Standard_Real kadd[2];
681 Standard_Integer madd[2];
682 Standard_Real tolk = 1./Max(10,2*knots[1]->Array1().Length());
683 Standard_Integer nbadd = inqadd(dom[0],dom[2],kadd,madd,degree[1],tolk);
685 TColStd_Array1OfReal addk(kadd[0],1,nbadd);
686 TColStd_Array1OfInteger addm(madd[0],1,nbadd);
687 Standard_Integer nbnp, nbnk;
688 if(BSplCLib::PrepareInsertKnots(degree[1],0,
691 addk,addm,nbnp,nbnk,tolk,0)){
692 nm[1] = new TColStd_HArray1OfInteger(1,nbnk);
693 nk[1] = new TColStd_HArray1OfReal(1,nbnk);
694 ncpol[1] = new TColgp_HArray1OfPnt(1,nbnp);
695 ncpol[3] = new TColgp_HArray1OfPnt(1,nbnp);
696 BSplCLib::InsertKnots(degree[1],0,
697 curvpol[1]->Array1(),PLib::NoWeights(),
698 knots[1]->Array1(),mults[1]->Array1(),
700 ncpol[1]->ChangeArray1(),PLib::NoWeights(),
701 nk[1]->ChangeArray1(),nm[1]->ChangeArray1(),
704 BSplCLib::InsertKnots(degree[1],0,
705 curvpol[3]->Array1(),PLib::NoWeights(),
706 knots[1]->Array1(),mults[1]->Array1(),
708 ncpol[3]->ChangeArray1(),PLib::NoWeights(),
709 nk[1]->ChangeArray1(),nm[1]->ChangeArray1(),
711 if(!tgtepol[1].IsNull()){
712 ntpol[1] = new TColgp_HArray1OfPnt(1,nbnp);
713 BSplCLib::InsertKnots(degree[1],0,
714 tgtepol[1]->Array1(),PLib::NoWeights(),
715 knots[1]->Array1(),mults[1]->Array1(),
717 ntpol[1]->ChangeArray1(),PLib::NoWeights(),
718 nk[1]->ChangeArray1(),nm[1]->ChangeArray1(),
721 if(!tgtepol[3].IsNull()){
722 ntpol[3] = new TColgp_HArray1OfPnt(1,nbnp);
723 BSplCLib::InsertKnots(degree[1],0,
724 tgtepol[3]->Array1(),PLib::NoWeights(),
725 knots[1]->Array1(),mults[1]->Array1(),
727 ntpol[3]->ChangeArray1(),PLib::NoWeights(),
728 nk[1]->ChangeArray1(),nm[1]->ChangeArray1(),
733 for(i = 2; i <= nbnk; i++){
734 if(Abs(dom[0]-nm[1]->Value(i)) < tolk){
741 for(i = 1; i < nbnk; i++){
742 if(Abs(1.-dom[2]-nm[1]->Value(i)) < tolk){
749 tolk = 1./Max(10.,2.*knots[0]->Array1().Length());
750 nbadd = inqadd(dom[1],dom[3],kadd,madd,degree[0],tolk);
752 TColStd_Array1OfReal addk(kadd[0],1,nbadd);
753 TColStd_Array1OfInteger addm(madd[0],1,nbadd);
754 Standard_Integer nbnp, nbnk;
755 if(BSplCLib::PrepareInsertKnots(degree[0],0,
758 addk,addm,nbnp,nbnk,tolk,0)){
759 nm[0] = new TColStd_HArray1OfInteger(1,nbnk);
760 nk[0] = new TColStd_HArray1OfReal(1,nbnk);
761 ncpol[0] = new TColgp_HArray1OfPnt(1,nbnp);
762 ncpol[2] = new TColgp_HArray1OfPnt(1,nbnp);
763 BSplCLib::InsertKnots(degree[0],0,
764 curvpol[0]->Array1(),PLib::NoWeights(),
765 knots[0]->Array1(),mults[0]->Array1(),
767 ncpol[0]->ChangeArray1(),PLib::NoWeights(),
768 nk[0]->ChangeArray1(),nm[0]->ChangeArray1(),
771 BSplCLib::InsertKnots(degree[0],0,
772 curvpol[2]->Array1(),PLib::NoWeights(),
773 knots[0]->Array1(),mults[0]->Array1(),
775 ncpol[2]->ChangeArray1(),PLib::NoWeights(),
776 nk[0]->ChangeArray1(),nm[0]->ChangeArray1(),
778 if(!tgtepol[0].IsNull()){
779 ntpol[0] = new TColgp_HArray1OfPnt(1,nbnp);
780 BSplCLib::InsertKnots(degree[0],0,
781 tgtepol[0]->Array1(),PLib::NoWeights(),
782 knots[0]->Array1(),mults[0]->Array1(),
784 ntpol[0]->ChangeArray1(),PLib::NoWeights(),
785 nk[0]->ChangeArray1(),nm[0]->ChangeArray1(),
788 if(!tgtepol[2].IsNull()){
789 ntpol[2] = new TColgp_HArray1OfPnt(1,nbnp);
790 BSplCLib::InsertKnots(degree[0],0,
791 tgtepol[2]->Array1(),PLib::NoWeights(),
792 knots[0]->Array1(),mults[0]->Array1(),
794 ntpol[2]->ChangeArray1(),PLib::NoWeights(),
795 nk[0]->ChangeArray1(),nm[0]->ChangeArray1(),
800 for(i = 2; i <= nbnk; i++){
801 if(Abs(dom[1]-nm[0]->Value(i)) < tolk){
808 for(i = 1; i < nbnk; i++){
809 if(Abs(1.-dom[3]-nm[0]->Value(i)) < tolk){
816 Handle(Law_Linear) fu = mklin(ptch->Func(0));
817 ab[0] = Law::MixBnd(degree[1],nk[1]->Array1(),nm[1]->Array1(),fu);
818 fu = mklin(ptch->Func(1));
819 ab[1] = Law::MixBnd(degree[0],nk[0]->Array1(),nm[0]->Array1(),fu);
821 for(i = 0; i<2; i++){
823 ab[i+2] = new TColStd_HArray1OfReal(1,l);
824 for(j = 1; j <= l; j++){
825 ab[i+2]->SetValue(j,1.-ab[i]->Value(j));
828 pq[0] = Law::MixTgt(degree[1],nk[1]->Array1(),nm[1]->Array1(),1,ind[0]);
829 pq[2] = Law::MixTgt(degree[1],nk[1]->Array1(),nm[1]->Array1(),0,ind[2]);
831 pq[1] = Law::MixTgt(degree[0],nk[0]->Array1(),nm[0]->Array1(),0,ind[1]);
832 pq[3] = Law::MixTgt(degree[0],nk[0]->Array1(),nm[0]->Array1(),1,ind[3]);
837 Standard_Real scal = 1.;
838 Law_draw1dcurve(ab[0]->Array1(),nk[1]->Array1(),nm[1]->Array1(),degree[1],tra,scal);
840 Law_draw1dcurve(ab[1]->Array1(),nk[0]->Array1(),nm[0]->Array1(),degree[0],tra,scal);
842 Law_draw1dcurve(ab[2]->Array1(),nk[1]->Array1(),nm[1]->Array1(),degree[1],tra,scal);
844 Law_draw1dcurve(ab[3]->Array1(),nk[0]->Array1(),nm[0]->Array1(),degree[0],tra,scal);
846 Law_draw1dcurve(pq[0]->Array1(),nk[1]->Array1(),nm[1]->Array1(),degree[1],tra,scal);
848 Law_draw1dcurve(pq[2]->Array1(),nk[1]->Array1(),nm[1]->Array1(),degree[1],tra,scal);
850 Law_draw1dcurve(pq[1]->Array1(),nk[0]->Array1(),nm[0]->Array1(),degree[0],tra,scal);
852 Law_draw1dcurve(pq[3]->Array1(),nk[0]->Array1(),nm[0]->Array1(),degree[0],tra,scal);
858 //=======================================================================
859 //function : PerformS0
861 //=======================================================================
863 void GeomFill_ConstrainedFilling::PerformS0()
865 // On construit les poles de S0 par combinaison des poles des bords,
866 // des poles des fonctions ab, des points c selon la formule :
867 // S0(i,j) = ab[0](j)*ncpol[0](i) + ab[1](i)*ncpol[1](j)
868 // + ab[2](j)*ncpol[2](i) + ab[3](i)*ncpol[3](j)
869 // - ab[3](i)*ab[0](j)*c[0] - ab[0](j)*ab[1](i)*c[1]
870 // - ab[1](i)*ab[2](j)*c[2] - ab[2](j)*ab[3](i)*c[3]
872 Standard_Integer i, j;
873 Standard_Integer ni = ncpol[0]->Length();
874 Standard_Integer nj = ncpol[1]->Length();
875 S0 = new TColgp_HArray2OfPnt(1,ni,1,nj);
876 TColgp_Array2OfPnt& ss0 = S0->ChangeArray2();
877 const gp_XYZ& c0 = ptch->Corner(0).Coord();
878 const gp_XYZ& c1 = ptch->Corner(1).Coord();
879 const gp_XYZ& c2 = ptch->Corner(2).Coord();
880 const gp_XYZ& c3 = ptch->Corner(3).Coord();
881 for (i = 1; i <= ni; i++){
882 Standard_Real ab1 = ab[1]->Value(i);
883 Standard_Real ab3 = ab[3]->Value(i);
884 const gp_XYZ& b0 = ncpol[0]->Value(i).Coord();
885 const gp_XYZ& b2 = ncpol[2]->Value(i).Coord();
886 for (j = 1; j <= nj; j++){
887 Standard_Real ab0 = ab[0]->Value(j);
888 Standard_Real ab2 = ab[2]->Value(j);
889 const gp_XYZ& b1 = ncpol[1]->Value(j).Coord();
890 const gp_XYZ& b3 = ncpol[3]->Value(j).Coord();
891 gp_XYZ polij = b0.Multiplied(ab0);
892 gp_XYZ temp = b1.Multiplied(ab1);
894 temp = b2.Multiplied(ab2);
896 temp = b3.Multiplied(ab3);
898 temp = c0.Multiplied(-ab3*ab0);
900 temp = c1.Multiplied(-ab0*ab1);
902 temp = c2.Multiplied(-ab1*ab2);
904 temp = c3.Multiplied(-ab2*ab3);
906 ss0(i,j).SetXYZ(polij);
912 //=======================================================================
913 //function : PerformS1
915 //=======================================================================
917 void GeomFill_ConstrainedFilling::PerformS1()
919 // on construit en temporaire les poles des champs tangents
921 // tgte[ibound](u) - d/dv (S0(u,vbound)) pour ibound = 0 ou 2
922 // tgte[ibound](v) - d/du (S0(ubound,v)) pour ibound = 1 ou 3
923 // sur les bords ou tgte est defini.
925 const TColgp_Array2OfPnt& ss0 = S0->Array2();
926 Standard_Integer l, i, j, k;
927 Standard_Integer ni = ss0.ColLength();
928 Standard_Integer nj = ss0.RowLength();
929 for(i = 0; i <= 3; i++){
930 if(ntpol[i].IsNull()) nt[i] = 0;
933 Standard_Integer nbp = ntpol[i]->Length();
934 Standard_Integer i1=0,i2=0,j1=0,j2=0;
935 Standard_Boolean inci=0;
936 nt[i] = new gp_XYZ[nbp];
939 z = - degree[1]/(nk[1]->Value(2) - nk[1]->Value(1));
940 inci = Standard_True;
941 i1 = 1; i2 = 1; j1 = 1; j2 = 2;
945 z = - degree[0]/(nk[0]->Value(l) - nk[0]->Value(l-1));
946 inci = Standard_False;
947 i1 = ni-1; i2 = ni; j1 = 1; j2 = 1;
951 z = - degree[1]/(nk[1]->Value(l) - nk[1]->Value(l-1));
952 inci = Standard_True;
953 i1 = 1; i2 = 1; j1 = nj-1; j2 = nj;
956 z = - degree[0]/(nk[0]->Value(2) - nk[0]->Value(1));
957 inci = Standard_False;
958 i1 = 1; i2 = 2; j1 = 1; j2 = 1;
961 for(k = 0; k < nbp; k++){
962 nt[i][k] = S0->Value(i1,j1).XYZ();
963 nt[i][k].Multiply(-1.);
964 nt[i][k].Add(S0->Value(i2,j2).XYZ());
965 nt[i][k].Multiply(z);
966 nt[i][k].Add(ntpol[i]->Value(k+1).XYZ());
967 if(inci) { i1++; i2++; }
972 // on calcul les termes correctifs pour le melange.
973 Standard_Real coef0 = degree[0]/(nk[0]->Value(2) - nk[0]->Value(1));
974 Standard_Real coef1 = degree[1]/(nk[1]->Value(2) - nk[1]->Value(1));
975 gp_XYZ vtemp, vtemp0, vtemp1;
977 vtemp0 = nt[0][0].Multiplied(-1.);
978 vtemp0.Add(nt[0][1]);
979 vtemp0.Multiply(coef0);
980 vtemp1 = nt[3][0].Multiplied(-1.);
981 vtemp1.Add(nt[3][1]);
982 vtemp1.Multiply(coef1);
983 vtemp = vtemp0.Added(vtemp1);
988 Standard_Integer ln0 = nk[0]->Length(), lp0 = ncpol[0]->Length();
989 coef0 = degree[0]/(nk[0]->Value(ln0) - nk[0]->Value(ln0 - 1));
990 coef1 = degree[1]/(nk[1]->Value(2) - nk[1]->Value(1));
992 vtemp0 = nt[0][lp0 - 2].Multiplied(-1.);
993 vtemp0.Add(nt[0][lp0 - 1]);
994 vtemp0.Multiply(coef0);
995 vtemp1 = nt[1][0].Multiplied(-1.);
996 vtemp1.Add(nt[1][1]);
997 vtemp1.Multiply(coef1);
998 vtemp = vtemp0.Added(vtemp1);
1002 ln0 = nk[0]->Length(); lp0 = ncpol[0]->Length();
1003 Standard_Integer ln1 = nk[1]->Length(), lp1 = ncpol[1]->Length();
1004 coef0 = degree[0]/(nk[0]->Value(ln0) - nk[0]->Value(ln0 - 1));
1005 coef1 = degree[1]/(nk[1]->Value(ln1) - nk[1]->Value(ln1 - 1));
1007 vtemp0 = nt[2][lp0 - 2].Multiplied(-1.);
1008 vtemp0.Add(nt[2][lp0 - 1]);
1009 vtemp0.Multiply(coef0);
1010 vtemp1 = nt[1][lp1 - 2].Multiplied(-1.);
1011 vtemp1.Add(nt[1][lp1 - 1]);
1012 vtemp1.Multiply(coef1);
1013 vtemp = vtemp0.Added(vtemp1);
1014 vtemp.Multiply(0.5);
1017 ln1 = nk[1]->Length(); lp1 = ncpol[1]->Length();
1018 coef0 = degree[0]/(nk[0]->Value(2) - nk[0]->Value(1));
1019 coef1 = degree[1]/(nk[1]->Value(ln1) - nk[1]->Value(ln1 - 1));
1021 vtemp0 = nt[2][0].Multiplied(-1.);
1022 vtemp0.Add(nt[2][1]);
1023 vtemp0.Multiply(coef0);
1024 vtemp1 = nt[3][lp1 - 2].Multiplied(-1.);
1025 vtemp1.Add(nt[3][lp1 - 1]);
1026 vtemp1.Multiply(coef1);
1027 vtemp = vtemp0.Added(vtemp1);
1028 vtemp.Multiply(0.5);
1032 // On construit les poles de S1 par combinaison des poles des
1033 // champs tangents, des poles des fonctions pq, des duv au coins
1034 // selon la formule :
1035 // S1(i,j) = pq[0](j)*ntpol[0](i) + pq[1](i)*ntpol[1](j)
1036 // + pq[2](j)*ntpol[2](i) + pq[3](i)*ntpol[3](j)
1037 // - pq[3](i)*pq[0](j)*v[0] - pq[0](j)*pq[1](i)*v[1]
1038 // - pq[1](i)*pq[2](j)*v[2] - pq[2](j)*pq[3](i)*v[3]
1039 S1 = new TColgp_HArray2OfPnt(1,ni,1,nj);
1040 TColgp_Array2OfPnt& ss1 = S1->ChangeArray2();
1041 const gp_XYZ& v0 = v[0].XYZ();
1042 const gp_XYZ& v1 = v[1].XYZ();
1043 const gp_XYZ& v2 = v[2].XYZ();
1044 const gp_XYZ& v3 = v[3].XYZ();
1046 for (i = 1; i <= ni; i++){
1047 Standard_Real pq1=0, pq3=0;
1048 if(nt[1]) pq1 = -pq[1]->Value(i);
1049 if(nt[3]) pq3 = pq[3]->Value(i);
1051 if(nt[0]) t0 = nt[0][i-1];
1052 if(nt[2]) t2 = nt[2][i-1];
1053 for (j = 1; j <= nj; j++){
1054 Standard_Real pq0=0, pq2=0;
1055 if(nt[0]) pq0 = pq[0]->Value(j);
1056 if(nt[2]) pq2 = -pq[2]->Value(j);
1058 if(nt[1]) t1 = nt[1][j-1];
1059 if(nt[3]) t3 = nt[3][j-1];
1061 gp_XYZ tpolij(0.,0.,0.), temp;
1063 temp = t0.Multiplied(pq0);
1067 temp = t1.Multiplied(pq1);
1071 temp = t2.Multiplied(pq2);
1075 temp = t3.Multiplied(pq3);
1079 temp = v0.Multiplied(-pq3*pq0);
1083 temp = v1.Multiplied(-pq0*pq1);
1087 temp = v2.Multiplied(-pq1*pq2);
1091 temp = v3.Multiplied(-pq2*pq3);
1094 ss1(i,j).SetXYZ(tpolij);
1099 for(i = 0; i <= 3; i++){
1107 //=======================================================================
1108 //function : PerformSurface
1110 //=======================================================================
1112 void GeomFill_ConstrainedFilling::PerformSurface()
1114 Standard_Integer ni = S0->ColLength(), nj = S0->RowLength(),i,j;
1115 TColgp_Array2OfPnt temp(1,ni,1,nj);
1116 const TColgp_Array2OfPnt& t0 = S0->Array2();
1117 const TColgp_Array2OfPnt& t1 = S1->Array2();
1118 for(i = 1; i <= ni; i++){
1119 for(j = 1; j <= nj; j++){
1120 temp(i,j).SetXYZ(t0(i,j).XYZ().Added(t1(i,j).XYZ()));
1123 surf = new Geom_BSplineSurface(temp,
1124 nk[0]->Array1(),nk[1]->Array1(),
1125 nm[0]->Array1(),nm[1]->Array1(),
1126 degree[0],degree[1]);
1129 //=======================================================================
1130 //function : CheckTgte
1132 //=======================================================================
1134 Standard_Boolean GeomFill_ConstrainedFilling::CheckTgte(const Standard_Integer I)
1136 Handle(GeomFill_Boundary) bou = ptch->Bound(I);
1137 if(!bou->HasNormals()) return Standard_True;
1138 // On prend 13 points le long du bord et on verifie que le triedre
1139 // forme par la tangente a la courbe la normale et la tangente du
1140 // peigne ne change pas d orientation.
1141 Standard_Real ll = 1./12., pmix=0;
1142 for (Standard_Integer iu = 0; iu < 13; iu++){
1143 Standard_Real uu = iu * ll;
1146 bou->D1(uu,pbid,tgte);
1147 gp_Vec norm = bou->Norm(uu);
1148 gp_Vec vfield = tgalg[I]->Value(uu);
1149 if(iu == 0) pmix = vfield.Dot(tgte.Crossed(norm));
1151 Standard_Real pmixcur = vfield.Dot(tgte.Crossed(norm));
1152 if(pmix*pmixcur < 0.) return Standard_False;
1155 return Standard_True;
1158 //=======================================================================
1159 //function : MinTgte
1161 //=======================================================================
1163 void GeomFill_ConstrainedFilling::MinTgte(const Standard_Integer I)
1165 if(!ptch->Bound(I)->HasNormals()) return;
1166 Standard_Real minmag = RealLast();
1167 Standard_Real ll = 0.02;
1168 for (Standard_Integer iu = 0; iu <= 30; iu++){
1169 Standard_Real uu = 0.2 + iu * ll;
1170 gp_Vec vv = tgalg[I]->Value(uu);
1171 Standard_Real temp = vv.SquareMagnitude();
1172 if(temp < minmag) minmag = temp;
1174 mig[I] = sqrt(minmag);
1177 //=======================================================================
1180 //=======================================================================
1182 Standard_Integer GeomFill_ConstrainedFilling::Eval(const Standard_Real W,
1183 const Standard_Integer Ord,
1184 Standard_Real& Result)const
1186 Standard_Real* res = &Result;
1187 Standard_Integer jmp = (3 * ctr[0]);
1191 ptch->Bound(ibound[0])->Value(W).Coord(res[0],res[1],res[2]);
1194 tgalg[ibound[0]]->Value(W).Coord(res[3],res[4],res[5]);
1197 ptch->Bound(ibound[1])->Value(W).Coord(res[jmp],res[jmp+1],res[jmp+2]);
1200 tgalg[ibound[1]]->Value(W).Coord(res[jmp+3],res[jmp+4],res[jmp+5]);
1207 ptch->Bound(ibound[0])->D1(W,pt,vt);
1208 vt.Coord(res[0],res[1],res[2]);
1211 tgalg[ibound[0]]->D1(W).Coord(res[3],res[4],res[5]);
1214 ptch->Bound(ibound[1])->D1(W,pt,vt);
1215 vt.Coord(res[jmp],res[jmp+1],res[jmp+2]);
1218 tgalg[ibound[1]]->D1(W).Coord(res[jmp+3],res[jmp+4],res[jmp+5]);
1225 //=======================================================================
1226 //function : CheckCoonsAlgPatch
1228 //=======================================================================
1230 void GeomFill_ConstrainedFilling::CheckCoonsAlgPatch(const Standard_Integer I)
1232 Standard_Integer nbp = 30;
1233 Standard_Real uu=0,duu=0,vv=0,dvv=0,ww=0,dww=0,u1,u2,v1,v2;
1234 surf->Bounds(u1,u2,v1,v2);
1235 Standard_Boolean enu = Standard_False;
1240 duu = dww = (u2 - u1)/nbp;
1246 dvv = dww = (v2 - v1)/nbp;
1248 enu = Standard_True;
1253 duu = dww = (u2 - u1)/nbp;
1259 dvv = dww = (v2 - v1)/nbp;
1261 enu = Standard_True;
1266 Handle(GeomFill_Boundary) bou = ptch->Bound(I);
1267 for (Standard_Integer k = 0; k <= nbp; k++){
1268 pbound = bou->Value(ww);
1269 if(enu) vptch = ptch->D1U(uu,vv);
1270 else vptch = ptch->D1V(uu,vv);
1273 Handle(Draw_Segment3D) seg;
1274 pp = pbound.Translated(vptch);
1275 seg = new Draw_Segment3D(pbound,pp,Draw_jaune);
1284 //=======================================================================
1285 //function : CheckTgteField
1287 //=======================================================================
1289 void GeomFill_ConstrainedFilling::CheckTgteField(const Standard_Integer I)
1291 if(tgalg[I].IsNull()) return;
1298 Standard_Boolean caplisse = 0;
1299 Standard_Real maxang = 0.,pmix=0,pmixcur;
1300 Handle(GeomFill_Boundary) bou = ptch->Bound(I);
1301 for (Standard_Integer iu = 0; iu <= 30; iu++){
1302 Standard_Real uu = iu/30.;
1304 gp_Vec vtg = tgalg[I]->Value(uu);
1305 gp_Vec vnor = bou->Norm(uu);
1306 gp_Vec vcros = d1.Crossed(vnor);
1308 if(iu == 0) pmix = vtg.Dot(vcros);
1310 pmixcur = vtg.Dot(vcros);
1311 if(pmix*pmixcur < 0.) caplisse = 1;
1314 Handle(Draw_Segment3D) seg;
1315 p2 = p1.Translated(vtg);
1316 seg = new Draw_Segment3D(p1,p2,Draw_blanc);
1318 p2 = p1.Translated(vnor);
1319 seg = new Draw_Segment3D(p1,p2,Draw_rouge);
1321 p2 = p1.Translated(vcros);
1322 seg = new Draw_Segment3D(p1,p2,Draw_jaune);
1325 if(vnor.Magnitude() > 1.e-15 && vtg.Magnitude() > 1.e-15){
1326 Standard_Real alpha = Abs(M_PI/2.-Abs(vnor.Angle(vtg)));
1327 if(Abs(alpha) > maxang) maxang = Abs(alpha);
1330 cout<<"KAlgo angle max sur bord "<<I<<" : "<<maxang<<endl;
1331 if(caplisse) cout<<"sur bord "<<I<<" le champ tangent change de cote!"<<endl;
1335 //=======================================================================
1336 //function : CheckApprox
1338 //=======================================================================
1340 void GeomFill_ConstrainedFilling::CheckApprox(const Standard_Integer I)
1342 Standard_Boolean donor = !tgalg[I].IsNull();
1343 Standard_Integer nbp = 30;
1344 Standard_Real maxang = 0., maxdist = 0.;
1345 gp_Pnt pbound, papp, pbid;
1346 gp_Vec vbound, vapp;
1347 Handle(GeomFill_Boundary) bou = ptch->Bound(I);
1348 for (Standard_Integer iu = 0; iu <= nbp; iu++){
1349 Standard_Real uu = iu;
1351 pbound = bou->Value(uu);
1352 BSplCLib::D0(uu,0,degree[I%2],0,ncpol[I]->Array1(),BSplCLib::NoWeights(),
1353 nk[I%2]->Array1(),nm[I%2]->Array1(),papp);
1355 BSplCLib::D0(uu,0,degree[I%2],0,ntpol[I]->Array1(),BSplCLib::NoWeights(),
1356 nk[I%2]->Array1(),nm[I%2]->Array1(),pbid);
1357 vapp.SetXYZ(pbid.XYZ());
1358 vbound = bou->Norm(uu);
1359 if(vapp.Magnitude() > 1.e-15 && vbound.Magnitude() > 1.e-15){
1360 Standard_Real alpha = Abs(M_PI/2.-Abs(vbound.Angle(vapp)));
1361 if(Abs(alpha) > maxang) maxang = Abs(alpha);
1364 Handle(Draw_Segment3D) seg;
1366 pp = pbound.Translated(vbound);
1367 seg = new Draw_Segment3D(pbound,pp,Draw_blanc);
1369 pp = papp.Translated(vapp);
1370 seg = new Draw_Segment3D(papp,pp,Draw_rouge);
1374 if(papp.Distance(pbound) > maxdist) maxdist = papp.Distance(pbound);
1376 cout<<"Controle approx/contrainte sur bord "<<I<<" : "<<endl;
1377 cout<<"Distance max : "<<maxdist<<endl;
1379 maxang = maxang*180./M_PI;
1380 cout<<"Angle max : "<<maxang<<" deg"<<endl;
1385 //=======================================================================
1386 //function : CheckResult
1388 //=======================================================================
1390 void GeomFill_ConstrainedFilling::CheckResult(const Standard_Integer I)
1392 Standard_Boolean donor = !tgalg[I].IsNull();
1393 Standard_Real maxang = 0., maxdist = 0.;
1394 Standard_Real uu=0,duu=0,vv=0,dvv=0,ww=0,dww=0,u1,u2,v1,v2;
1395 surf->Bounds(u1,u2,v1,v2);
1400 duu = dww = (u2 - u1)/30;
1406 dvv = dww = (v2 - v1)/30;
1412 duu = dww = (u2 - u1)/30;
1418 dvv = dww = (v2 - v1)/30;
1422 gp_Pnt pbound[31],pres[31];
1423 gp_Vec vbound[31],vres[31];
1425 Standard_Real ang[31];
1426 Standard_Boolean hasang[31];
1428 Handle(GeomFill_Boundary) bou = ptch->Bound(I);
1429 Standard_Integer k ;
1430 for ( k = 0; k <= 30; k++){
1431 pbound[k] = bou->Value(ww);
1432 if(!donor) surf->D0(uu,vv,pres[k]);
1434 vbound[k] = bou->Norm(ww);
1436 surf->D1(uu,vv,pres[k],V1,V2);
1437 vres[k] = V1.Crossed(V2);
1438 if(vres[k].Magnitude() > 1.e-15 && vbound[k].Magnitude() > 1.e-15){
1439 Standard_Real alpha = Abs(vres[k].Angle(vbound[k]));
1440 alpha = Min(alpha,Abs(M_PI-alpha));
1441 if(alpha > maxang) maxang = alpha;
1451 if(pres[k].Distance(pbound[k]) > maxdist) maxdist = pres[k].Distance(pbound[k]);
1456 cout<<"Controle resultat/contrainte sur bord "<<I<<" : "<<endl;
1457 cout<<"Distance max : "<<maxdist<<endl;
1459 Standard_Real angdeg = maxang*180./M_PI;
1460 cout<<"Angle max : "<<angdeg<<" deg"<<endl;
1463 Standard_Boolean scale = maxang>1.e-10;
1464 for (k = 0; k <= 30; k++){
1467 Handle(Draw_Segment3D) seg;
1468 vbound[k].Normalize();
1469 if(scale) vbound[k].Multiply(1.+3.*ang[k]/maxang);
1470 vbound[k].Multiply(drawfac);
1471 pp = pbound[k].Translated(vbound[k]);
1472 seg = new Draw_Segment3D(pbound[k],pp,Draw_blanc);
1474 vres[k].Normalize();
1475 if(scale) vres[k].Multiply(1.+3.*ang[k]/maxang);
1476 vres[k].Multiply(drawfac);
1477 pp = pres[k].Translated(vres[k]);
1478 seg = new Draw_Segment3D(pres[k],pp,Draw_rouge);