Programming and Graphics
7.3 A rotating polygon in animation 209 //--- Animation loop: backbuffer(); // draw in the back buffer repeat: color(BLUE); clea ...
210 Introduction to C++ Programming and Graphics (a)(b) Figure 7.3.1. Snapshot of (a) an animated rotating polygon produced by t ...
7.3 A rotating polygon in animation 211 in Chapter 8 we will see that the menu of available graphics functions and system depend ...
212 Introduction to C++ Programming and Graphics //--- Loop indefinitely: while((but=slocator(&x, &y)) != 44) { pushmatr ...
7.3 A rotating polygon in animation 213 break; case ’+’: tdir = TRANS; break; case 27: /* ESC */ case ’q’: vexit(); exit(0); } } ...
214 Introduction to C++ Programming and Graphics void drawshape(int fill) { polyfill(fill); if (!fill) for (int i=0; i<20; i+ ...
7.4 Plotting a line 215 7.4 Plotting a line............................. Next, we build a code that draws the graph of a line in ...
216 Introduction to C++ Programming and Graphics float ysize = 0.02*yrange; // move to the point: move2(x, y); if (marker==1) ci ...
7.4 Plotting a line 217 /*------------------------------------------- void drawline2d Draw a polygonal line defined by a set of ...
218 Introduction to C++ Programming and Graphics xp=x[i]; yp=y[i]; if(Icheck==1) // perform crossing checks { if( (xp>xmax &a ...
7.4 Plotting a line 219 if (crossymax<tol) { yint = ymax-0.001; xint= ((yint-ypp)*xp-(yint-yp)*xpp)/(yp-ypp); if(ypp>=ymax ...
220 Introduction to C++ Programming and Graphics /*---------------- plot2dsimple plot a line -----------------*/ #include<cma ...
7.5 A graph with axes 221 color (BLACK); int marker = 3; for(int i=0; i<n; i++) { if( xd[i]>xmin && xd[i]<xmax ...
222 Introduction to C++ Programming and Graphics Figure 7.4.1 Graphics display of codeplot2dsimpleshowing a line with markers at ...
7.5 A graph with axes 223 ,char labely[] // y-axis label ,char title1[] // first plot title ,char title2[] // second plot title ...
224 Introduction to C++ Programming and Graphics file1<< setiosflags(ios::fixed | ios::showpoint); for (int i=0; i<=ntc ...
7.5 A graph with axes 225 } } //--- Complete the axes box: move2 (xmax,ymin); draw2 (xmax,ymax); draw2 (xmin,ymax); //--- Print ...
226 Introduction to C++ Programming and Graphics *------------------------ plot2d Plot a line with axes ------------------------ ...
7.5 A graph with axes 227 char device[]="X11"; // initialize on the screen vinit(device); ortho2 (xmin-xmarg,xmax+xmarg,ymin-yma ...
228 Introduction to C++ Programming and Graphics Figure 7.5.1 Graphics display produced by codeplot2dshowing a line with markers ...
«
7
8
9
10
11
12
13
14
15
16
»
Free download pdf