1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| double* ConstruitParametres (int Dimension, int NbPoints, VecteurPtr Q[]) //Q contient NbPoints vecteurs de dimension Dimension
{
int i;
double* t;
t[0]=0.;
for (i=1; i<NbPoints; i++)
{
t[i]=t[i-1]+DistancePoints(Q[i],Q[i-1]);
printf("Termine DistancePoints pour i=%d. t[%d]=%f\n",i,i,t[i]);
}
return t;
}
CourbeBezierPtr ConstruitCourbe (int Dimension, int NbPoints, int Degre, VecteurPtr Points[])
{
if (NbPoints==Degre+1)
{
CourbeBezierPtr C = CourbeBezierConstructeur(Dimension, Degre);
printf("1/ C->Degre=%d\n",C->Degre); // vaut 2
MatricePtr M = MatriceConstructeur(NbPoints,C->Ordre);
printf("2/ C->Degre=%d\n",C->Degre); // vaut 2
double* A = ConstruitParametres(Dimension, NbPoints, Points);
int i,j,k;
printf("3/C->Degre=%d\n",C->Degre); // vaut 0 !!?
for (i=0; i<NbPoints; i++)
{
for (j=0; j<(C->Ordre); j++)
{
printf("A[%d]=%f, C->Degre=%d, j=%d\n",i,A[i],C->Degre,j);
M->Coef2d[i][j] = EvalueBernstein(C->Degre, j, A[i]);
}
} |
Partager