Aller au contenu

Mathc initiation/Fichiers h : x 69a3

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.

kg_3dv2.h
/* --------------------------------- */
/* save as kg_3dv2.h                 */
/* --------------------------------- */
void G_3d_v2(
CTRL_splot  p,
  char      feq[],
double      (*P_f)     (double x, double y),
double      (*P_f_mnsz)(double x, double y, double z),
pt2d        Q2d,
double      SizeSide
)
{
FILE   *fp;

pt3d Q3d = i_pt3d(Q2d.x,Q2d.y,(*P_f)(Q2d.x,Q2d.y));

v2d    V = grad_fxy((*P_f),       H, Q2d);
v3d    U = grad_fxyz((*P_f_mnsz), H, Q3d);

        fp = fopen("a_main.plt","w");
        
fprintf(fp,"reset\n");

fprintf(fp,"set    samples 40\n");
fprintf(fp,"set isosamples 40\n");
//fprintf(fp,"set hidden3d\n");

fprintf(fp,"set xlabel \"X axis\"\n");
fprintf(fp,"set ylabel \"Y axis\"\n");
fprintf(fp,"set zlabel \"Z axis\" offset 1, 0\n");

fprintf(fp,"set view %0.3f, %0.3f, %0.3f, %0.3f \n",
                    p.rot_x,p.rot_z,p.scale,p.scale_z);
fprintf(fp,"set xrange [%0.3f:%0.3f]\n",p.xmin,p.xmax);
fprintf(fp,"set yrange [%0.3f:%0.3f]\n",p.ymin,p.ymax);
fprintf(fp,"set zrange [%0.3f:%0.3f]\n",p.zmin,p.zmax);

fprintf(fp,"splot ");
fprintf(fp," \"a_ka\" with linespoints lt 7,\\\n");
fprintf(fp," \"a_kb\" with linespoints lt 7,\\\n");
fprintf(fp," %s ",feq);
fprintf(fp,"\n\n");
 fclose(fp);

 fp = fopen("a_ka","w");
 
         fprintf(fp," %6.3f   %6.3f   %6.3f\n", 
                      Q3d.x,  Q3d.y,  Q3d.z );
                     
         fprintf(fp," %6.3f   %6.3f   %6.3f\n", 
                      Q3d.x - U.i,
                      Q3d.y - U.j,             
                      Q3d.z - U.k);
 fclose(fp);
 
 fp = fopen("a_kb","w");
         fprintf(fp," %6.3f   %6.3f   %6.3f\n", 
              Q2d.x + SizeSide, 
              Q2d.y + SizeSide,               
              V.i * (+SizeSide) + V.j * (+SizeSide) + Q3d.z
              );
         fprintf(fp," %6.3f   %6.3f   %6.3f\n", 
              Q2d.x - SizeSide, 
              Q2d.y + SizeSide,
              V.i * (-SizeSide) + V.j * (+SizeSide) + Q3d.z              
              );
         fprintf(fp," %6.3f   %6.3f   %6.3f\n", 
              Q2d.x - SizeSide, 
              Q2d.y - SizeSide,
              V.i * (-SizeSide)+V.j * (-SizeSide) + Q3d.z               
              );
         fprintf(fp," %6.3f   %6.3f   %6.3f\n", 
              Q2d.x + SizeSide, 
              Q2d.y - SizeSide,
              V.i * (+SizeSide) + V.j * (-SizeSide) + Q3d.z                               
              );
         fprintf(fp," %6.3f   %6.3f   %6.3f\n", 
              Q2d.x+SizeSide, 
              Q2d.y+SizeSide,
              V.i * (+SizeSide)+V.j * (+SizeSide) + Q3d.z                             
              );
         fprintf(fp," %6.3f   %6.3f   %6.3f\n", 
              Q2d.x - SizeSide, 
              Q2d.y - SizeSide, 
              V.i * (-SizeSide) + V.j * (-SizeSide) + Q3d.z             
              );
         fprintf(fp," %6.3f   %6.3f   %6.3f\n", 
              Q2d.x + SizeSide, 
              Q2d.y - SizeSide,    
              V.i * (+SizeSide) + V.j * (-SizeSide) + Q3d.z                          
              );
         fprintf(fp," %6.3f   %6.3f   %6.3f\n", 
              Q2d.x - SizeSide, 
              Q2d.y + SizeSide,
              V.i * (-SizeSide) + V.j*(+SizeSide) + Q3d.z                               
              );
 fclose(fp);
}
/* --------------------------------- */
/* --------------------------------- */


Déclaration des fichiers h.