Perform 2D Rotation On A Given Object Program In C | VCMIT

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”,&deg);
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


Disqus Comments
TheWaoFam. Powered by Blogger.

Total Pageviews

Search This Blog

  • ()

Random Posts

randomposts

Recent Posts

recentposts

Footer Link

Connected

Facebook

banner image

Most Recent

Contact Form

Categories

There are many variations of passages of Lorem Ipsum available.

About Me

Hi there, I’m Amanda – a girl love fashion and love to express herself with her own sense of style.

Trending