Mathc initiation/Fichiers h : c47
Apparence
Installer ce fichier dans votre répertoire de travail.
kg_3dp.h |
---|
/* --------------------------------- */
/* save as kg_3dw.h */
/* --------------------------------- */
void G_3dp(
CTRL_splot w,
double (*P_f)(double x, double y),
tvalue x,
tvalue y
)
{
FILE *fp = fopen("a_main.plt","w");
fprintf(fp,"reset\n");
fprintf(fp,"set xlabel \"<x>\"\n");
fprintf(fp,"set ylabel \"<y>\"\n");
fprintf(fp,"set zlabel \"<z>\"\n");
fprintf(fp,"set samples 40\n");
fprintf(fp,"set isosamples 40\n");
fprintf(fp,"set view %0.3f, %0.3f, %0.3f, %0.3f \n",
w.rot_x,w.rot_z,w.scale,w.scale_z);
fprintf(fp,"set xrange [%0.3f:%0.3f]\n",w.xmin,w.xmax);
fprintf(fp,"set yrange [%0.3f:%0.3f]\n",w.ymin,w.ymax);
fprintf(fp,"set zrange [%0.3f:%0.3f]\n",w.zmin,w.zmax);
fprintf(fp,"splot ");
fprintf(fp," \"a_ka\" with lines,\\\n");
fprintf(fp," \"a_kb\" with lines");
fprintf(fp,"\n\n");
fclose(fp);
fp = fopen("a_ka","w");
for(x.value = w.xmin; x.value <= w.xmax; x.value += x.step)
{
fprintf(fp,"\n\n");
for(y.value = w.ymin; y.value <= w.ymax; y.value += y.step)
fprintf(fp," %6.3f %6.3f %6.3f\n",
x.value, y.value, ((*P_f)(x.value,y.value)) );
}
fclose(fp);
fp = fopen("a_kb","w");
for(y.value = w.ymin; y.value <= w.ymax; y.value += y.step)
{
fprintf(fp,"\n\n");
for(x.value = w.xmin; x.value <= w.xmax; x.value += x.step)
fprintf(fp," %6.3f %6.3f %6.3f\n",
x.value, y.value, ((*P_f)(x.value,y.value)) );
}
fclose(fp);
printf(" ... load \"a_main.plt\" ... with gnuplot.\n\n");
stop();
}
/* --------------------------------- */
/* --------------------------------- */
Déclaration des fichiers h.