Aller au contenu

Mathc initiation/a139

Un livre de Wikilivres.


Sommaire

Installer ce fichier dans votre répertoire de travail.

kg_curv3d.h
/* --------------------------------- */
/* save as kg_curv3d.h               */
/* --------------------------------- */
void G_Curve_3d(
double (*P_f)(double t),
double (*P_g)(double t),
double (*P_h)(double t),
tvalue t
)
{
FILE   *fp;
double  T;

  fp = fopen("a_main.plt","w");
  fprintf(fp," reset\n"
             " set zeroaxis lt 8\n"
             " set grid\n\n" 
             " splot \\\n"  
             " \"a_curve\"     with linespoints lt  6,\\\n" 
             " \"a_vector\"    with linespoints lt 16 lw 4");
  fclose(fp);


  fp = fopen("a_curve","w");
  for(T=t.min; T<t.max; T+=t.step)
      fprintf(fp," %6.3f  %6.3f  %6.3f\n",
             (*P_f)(T),(*P_g)(T),(*P_h)(T));
              
  fprintf(fp," %6.3f  %6.3f  %6.3f\n",
         (*P_f)(t.value),(*P_g)(t.value),(*P_h)(t.value));     
  fclose(fp);


  fp = fopen("a_vector","w");
  fprintf(fp,"  0  0  0   \n %6.5f  %6.5f  %6.5f  \n",
       (*P_f)(t.value),(*P_g)(t.value),(*P_h)(t.value));
  fclose(fp);
}
/* --------------------------------- */
/* --------------------------------- */


Déclaration des fichiers h.