{$N+} uses graph,crt; const POLYSIZE=4+1; STEP=0.01; const xy:array[1..POLYSIZE]of PointType=( (x:100;y:100), (x:100;y:150), (x:200;y:150), (x:200;y:100), (x:100;y:100)); x0=100; y0=100; var gd,gm,i:integer; r:array[1..POLYSIZE]of double; fi:array[1..POLYSIZE]of double; alp:double; begin gd:=DETECT; initgraph(gd,gm,''); for i:=1 to POLYSIZE do begin r[i]:=sqrt(sqr(xy[i].x-x0)+sqr(xy[i].y-y0)); if(xy[i].x-x0<>0)then fi[i]:=arctan((xy[i].y-y0)/(xy[i].x-x0)) else if xy[i].y-y0<0 then fi[i]:=-PI/2 else if xy[i].y-y0>0 then fi[i]:=PI/2 else fi[i]:=0; end; repeat for i:=1 to POLYSIZE do begin xy[i].x:=x0+round(r[i]*cos(fi[i]+alp)); xy[i].y:=y0+round(r[i]*sin(fi[i]+alp)); end; setcolor(WHITE); drawpoly(POLYSIZE,xy); delay(1000); setcolor(BLACK); drawpoly(POLYSIZE,xy); alp:=alp+STEP; until keypressed; closegraph; end. |