TECHASHUS - C PROGRAM FOR IMAGE ROTATION
PROGRAM :
#include<stdio.h>
#include<math.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT ,gm; //declare the variable
initgraph(&gd,gm,"c:\\tc\\bgi"); //performe the initgraph() function
int x1,y1,x2,y2,ang;double dr;
circle(200,180,40);
circle(250,180,20);
printf("\nEnter the angle");
scanf(%d",&ang);
dr=ang*3.14/180;
x1=200+(100)*cos(dr)+100*sin(dr);
y1=200+(100)*cos(dr)+100*sin(dr);
x2=200=(100)*cos(dr)+100*sin(dr);
y2=200=(100)*cos(dr)=100*sin(dr);
circle(x1,y1,40);
circle(x2,y2,20);
getch();
closegraph();
}
the image will be displayed on the screen by using two circle function, by using angle of an circle function, then the image will be rotated as per angle entered by the user.
OUTPUT :
No comments: