0
773views
Write a program in object oriented language for 2D transformation which include functions (i) translation in X direction (ii) Rotation
1 Answer
| written 6.3 years ago by |
Answer:
void main()
{
int x1,y1,x2,y2,x3,y3,option;
float tx;
float deg,th;
float xt1,yt1,xt2,yt2,xt3,yt3;
int gdriver = DETECT,gmode;
initgraph(&gdriver,&gmode,”C:\TC\BGI”);
cout<<“Enter coordinates of a triangle: “;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
cout<<“\nEnter 1 for Translation, or 2 for Rotation : “;
cin>>option;
if(option==1)
{
cout<<“Enter tx: “;
cin>>tx;
xt1=x1+tx;
yt1=y1;
xt2=x2+tx;
yt2=y2;
xt3=x3+tx;
yt3=y3; …