-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2DScaling.CPP
42 lines (42 loc) · 879 Bytes
/
2DScaling.CPP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<graphics.h>
#include<math.h>
#include<iostream.h>
void main()
{
int x[10],y[10];
int sx,sy,dm,dd=DETECT;
clrscr();
cout<<" Enter ther co-ordinates of the polygon:\n";
for(int i=0;i<3;i++)
{
cout<<" X-Coordinate:\t";
cin>>x[i];
cout<<" Y-Coordinate:\t";
cin>>y[i];
}
cout<<"\nEnter the scaling factor for X coordinates:\t";
cin>>sx;
cout<<"Enter the scaling factor for Y coordinates:\t";
cin>>sy;
initgraph(&dd,&dm,"C:/TURBOC3/BGI");
x[3]=x[0];
y[3]=y[0];
cout<<"ORIGINAL";
for(i=0;i<3;i++)
{
line(x[i],y[i],x[i+1],y[i+1]);
}
getch();
setcolor(RED);
cout<<"\nScaled Image";
for(i=0;i<3;i++)
{
line(x[i]*sx,y[i]*sy,x[i+1]*sx,y[i+1]*sy);
}
getch();
closegraph();
getch();
}