Aller au contenu

Mathc gnuplot/Fichiers h : xfxyz x

Un livre de Wikilivres.


Installer ce fichier dans votre répertoire de travail.

y_r.h
/* ------------------------------------ */
/*      Save as : y_r.h                 */
/* ------------------------------------ */
void pd(
double **A
)
{
FILE   *fp = fopen("data.plt","a");   
                    
fprintf(fp," %+.3f %+.3f\n",A[R1][C1],A[R2][C1]); 	  
 fclose(fp);
}
/* ------------------------------------ */   
void pu(
double **A
)
{
FILE   *fp = fopen("data.plt","a"); 
        
fprintf(fp,"\n %+.3f %+.3f\n",A[R1][C1],A[R2][C1]); 	   
 fclose(fp);
}
/* ------------------------------------ */   
double **g_main(
double **A,
double xmin,
double xmax,
double ymin,
double ymax
)
{
FILE *fp;

        fp = fopen("a_main.plt","w");
fprintf(fp,"# Gnuplot file : load \"a_main.plt\" \n"
           "reset\n" 
           "set zeroaxis\n" 
           "set size ratio -1\n" 
           "plot [%0.3f:%0.3f] [%0.3f:%0.3f] \\\n"
           "\"data.plt\" with linesp pt 0\n"
           ,xmin,xmax,ymin,ymax);
 fclose(fp);
 
        fp = fopen("data.plt","w"); 
 fclose(fp);
 
        A[R1][C1] = 0.;
        A[R2][C1] = 0.;
   
        pd(A);
        
return(A);                         
}
/* ------------------------------------ */   
double **G_main(
double xmin,
double xmax,
double ymin,
double ymax
)
{ 
 return(g_main(I_mR(R2,C1),xmin,xmax,ymin,ymax));     
}
/* ------------------------------------ */   
void set(
double **A,
double x,
double y
)
{
   A[R1][C1] = x;
   A[R2][C1] = y;
   
   pd(A);
}
/* ------------------------------------ */   
void setup(
double **A,
double x,
double y
)
{
   A[R1][C1] = x;
   A[R2][C1] = y;
   
   pu(A);
}
/* ------------------------------------ */   
void vo(
double **A,
double alpha,
double side
)
{
double **T = I_mR(R2,C2);
double **B = I_mR(R2,C1);
double **C = I_mR(R2,C1);

   B[R1][C1] = side;
   B[R2][C1] = 0.;
   
   rot2D_mR(T,PI/180.*(alpha));
     mul_mR(T,B,C);
       c_mR(A,B);
     add_mR(B,C,A);
   
   pd(A);   
   
F_mR(C);
F_mR(B);                        
F_mR(T);
}
/* ------------------------------------ */   
void vu(
double **A,
double alpha,
double side
)
{
double **T = I_mR(R2,C2);
double **B = I_mR(R2,C1);
double **C = I_mR(R2,C1);

   B[R1][C1] = side;
   B[R2][C1] = 0.;
   
   rot2D_mR(T,PI/180.*(alpha));
     mul_mR(T,B,C);
       c_mR(A,B);
     add_mR(B,C,A);
   
   pu(A);   
   
F_mR(C);
F_mR(B);                        
F_mR(T);
}
/* ------------------------------------ */
/* ------------------------------------ */