Programming and Graphics
7.5 A graph with axes 229 int main() { float points[4][2]; //--- Define the data to be plotted: ... //--- Define plotting parame ...
230 Introduction to C++ Programming and Graphics ... //--- Prepare the graph: ... //--- Draw axes: ... //----------------------- ...
7.6 Graph animation 231 return 0; } The three dots indicate previously listed blocks of code. When the graph is drawn on the scr ...
232 Introduction to C++ Programming and Graphics float xd[n], yd[n]; // data points float t=0.; // time float Dt=0.05; // time s ...
7.6 Graph animation 233 { points[1][1] = xmin; points[1][2] = ymin; points[2][1] = xmax; points[2][2] = ymin; points[3][1] = xma ...
234 Introduction to C++ Programming and Graphics ,labely // y-axis label ,title1 // first plot label ,title2 // second plot labe ...
7.6 Graph animation 235 Figure 7.6.1 Snapshot of a traveling wave produced by theVogleanimation code graph2danm.cc. if(Iplot==3) ...
236 Introduction to C++ Programming and Graphics Problems 7.6.1. Modify the codegraph2danmto display (a) a traveling square wave ...
7.7 Three-dimensional interactive graph 237 float xrange = xmax-xmin; float yrange = ymax-ymin; float zrange = zmax-zmin; float ...
238 Introduction to C++ Programming and Graphics move (xmin, ymax+0.3*ymargin,zmin-0.8*zmargin); drawstr(labely); move (xmin-0.8 ...
7.7 Three-dimensional interactive graph 239 textsize(csizex,csizey); // ..x axis ticks.../ for (int i=1; i<=ntcx+1; i++) { fl ...
240 Introduction to C++ Programming and Graphics file2 >> zunit; color (lbc); move (xmin-3*csizex, ymin-1.5*ymargin, zgo); ...
7.7 Three-dimensional interactive graph 241 Function plot3dtrans The implementation of the functionplot3dtransis: /*------------ ...
242 Introduction to C++ Programming and Graphics angx = angxinit; angy = angyinit; zoom = zoominit; color (bgc); clear (); drawp ...
7.7 Three-dimensional interactive graph 243 cout << " right-mouse button to rotate up-down" << endl; cout << " ...
244 Introduction to C++ Programming and Graphics //--- Zoom if middle button is pressed: if(click==2) { zoom = zoominit*(xaddr+1 ...
7.7 Three-dimensional interactive graph 245 float zoom=1.0; // zoom float angxinit = angx; float angyinit = angy; float angzinit ...
246 Introduction to C++ Programming and Graphics cout << "Device cannot support double-buffering" << endl; exit(1); ...
7.7 Three-dimensional interactive graph 247 vexit(); return 0; } The plotting parameters are passed to the functionsdrawplot3d.c ...
248 Introduction to C++ Programming and Graphics Figure 7.7.1 Graphics display of codeplot3d. Since these variables are declared ...
«
8
9
10
11
12
13
14
15
16
17
»
Free download pdf