Aller au contenu

Mathc gnuplot/Animer deux points

Un livre de Wikilivres.


Sommaire

Jeux sur les polygones

[modifier | modifier le wikicode]

N'oubliez pas les fichiers h de la librairie.

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
#include "y_o.h"
/* ------------------------------------ */
void poly(
double **U,
double d,
double a,
double phasechange,
double n
)
{
double phase=0.;

  for(;n-->0;)
     {
      GO(U,d*cos(phase));
      TU(U,-a);
      phase+=phasechange;
     }
}
/* ------------------------------------ */
int main(void)
{
double **U = GINIT(-10.,10.,-10.,10.);


   clrscrn();

 /*  poly(U, d,   a,   phasechange, n) */
   SETUP(U,0.,-7., 2.5);poly(U, 5. , 45., 11.,300.);
   SETUP(U,0., 8., 4. );poly(U, 2. , 45., 13.,500.);
   SETUP(U,0.,-1.,-7. );poly(U, 3. , 45., 19.,500.);
   SETUP(U,0., 3.,-8. );poly(U, 6. , 45., 17.,500.);

   F_mR(U);

  printf("  ... load \"a_main.plt\" ... with gnuplot.\n");
  getchar(); 

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Résultat dans gnuplot
Turtles09