Rotation of an Image

#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
setbkcolor(11);
setcolor(BLACK);
float a,b;
int x1,x2,x3,y1,y2,y3;
outtextxy(250,100,"Original Image");
line(210,180,370,180);
line(210,180,280,120);
line(370,180,280,120);
cout<<"\n\n\t\tRotation of an Image";
cout<<"\n\t\t********************\n";
cout<<"\n\tEnter the angle =";
cin>>a;
x1=60*cos((a-45)*(3.14/180))+300;
y1=60*sin((a-45)*(3.14/180))+300;
x2=60*cos((a+45)*(3.14/180))+300;
y2=60*sin((a+45)*(3.14/180))+300;
x3=60*cos((b-45)*(3.14/180))+300;
y3=60*sin((b-45)*(3.14/180))+300;
outtextxy(270,380,"After Roation");
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
getch();
}

No comments:

Post a Comment

Thank you for using this blog.