2 // Created: Mon Aug 28 16:32:43 1995
3 // Author: Laurent BOURESCHE
5 // Modified: 28/02/1996 by PMN : HermiteCoefficients added
6 // Modified: 18/06/1996 by PMN : NULL reference.
7 // Modified: 19/02/1997 by JCT : EvalPoly2Var added
10 #include <PLib_LocalArray.hxx>
11 #include <math_Matrix.hxx>
12 #include <math_Gauss.hxx>
13 #include <Standard_ConstructionError.hxx>
14 #include <GeomAbs_Shape.hxx>
16 // To convert points array into Real ..
17 // *********************************
19 #define Dimension_gen 2
20 #define Array1OfPoints TColgp_Array1OfPnt2d
21 #define Point gp_Pnt2d
23 #include <PLib_ChangeDim.gxx>
29 #define Dimension_gen 3
30 #define Array1OfPoints TColgp_Array1OfPnt
33 #include <PLib_ChangeDim.gxx>
39 #include <math_Gauss.hxx>
47 BinomAllocator (const Standard_Integer theMaxBinom)
49 myMaxBinom (theMaxBinom)
51 Standard_Integer i, im1, ip1, id2, md2, md3, j, k;
52 Standard_Integer np1 = myMaxBinom + 1;
53 myBinom = new Standard_Integer*[np1];
54 myBinom[0] = new Standard_Integer[1];
56 for (i = 1; i < np1; ++i)
64 myBinom[i] = new Standard_Integer[ip1];
66 for (j = 0; j < id2; ++j)
68 myBinom[i][j] = k + myBinom[im1][j];
72 if (j > md2) j = im1 - j;
73 myBinom[i][id2] = k + myBinom[im1][j];
75 for (j = ip1 - md3; j < ip1; j++)
77 myBinom[i][j] = myBinom[i][i - j];
86 for (Standard_Integer i = 0; i <= myMaxBinom; ++i)
93 Standard_Real Value (const Standard_Integer N,
94 const Standard_Integer P) const
96 Standard_OutOfRange_Raise_if (N > myMaxBinom,
97 "PLib, BinomAllocator: requested degree is greater than maximum supported");
98 return Standard_Real (myBinom[N][P]);
102 Standard_Integer** myBinom;
103 Standard_Integer myMaxBinom;
109 // we do not call BSplCLib here to avoid Cyclic dependency detection by WOK
110 //static BinomAllocator THE_BINOM (BSplCLib::MaxDegree() + 1);
111 static BinomAllocator THE_BINOM (25 + 1);
114 //=======================================================================
117 //=======================================================================
119 Standard_Real PLib::Bin(const Standard_Integer N,
120 const Standard_Integer P)
122 return THE_BINOM.Value (N, P);
125 //=======================================================================
126 //function : RationalDerivative
128 //=======================================================================
130 void PLib::RationalDerivative(const Standard_Integer Degree,
131 const Standard_Integer DerivativeRequest,
132 const Standard_Integer Dimension,
134 Standard_Real& RDers,
135 const Standard_Boolean All)
138 // Our purpose is to compute f = (u/v) derivated N = DerivativeRequest times
141 // Let C(N,P) be the binomial
146 // u = SUM C (q,p) f v
153 // (q) ( (q) (p) (q-p) )
154 // f = (1/v) ( u - SUM C (q,p) f v )
158 // make arrays for the binomial since computing it each time could raise a performance
160 // As oppose to the method below the <Der> array is organized in the following
163 // u (1) u (2) .... u (Dimension) v (1)
166 // u (1) u (2) .... u (Dimension) v (1)
168 // ............................................
170 // (Degree) (Degree) (Degree) (Degree)
171 // u (1) u (2) .... u (Dimension) v (1)
174 Standard_Real Inverse;
175 Standard_Real *PolesArray = &Ders;
176 Standard_Real *RationalArray = &RDers;
177 Standard_Real Factor ;
178 Standard_Integer ii, Index, OtherIndex, Index1, Index2, jj;
179 PLib_LocalArray binomial_array;
180 PLib_LocalArray derivative_storage;
181 if (Dimension == 3) {
182 Standard_Integer DeRequest1 = DerivativeRequest + 1;
183 Standard_Integer MinDegRequ = DerivativeRequest;
184 if (MinDegRequ > Degree) MinDegRequ = Degree;
185 binomial_array.Allocate (DeRequest1);
187 for (ii = 0 ; ii < DeRequest1 ; ii++) {
188 binomial_array[ii] = 1.0e0 ;
191 Standard_Integer DimDeRequ1 = (DeRequest1 << 1) + DeRequest1;
192 derivative_storage.Allocate (DimDeRequ1);
193 RationalArray = derivative_storage ;
196 Inverse = 1.0e0 / PolesArray[3] ;
201 for (ii = 0 ; ii <= MinDegRequ ; ii++) {
204 RationalArray[Index] = PolesArray[OtherIndex]; Index++; OtherIndex++;
205 RationalArray[Index] = PolesArray[OtherIndex]; Index++; OtherIndex++;
206 RationalArray[Index] = PolesArray[OtherIndex];
210 for (jj = ii - 1 ; jj >= 0 ; jj--) {
211 Factor = binomial_array[jj] * PolesArray[((ii-jj) << 2) + 3];
212 RationalArray[Index] -= Factor * RationalArray[Index1]; Index++; Index1++;
213 RationalArray[Index] -= Factor * RationalArray[Index1]; Index++; Index1++;
214 RationalArray[Index] -= Factor * RationalArray[Index1];
219 for (jj = ii ; jj >= 1 ; jj--) {
220 binomial_array[jj] += binomial_array[jj - 1] ;
222 RationalArray[Index] *= Inverse ; Index++;
223 RationalArray[Index] *= Inverse ; Index++;
224 RationalArray[Index] *= Inverse ; Index++;
227 for (ii= MinDegRequ + 1; ii <= DerivativeRequest ; ii++){
230 RationalArray[Index] = 0.0e0; Index++;
231 RationalArray[Index] = 0.0e0; Index++;
232 RationalArray[Index] = 0.0e0;
235 for (jj = ii - 1 ; jj >= ii - MinDegRequ ; jj--) {
236 Factor = binomial_array[jj] * PolesArray[((ii-jj) << 2) + 3];
237 RationalArray[Index] -= Factor * RationalArray[Index1]; Index++; Index1++;
238 RationalArray[Index] -= Factor * RationalArray[Index1]; Index++; Index1++;
239 RationalArray[Index] -= Factor * RationalArray[Index1];
244 for (jj = ii ; jj >= 1 ; jj--) {
245 binomial_array[jj] += binomial_array[jj - 1] ;
247 RationalArray[Index] *= Inverse; Index++;
248 RationalArray[Index] *= Inverse; Index++;
249 RationalArray[Index] *= Inverse; Index++;
253 RationalArray = &RDers ;
254 Standard_Integer DimDeRequ = (DerivativeRequest << 1) + DerivativeRequest;
255 RationalArray[0] = derivative_storage[DimDeRequ]; DimDeRequ++;
256 RationalArray[1] = derivative_storage[DimDeRequ]; DimDeRequ++;
257 RationalArray[2] = derivative_storage[DimDeRequ];
262 Standard_Integer Dimension1 = Dimension + 1;
263 Standard_Integer Dimension2 = Dimension << 1;
264 Standard_Integer DeRequest1 = DerivativeRequest + 1;
265 Standard_Integer MinDegRequ = DerivativeRequest;
266 if (MinDegRequ > Degree) MinDegRequ = Degree;
267 binomial_array.Allocate (DeRequest1);
269 for (ii = 0 ; ii < DeRequest1 ; ii++) {
270 binomial_array[ii] = 1.0e0 ;
273 Standard_Integer DimDeRequ1 = Dimension * DeRequest1;
274 derivative_storage.Allocate (DimDeRequ1);
275 RationalArray = derivative_storage ;
278 Inverse = 1.0e0 / PolesArray[Dimension] ;
280 Index2 = - Dimension2;
283 for (ii = 0 ; ii <= MinDegRequ ; ii++) {
287 for (kk = 0 ; kk < Dimension ; kk++) {
288 RationalArray[Index] = PolesArray[OtherIndex]; Index++; OtherIndex++;
293 for (jj = ii - 1 ; jj >= 0 ; jj--) {
294 Factor = binomial_array[jj] * PolesArray[(ii-jj) * Dimension1 + Dimension];
296 for (kk = 0 ; kk < Dimension ; kk++) {
297 RationalArray[Index] -= Factor * RationalArray[Index1]; Index++; Index1++;
300 Index1 -= Dimension2 ;
303 for (jj = ii ; jj >= 1 ; jj--) {
304 binomial_array[jj] += binomial_array[jj - 1] ;
307 for (kk = 0 ; kk < Dimension ; kk++) {
308 RationalArray[Index] *= Inverse ; Index++;
312 for (ii= MinDegRequ + 1; ii <= DerivativeRequest ; ii++){
316 for (kk = 0 ; kk < Dimension ; kk++) {
317 RationalArray[Index] = 0.0e0 ; Index++;
321 for (jj = ii - 1 ; jj >= ii - MinDegRequ ; jj--) {
322 Factor = binomial_array[jj] * PolesArray[(ii-jj) * Dimension1 + Dimension];
324 for (kk = 0 ; kk < Dimension ; kk++) {
325 RationalArray[Index] -= Factor * RationalArray[Index1]; Index++; Index1++;
328 Index1 -= Dimension2 ;
331 for (jj = ii ; jj >= 1 ; jj--) {
332 binomial_array[jj] += binomial_array[jj - 1] ;
335 for (kk = 0 ; kk < Dimension ; kk++) {
336 RationalArray[Index] *= Inverse; Index++;
341 RationalArray = &RDers ;
342 Standard_Integer DimDeRequ = Dimension * DerivativeRequest;
344 for (kk = 0 ; kk < Dimension ; kk++) {
345 RationalArray[kk] = derivative_storage[DimDeRequ]; DimDeRequ++;
351 //=======================================================================
352 //function : RationalDerivatives
353 //purpose : Uses Homogeneous Poles Derivatives and Deivatives of Weights
354 //=======================================================================
356 void PLib::RationalDerivatives(const Standard_Integer DerivativeRequest,
357 const Standard_Integer Dimension,
358 Standard_Real& PolesDerivates,
359 // must be an array with
360 // (DerivativeRequest + 1) * Dimension slots
361 Standard_Real& WeightsDerivates,
362 // must be an array with
363 // (DerivativeRequest + 1) slots
364 Standard_Real& RationalDerivates)
367 // Our purpose is to compute f = (u/v) derivated N times
370 // Let C(N,P) be the binomial
375 // u = SUM C (q,p) f v
382 // (q) ( (q) (p) (q-p) )
383 // f = (1/v) ( u - SUM C (q,p) f v )
387 // make arrays for the binomial since computing it each time could
388 // raize a performance issue
390 Standard_Real Inverse;
391 Standard_Real *PolesArray = &PolesDerivates;
392 Standard_Real *WeightsArray = &WeightsDerivates;
393 Standard_Real *RationalArray = &RationalDerivates;
394 Standard_Real Factor ;
396 Standard_Integer ii, Index, Index1, Index2, jj;
397 Standard_Integer DeRequest1 = DerivativeRequest + 1;
399 PLib_LocalArray binomial_array (DeRequest1);
400 PLib_LocalArray derivative_storage;
402 for (ii = 0 ; ii < DeRequest1 ; ii++) {
403 binomial_array[ii] = 1.0e0 ;
405 Inverse = 1.0e0 / WeightsArray[0] ;
406 if (Dimension == 3) {
410 for (ii = 0 ; ii < DeRequest1 ; ii++) {
413 RationalArray[Index] = PolesArray[Index] ; Index++;
414 RationalArray[Index] = PolesArray[Index] ; Index++;
415 RationalArray[Index] = PolesArray[Index] ;
418 for (jj = ii - 1 ; jj >= 0 ; jj--) {
419 Factor = binomial_array[jj] * WeightsArray[ii - jj] ;
420 RationalArray[Index] -= Factor * RationalArray[Index1]; Index++; Index1++;
421 RationalArray[Index] -= Factor * RationalArray[Index1]; Index++; Index1++;
422 RationalArray[Index] -= Factor * RationalArray[Index1];
427 for (jj = ii ; jj >= 1 ; jj--) {
428 binomial_array[jj] += binomial_array[jj - 1] ;
430 RationalArray[Index] *= Inverse ; Index++;
431 RationalArray[Index] *= Inverse ; Index++;
432 RationalArray[Index] *= Inverse ; Index++;
437 Standard_Integer Dimension2 = Dimension << 1;
439 Index2 = - Dimension2;
441 for (ii = 0 ; ii < DeRequest1 ; ii++) {
445 for (kk = 0 ; kk < Dimension ; kk++) {
446 RationalArray[Index] = PolesArray[Index]; Index++;
450 for (jj = ii - 1 ; jj >= 0 ; jj--) {
451 Factor = binomial_array[jj] * WeightsArray[ii - jj] ;
453 for (kk = 0 ; kk < Dimension ; kk++) {
454 RationalArray[Index] -= Factor * RationalArray[Index1]; Index++; Index1++;
457 Index1 -= Dimension2;
460 for (jj = ii ; jj >= 1 ; jj--) {
461 binomial_array[jj] += binomial_array[jj - 1] ;
464 for (kk = 0 ; kk < Dimension ; kk++) {
465 RationalArray[Index] *= Inverse ; Index++;
471 //=======================================================================
472 //function : This evaluates a polynomial and its derivatives
473 //purpose : up to the requested order
474 //=======================================================================
476 void PLib::EvalPolynomial(const Standard_Real Par,
477 const Standard_Integer DerivativeRequest,
478 const Standard_Integer Degree,
479 const Standard_Integer Dimension,
480 Standard_Real& PolynomialCoeff,
481 Standard_Real& Results)
483 // the polynomial coefficients are assumed to be stored as follows :
485 // [0] [Dimension -1] X coefficient
487 // [Dimension] [Dimension + Dimension -1] X coefficient
489 // [2 * Dimension] [2 * Dimension + Dimension-1] X coefficient
491 // ...................................................
495 // [d * Dimension] [d * Dimension + Dimension-1] X coefficient
497 // where d is the Degree
500 Standard_Integer DegreeDimension = Degree * Dimension;
503 Standard_Real *RA = &Results ;
504 Standard_Real *PA = &PolynomialCoeff ;
505 Standard_Real *tmpRA = RA;
506 Standard_Real *tmpPA = PA + DegreeDimension;
512 if (DerivativeRequest > 0 ) {
514 Standard_Real *valRA;
515 Standard_Integer ii, LocalRequest;
516 Standard_Integer Index1, Index2;
517 Standard_Integer MaxIndex1, MaxIndex2;
518 if (DerivativeRequest < Degree) {
519 LocalRequest = DerivativeRequest;
520 MaxIndex2 = MaxIndex1 = LocalRequest;
523 LocalRequest = Degree;
524 MaxIndex2 = MaxIndex1 = Degree;
528 for (ii = 1; ii <= LocalRequest; ii++) {
529 *tmpRA = 0.0e0; tmpRA ++ ;
532 for (jj = Degree ; jj > 0 ; jj--) {
537 for (ii = LocalRequest ; ii > 0 ; ii--) {
539 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
544 *valRA = Par * (*valRA) + (*tmpPA);
549 for (jj = Degree ; jj > 0 ; jj--) {
551 *tmpRA = Par * (*tmpRA) + (*tmpPA);
557 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
558 *tmpRA = *tmpPA; tmpRA++;
560 if (DerivativeRequest > 0 ) {
561 Standard_Real *valRA;
562 Standard_Integer ii, LocalRequest;
563 Standard_Integer Index1, Index2;
564 Standard_Integer MaxIndex1, MaxIndex2;
565 if (DerivativeRequest < Degree) {
566 LocalRequest = DerivativeRequest;
567 MaxIndex2 = MaxIndex1 = LocalRequest << 1;
570 LocalRequest = Degree;
571 MaxIndex2 = MaxIndex1 = DegreeDimension;
575 for (ii = 1; ii <= LocalRequest; ii++) {
576 *tmpRA = 0.0e0; tmpRA++;
577 *tmpRA = 0.0e0; tmpRA++;
580 for (jj = Degree ; jj > 0 ; jj--) {
586 for (ii = LocalRequest ; ii > 0 ; ii--) {
588 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
593 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
595 Index1 = MaxIndex1 + 1;
596 Index2 = MaxIndex2 + 1;
598 for (ii = LocalRequest ; ii > 0 ; ii--) {
600 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
605 *valRA = Par * (*valRA) + (*tmpPA);
612 for (jj = Degree ; jj > 0 ; jj--) {
615 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
616 *tmpRA = Par * (*tmpRA) + (*tmpPA);
623 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
624 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
625 *tmpRA = *tmpPA; tmpRA++;
627 if (DerivativeRequest > 0 ) {
628 Standard_Real *valRA;
629 Standard_Integer ii, LocalRequest;
630 Standard_Integer Index1, Index2;
631 Standard_Integer MaxIndex1, MaxIndex2;
632 if (DerivativeRequest < Degree) {
633 LocalRequest = DerivativeRequest;
634 MaxIndex2 = MaxIndex1 = (LocalRequest << 1) + LocalRequest;
637 LocalRequest = Degree;
638 MaxIndex2 = MaxIndex1 = DegreeDimension;
642 for (ii = 1; ii <= LocalRequest; ii++) {
643 *tmpRA = 0.0e0; tmpRA++;
644 *tmpRA = 0.0e0; tmpRA++;
645 *tmpRA = 0.0e0; tmpRA++;
648 for (jj = Degree ; jj > 0 ; jj--) {
654 for (ii = LocalRequest ; ii > 0 ; ii--) {
656 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
661 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
663 Index1 = MaxIndex1 + 1;
664 Index2 = MaxIndex2 + 1;
666 for (ii = LocalRequest ; ii > 0 ; ii--) {
668 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
673 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
675 Index1 = MaxIndex1 + 2;
676 Index2 = MaxIndex2 + 2;
678 for (ii = LocalRequest ; ii > 0 ; ii--) {
680 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
685 *valRA = Par * (*valRA) + (*tmpPA);
692 for (jj = Degree ; jj > 0 ; jj--) {
695 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
696 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
697 *tmpRA = Par * (*tmpRA) + (*tmpPA);
704 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
705 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
706 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
708 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
709 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
710 *tmpRA = *tmpPA; tmpRA++;
712 if (DerivativeRequest > 0 ) {
713 Standard_Real *valRA;
714 Standard_Integer ii, LocalRequest;
715 Standard_Integer Index1, Index2;
716 Standard_Integer MaxIndex1, MaxIndex2;
717 if (DerivativeRequest < Degree) {
718 LocalRequest = DerivativeRequest;
719 MaxIndex2 = MaxIndex1 = (LocalRequest << 2) + (LocalRequest << 1);
722 LocalRequest = Degree;
723 MaxIndex2 = MaxIndex1 = DegreeDimension;
727 for (ii = 1; ii <= LocalRequest; ii++) {
728 *tmpRA = 0.0e0; tmpRA++;
729 *tmpRA = 0.0e0; tmpRA++;
730 *tmpRA = 0.0e0; tmpRA++;
732 *tmpRA = 0.0e0; tmpRA++;
733 *tmpRA = 0.0e0; tmpRA++;
734 *tmpRA = 0.0e0; tmpRA++;
737 for (jj = Degree ; jj > 0 ; jj--) {
743 for (ii = LocalRequest ; ii > 0 ; ii--) {
745 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
750 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
752 Index1 = MaxIndex1 + 1;
753 Index2 = MaxIndex2 + 1;
755 for (ii = LocalRequest ; ii > 0 ; ii--) {
757 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
762 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
764 Index1 = MaxIndex1 + 2;
765 Index2 = MaxIndex2 + 2;
767 for (ii = LocalRequest ; ii > 0 ; ii--) {
769 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
774 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
776 Index1 = MaxIndex1 + 3;
777 Index2 = MaxIndex2 + 3;
779 for (ii = LocalRequest ; ii > 0 ; ii--) {
781 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
786 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
788 Index1 = MaxIndex1 + 4;
789 Index2 = MaxIndex2 + 4;
791 for (ii = LocalRequest ; ii > 0 ; ii--) {
793 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
798 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
800 Index1 = MaxIndex1 + 5;
801 Index2 = MaxIndex2 + 5;
803 for (ii = LocalRequest ; ii > 0 ; ii--) {
805 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
810 *valRA = Par * (*valRA) + (*tmpPA);
817 for (jj = Degree ; jj > 0 ; jj--) {
821 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
822 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
823 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
825 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
826 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
827 *tmpRA = Par * (*tmpRA) + (*tmpPA);
834 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
835 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
836 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
838 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
839 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
840 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
842 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
843 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
844 *tmpRA = *tmpPA; tmpRA++;
846 if (DerivativeRequest > 0 ) {
847 Standard_Real *valRA;
848 Standard_Integer ii, LocalRequest;
849 Standard_Integer Index1, Index2;
850 Standard_Integer MaxIndex1, MaxIndex2;
851 if (DerivativeRequest < Degree) {
852 LocalRequest = DerivativeRequest;
853 MaxIndex2 = MaxIndex1 = (LocalRequest << 3) + LocalRequest;
856 LocalRequest = Degree;
857 MaxIndex2 = MaxIndex1 = DegreeDimension;
861 for (ii = 1; ii <= LocalRequest; ii++) {
862 *tmpRA = 0.0e0; tmpRA++;
863 *tmpRA = 0.0e0; tmpRA++;
864 *tmpRA = 0.0e0; tmpRA++;
866 *tmpRA = 0.0e0; tmpRA++;
867 *tmpRA = 0.0e0; tmpRA++;
868 *tmpRA = 0.0e0; tmpRA++;
870 *tmpRA = 0.0e0; tmpRA++;
871 *tmpRA = 0.0e0; tmpRA++;
872 *tmpRA = 0.0e0; tmpRA++;
875 for (jj = Degree ; jj > 0 ; jj--) {
881 for (ii = LocalRequest ; ii > 0 ; ii--) {
883 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
888 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
890 Index1 = MaxIndex1 + 1;
891 Index2 = MaxIndex2 + 1;
893 for (ii = LocalRequest ; ii > 0 ; ii--) {
895 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
900 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
902 Index1 = MaxIndex1 + 2;
903 Index2 = MaxIndex2 + 2;
905 for (ii = LocalRequest ; ii > 0 ; ii--) {
907 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
912 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
914 Index1 = MaxIndex1 + 3;
915 Index2 = MaxIndex2 + 3;
917 for (ii = LocalRequest ; ii > 0 ; ii--) {
919 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
924 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
926 Index1 = MaxIndex1 + 4;
927 Index2 = MaxIndex2 + 4;
929 for (ii = LocalRequest ; ii > 0 ; ii--) {
931 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
936 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
938 Index1 = MaxIndex1 + 5;
939 Index2 = MaxIndex2 + 5;
941 for (ii = LocalRequest ; ii > 0 ; ii--) {
943 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
948 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
950 Index1 = MaxIndex1 + 6;
951 Index2 = MaxIndex2 + 6;
953 for (ii = LocalRequest ; ii > 0 ; ii--) {
955 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
960 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
962 Index1 = MaxIndex1 + 7;
963 Index2 = MaxIndex2 + 7;
965 for (ii = LocalRequest ; ii > 0 ; ii--) {
967 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
972 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
974 Index1 = MaxIndex1 + 8;
975 Index2 = MaxIndex2 + 8;
977 for (ii = LocalRequest ; ii > 0 ; ii--) {
979 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
984 *valRA = Par * (*valRA) + (*tmpPA);
991 for (jj = Degree ; jj > 0 ; jj--) {
995 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
996 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
997 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
999 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1000 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1001 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1003 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1004 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1005 *tmpRA = Par * (*tmpRA) + (*tmpPA);
1012 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1013 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1014 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1016 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1017 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1018 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1020 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1021 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1022 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1024 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1025 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1026 *tmpRA = *tmpPA; tmpRA++;
1028 if (DerivativeRequest > 0 ) {
1029 Standard_Real *valRA;
1030 Standard_Integer ii, LocalRequest;
1031 Standard_Integer Index1, Index2;
1032 Standard_Integer MaxIndex1, MaxIndex2;
1033 if (DerivativeRequest < Degree) {
1034 LocalRequest = DerivativeRequest;
1035 MaxIndex2 = MaxIndex1 = (LocalRequest << 3) + (LocalRequest << 2);
1038 LocalRequest = Degree;
1039 MaxIndex2 = MaxIndex1 = DegreeDimension;
1043 for (ii = 1; ii <= LocalRequest; ii++) {
1044 *tmpRA = 0.0e0; tmpRA++;
1045 *tmpRA = 0.0e0; tmpRA++;
1046 *tmpRA = 0.0e0; tmpRA++;
1048 *tmpRA = 0.0e0; tmpRA++;
1049 *tmpRA = 0.0e0; tmpRA++;
1050 *tmpRA = 0.0e0; tmpRA++;
1052 *tmpRA = 0.0e0; tmpRA++;
1053 *tmpRA = 0.0e0; tmpRA++;
1054 *tmpRA = 0.0e0; tmpRA++;
1056 *tmpRA = 0.0e0; tmpRA++;
1057 *tmpRA = 0.0e0; tmpRA++;
1058 *tmpRA = 0.0e0; tmpRA++;
1061 for (jj = Degree ; jj > 0 ; jj--) {
1067 for (ii = LocalRequest ; ii > 0 ; ii--) {
1068 valRA = &RA[Index1];
1069 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1073 valRA = &RA[Index1];
1074 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1076 Index1 = MaxIndex1 + 1;
1077 Index2 = MaxIndex2 + 1;
1079 for (ii = LocalRequest ; ii > 0 ; ii--) {
1080 valRA = &RA[Index1];
1081 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1085 valRA = &RA[Index1];
1086 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1088 Index1 = MaxIndex1 + 2;
1089 Index2 = MaxIndex2 + 2;
1091 for (ii = LocalRequest ; ii > 0 ; ii--) {
1092 valRA = &RA[Index1];
1093 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1097 valRA = &RA[Index1];
1098 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1100 Index1 = MaxIndex1 + 3;
1101 Index2 = MaxIndex2 + 3;
1103 for (ii = LocalRequest ; ii > 0 ; ii--) {
1104 valRA = &RA[Index1];
1105 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1109 valRA = &RA[Index1];
1110 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1112 Index1 = MaxIndex1 + 4;
1113 Index2 = MaxIndex2 + 4;
1115 for (ii = LocalRequest ; ii > 0 ; ii--) {
1116 valRA = &RA[Index1];
1117 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1121 valRA = &RA[Index1];
1122 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1124 Index1 = MaxIndex1 + 5;
1125 Index2 = MaxIndex2 + 5;
1127 for (ii = LocalRequest ; ii > 0 ; ii--) {
1128 valRA = &RA[Index1];
1129 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1133 valRA = &RA[Index1];
1134 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1136 Index1 = MaxIndex1 + 6;
1137 Index2 = MaxIndex2 + 6;
1139 for (ii = LocalRequest ; ii > 0 ; ii--) {
1140 valRA = &RA[Index1];
1141 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1145 valRA = &RA[Index1];
1146 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1148 Index1 = MaxIndex1 + 7;
1149 Index2 = MaxIndex2 + 7;
1151 for (ii = LocalRequest ; ii > 0 ; ii--) {
1152 valRA = &RA[Index1];
1153 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1157 valRA = &RA[Index1];
1158 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1160 Index1 = MaxIndex1 + 8;
1161 Index2 = MaxIndex2 + 8;
1163 for (ii = LocalRequest ; ii > 0 ; ii--) {
1164 valRA = &RA[Index1];
1165 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1169 valRA = &RA[Index1];
1170 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1172 Index1 = MaxIndex1 + 9;
1173 Index2 = MaxIndex2 + 9;
1175 for (ii = LocalRequest ; ii > 0 ; ii--) {
1176 valRA = &RA[Index1];
1177 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1181 valRA = &RA[Index1];
1182 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1184 Index1 = MaxIndex1 + 10;
1185 Index2 = MaxIndex2 + 10;
1187 for (ii = LocalRequest ; ii > 0 ; ii--) {
1188 valRA = &RA[Index1];
1189 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1193 valRA = &RA[Index1];
1194 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1196 Index1 = MaxIndex1 + 11;
1197 Index2 = MaxIndex2 + 11;
1199 for (ii = LocalRequest ; ii > 0 ; ii--) {
1200 valRA = &RA[Index1];
1201 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1205 valRA = &RA[Index1];
1206 *valRA = Par * (*valRA) + (*tmpPA);
1213 for (jj = Degree ; jj > 0 ; jj--) {
1217 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1218 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1219 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1221 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1222 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1223 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1225 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1226 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1227 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1229 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1230 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1231 *tmpRA = Par * (*tmpRA) + (*tmpPA);
1239 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1240 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1241 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1243 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1244 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1245 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1247 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1248 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1249 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1251 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1252 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1253 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1255 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1256 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1257 *tmpRA = *tmpPA; tmpRA++;
1259 if (DerivativeRequest > 0 ) {
1260 Standard_Real *valRA;
1261 Standard_Integer ii, LocalRequest;
1262 Standard_Integer Index1, Index2;
1263 Standard_Integer MaxIndex1, MaxIndex2;
1264 if (DerivativeRequest < Degree) {
1265 LocalRequest = DerivativeRequest;
1266 MaxIndex2 = MaxIndex1 = (LocalRequest << 4) - LocalRequest;
1269 LocalRequest = Degree;
1270 MaxIndex2 = MaxIndex1 = DegreeDimension;
1274 for (ii = 1; ii <= LocalRequest; ii++) {
1275 *tmpRA = 0.0e0; tmpRA++;
1276 *tmpRA = 0.0e0; tmpRA++;
1277 *tmpRA = 0.0e0; tmpRA++;
1279 *tmpRA = 0.0e0; tmpRA++;
1280 *tmpRA = 0.0e0; tmpRA++;
1281 *tmpRA = 0.0e0; tmpRA++;
1283 *tmpRA = 0.0e0; tmpRA++;
1284 *tmpRA = 0.0e0; tmpRA++;
1285 *tmpRA = 0.0e0; tmpRA++;
1287 *tmpRA = 0.0e0; tmpRA++;
1288 *tmpRA = 0.0e0; tmpRA++;
1289 *tmpRA = 0.0e0; tmpRA++;
1291 *tmpRA = 0.0e0; tmpRA++;
1292 *tmpRA = 0.0e0; tmpRA++;
1293 *tmpRA = 0.0e0; tmpRA++;
1296 for (jj = Degree ; jj > 0 ; jj--) {
1302 for (ii = LocalRequest ; ii > 0 ; ii--) {
1303 valRA = &RA[Index1];
1304 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1308 valRA = &RA[Index1];
1309 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1311 Index1 = MaxIndex1 + 1;
1312 Index2 = MaxIndex2 + 1;
1314 for (ii = LocalRequest ; ii > 0 ; ii--) {
1315 valRA = &RA[Index1];
1316 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1320 valRA = &RA[Index1];
1321 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1323 Index1 = MaxIndex1 + 2;
1324 Index2 = MaxIndex2 + 2;
1326 for (ii = LocalRequest ; ii > 0 ; ii--) {
1327 valRA = &RA[Index1];
1328 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1332 valRA = &RA[Index1];
1333 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1335 Index1 = MaxIndex1 + 3;
1336 Index2 = MaxIndex2 + 3;
1338 for (ii = LocalRequest ; ii > 0 ; ii--) {
1339 valRA = &RA[Index1];
1340 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1344 valRA = &RA[Index1];
1345 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1347 Index1 = MaxIndex1 + 4;
1348 Index2 = MaxIndex2 + 4;
1350 for (ii = LocalRequest ; ii > 0 ; ii--) {
1351 valRA = &RA[Index1];
1352 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1356 valRA = &RA[Index1];
1357 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1359 Index1 = MaxIndex1 + 5;
1360 Index2 = MaxIndex2 + 5;
1362 for (ii = LocalRequest ; ii > 0 ; ii--) {
1363 valRA = &RA[Index1];
1364 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1368 valRA = &RA[Index1];
1369 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1371 Index1 = MaxIndex1 + 6;
1372 Index2 = MaxIndex2 + 6;
1374 for (ii = LocalRequest ; ii > 0 ; ii--) {
1375 valRA = &RA[Index1];
1376 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1380 valRA = &RA[Index1];
1381 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1383 Index1 = MaxIndex1 + 7;
1384 Index2 = MaxIndex2 + 7;
1386 for (ii = LocalRequest ; ii > 0 ; ii--) {
1387 valRA = &RA[Index1];
1388 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1392 valRA = &RA[Index1];
1393 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1395 Index1 = MaxIndex1 + 8;
1396 Index2 = MaxIndex2 + 8;
1398 for (ii = LocalRequest ; ii > 0 ; ii--) {
1399 valRA = &RA[Index1];
1400 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1404 valRA = &RA[Index1];
1405 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1407 Index1 = MaxIndex1 + 9;
1408 Index2 = MaxIndex2 + 9;
1410 for (ii = LocalRequest ; ii > 0 ; ii--) {
1411 valRA = &RA[Index1];
1412 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1416 valRA = &RA[Index1];
1417 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1419 Index1 = MaxIndex1 + 10;
1420 Index2 = MaxIndex2 + 10;
1422 for (ii = LocalRequest ; ii > 0 ; ii--) {
1423 valRA = &RA[Index1];
1424 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1428 valRA = &RA[Index1];
1429 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1431 Index1 = MaxIndex1 + 11;
1432 Index2 = MaxIndex2 + 11;
1434 for (ii = LocalRequest ; ii > 0 ; ii--) {
1435 valRA = &RA[Index1];
1436 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1440 valRA = &RA[Index1];
1441 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1443 Index1 = MaxIndex1 + 12;
1444 Index2 = MaxIndex2 + 12;
1446 for (ii = LocalRequest ; ii > 0 ; ii--) {
1447 valRA = &RA[Index1];
1448 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1452 valRA = &RA[Index1];
1453 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1455 Index1 = MaxIndex1 + 13;
1456 Index2 = MaxIndex2 + 13;
1458 for (ii = LocalRequest ; ii > 0 ; ii--) {
1459 valRA = &RA[Index1];
1460 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1464 valRA = &RA[Index1];
1465 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1467 Index1 = MaxIndex1 + 14;
1468 Index2 = MaxIndex2 + 14;
1470 for (ii = LocalRequest ; ii > 0 ; ii--) {
1471 valRA = &RA[Index1];
1472 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1476 valRA = &RA[Index1];
1477 *valRA = Par * (*valRA) + (*tmpPA);
1484 for (jj = Degree ; jj > 0 ; jj--) {
1488 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1489 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1490 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1492 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1493 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1494 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1496 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1497 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1498 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1500 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1501 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1502 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1504 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1505 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1506 *tmpRA = Par * (*tmpRA) + (*tmpPA);
1513 Standard_Integer kk ;
1514 for ( kk = 0 ; kk < Dimension ; kk++) {
1515 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1518 if (DerivativeRequest > 0 ) {
1519 Standard_Real *valRA;
1520 Standard_Integer ii, LocalRequest;
1521 Standard_Integer Index1, Index2;
1522 Standard_Integer MaxIndex1, MaxIndex2;
1523 if (DerivativeRequest < Degree) {
1524 LocalRequest = DerivativeRequest;
1525 MaxIndex2 = MaxIndex1 = LocalRequest * Dimension;
1528 LocalRequest = Degree;
1529 MaxIndex2 = MaxIndex1 = DegreeDimension;
1531 MaxIndex2 -= Dimension;
1533 for (ii = 1; ii <= MaxIndex1; ii++) {
1534 *tmpRA = 0.0e0; tmpRA++;
1537 for (jj = Degree ; jj > 0 ; jj--) {
1540 for (kk = 0 ; kk < Dimension ; kk++) {
1541 Index1 = MaxIndex1 + kk;
1542 Index2 = MaxIndex2 + kk;
1544 for (ii = LocalRequest ; ii > 0 ; ii--) {
1545 valRA = &RA[Index1];
1546 *valRA = Par * (*valRA) + ((Standard_Real)ii) * RA[Index2] ;
1547 Index1 -= Dimension;
1548 Index2 -= Dimension;
1550 valRA = &RA[Index1];
1551 *valRA = Par * (*valRA) + (*tmpPA); tmpPA++;
1558 for (jj = Degree ; jj > 0 ; jj--) {
1562 for (kk = 0 ; kk < Dimension ; kk++) {
1563 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1572 //=======================================================================
1573 //function : This evaluates a polynomial without derivative
1575 //=======================================================================
1577 void PLib::NoDerivativeEvalPolynomial(const Standard_Real Par,
1578 const Standard_Integer Degree,
1579 const Standard_Integer Dimension,
1580 const Standard_Integer DegreeDimension,
1581 Standard_Real& PolynomialCoeff,
1582 Standard_Real& Results)
1584 Standard_Integer jj;
1585 Standard_Real *RA = &Results ;
1586 Standard_Real *PA = &PolynomialCoeff ;
1587 Standard_Real *tmpRA = RA;
1588 Standard_Real *tmpPA = PA + DegreeDimension;
1590 switch (Dimension) {
1595 for (jj = Degree ; jj > 0 ; jj--) {
1598 *tmpRA = Par * (*tmpRA) + (*tmpPA);
1603 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1607 for (jj = Degree ; jj > 0 ; jj--) {
1611 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1612 *tmpRA = Par * (*tmpRA) + (*tmpPA);
1618 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1619 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1623 for (jj = Degree ; jj > 0 ; jj--) {
1627 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1628 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1629 *tmpRA = Par * (*tmpRA) + (*tmpPA);
1635 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1636 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1637 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1639 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1640 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1644 for (jj = Degree ; jj > 0 ; jj--) {
1648 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1649 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1650 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1652 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1653 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1654 *tmpRA = Par * (*tmpRA) + (*tmpPA);
1660 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1661 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1662 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1664 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1665 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1666 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1668 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1669 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1673 for (jj = Degree ; jj > 0 ; jj--) {
1677 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1678 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1679 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1681 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1682 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1683 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1685 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1686 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1687 *tmpRA = Par * (*tmpRA) + (*tmpPA);
1693 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1694 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1695 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1697 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1698 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1699 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1701 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1702 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1703 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1705 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1706 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1710 for (jj = Degree ; jj > 0 ; jj--) {
1714 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1715 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1716 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1718 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1719 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1720 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1722 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1723 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1724 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1726 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1727 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1728 *tmpRA = Par * (*tmpRA) + (*tmpPA);
1734 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1735 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1736 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1738 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1739 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1740 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1742 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1743 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1744 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1746 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1747 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1748 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1750 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1751 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1755 for (jj = Degree ; jj > 0 ; jj--) {
1759 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1760 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1761 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1763 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1764 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1765 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1767 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1768 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1769 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1771 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1772 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1773 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1775 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1776 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1777 *tmpRA = Par * (*tmpRA) + (*tmpPA);
1783 Standard_Integer kk ;
1784 for ( kk = 0 ; kk < Dimension ; kk++) {
1785 *tmpRA = *tmpPA; tmpRA++; tmpPA++;
1789 for (jj = Degree ; jj > 0 ; jj--) {
1793 for (kk = 0 ; kk < Dimension ; kk++) {
1794 *tmpRA = Par * (*tmpRA) + (*tmpPA); tmpPA++; tmpRA++;
1802 //=======================================================================
1803 //function : This evaluates a polynomial of 2 variables
1804 //purpose : or its derivative at the requested orders
1805 //=======================================================================
1807 void PLib::EvalPoly2Var(const Standard_Real UParameter,
1808 const Standard_Real VParameter,
1809 const Standard_Integer UDerivativeRequest,
1810 const Standard_Integer VDerivativeRequest,
1811 const Standard_Integer UDegree,
1812 const Standard_Integer VDegree,
1813 const Standard_Integer Dimension,
1814 Standard_Real& PolynomialCoeff,
1815 Standard_Real& Results)
1817 // the polynomial coefficients are assumed to be stored as follows :
1819 // [0] [Dimension -1] U V coefficient
1821 // [Dimension] [Dimension + Dimension -1] U V coefficient
1823 // [2 * Dimension] [2 * Dimension + Dimension-1] U V coefficient
1825 // ...................................................
1829 // [m * Dimension] [m * Dimension + Dimension-1] U V coefficient
1831 // where m = UDegree
1834 // [(m+1) * Dimension] [(m+1) * Dimension + Dimension-1] U V coefficient
1836 // ...................................................
1839 // [2*m * Dimension] [2*m * Dimension + Dimension-1] U V coefficient
1841 // ...................................................
1844 // [m*n * Dimension] [m*n * Dimension + Dimension-1] U V coefficient
1846 // where n = VDegree
1848 Standard_Integer Udim = (VDegree+1)*Dimension,
1849 index = Udim*UDerivativeRequest;
1850 TColStd_Array1OfReal Curve(1, Udim*(UDerivativeRequest+1));
1851 TColStd_Array1OfReal Point(1, Dimension*(VDerivativeRequest+1));
1852 Standard_Real * Result = (Standard_Real *) &Curve.ChangeValue(1);
1853 Standard_Real * Digit = (Standard_Real *) &Point.ChangeValue(1);
1854 Standard_Real * ResultArray ;
1855 ResultArray = &Results ;
1857 PLib::EvalPolynomial(UParameter,
1864 PLib::EvalPolynomial(VParameter,
1871 index = Dimension*VDerivativeRequest;
1873 for (Standard_Integer i=0;i<Dimension;i++) {
1874 ResultArray[i] = Digit[index+i];
1879 static Standard_Integer storage_divided = 0 ;
1880 static Standard_Real *divided_differences_array = NULL;
1882 //=======================================================================
1883 //function : This evaluates the lagrange polynomial and its derivatives
1884 //purpose : up to the requested order that interpolates a series of
1885 //points of dimension <Dimension> with given assigned parameters
1886 //=======================================================================
1889 PLib::EvalLagrange(const Standard_Real Parameter,
1890 const Standard_Integer DerivativeRequest,
1891 const Standard_Integer Degree,
1892 const Standard_Integer Dimension,
1893 Standard_Real& Values,
1894 Standard_Real& Parameters,
1895 Standard_Real& Results)
1898 // the points are assumed to be stored as follows in the Values array :
1900 // [0] [Dimension -1] first point coefficients
1902 // [Dimension] [Dimension + Dimension -1] second point coefficients
1904 // [2 * Dimension] [2 * Dimension + Dimension-1] third point coefficients
1906 // ...................................................
1910 // [d * Dimension] [d * Dimension + Dimension-1] d + 1 point coefficients
1912 // where d is the Degree
1914 // The ParameterArray stores the parameter value assign to each point in
1915 // order described above, that is
1916 // [0] is assign to first point
1917 // [1] is assign to second point
1919 Standard_Integer ii, jj, kk, Index, Index1, ReturnCode=0;
1920 Standard_Integer local_request = DerivativeRequest;
1921 Standard_Real *ParameterArray;
1922 Standard_Real difference;
1923 Standard_Real *PointsArray;
1924 Standard_Real *ResultArray ;
1926 PointsArray = &Values ;
1927 ParameterArray = &Parameters ;
1928 ResultArray = &Results ;
1929 if (local_request >= Degree) {
1930 local_request = Degree ;
1932 PLib_LocalArray divided_differences_array ((Degree + 1) * Dimension);
1934 // Build the divided differences array
1937 for (ii = 0 ; ii < (Degree + 1) * Dimension ; ii++) {
1938 divided_differences_array[ii] = PointsArray[ii] ;
1941 for (ii = Degree ; ii >= 0 ; ii--) {
1943 for (jj = Degree ; jj > Degree - ii ; jj--) {
1944 Index = jj * Dimension ;
1945 Index1 = Index - Dimension ;
1947 for (kk = 0 ; kk < Dimension ; kk++) {
1948 divided_differences_array[Index + kk] -=
1949 divided_differences_array[Index1 + kk] ;
1952 ParameterArray[jj] - ParameterArray[jj - Degree -1 + ii] ;
1953 if (Abs(difference) < RealSmall()) {
1957 difference = 1.0e0 / difference ;
1959 for (kk = 0 ; kk < Dimension ; kk++) {
1960 divided_differences_array[Index + kk] *= difference ;
1966 // Evaluate the divided difference array polynomial which expresses as
1968 // P(t) = [t1] P + (t - t1) [t1,t2] P + (t - t1)(t - t2)[t1,t2,t3] P + ...
1969 // + (t - t1)(t - t2)(t - t3)...(t - td) [t1,t2,...,td+1] P
1971 // The ith slot in the divided_differences_array is [t1,t2,...,ti+1]
1974 Index = Degree * Dimension ;
1976 for (kk = 0 ; kk < Dimension ; kk++) {
1977 ResultArray[kk] = divided_differences_array[Index + kk] ;
1980 for (ii = Dimension ; ii < (local_request + 1) * Dimension ; ii++) {
1981 ResultArray[ii] = 0.0e0 ;
1984 for (ii = Degree ; ii >= 1 ; ii--) {
1985 difference = Parameter - ParameterArray[ii - 1] ;
1987 for (jj = local_request ; jj > 0 ; jj--) {
1988 Index = jj * Dimension ;
1989 Index1 = Index - Dimension ;
1991 for (kk = 0 ; kk < Dimension ; kk++) {
1992 ResultArray[Index + kk] *= difference ;
1993 ResultArray[Index + kk] += ResultArray[Index1+kk]*(Standard_Real) jj ;
1996 Index = (ii -1) * Dimension ;
1998 for (kk = 0 ; kk < Dimension ; kk++) {
1999 ResultArray[kk] *= difference ;
2000 ResultArray[kk] += divided_differences_array[Index+kk] ;
2004 return (ReturnCode) ;
2007 //=======================================================================
2008 //function : This evaluates the hermite polynomial and its derivatives
2009 //purpose : up to the requested order that interpolates a series of
2010 //points of dimension <Dimension> with given assigned parameters
2011 //=======================================================================
2013 Standard_Integer PLib::EvalCubicHermite
2014 (const Standard_Real Parameter,
2015 const Standard_Integer DerivativeRequest,
2016 const Standard_Integer Dimension,
2017 Standard_Real& Values,
2018 Standard_Real& Derivatives,
2019 Standard_Real& theParameters,
2020 Standard_Real& Results)
2023 // the points are assumed to be stored as follows in the Values array :
2025 // [0] [Dimension -1] first point coefficients
2027 // [Dimension] [Dimension + Dimension -1] last point coefficients
2030 // the derivatives are assumed to be stored as follows in
2031 // the Derivatives array :
2033 // [0] [Dimension -1] first point coefficients
2035 // [Dimension] [Dimension + Dimension -1] last point coefficients
2037 // The ParameterArray stores the parameter value assign to each point in
2038 // order described above, that is
2039 // [0] is assign to first point
2040 // [1] is assign to last point
2042 Standard_Integer ii, jj, kk, pp, Index, Index1, Degree, ReturnCode;
2043 Standard_Integer local_request = DerivativeRequest ;
2047 Standard_Real ParametersArray[4];
2048 Standard_Real difference;
2049 Standard_Real inverse;
2050 Standard_Real *FirstLast;
2051 Standard_Real *PointsArray;
2052 Standard_Real *DerivativesArray;
2053 Standard_Real *ResultArray ;
2055 DerivativesArray = &Derivatives ;
2056 PointsArray = &Values ;
2057 FirstLast = &theParameters ;
2058 ResultArray = &Results ;
2059 if (local_request >= Degree) {
2060 local_request = Degree ;
2062 PLib_LocalArray divided_differences_array ((Degree + 1) * Dimension);
2064 for (ii = 0, jj = 0 ; ii < 2 ; ii++, jj+= 2) {
2065 ParametersArray[jj] =
2066 ParametersArray[jj+1] = FirstLast[ii] ;
2069 // Build the divided differences array
2072 // initialise it at the stage 2 of the building algorithm
2073 // for devided differences
2075 inverse = FirstLast[1] - FirstLast[0] ;
2076 inverse = 1.0e0 / inverse ;
2078 for (ii = 0, jj = Dimension, kk = 2 * Dimension, pp = 3 * Dimension ;
2080 ii++, jj++, kk++, pp++) {
2081 divided_differences_array[ii] = PointsArray[ii] ;
2082 divided_differences_array[kk] = inverse *
2083 (PointsArray[jj] - PointsArray[ii]) ;
2084 divided_differences_array[jj] = DerivativesArray[ii] ;
2085 divided_differences_array[pp] = DerivativesArray[jj] ;
2088 for (ii = 1 ; ii <= Degree ; ii++) {
2090 for (jj = Degree ; jj >= ii+1 ; jj--) {
2091 Index = jj * Dimension ;
2092 Index1 = Index - Dimension ;
2094 for (kk = 0 ; kk < Dimension ; kk++) {
2095 divided_differences_array[Index + kk] -=
2096 divided_differences_array[Index1 + kk] ;
2099 for (kk = 0 ; kk < Dimension ; kk++) {
2100 divided_differences_array[Index + kk] *= inverse ;
2106 // Evaluate the divided difference array polynomial which expresses as
2108 // P(t) = [t1] P + (t - t1) [t1,t2] P + (t - t1)(t - t2)[t1,t2,t3] P + ...
2109 // + (t - t1)(t - t2)(t - t3)...(t - td) [t1,t2,...,td+1] P
2111 // The ith slot in the divided_differences_array is [t1,t2,...,ti+1]
2114 Index = Degree * Dimension ;
2116 for (kk = 0 ; kk < Dimension ; kk++) {
2117 ResultArray[kk] = divided_differences_array[Index + kk] ;
2120 for (ii = Dimension ; ii < (local_request + 1) * Dimension ; ii++) {
2121 ResultArray[ii] = 0.0e0 ;
2124 for (ii = Degree ; ii >= 1 ; ii--) {
2125 difference = Parameter - ParametersArray[ii - 1] ;
2127 for (jj = local_request ; jj > 0 ; jj--) {
2128 Index = jj * Dimension ;
2129 Index1 = Index - Dimension ;
2131 for (kk = 0 ; kk < Dimension ; kk++) {
2132 ResultArray[Index + kk] *= difference ;
2133 ResultArray[Index + kk] += ResultArray[Index1+kk]*(Standard_Real) jj;
2136 Index = (ii -1) * Dimension ;
2138 for (kk = 0 ; kk < Dimension ; kk++) {
2139 ResultArray[kk] *= difference ;
2140 ResultArray[kk] += divided_differences_array[Index+kk] ;
2144 return (ReturnCode) ;
2147 //=======================================================================
2148 //function : HermiteCoefficients
2149 //purpose : calcul des polynomes d'Hermite
2150 //=======================================================================
2152 Standard_Boolean PLib::HermiteCoefficients(const Standard_Real FirstParameter,
2153 const Standard_Real LastParameter,
2154 const Standard_Integer FirstOrder,
2155 const Standard_Integer LastOrder,
2156 math_Matrix& MatrixCoefs)
2158 Standard_Integer NbCoeff = FirstOrder + LastOrder + 2, Ordre[2];
2159 Standard_Integer ii, jj, pp, cote, iof=0;
2160 Standard_Real Prod, TBorne = FirstParameter;
2161 math_Vector Coeff(1,NbCoeff), B(1, NbCoeff, 0.0);
2162 math_Matrix MAT(1,NbCoeff, 1,NbCoeff, 0.0);
2164 // Test de validites
2166 if ((FirstOrder < 0) || (LastOrder < 0)) return Standard_False;
2167 Standard_Real D1 = fabs(FirstParameter), D2 = fabs(LastParameter);
2168 if (D1 > 100 || D2 > 100) return Standard_False;
2170 if (D2 < 0.01) return Standard_False;
2171 if (fabs(LastParameter - FirstParameter) / D2 < 0.01) return Standard_False;
2173 // Calcul de la matrice a inverser (MAT)
2175 Ordre[0] = FirstOrder+1;
2176 Ordre[1] = LastOrder+1;
2178 for (cote=0; cote<=1; cote++) {
2181 for (pp=1; pp<=Ordre[cote]; pp++) {
2185 for (jj=pp; jj<=NbCoeff; jj++) {
2186 // tout se passe dans les 3 lignes suivantes
2187 MAT(ii, jj) = Coeff(jj) * Prod;
2188 Coeff(jj) *= jj - pp;
2192 TBorne = LastParameter;
2196 // resolution du systemes
2197 math_Gauss ResolCoeff(MAT, 1.0e-10);
2198 if (!ResolCoeff.IsDone()) return Standard_False;
2200 for (ii=1; ii<=NbCoeff; ii++) {
2202 ResolCoeff.Solve(B, Coeff);
2203 MatrixCoefs.SetRow( ii, Coeff);
2206 return Standard_True;
2209 //=======================================================================
2210 //function : CoefficientsPoles
2212 //=======================================================================
2214 void PLib::CoefficientsPoles (const TColgp_Array1OfPnt& Coefs,
2215 const TColStd_Array1OfReal& WCoefs,
2216 TColgp_Array1OfPnt& Poles,
2217 TColStd_Array1OfReal& Weights)
2219 TColStd_Array1OfReal tempC(1,3*Coefs.Length());
2220 PLib::SetPoles(Coefs,tempC);
2221 TColStd_Array1OfReal tempP(1,3*Poles.Length());
2222 PLib::SetPoles(Coefs,tempP);
2223 PLib::CoefficientsPoles(3,tempC,WCoefs,tempP,Weights);
2224 PLib::GetPoles(tempP,Poles);
2227 //=======================================================================
2228 //function : CoefficientsPoles
2230 //=======================================================================
2232 void PLib::CoefficientsPoles (const TColgp_Array1OfPnt2d& Coefs,
2233 const TColStd_Array1OfReal& WCoefs,
2234 TColgp_Array1OfPnt2d& Poles,
2235 TColStd_Array1OfReal& Weights)
2237 TColStd_Array1OfReal tempC(1,2*Coefs.Length());
2238 PLib::SetPoles(Coefs,tempC);
2239 TColStd_Array1OfReal tempP(1,2*Poles.Length());
2240 PLib::SetPoles(Coefs,tempP);
2241 PLib::CoefficientsPoles(2,tempC,WCoefs,tempP,Weights);
2242 PLib::GetPoles(tempP,Poles);
2245 //=======================================================================
2246 //function : CoefficientsPoles
2248 //=======================================================================
2250 void PLib::CoefficientsPoles (const TColStd_Array1OfReal& Coefs,
2251 const TColStd_Array1OfReal& WCoefs,
2252 TColStd_Array1OfReal& Poles,
2253 TColStd_Array1OfReal& Weights)
2255 PLib::CoefficientsPoles(1,Coefs,WCoefs,Poles,Weights);
2258 //=======================================================================
2259 //function : CoefficientsPoles
2261 //=======================================================================
2263 void PLib::CoefficientsPoles (const Standard_Integer dim,
2264 const TColStd_Array1OfReal& Coefs,
2265 const TColStd_Array1OfReal& WCoefs,
2266 TColStd_Array1OfReal& Poles,
2267 TColStd_Array1OfReal& Weights)
2269 Standard_Boolean rat = &WCoefs != NULL;
2270 Standard_Integer loc = Coefs.Lower();
2271 Standard_Integer lop = Poles.Lower();
2272 Standard_Integer lowc=0;
2273 Standard_Integer lowp=0;
2274 Standard_Integer upc = Coefs.Upper();
2275 Standard_Integer upp = Poles.Upper();
2276 Standard_Integer upwc=0;
2277 Standard_Integer upwp=0;
2278 Standard_Integer reflen = Coefs.Length()/dim;
2279 Standard_Integer i,j,k;
2282 lowc = WCoefs.Lower(); lowp = Weights.Lower();
2283 upwc = WCoefs.Upper(); upwp = Weights.Upper();
2286 for (i = 0; i < dim; i++){
2287 Poles (lop + i) = Coefs (loc + i);
2288 Poles (upp - i) = Coefs (upc - i);
2291 Weights (lowp) = WCoefs (lowc);
2292 Weights (upwp) = WCoefs (upwc);
2296 for (i = 2; i < reflen; i++ ) {
2297 Cnp = PLib::Bin(reflen - 1, i - 1);
2298 if (rat) Weights (lowp + i - 1) = WCoefs (lowc + i - 1) / Cnp;
2300 for(j = 0; j < dim; j++){
2301 Poles(lop + dim * (i-1) + j)= Coefs(loc + dim * (i-1) + j) / Cnp;
2305 for (i = 1; i <= reflen - 1; i++) {
2307 for (j = reflen - 1; j >= i; j--) {
2308 if (rat) Weights (lowp + j) += Weights (lowp + j -1);
2310 for(k = 0; k < dim; k++){
2311 Poles(lop + dim * j + k) += Poles(lop + dim * (j - 1) + k);
2317 for (i = 1; i <= reflen; i++) {
2319 for(j = 0; j < dim; j++){
2320 Poles(lop + dim * (i-1) + j) /= Weights(lowp + i -1);
2326 //=======================================================================
2327 //function : Trimming
2329 //=======================================================================
2331 void PLib::Trimming(const Standard_Real U1,
2332 const Standard_Real U2,
2333 TColgp_Array1OfPnt& Coefs,
2334 TColStd_Array1OfReal& WCoefs)
2336 TColStd_Array1OfReal temp(1,3*Coefs.Length());
2337 PLib::SetPoles(Coefs,temp);
2338 PLib::Trimming(U1,U2,3,temp,WCoefs);
2339 PLib::GetPoles(temp,Coefs);
2342 //=======================================================================
2343 //function : Trimming
2345 //=======================================================================
2347 void PLib::Trimming(const Standard_Real U1,
2348 const Standard_Real U2,
2349 TColgp_Array1OfPnt2d& Coefs,
2350 TColStd_Array1OfReal& WCoefs)
2352 TColStd_Array1OfReal temp(1,2*Coefs.Length());
2353 PLib::SetPoles(Coefs,temp);
2354 PLib::Trimming(U1,U2,2,temp,WCoefs);
2355 PLib::GetPoles(temp,Coefs);
2358 //=======================================================================
2359 //function : Trimming
2361 //=======================================================================
2363 void PLib::Trimming(const Standard_Real U1,
2364 const Standard_Real U2,
2365 TColStd_Array1OfReal& Coefs,
2366 TColStd_Array1OfReal& WCoefs)
2368 PLib::Trimming(U1,U2,1,Coefs,WCoefs);
2371 //=======================================================================
2372 //function : Trimming
2374 //=======================================================================
2376 void PLib::Trimming(const Standard_Real U1,
2377 const Standard_Real U2,
2378 const Standard_Integer dim,
2379 TColStd_Array1OfReal& Coefs,
2380 TColStd_Array1OfReal& WCoefs)
2384 // on fait le changement de variable v = (u-U1) / (U2-U1)
2385 // on exprime u = f(v) que l'on remplace dans l'expression polynomiale
2386 // decomposee sous la forme du schema iteratif de horner.
2388 Standard_Real lsp = U2 - U1;
2389 Standard_Integer indc, indw=0;
2390 Standard_Integer upc = Coefs.Upper() - dim + 1, upw=0;
2391 Standard_Integer len = Coefs.Length()/dim;
2392 Standard_Boolean rat = &WCoefs != NULL;
2395 if(len != WCoefs.Length())
2396 Standard_Failure::Raise("PLib::Trimming : nbcoefs/dim != nbweights !!!");
2397 upw = WCoefs.Upper();
2401 for (Standard_Integer i = 1; i <= len; i++) {
2402 Standard_Integer j ;
2403 indc = upc - dim*(i-1);
2404 if (rat) indw = upw - i + 1;
2405 //calcul du coefficient de degre le plus faible a l'iteration i
2407 for( j = 0; j < dim; j++){
2408 Coefs(indc - dim + j) += U1 * Coefs(indc + j);
2410 if (rat) WCoefs(indw - 1) += U1 * WCoefs(indw);
2412 //calcul des coefficients intermediaires :
2417 for(Standard_Integer k = 0; k < dim; k++){
2418 Coefs(indc - dim + k) =
2419 U1 * Coefs(indc + k) + lsp * Coefs(indc - dim + k);
2423 WCoefs(indw - 1) = U1 * WCoefs(indw) + lsp * WCoefs(indw - 1);
2427 //calcul du coefficient de degre le plus eleve :
2429 for(j = 0; j < dim; j++){
2430 Coefs(upc + j) *= lsp;
2432 if (rat) WCoefs(upw) *= lsp;
2436 //=======================================================================
2437 //function : CoefficientsPoles
2439 // Modified: 21/10/1996 by PMN : PolesCoefficient (PRO5852).
2440 // on ne bidouille plus les u et v c'est a l'appelant de savoir ce qu'il
2441 // fait avec BuildCache ou plus simplement d'utiliser PolesCoefficients
2442 //=======================================================================
2444 void PLib::CoefficientsPoles (const TColgp_Array2OfPnt& Coefs,
2445 const TColStd_Array2OfReal& WCoefs,
2446 TColgp_Array2OfPnt& Poles,
2447 TColStd_Array2OfReal& Weights)
2449 Standard_Boolean rat = (&WCoefs != NULL);
2450 Standard_Integer LowerRow = Poles.LowerRow();
2451 Standard_Integer UpperRow = Poles.UpperRow();
2452 Standard_Integer LowerCol = Poles.LowerCol();
2453 Standard_Integer UpperCol = Poles.UpperCol();
2454 Standard_Integer ColLength = Poles.ColLength();
2455 Standard_Integer RowLength = Poles.RowLength();
2457 // Bidouille pour retablir u et v pour les coefs calcules
2459 // Standard_Boolean inv = Standard_False; //ColLength != Coefs.ColLength();
2461 Standard_Integer Row, Col;
2462 Standard_Real W, Cnp;
2464 Standard_Integer I1, I2;
2465 Standard_Integer NPoleu , NPolev;
2468 for (NPoleu = LowerRow; NPoleu <= UpperRow; NPoleu++){
2469 Poles (NPoleu, LowerCol) = Coefs (NPoleu, LowerCol);
2471 Weights (NPoleu, LowerCol) = WCoefs (NPoleu, LowerCol);
2474 for (Col = LowerCol + 1; Col <= UpperCol - 1; Col++) {
2475 Cnp = PLib::Bin(RowLength - 1,Col - LowerCol);
2476 Temp = Coefs (NPoleu, Col).XYZ();
2478 Poles (NPoleu, Col).SetXYZ (Temp);
2480 Weights (NPoleu, Col) = WCoefs (NPoleu, Col) / Cnp;
2483 Poles (NPoleu, UpperCol) = Coefs (NPoleu, UpperCol);
2485 Weights (NPoleu, UpperCol) = WCoefs (NPoleu, UpperCol);
2488 for (I1 = 1; I1 <= RowLength - 1; I1++) {
2490 for (I2 = UpperCol; I2 >= LowerCol + I1; I2--) {
2492 (Poles (NPoleu, I2).XYZ(), Poles (NPoleu, I2-1).XYZ());
2493 Poles (NPoleu, I2).SetXYZ (Temp);
2494 if (rat) Weights(NPoleu, I2) += Weights(NPoleu, I2-1);
2499 for (NPolev = LowerCol; NPolev <= UpperCol; NPolev++){
2501 for (Row = LowerRow + 1; Row <= UpperRow - 1; Row++) {
2502 Cnp = PLib::Bin(ColLength - 1,Row - LowerRow);
2503 Temp = Poles (Row, NPolev).XYZ();
2505 Poles (Row, NPolev).SetXYZ (Temp);
2506 if (rat) Weights(Row, NPolev) /= Cnp;
2509 for (I1 = 1; I1 <= ColLength - 1; I1++) {
2511 for (I2 = UpperRow; I2 >= LowerRow + I1; I2--) {
2513 (Poles (I2, NPolev).XYZ(), Poles (I2-1, NPolev).XYZ());
2514 Poles (I2, NPolev).SetXYZ (Temp);
2515 if (rat) Weights(I2, NPolev) += Weights(I2-1, NPolev);
2521 for (Row = LowerRow; Row <= UpperRow; Row++) {
2523 for (Col = LowerCol; Col <= UpperCol; Col++) {
2524 W = Weights (Row, Col);
2525 Temp = Poles(Row, Col).XYZ();
2527 Poles(Row, Col).SetXYZ (Temp);
2533 //=======================================================================
2534 //function : UTrimming
2536 //=======================================================================
2538 void PLib::UTrimming(const Standard_Real U1,
2539 const Standard_Real U2,
2540 TColgp_Array2OfPnt& Coeffs,
2541 TColStd_Array2OfReal& WCoeffs)
2543 Standard_Boolean rat = &WCoeffs != NULL;
2544 Standard_Integer lr = Coeffs.LowerRow();
2545 Standard_Integer ur = Coeffs.UpperRow();
2546 Standard_Integer lc = Coeffs.LowerCol();
2547 Standard_Integer uc = Coeffs.UpperCol();
2548 TColgp_Array1OfPnt Temp (lr,ur);
2549 TColStd_Array1OfReal Temw (lr,ur);
2551 for (Standard_Integer icol = lc; icol <= uc; icol++) {
2552 Standard_Integer irow ;
2553 for ( irow = lr; irow <= ur; irow++) {
2554 Temp (irow) = Coeffs (irow, icol);
2555 if (rat) Temw (irow) = WCoeffs (irow, icol);
2557 if (rat) PLib::Trimming (U1, U2, Temp, Temw);
2558 else PLib::Trimming (U1, U2, Temp, PLib::NoWeights());
2560 for (irow = lr; irow <= ur; irow++) {
2561 Coeffs (irow, icol) = Temp (irow);
2562 if (rat) WCoeffs (irow, icol) = Temw (irow);
2567 //=======================================================================
2568 //function : VTrimming
2570 //=======================================================================
2572 void PLib::VTrimming(const Standard_Real V1,
2573 const Standard_Real V2,
2574 TColgp_Array2OfPnt& Coeffs,
2575 TColStd_Array2OfReal& WCoeffs)
2577 Standard_Boolean rat = &WCoeffs != NULL;
2578 Standard_Integer lr = Coeffs.LowerRow();
2579 Standard_Integer ur = Coeffs.UpperRow();
2580 Standard_Integer lc = Coeffs.LowerCol();
2581 Standard_Integer uc = Coeffs.UpperCol();
2582 TColgp_Array1OfPnt Temp (lc,uc);
2583 TColStd_Array1OfReal Temw (lc,uc);
2585 for (Standard_Integer irow = lr; irow <= ur; irow++) {
2586 Standard_Integer icol ;
2587 for ( icol = lc; icol <= uc; icol++) {
2588 Temp (icol) = Coeffs (irow, icol);
2589 if (rat) Temw (icol) = WCoeffs (irow, icol);
2591 if (rat) PLib::Trimming (V1, V2, Temp, Temw);
2592 else PLib::Trimming (V1, V2, Temp, PLib::NoWeights());
2594 for (icol = lc; icol <= uc; icol++) {
2595 Coeffs (irow, icol) = Temp (icol);
2596 if (rat) WCoeffs (irow, icol) = Temw (icol);
2601 //=======================================================================
2602 //function : HermiteInterpolate
2604 //=======================================================================
2606 Standard_Boolean PLib::HermiteInterpolate
2607 (const Standard_Integer Dimension,
2608 const Standard_Real FirstParameter,
2609 const Standard_Real LastParameter,
2610 const Standard_Integer FirstOrder,
2611 const Standard_Integer LastOrder,
2612 const TColStd_Array2OfReal& FirstConstr,
2613 const TColStd_Array2OfReal& LastConstr,
2614 TColStd_Array1OfReal& Coefficients)
2616 Standard_Real Pattern[3][6];
2618 // portage HP : il faut les initialiser 1 par 1
2639 math_Matrix A(0,FirstOrder+LastOrder+1, 0,FirstOrder+LastOrder+1);
2640 // The initialisation of the matrix A
2641 Standard_Integer irow ;
2642 for ( irow=0; irow<=FirstOrder; irow++) {
2643 Standard_Real FirstVal = 1.;
2645 for (Standard_Integer icol=0; icol<=FirstOrder+LastOrder+1; icol++) {
2646 A(irow,icol) = Pattern[irow][icol]*FirstVal;
2647 if (irow <= icol) FirstVal *= FirstParameter;
2651 for (irow=0; irow<=LastOrder; irow++) {
2652 Standard_Real LastVal = 1.;
2654 for (Standard_Integer icol=0; icol<=FirstOrder+LastOrder+1; icol++) {
2655 A(irow+FirstOrder+1,icol) = Pattern[irow][icol]*LastVal;
2656 if (irow <= icol) LastVal *= LastParameter;
2660 // The filled matrix A for FirstOrder=LastOrder=2 is:
2662 // 1 FP FP**2 FP**3 FP**4 FP**5
2663 // 0 1 2*FP 3*FP**2 4*FP**3 5*FP**4 FP - FirstParameter
2664 // 0 0 2 6*FP 12*FP**2 20*FP**3
2665 // 1 LP LP**2 LP**3 LP**4 LP**5
2666 // 0 1 2*LP 3*LP**2 4*LP**3 5*LP**4 LP - LastParameter
2667 // 0 0 2 6*LP 12*LP**2 20*LP**3
2669 // If FirstOrder or LastOrder <=2 then some rows and columns are missing.
2671 // If FirstOrder=1 then 3th row and 6th column are missing
2672 // If FirstOrder=LastOrder=0 then 2,3,5,6th rows and 3,4,5,6th columns are missing
2674 math_Gauss Equations(A);
2675 // cout << "A=" << A << endl;
2677 for (Standard_Integer idim=1; idim<=Dimension; idim++) {
2678 // cout << "idim=" << idim << endl;
2680 math_Vector B(0,FirstOrder+LastOrder+1);
2681 Standard_Integer icol ;
2682 for ( icol=0; icol<=FirstOrder; icol++)
2683 B(icol) = FirstConstr(idim,icol);
2685 for (icol=0; icol<=LastOrder; icol++)
2686 B(FirstOrder+1+icol) = LastConstr(idim,icol);
2687 // cout << "B=" << B << endl;
2689 // The solving of equations system A * X = B. Then B = X
2691 // cout << "After Solving" << endl << "B=" << B << endl;
2693 if (Equations.IsDone()==Standard_False) return Standard_False;
2695 // the filling of the Coefficients
2697 for (icol=0; icol<=FirstOrder+LastOrder+1; icol++)
2698 Coefficients(Dimension*icol+idim-1) = B(icol);
2700 return Standard_True;
2703 //=======================================================================
2704 //function : JacobiParameters
2706 //=======================================================================
2708 void PLib::JacobiParameters(const GeomAbs_Shape ConstraintOrder,
2709 const Standard_Integer MaxDegree,
2710 const Standard_Integer Code,
2711 Standard_Integer& NbGaussPoints,
2712 Standard_Integer& WorkDegree)
2714 // ConstraintOrder: Ordre de contrainte aux extremites :
2715 // C0 = contraintes de passage aux bornes;
2716 // C1 = C0 + contraintes de derivees 1eres;
2717 // C2 = C1 + contraintes de derivees 2ndes.
2718 // MaxDegree: Nombre maxi de coeff de la "courbe" polynomiale
2719 // d' approximation (doit etre superieur ou egal a
2720 // 2*NivConstr+2 et inferieur ou egal a 50).
2721 // Code: Code d' init. des parametres de discretisation.
2722 // (choix de NBPNTS et de NDGJAC de MAPF1C,MAPFXC).
2723 // = -5 Calcul tres rapide mais peu precis (8pts)
2724 // = -4 ' ' ' ' ' ' (10pts)
2725 // = -3 ' ' ' ' ' ' (15pts)
2726 // = -2 ' ' ' ' ' ' (20pts)
2727 // = -1 ' ' ' ' ' ' (25pts)
2728 // = 1 calcul rapide avec precision moyenne (30pts).
2729 // = 2 calcul rapide avec meilleure precision (40pts).
2730 // = 3 calcul un peu plus lent avec bonne precision (50 pts).
2731 // = 4 calcul lent avec la meilleure precision possible
2734 // The possible values of NbGaussPoints
2736 const Standard_Integer NDEG8=8, NDEG10=10, NDEG15=15, NDEG20=20, NDEG25=25,
2737 NDEG30=30, NDEG40=40, NDEG50=50, NDEG61=61;
2739 Standard_Integer NivConstr=0;
2740 switch (ConstraintOrder) {
2741 case GeomAbs_C0: NivConstr = 0; break;
2742 case GeomAbs_C1: NivConstr = 1; break;
2743 case GeomAbs_C2: NivConstr = 2; break;
2745 Standard_ConstructionError::Raise("Invalid ConstraintOrder");
2747 if (MaxDegree < 2*NivConstr+1)
2748 Standard_ConstructionError::Raise("Invalid MaxDegree");
2751 WorkDegree = MaxDegree + 9;
2753 WorkDegree = MaxDegree + 6;
2755 //---> Nbre mini de points necessaires.
2756 Standard_Integer IPMIN=0;
2757 if (WorkDegree < NDEG8)
2759 else if (WorkDegree < NDEG10)
2761 else if (WorkDegree < NDEG15)
2763 else if (WorkDegree < NDEG20)
2765 else if (WorkDegree < NDEG25)
2767 else if (WorkDegree < NDEG30)
2769 else if (WorkDegree < NDEG40)
2771 else if (WorkDegree < NDEG50)
2773 else if (WorkDegree < NDEG61)
2776 Standard_ConstructionError::Raise("Invalid MaxDegree");
2777 // ---> Nbre de points voulus.
2778 Standard_Integer IWANT=0;
2780 case -5: IWANT=NDEG8; break;
2781 case -4: IWANT=NDEG10; break;
2782 case -3: IWANT=NDEG15; break;
2783 case -2: IWANT=NDEG20; break;
2784 case -1: IWANT=NDEG25; break;
2785 case 1: IWANT=NDEG30; break;
2786 case 2: IWANT=NDEG40; break;
2787 case 3: IWANT=NDEG50; break;
2788 case 4: IWANT=NDEG61; break;
2790 Standard_ConstructionError::Raise("Invalid Code");
2792 //--> NbGaussPoints est le nombre de points de discretisation de la fonction,
2793 // il ne peut prendre que les valeurs 8,10,15,20,25,30,40,50 ou 61.
2794 // NbGaussPoints doit etre superieur strictement a WorkDegree.
2795 NbGaussPoints = Max(IPMIN,IWANT);
2796 // NbGaussPoints +=2;
2799 //=======================================================================
2800 //function : NivConstr
2801 //purpose : translates from GeomAbs_Shape to Integer
2802 //=======================================================================
2804 Standard_Integer PLib::NivConstr(const GeomAbs_Shape ConstraintOrder)
2806 Standard_Integer NivConstr=0;
2807 switch (ConstraintOrder) {
2808 case GeomAbs_C0: NivConstr = 0; break;
2809 case GeomAbs_C1: NivConstr = 1; break;
2810 case GeomAbs_C2: NivConstr = 2; break;
2812 Standard_ConstructionError::Raise("Invalid ConstraintOrder");
2817 //=======================================================================
2818 //function : ConstraintOrder
2819 //purpose : translates from Integer to GeomAbs_Shape
2820 //=======================================================================
2822 GeomAbs_Shape PLib::ConstraintOrder(const Standard_Integer NivConstr)
2824 GeomAbs_Shape ConstraintOrder=GeomAbs_C0;
2825 switch (NivConstr) {
2826 case 0: ConstraintOrder = GeomAbs_C0; break;
2827 case 1: ConstraintOrder = GeomAbs_C1; break;
2828 case 2: ConstraintOrder = GeomAbs_C2; break;
2830 Standard_ConstructionError::Raise("Invalid NivConstr");
2832 return ConstraintOrder;
2835 //=======================================================================
2836 //function : EvalLength
2838 //=======================================================================
2840 void PLib::EvalLength(const Standard_Integer Degree, const Standard_Integer Dimension,
2841 Standard_Real& PolynomialCoeff,
2842 const Standard_Real U1, const Standard_Real U2,
2843 Standard_Real& Length)
2845 Standard_Integer i,j,idim, degdim;
2846 Standard_Real C1,C2,Sum,Tran,X1,X2,Der1,Der2,D1,D2,DD;
2848 Standard_Real *PolynomialArray = &PolynomialCoeff ;
2850 Standard_Integer NbGaussPoints = 4 * Min((Degree/4)+1,10);
2852 math_Vector GaussPoints(1,NbGaussPoints);
2853 math::GaussPoints(NbGaussPoints,GaussPoints);
2855 math_Vector GaussWeights(1,NbGaussPoints);
2856 math::GaussWeights(NbGaussPoints,GaussWeights);
2858 C1 = (U2 + U1) / 2.;
2859 C2 = (U2 - U1) / 2.;
2861 //-----------------------------------------------------------
2862 //****** Integration - Boucle sur les intervalles de GAUSS **
2863 //-----------------------------------------------------------
2867 for (j=1; j<=NbGaussPoints/2; j++) {
2868 // Integration en tenant compte de la symetrie
2869 Tran = C2 * GaussPoints(j);
2873 //****** Derivation sur la dimension de l'espace **
2875 degdim = Degree*Dimension;
2877 for (idim=0; idim<Dimension; idim++) {
2878 D1 = D2 = Degree * PolynomialArray [idim + degdim];
2879 for (i=Degree-1; i>=1; i--) {
2880 DD = i * PolynomialArray [idim + i*Dimension];
2888 //****** Integration **
2890 Sum += GaussWeights(j) * C2 * (Sqrt(Der1) + Sqrt(Der2));
2892 //****** Fin de boucle dur les intervalles de GAUSS **
2898 //=======================================================================
2899 //function : EvalLength
2901 //=======================================================================
2903 void PLib::EvalLength(const Standard_Integer Degree, const Standard_Integer Dimension,
2904 Standard_Real& PolynomialCoeff,
2905 const Standard_Real U1, const Standard_Real U2,
2906 const Standard_Real Tol,
2907 Standard_Real& Length, Standard_Real& Error)
2910 Standard_Integer NbSubInt = 1, // Current number of subintervals
2911 MaxNbIter = 13, // Max number of iterations
2912 NbIter = 1; // Current number of iterations
2913 Standard_Real dU,OldLen,LenI;
2915 PLib::EvalLength(Degree,Dimension, PolynomialCoeff, U1,U2, Length);
2921 dU = (U2-U1)/NbSubInt;
2922 for (i=1; i<=NbSubInt; i++) {
2923 PLib::EvalLength(Degree,Dimension, PolynomialCoeff, U1+(i-1)*dU,U1+i*dU, LenI);
2927 Error = Abs(OldLen-Length);
2929 while (Error > Tol && NbIter <= MaxNbIter);