0
953views
Write a program in object oriented language for 2D transformation which include functions (i) translation (ii) scaling (iii) Rotation
1 Answer
| written 6.3 years ago by |
Answer:
#include <iostream.h>
#include <conio.h>
#include <graphics.h>
#include <math.h>
void main()
{
int x1,y1,x2,y2,x3,y3,option;
float tx,ty;
float sx,sy;
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, 2 for Scaling and 3 for Rotation : “; …