2D Rotation On A Given Object Program
INPUT
#include<stdio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gdriver,&gmode,"C//TurboC3//BGI");
int x1,y1,x2,y2 ;
float b1,b2;
float t,deg;
printf(“Enter the coordinates of Line: ”);
scanf(“%d%d%d%d”,&x1,&y1,&x2,&y2);
setcolor(6);
line(x1,y1,x2,y2);
getch();
//cleardevice();
printf(“Enter the angle of rotation: “);
scanf(“%f”,°);
t=(22*deg)/(180*7);
b1=abs((x2*cos(t))-(y2*sin(t)));
b2=abs((x2*sin(t))+(y2*cos(t)));
line(x1,y1,b1,b2);
getch();
closegraph();
}
OUTPUT
Comments
Post a Comment