gem-graph-client/include/xfxyz_x.h

52 lines
1.0 KiB
C

/* ------------------------------------------------------------------ */
/* gnuplot : xfxyz_x.h */
/* https://fr.wikibooks.org/wiki/Mathc_gnuplot/Fichiers_h_:_xfxyz_x */
/* ------------------------------------------------------------------ */
#include "xspv.h"
double fxyz_x(
double (*P_f)(double x, double y, double z),
double h,
point3d p
)
{
double tplsh;
double tmnsh;
tplsh = ((*P_f)(p.x+h,p.y,p.z));
tmnsh = ((*P_f)(p.x-h,p.y,p.z));
return(( tplsh-tmnsh)/(2.*h) );
}
/* ------------------------------------ */
double fxyz_y(
double (*P_f)(double x, double y, double z),
double h,
point3d p
)
{
double tplsh;
double tmnsh;
tplsh = ((*P_f)(p.x,p.y+h,p.z));
tmnsh = ((*P_f)(p.x,p.y-h,p.z));
return(( tplsh-tmnsh)/(2.*h) );
}
/* ------------------------------------ */
double fxyz_z(
double (*P_f)(double x, double y, double z),
double h,
point3d p
)
{
double tplsh;
double tmnsh;
tplsh = ((*P_f)(p.x,p.y,p.z+h));
tmnsh = ((*P_f)(p.x,p.y,p.z-h));
return(( tplsh-tmnsh)/(2.*h) );
}