1.angle Դ?彩虹代刷美化源码?
angle Դ??
#i nclude "graphics.h"
#i nclude "math.h"
#i nclude "dos.h"
#i nclude "conio.h"
#i nclude "stdlib.h"
#i nclude "stdio.h"
#i nclude "stdarg.h"
#define MAXPTS
#define PI 3.
struct PTS {
int x,y;
};
double AspectRatio=0.;
void LineToDemo(void)
{
struct viewporttype vp;
struct PTS points[MAXPTS];
int i, j, h, w, xcenter, ycenter;
int radius, angle, step;
double rads;
printf(" MoveTo / LineTo Demonstration" );
getviewsettings( &vp );
h = vp.bottom - vp.top;
w = vp.right - vp.left;
xcenter = w / 2; /* Determine the center of circle */ ycenter = h / 2;
radius = (h - ) / (AspectRatio * 2);
step = / MAXPTS; /* Determine # of increments */ angle = 0; /* Begin at zero degrees */ for( i=0 ; i<MAXPTS ; ++i ){ /* Determine circle intercepts */ rads = (double)angle * PI / .0; /* Convert angle to radians */ points[i].x = xcenter + (int)( cos(rads) * radius );
points[i].y = ycenter - (int)( sin(rads) * radius * AspectRatio );
angle += step; /* Move to next increment */ }
circle( xcenter, ycenter, radius ); /* Draw bounding circle */ for( i=0 ; i<MAXPTS ; ++i ){ /* Draw the cords to the circle */ for( j=i ; j<MAXPTS ; ++j ){ /* For each remaining intersect */ moveto(points[i].x, points[i].y); /* Move to beginning of cord */ lineto(points[j].x, points[j].y); /* Draw the cord */ } } }
main()
{ int driver,mode;
driver=CGA;mode=CGAC0;
initgraph(&driver,&mode,"");
setcolor(3);
setbkcolor(GREEN);
LineToDemo();}