Programming and Graphics

(Kiana) #1

7.6 Graph animation 233


{
points[1][1] = xmin;
points[1][2] = ymin;
points[2][1] = xmax;
points[2][2] = ymin;
points[3][1] = xmax;
points[3][2] = ymax;
points[4][1] = xmin;
points[4][2] = ymax;

poly2 (4,points);
}

//--- Data:

for (int i=0; i<n; i++)
{
yd[i] = 0.5+ 0.2*sin(6*xd[i]-0.3*t);
}

//--- Markers:

color (BLACK);
int marker = 0;

for(int i=0; i<n; i++)
{
if( xd[i]>xmin && xd[i]<xmax
&& yd[i]>ymin && yd[i]<ymax)
drawmarker2d (xd[i], yd[i], marker
xmin, xmax,ymin, ymax);
}

//--- Prepare the graph:

color (BLUE);
Icheck=1;
drawline2d (n,xd,yd,xmin,xmax,ymin,ymax,Icheck);

//--- Draw draw axes:

drawaxes2d
(xmin,xmax
,ymin,ymax
,ntcx,ntcy
,Ilabelax // 1 to label axes; 0 for no labels
,axc // axis color
,lbc // label color
,labelx // x-axis label
Free download pdf