Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- #include<conio.h>
- #include<graphics.h>
- #include<math.h>
- void main()
- {
- clrscr();
- int gd=DETECT, gm;
- initgraph(&gd, &gm,"D:\TC\BGI");
- double x1, x2, y1, y2, x3, x4, x5, x6, x7, x8, x9, y3, y4, y5, y6, y7, y8, y9, tx,ty, d;
- x1=50;
- y1=50;
- x2=100;
- y2=50;
- d=45;
- tx=50;
- ty=50;
- double tempx, tempy;
- tempx = x2;
- tempy = y2;
- line(x1,y1,x2,y2);
- circle(50,50,50);
- for(int z=0;z<7;z++)
- {
- double p[3][3]={{cos(d),sin(d),0},{-sin(d),cos(d),0},{tx*(1-cos(d))+ty*sin(d),ty*(1-
- cos(d))-tx*sin(d),1}};
- double m[3][3]={{x1,y1,1},{tempx,tempy,1},{0,0,1}};
- double M[3][3];
- for(int i=0; i<3 ;i++)
- {
- for(int j=0;j<3;j++)
- {
- M[i][j]=0;
- for(int k=0;k<3;k++)
- {
- M[i][j]=M[i][j]+m[i][k]*p[k][j];
- }
- }
- }
- line(M[2][0],M[2][1],M[0][0],M[0][1]);
- tempx = M[0][0];
- tempy = M[0][1];
- switch(z)
- {
- case 0 : x3=tempx;
- y3=tempy;
- break;
- case 1 : x4=tempx;
- y4=tempy;
- break;
- case 2 : x5=tempx;
- y5=tempy;
- break;
- case 3 : x6=tempx;
- y6=tempy;
- break;
- case 4 : x7=tempx;
- y7=tempy;
- break;
- case 5 : x8=tempx;
- y8=tempy;
- break;
- case 6 : x9=tempx;
- y9=tempy;
- break;
- }
- }
- cout<<"n";
- for(int i=0;i<7;i++)
- {
- switch(1)
- {
- case 0 : cout<<x3<<y3<<"n";
- break;
- case 1 : cout<<x4<<y4<<"n";
- break;
- case 2 : cout<<x5<<y5<<"n";
- break;
- case 3 : cout<<x6<<y6<<"n";
- break;
- case 4 : cout<<x7<<y7<<"n";
- break;
- case 5 : cout<<x8<<y8<<"n";
- break;
- case 6 : cout<<x9<<y9<<"n";
- break;
- }
- getch();
- closegraph();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement