#include #include #include #include #include #include int gd,gm,x,y,n,h,x1,x2,x3,x4,y1,y2,y3,y4,xc,yc,l,i; void latura(int x1, int y1,int x2,int y2,int x3,int y3,int x4,int y4); float rotplan1(int xc,int yc,int x1,int y1,float n); float rotplan2(int xc,int yc,int x1,int y1,float n); void main(void) { clrscr(); //cleardevice(); randomize(); detectgraph(&gd,&gm); initgraph(&gd,&gm,"C:\\borlandc\\bgi"); cleardevice(); setwritemode(XOR_PUT); x1=100; y1=100; x2=120; y2=100; x3=120; y3=120; x4=100; y4=120; latura(x1,y1,x2,y2,x3,y3,x4,y4); for (i=1;i<=50;i++) { delay(100); latura(x1,y1,x2,y2,x3,y3,x4,y4); x1++;x2++;x3++;x4++; latura(x1,y1,x2,y2,x3,y3,x4,y4); } latura(x1,y1,x2,y2,x3,y3,x4,y4); for (i=1;i<=50;i++) { y1++;y2++;y3++;y4++; latura(x1,y1,x2,y2,x3,y3,x4,y4); delay(100); latura(x1,y1,x2,y2,x3,y3,x4,y4); } latura(x1,y1,x2,y2,x3,y3,x4,y4); x=x1; y=y1; l=x2-x1; for (i=1;i<=100;i++) { latura(x1,y1,x2,y2,x3,y3,x4,y4); x2=rotplan1(x,y,x+l,y,M_PI*i/50); y2=rotplan2(x,y,x+l,y,M_PI*i/50); x3=rotplan1(x,y,x+l,y+l,M_PI*i/50); y3=rotplan2(x,y,x+l,y+l,M_PI*i/50); x4=rotplan1(x,y,x,y+l,M_PI*i/50); y4=rotplan2(x,y,x,y+l,M_PI*i/50); latura(x1,y1,x2,y2,x3,y3,x4,y4); delay(100); } getch(); // closegraph(); } void latura(int x1, int y1,int x2,int y2,int x3,int y3,int x4,int y4) { moveto(x1,y1); lineto(x2,y2);lineto(x3,y3);lineto(x4,y4);lineto(x1,x1); } float rotplan1(int xc,int yc,int x1,int y1,float n) { float x; x=xc+(x1-xc)*cos(n)-(y1-yc)*sin(n); return x; } float rotplan2(int xc,int yc,int x1,int y1,float n) { float y; y=yc+(x1-xc)*sin(n)+(y1-yc)*cos(n); return y; }