0024129: Eliminate remaining compiler warnings in MSVC++ 2008 32 bit with warning...
[occt.git] / src / GeomFill / GeomFill_SweepSectionGenerator.cxx
1 // Created on: 1994-02-28
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22 #include <GeomFill_SweepSectionGenerator.ixx>
23
24 #include <GeomFill_Profiler.hxx>
25
26 #include <gp_Dir.hxx>
27 #include <gp_Vec.hxx>
28 #include <gp_Trsf.hxx>
29 #include <gp_Pnt.hxx>
30 #include <gp_Ax3.hxx>
31 #include <gp_Ax2.hxx>
32 #include <Geom_TrimmedCurve.hxx>
33 #include <Geom_Circle.hxx>
34 #include <GeomConvert.hxx>
35 #include <Precision.hxx>
36 #include <ElCLib.hxx>
37 #include <GeomAdaptor.hxx>
38 #include <GeomAdaptor_Curve.hxx>
39 #include <GCPnts_QuasiUniformDeflection.hxx>
40 #include <TColStd_Array1OfReal.hxx>
41
42 #include <stdio.h>
43
44 #ifdef DRAW
45 #include <DrawTrSurf.hxx>
46 #endif
47 #ifdef DEB
48 static Standard_Boolean Affich     = Standard_False;
49 static Standard_Integer NbSECTIONS = 0;
50 #endif
51 //#define GF_DEB
52 //=======================================================================
53 //function : GeomFill_SweepSectionGenerator
54 //purpose  : 
55 //=======================================================================
56
57 GeomFill_SweepSectionGenerator::GeomFill_SweepSectionGenerator()
58 {
59   myIsDone = Standard_False;
60 }
61
62
63 //=======================================================================
64 //function : GeomFill_SweepSectionGenerator
65 //purpose  : 
66 //=======================================================================
67
68 GeomFill_SweepSectionGenerator::GeomFill_SweepSectionGenerator
69   (const Handle(Geom_Curve)& Path,
70    const Standard_Real       Radius)
71 {
72   Init(Path,Radius);
73 }
74
75
76 //=======================================================================
77 //function : GeomFill_SweepSectionGenerator
78 //purpose  : 
79 //=======================================================================
80
81 GeomFill_SweepSectionGenerator::GeomFill_SweepSectionGenerator
82   (const Handle(Geom_Curve)& Path,
83    const Handle(Geom_Curve)& FirstSect)
84 {
85   Init(Path,FirstSect);
86 }
87
88
89 //=======================================================================
90 //function : GeomFill_SweepSectionGenerator
91 //purpose  : 
92 //=======================================================================
93
94 GeomFill_SweepSectionGenerator::GeomFill_SweepSectionGenerator
95   (const Handle(Geom_Curve)& Path,
96    const Handle(Geom_Curve)& FirstSect,
97    const Handle(Geom_Curve)& LastSect  )
98 {
99   Init(Path,FirstSect,LastSect);
100 }
101
102
103 //=======================================================================
104 //function : GeomFill_SweepSectionGenerator
105 //purpose  : 
106 //=======================================================================
107
108 GeomFill_SweepSectionGenerator::GeomFill_SweepSectionGenerator
109   (const Handle(Adaptor3d_HCurve)& Path,
110    const Handle(Adaptor3d_HCurve)& Curve1,
111    const Handle(Adaptor3d_HCurve)& Curve2,
112    const Standard_Real       Radius)
113 {
114   Init(Path,Curve1,Curve2,Radius);
115 }
116
117
118 //=======================================================================
119 //function : Init
120 //purpose  : 
121 //=======================================================================
122
123 void GeomFill_SweepSectionGenerator::Init(const Handle(Geom_Curve)& Path,
124                                           const Standard_Real       Radius)
125 {
126   myIsDone = Standard_False;
127   myRadius = Radius;
128   GeomAdaptor_Curve ThePath(Path);
129
130   if (ThePath.GetType() == GeomAbs_Circle) {
131     
132     myCircPathAxis = ThePath.Circle().Axis();
133     myType = 4;
134   }
135   else myType = 1;
136   if ( Path->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
137     myPath = Handle(Geom_BSplineCurve)::DownCast(Path->Copy());
138   }
139   else {
140     myPath = GeomConvert::CurveToBSplineCurve(Path);
141   }
142 }
143
144
145 //=======================================================================
146 //function : Init
147 //purpose  : 
148 //=======================================================================
149 void GeomFill_SweepSectionGenerator::Init
150   (const Handle(Geom_Curve)& Path,
151    const Handle(Geom_Curve)& FirstSect)
152 {
153   myIsDone = Standard_False;
154   myRadius = 0; 
155   GeomAdaptor_Curve ThePath(Path);
156
157   if (ThePath.GetType() == GeomAbs_Circle) {    
158     myCircPathAxis = ThePath.Circle().Axis();
159     myType = 5;
160   }
161
162   else  myType   = 2;
163   
164   if ( Path->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
165     myPath = Handle(Geom_BSplineCurve)::DownCast(Path->Copy());
166   }
167   else {
168     myPath = GeomConvert::CurveToBSplineCurve(Path);
169   }
170   if ( FirstSect->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
171       myFirstSect = Handle(Geom_BSplineCurve)::DownCast(FirstSect->Copy());
172     }
173   else {
174     // JAG
175     myFirstSect = GeomConvert::CurveToBSplineCurve(FirstSect,
176                                                    Convert_QuasiAngular);
177   }
178   if ( myFirstSect->IsPeriodic()) myFirstSect->SetNotPeriodic();
179 }
180
181
182 //=======================================================================
183 //function : Init
184 //purpose  : 
185 //=======================================================================
186
187 void GeomFill_SweepSectionGenerator::Init
188   (const Handle(Geom_Curve)& Path,
189    const Handle(Geom_Curve)& FirstSect,
190    const Handle(Geom_Curve)& LastSect  )
191 {
192   myIsDone = Standard_False;
193   myRadius = 0;
194   GeomAdaptor_Curve ThePath(Path);
195
196   if (ThePath.GetType() == GeomAbs_Circle) {
197     
198     myCircPathAxis = ThePath.Circle().Axis();
199     myType = 6;
200   }
201   else myType   = 3;
202   
203   if ( Path->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
204     myPath = Handle(Geom_BSplineCurve)::DownCast(Path->Copy());
205   }
206   else {
207     myPath = GeomConvert::CurveToBSplineCurve(Path);
208   }
209   
210   // JAG
211   if ( FirstSect->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
212       myFirstSect = Handle(Geom_BSplineCurve)::DownCast(FirstSect->Copy());
213     }
214   else {
215     myFirstSect = GeomConvert::CurveToBSplineCurve(FirstSect,
216                                                    Convert_QuasiAngular);
217   }
218   if ( LastSect->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
219       myLastSect = Handle(Geom_BSplineCurve)::DownCast(LastSect->Copy());
220     }
221   else {
222     myLastSect = GeomConvert::CurveToBSplineCurve(LastSect,
223                                                    Convert_QuasiAngular);
224   }
225
226   if ( myFirstSect->IsPeriodic()) myFirstSect->SetNotPeriodic();
227   if ( myLastSect->IsPeriodic()) myLastSect->SetNotPeriodic();
228
229
230   // JAG
231
232   GeomFill_Profiler Profil;
233   Profil.AddCurve(myFirstSect);
234   Profil.AddCurve(myLastSect);
235   Profil.Perform(Precision::Confusion());
236   
237   myFirstSect = Handle(Geom_BSplineCurve)::DownCast(Profil.Curve(1));
238   myLastSect  = Handle(Geom_BSplineCurve)::DownCast(Profil.Curve(2));
239 }
240
241
242 //=======================================================================
243 //function : Init
244 //purpose  : 
245 //=======================================================================
246
247 void GeomFill_SweepSectionGenerator::Init
248   (const Handle(Adaptor3d_HCurve)& Path,
249    const Handle(Adaptor3d_HCurve)& Curve1,
250    const Handle(Adaptor3d_HCurve)& Curve2,
251    const Standard_Real       Radius)
252 {
253   myIsDone = Standard_False;
254   myRadius = Radius;
255   myType   = 0;
256
257   Handle(Geom_Curve) CC = GeomAdaptor::MakeCurve(Path->Curve());
258   myPath         = GeomConvert::CurveToBSplineCurve(CC);
259   myAdpPath      = Path;
260   myAdpFirstSect = Curve1;
261   myAdpLastSect  = Curve2;
262 }
263
264
265 //=======================================================================
266 //function : Perform
267 //purpose  : 
268 //=======================================================================
269
270 void GeomFill_SweepSectionGenerator::Perform(const Standard_Boolean Polynomial)
271 {
272   myPolynomial = Polynomial;
273
274   // eval myNbSections.
275   Standard_Integer NSpans = myPath->NbKnots()-1;
276
277   myNbSections = 21 * NSpans;
278
279   Standard_Real U;
280
281   Standard_Real U1 = myPath->FirstParameter();
282   Standard_Real U2 = myPath->LastParameter();
283   
284   GCPnts_QuasiUniformDeflection Samp;
285   // Calcul de la longueur approximative de la courbe
286   GeomAdaptor_Curve AdpPath(myPath);
287   gp_Pnt P1 = AdpPath.Value(U1);
288   gp_Pnt P2 = AdpPath.Value((U1+U2)/2.);
289   gp_Pnt P3 = AdpPath.Value(U2);
290   Standard_Real Length = 
291     P1.Distance(P2) + P2.Distance(P3);
292   Standard_Real Fleche = 1.e-5 * Length;
293   Samp.Initialize(AdpPath,Fleche);
294
295   if ( Samp.IsDone() && (Samp.NbPoints() > myNbSections) ) {
296     myNbSections = Samp.NbPoints();
297   }
298   // the transformations are calculate on differents points of <myPath>
299   // corresponding to the path parameter uniformly reparted.
300   Standard_Real DeltaU = (U2-U1)/(Standard_Real)(myNbSections-1);
301   TColStd_Array1OfReal Parameters(1,myNbSections);
302 //  Parameters(1) = U1;
303 //  for (Standard_Integer i = 2; i < myNbSections; i++) {
304 //    Parameters(i) = U1 + (i-1) * DeltaU;
305 //  }
306 //  Parameters(myNbSections) = U2;
307   
308   Parameters(1) = 0.;
309   for (Standard_Integer i = 2; i < myNbSections; i++) {
310     Parameters(i) = (i-1) * DeltaU;
311   }
312   Parameters(myNbSections) = U2 - U1;
313
314   gp_Vec D1Ref, D1;
315   gp_Pnt PRef , P; 
316   gp_Trsf TR, cumulTR, Trans;
317
318   myPath->D1( U1, PRef, D1Ref); 
319
320   if ( ( myType == 1) || (myType == 4) ) {
321     // We create a circle with radius <myRadius>. This axis is create with
322     // main direction <DRef> (first derivate vector of <myPath> on the first
323     // point <PRef> ). This circle is, after transform to BSpline curve, 
324     // put in <myFirstSect>.
325                               
326     gp_Ax2 CircleAxis (PRef,D1Ref);
327 /*
328     Handle(Geom_Circle) Circ = new Geom_Circle( CircleAxis, myRadius); 
329     
330     myFirstSect = GeomConvert::CurveToBSplineCurve(Circ);
331     // le cercle est segmente car AppBlend_AppSurf ne gere
332     // pas les courbes periodiques.
333     myFirstSect->Segment(0., 2.*M_PI);
334 */
335     Handle(Geom_TrimmedCurve) Circ = 
336       new Geom_TrimmedCurve(new Geom_Circle( CircleAxis, myRadius), 
337                             0., 2.*M_PI); 
338     
339     myFirstSect = GeomConvert::CurveToBSplineCurve(Circ,Convert_QuasiAngular);
340   }
341   
342   if (myType <= 3 && myType >=1 ) {
343     
344     for (Standard_Integer i = 2; i <= myNbSections; i++) {
345
346       U = Parameters(i) + U1;
347       if (i == myNbSections) U = U2;
348
349       myPath->D1( U, P, D1);
350     
351       // Eval the translation between the (i-1) section and the i-th.
352       Trans.SetTranslation(PRef, P);
353
354       gp_Trsf Rot;
355       if (! D1Ref.IsParallel(D1, Precision::Angular())) {
356         // Eval the Rotation between (i-1) section and the i-th.
357         Rot.SetRotation(gp_Ax1(P, gp_Dir(D1Ref^D1)), 
358                         D1Ref.AngleWithRef(D1, D1Ref^D1));
359       }
360       else
361         if (D1Ref.IsOpposite(D1, Precision::Angular()))
362           cout <<"Que fais-je ???? " << endl;
363
364       // TR is the transformation between (i-1) section and the i-th.
365       TR = Rot * Trans;
366       // cumulTR is the transformation between <myFirstSec> and 
367       // the i-th section.
368       cumulTR = TR * cumulTR;
369
370       myTrsfs.Append(cumulTR);
371       
372       PRef = P;
373       D1Ref = D1;
374     }
375   }
376   else if ( myType != 0) { 
377     for (Standard_Integer i = 2; i<= myNbSections; i++) {
378       cumulTR.SetRotation(myCircPathAxis, Parameters(i));
379       myTrsfs.Append(cumulTR);      
380     }
381   }
382     
383   myIsDone = Standard_True;
384 }
385
386 //=======================================================================
387 //function : GetShape
388 //purpose  : 
389 //=======================================================================
390
391 void GeomFill_SweepSectionGenerator::GetShape
392   (Standard_Integer& NbPoles,
393    Standard_Integer& NbKnots,
394    Standard_Integer& Degree,
395    Standard_Integer& NbPoles2d) const 
396 {
397 /* 
398  if ( myType == 1) {
399     NbPoles   = 7;
400     NbKnots   = 4;
401     Degree    = 2;
402   }
403   else {
404 */
405   if ( myType != 0) {
406     NbPoles = myFirstSect->NbPoles();
407     NbKnots = myFirstSect->NbKnots();
408     Degree  = myFirstSect->Degree();
409   }
410   else { // myType == 0
411     NbPoles   = 7;
412     NbKnots   = 2;
413     Degree    = 6;
414   }
415   NbPoles2d = 0;
416 }
417
418
419 //=======================================================================
420 //function : Knots
421 //purpose  : 
422 //=======================================================================
423
424 void GeomFill_SweepSectionGenerator::Knots(TColStd_Array1OfReal& TKnots) const 
425 {
426 /*
427   if (myType == 1) {
428     Standard_Real U = 2.*M_PI/3.;
429     for ( Standard_Integer i = 1; i <= 4; i++) 
430       TKnots(i) = ( i-1) * U;
431   }
432   else {
433 */
434   if (myType !=0) {
435     myFirstSect->Knots(TKnots);
436   }
437   else {
438     TKnots(1) = 0.;
439     TKnots(2) = 1.;
440   }
441 //  }
442 }
443
444
445 //=======================================================================
446 //function : Mults
447 //purpose  : 
448 //=======================================================================
449
450 void GeomFill_SweepSectionGenerator::Mults(TColStd_Array1OfInteger& TMults)
451   const 
452 {
453 /*
454   if ( myType == 1) {
455     TMults( 1) = TMults( 4) = 3;
456     TMults( 2) = TMults( 3) = 2;
457   }
458   else {
459 */
460   if ( myType != 0) {
461     myFirstSect->Multiplicities(TMults);
462   }
463   else {
464     TMults( 1) = TMults( 2) = 7;
465   }
466 //  }
467 }
468
469
470 //=======================================================================
471 //function : Section
472 //purpose  : 
473 //=======================================================================
474
475 Standard_Boolean GeomFill_SweepSectionGenerator::Section
476   (const Standard_Integer      P,
477          TColgp_Array1OfPnt&   Poles, 
478          TColgp_Array1OfVec&   DPoles,
479          TColgp_Array1OfPnt2d& Poles2d,
480          TColgp_Array1OfVec2d& , //DPoles2d,
481          TColStd_Array1OfReal& Weigths,
482          TColStd_Array1OfReal& DWeigths
483    ) const 
484 {
485   Section( P, Poles, Poles2d, Weigths);
486
487   // pour les tuyaux sur aretes pour l'instant on ne calcule pas les derivees
488   if ( myType == 0 ) return Standard_False; // a voir pour mieux.
489
490   // calcul des derivees sur la surface
491   // on calcule les derivees en approximant le path au voisinage du point
492   // P(u) par le cercle osculateur au path .
493
494   // calcul du cercle osculateur.
495
496   Standard_Real U;
497   if ( P == 1) {
498     U = myPath->FirstParameter();
499   }
500   else if ( P == myNbSections ) {
501     U = myPath->LastParameter();
502   }
503   else
504     return Standard_False;
505     
506   gp_Vec D1, D2;
507   gp_Pnt Pt;
508
509   myPath->D2(U,Pt,D1,D2);
510   Standard_Real l = D1.Magnitude();
511   
512   if ( l < Epsilon(1.))
513     return Standard_False;
514
515   gp_Dir T = D1;
516   Standard_Real m = D2.Dot(T);
517   gp_Vec D = D2 - m * T;
518   Standard_Real c = D.Magnitude() / (l*l);
519   
520   if ( c < Epsilon(1.)) { 
521     // null curvature : equivalent to a translation of the section 
522     for (Standard_Integer i = 1; i <= myFirstSect->NbPoles(); i++) {
523       DPoles(i) = D1;
524     }    
525   }
526   else {
527     gp_Dir N = D;
528     gp_Pnt Q = Pt.Translated( (1./c) * gp_Vec(N));
529     Standard_Real x, y;
530     gp_Vec V;
531     for ( Standard_Integer i = 1; i <= myFirstSect->NbPoles(); i++) {
532       V = gp_Vec(Q, Poles(i));
533       x = V * gp_Vec(T);
534       y = V * gp_Vec(N);
535       DPoles(i) = x * gp_Vec(N) - y * gp_Vec(T);
536       if ( DPoles(i).Magnitude() > Epsilon(1.)) {
537         DPoles(i).Normalize();
538         DPoles(i) *= Sqrt( x*x + y*y);
539       }
540     }
541   }
542   
543   for ( Standard_Integer i = 1; i <= myFirstSect->NbPoles(); i++) {
544     DWeigths(i) = 0.;
545   }
546   
547   return Standard_True;
548 }
549
550
551 //=======================================================================
552 //function : Section
553 //purpose  : 
554 //=======================================================================
555
556 void GeomFill_SweepSectionGenerator::Section
557   (const Standard_Integer      P,
558          TColgp_Array1OfPnt&   Poles,
559          TColgp_Array1OfPnt2d& , //Poles2d, 
560          TColStd_Array1OfReal& Weigths) const 
561 {
562   if (myType != 0) {
563     myFirstSect->Poles(Poles);
564     myFirstSect->Weights(Weigths);
565     gp_Trsf cumulTR;
566     if (P > 1) {
567       cumulTR = myTrsfs(P - 1); 
568       // <cumulTR> transform <myFirstSect> to the P ieme Section. In fact
569       // each points of the array <poles> will be transformed.
570       
571       if ( (myType == 3 ) || (myType == 6) ){
572         for (Standard_Integer i = 1; i <= myFirstSect->NbPoles(); i++) {
573           Poles(i).SetXYZ( (myNbSections - P) * myFirstSect->Pole(i).XYZ() +
574                           (P - 1) * myLastSect->Pole(i).XYZ() );
575           Poles(i).SetXYZ( Poles(i).XYZ() / (myNbSections - 1));
576           
577           Weigths(i) = (myNbSections - P) * myFirstSect->Weight(i) +
578             (P - 1) * myLastSect->Weight(i);
579           Weigths(i) /= myNbSections - 1;
580         }
581       }
582       
583       for (Standard_Integer i = 1; i<=Poles.Length(); i++)
584         Poles(i).Transform(cumulTR);
585     }
586 #ifdef DRAW
587     if ( Affich) {
588 //POP pour NT
589 //      char name[100];
590       char* name = new char[100];
591       sprintf(name,"SECTION_%d",++NbSECTIONS);
592       DrawTrSurf::Set(name,myFirstSect->Transformed(cumulTR));
593     }
594 #endif
595   }
596   else {
597
598     Standard_Real Coef = (P -1. ) / ( myNbSections - 1.);
599     Standard_Real U = 
600       ( 1- Coef) * myAdpPath->FirstParameter() +
601         Coef     * myAdpPath->LastParameter();
602
603     gp_Pnt PPath = myAdpPath->Value(U);
604     
605     Standard_Real Alpha = U - myAdpPath->FirstParameter();
606     Alpha /= myAdpPath->LastParameter() - myAdpPath->FirstParameter();
607     
608     Standard_Real U1 = 
609       ( 1- Alpha) * myAdpFirstSect->FirstParameter() +
610         Alpha     * myAdpFirstSect->LastParameter();
611     
612     gp_Pnt P1 = myAdpFirstSect->Value(U1);
613     
614     Standard_Real U2 = 
615       ( 1- Alpha) * myAdpLastSect->FirstParameter() +
616         Alpha     * myAdpLastSect->LastParameter();
617     
618     gp_Pnt P2 = myAdpLastSect->Value(U2);
619     
620     gp_Ax2 Axis;
621     Standard_Real Angle;
622     if ( P1.Distance(P2) < Precision::Confusion()) {
623       Angle = 0.;
624     }
625     else {
626       Axis = gp_Ax2(PPath, 
627                     gp_Vec(PPath,P1) ^ gp_Vec(PPath,P2),
628                     gp_Vec(PPath,P1));
629       Angle = ElCLib::CircleParameter(Axis,P2);
630     }
631 #ifdef GF_DEB
632     if (Standard_False) {
633       gp_Vec dummyD1 = myAdpPath->DN(U,1);
634       gp_Vec dummyTg = Axis.Direction();
635       Standard_Real Cos = dummyD1.Dot(dummyTg);
636       if ( Cos > 0.) cout << "+" ;
637       else           cout << "-" ;
638     }
639 #endif
640     if ( Angle < Precision::Angular()) {
641       for ( Standard_Integer i = 1; i <= Poles.Upper(); i++) {
642         Poles(i) = P1;
643         Weigths(i) = 1;
644       }
645     }
646     else {
647       Handle(Geom_Circle) Circ =
648         new Geom_Circle( Axis, myRadius);
649       Handle(Geom_TrimmedCurve) CT = 
650         new Geom_TrimmedCurve(Circ, 0., Angle);
651       Handle(Geom_BSplineCurve) BS;
652       if ( myPolynomial) 
653         BS = GeomConvert::CurveToBSplineCurve( CT, Convert_Polynomial);
654       else 
655         BS = GeomConvert::CurveToBSplineCurve( CT, Convert_QuasiAngular);
656
657 #ifdef DRAW
658       if ( Affich) {
659 // POP pour NT
660 //      char name[100];
661         char* name = new char[100];
662         sprintf(name,"SECTION_%d",++NbSECTIONS);
663         DrawTrSurf::Set(name,BS);
664       }
665 #endif
666       
667       BS->Poles(Poles);
668       BS->Weights(Weigths);
669     }
670   }
671 }
672
673 //=======================================================================
674 //function : Transformation
675 //purpose  : 
676 //=======================================================================
677 const gp_Trsf& GeomFill_SweepSectionGenerator::Transformation
678   (const Standard_Integer Index) const 
679 {
680   if (Index > myTrsfs.Length())
681     Standard_RangeError::Raise
682       ("GeomFill_SweepSectionGenerator::Transformation");
683   
684   return myTrsfs(Index);
685 }
686
687
688 //=======================================================================
689 //function : Parameter
690 //purpose  : 
691 //=======================================================================
692
693 Standard_Real GeomFill_SweepSectionGenerator::Parameter
694   (const Standard_Integer P) const
695 {
696   if (P == 1) {
697     return myPath->FirstParameter();
698   }
699   else if (P == myNbSections) {
700     return myPath->LastParameter();
701   }
702   else {
703     Standard_Real U1 = myPath->FirstParameter();
704     Standard_Real U2 = myPath->LastParameter();
705     Standard_Real prm = ((myNbSections-P)*U1 + (P-1)*U2)/
706       (Standard_Real)(myNbSections-1);
707     return prm;
708   }
709 }