/* plot3d.c */ /* move x, X, y, Y, z, Z */ /* We use the plot3d view function in the display callback to point the object, whose position can be altered by the x,X,y,Y,z and Z keys for object position r,R,p,P,h and H keys for rool, pitch and heading s,S kets for scale The view is set in the reshape callback */ #include #include #include #include #undef abs #define abs(a) ((a)<0.0?(-(a)):(a)) #undef min #define min(a,b) ((a)<(b)?(a):(b)) #undef max #define max(a,b) ((a)>(b)?(a):(b)) static GLfloat xoff=0.0; static GLfloat yoff=0.0; static GLfloat zoff=0.0; static GLfloat roll =15.0; static GLfloat pitch =30.0; static GLfloat heading=45.0; static GLfloat scale=0.0625; static GLfloat xmin=0.0; static GLfloat xmax=4.0; static GLfloat ymin=0.0; static GLfloat ymax=4.0; static GLfloat zmin=0.0; static GLfloat zmax=4.0; static GLfloat zsmall; static GLfloat zlarge; static int n = 33; /* define function F(x,y) to be plotted */ double F1(double x,double y) { return 2.0*x+3.0*x*x+y+2.0*x*y-31.0; } double F2(double x,double y) { return (-x)+x*x+2.0*y+x*y-14.0; } double F(double x,double y) { return abs(F1(x,y))+abs(F2(x,y)); } static void printstring(void *font, char msg[]) { int len, i; len = (int)strlen(msg); for(i=0; i