Aller au contenu

Mathc gnuplot/000f

Un livre de Wikilivres.


Sommaire

Petits jeux sur les pentagones

[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_r.h" 
/* ------------------------------------ */  
double **tree(
double **U,
double brancheangle,
double branchelength,
double branchebranche,
double step                             
)
{
double i=branchelength;

  vo(U,+90.,branchelength);
    
  for(;i>0;i-=step)         
     { 
       vo(U, brancheangle+90.,   i);                
       vo(U, brancheangle+90.,  -i);               
       vo(U,-brancheangle+90.,   i);            
       vo(U,-brancheangle+90.,  -i);
       vo(U,             +90.,   i/branchebranche);                   
     } 
     
return(U); 
}
/* ------------------------------------ */   
int main(void)
{
double **U = G_main(-40.,40.,-40.,40.);

double  branchebranche =  4.;                                                             
double   branchelength =  10.;                                          
double    brancheangle = -45.;                        
double            step =  .5;                        

      setup(U,-30.,0.);
      tree(U,brancheangle,branchelength,branchebranche,step);      
      setup(U,-30.,-40.);
      tree(U,brancheangle,branchelength,8.,.3);
      
      setup(U,-10.,0.);
      tree(U,-90,branchelength,branchebranche,step);         
      setup(U,-10.,-40.);
      tree(U,-90,branchelength,8.,.3);               
                  
      setup(U, 10.,0.);
      tree(U,-130,branchelength,branchebranche,step);         
      setup(U, 10.,-40.);
      tree(U,-130,branchelength,8.,.3); 
      
      setup(U, 30.,0.);
      tree(U,-160,branchelength,branchebranche,step);         
      setup(U, 30.,-40.);
      tree(U,-160,branchelength,8.,.3);                          

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

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