Aller au contenu

Mathc initiation/a243

Un livre de Wikilivres.


Sommaire


Installer et compiler ces fichiers dans votre répertoire de travail.

c00c.c
/* ------------------------------------ */
/*  Save as :   c00c.c                  */
/* ------------------------------------ */
#include  "x_hfile.h"
/* ------------------------------------ */
int main(void)
{
double n = 5;

 clrscrn();

 printf(" |n|     n!       \n"
        " |k| = ---------         Binomial Coefficient\n"
        "       k! (n-k)!\n\n\n\n");
         
 printf(" Polynomial for bezier curves :\n\n" 
        "          With n = %.0f and  0 < k < n  \n\n"         
        "    |n|                                   \n"
        "    |k|                   n-k           k   ",n);          

 if(n<22)
   {
    p_BezierCurves(n,'x');
    
    p_BezierCurves(n,'y');
   }
 else
   {
    clrscrn();
    printf(" Error: n = %.0f. n must be"
           " an integer between 1 and 21.\n\n\n\n",n);
   }
    
 stop();

 return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Courbe de Bezier avec 5 Points de Contrôles


Exemple de sortie écran :

 |n|     n!       
 |k| = ---------         Binomial Coefficient
       k! (n-k)!


 Polynomial for bezier curves :

          With n = 5 and  0 < k < n  

    |n|                                   
    |k|                   n-k           k   
      1 * P0.x * pow((1-t), 5) * pow(t, 0) +
      5 * P1.x * pow((1-t), 4) * pow(t, 1) +
     10 * P2.x * pow((1-t), 3) * pow(t, 2) +
     10 * P3.x * pow((1-t), 2) * pow(t, 3) +
      5 * P4.x * pow((1-t), 1) * pow(t, 4) +
      1 * P5.x * pow((1-t), 0) * pow(t, 5)  


      1 * P0.y * pow((1-t), 5) * pow(t, 0) +
      5 * P1.y * pow((1-t), 4) * pow(t, 1) +
     10 * P2.y * pow((1-t), 3) * pow(t, 2) +
     10 * P3.y * pow((1-t), 2) * pow(t, 3) +
      5 * P4.y * pow((1-t), 1) * pow(t, 4) +
      1 * P5.y * pow((1-t), 0) * pow(t, 5)  

 Press return to continue.