242 Introduction to C++ Programming and Graphics
angx = angxinit;
angy = angyinit;
zoom = zoominit;
color (bgc);
clear ();
drawplot3d();
}
//--- If ’p’ is pressed, print in a file:
if(kbd==’p’)
{
char outfile[1];
cout << " Please enter the name of the postscript file " <<endl;
cin >> outfile;
cout << "Please enter:" << endl << endl;
cout <<" 1 for a black/white plot" << endl;
cout <<" 2 for a black/white plot in portrait" << endl;
cout <<" 3 for a color plot" << endl;
cout <<" 4 for a color plot with background color" << endl;
cout <<" 5 for a color plot in portrait" << endl;
cout <<" 6 for a color plot in portrait with background color" << endl;
short Iplot;
cin >> Iplot;
voutput (outfile);
if(Iplot==1) vnewdev("postscript");
if(Iplot==2) vnewdev("ppostscript");
if(Iplot==3) vnewdev("cps");
if(Iplot==4) vnewdev("cps");
if(Iplot==5) vnewdev("pcps");
if(Iplot==6) vnewdev("pcps");
drawplot3d(); // print in file
vnewdev ("X11"); // redraw on the screen
color (bgc);
clear ();
drawplot3d();
//--- Interactive:
cout << "Press q to quit" << endl;
cout <<"ptoprint a postscript file" << endl;
cout <<"rtoreset" << endl;
cout << "Place cursor at the center of the graphics window" << endl;
cout << "and then click and move the:" << endl;
cout << " left-mouse button to rotate left-right" << endl;