Programming and Graphics

(Kiana) #1

7.7 Three-dimensional interactive graph 245


float zoom=1.0; // zoom
float angxinit = angx;
float angyinit = angy;
float angzinit = angz;
float zoominit = zoom;
int ntcx=4; // number of ticks on the x axis
int ntcy=4; // number of ticks on the y axis
int ntcz=4; // number of ticks on the z axis
int bgc=WHITE; // background color
int axc=RED; // axis color
int lbc=GREEN; // label color
int lnc=BLUE; // line color
int Iswap=1;
char labelx[]="x"; // x-axis label
char labely[]="y"; // y-axis label
char labelz[]="z"; // y-axis label
char title1[12]="vogle"; // first title
char title2[12]="plot3d"; // second title
char title3[12]="beerware"; // third title
int Iaxes; // draw axes?
int Itick; // ticks on axes?
int Itry; // repeat index for animation
int np[21];
float xd[21][128];
float yd[21][128];
float zd[21][128];
int nc=2; // number of curves

//------------main----------------

int main()
{

//--- Preferences:

Iaxes = 1; // draw axes
Itick = 1; // draw ticks
int Itry = 1; // for animation

//--- Initialize the device:

char device[] = "X11";
prefposition (500,100);
prefsize (500,500);
vinit (device);

if(backbuffer()==0)
{
vexit();
Free download pdf