Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
46
Task/Polyspiral/C/polyspiral.c
Normal file
46
Task/Polyspiral/C/polyspiral.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#include<graphics.h>
|
||||
#include<math.h>
|
||||
|
||||
#define factor M_PI/180
|
||||
#define LAG 1000
|
||||
|
||||
void polySpiral(int windowWidth,int windowHeight){
|
||||
int incr = 0, angle, i, length;
|
||||
double x,y,x1,y1;
|
||||
|
||||
while(1){
|
||||
incr = (incr + 5)%360;
|
||||
|
||||
x = windowWidth/2;
|
||||
y = windowHeight/2;
|
||||
|
||||
length = 5;
|
||||
angle = incr;
|
||||
|
||||
for(i=1;i<=150;i++){
|
||||
x1 = x + length*cos(factor*angle);
|
||||
y1 = y + length*sin(factor*angle);
|
||||
line(x,y,x1,y1);
|
||||
|
||||
length += 3;
|
||||
|
||||
angle = (angle + incr)%360;
|
||||
|
||||
x = x1;
|
||||
y = y1;
|
||||
}
|
||||
delay(LAG);
|
||||
cleardevice();
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
initwindow(500,500,"Polyspiral");
|
||||
|
||||
polySpiral(500,500);
|
||||
|
||||
closegraph();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue