Page 141 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 141
Unit 8: Implementing of Scaling in 2D Transformation
{ Notes
int poly[3][2],i,points,Xdis,Ydis;
float Sx,Sy,Matrix[3][3],temp,Cos,Sin;
char ch;
intgraph();
setfillstyle(8,RED);
points=Create_poly(poly);
display_cordinate(DARKGRAY,WHITE);
fill_poly(poly,points,WHITE,RED);
getch();
Identity(Matrix);
Xdis=0–poly[0][0];
Ydis=0–poly[0][1];
Translate_to_Relative(poly,points,Xdis,Ydis);
Menu:
restorecrtmode();
do
{
clrscr();
printf("================================");
printf("
1. Scaling");
printf("
2. Translation");
printf("
3. Rotation");
printf("
4. Reflection [ X axis ]");
printf("
5. Reflection [ Y axis ]");
printf("
6. Reflection [ X=Y axis ]");
printf("
7. Draw ");
printf("
8. EXIT ");
printf("================================");
printf("
Choose Ur Destiny:- ");
ch=getche();
}while((ch< ‘1’)||(ch> ‘8’));
switch(ch)
LOVELY PROFESSIONAL UNIVERSITY 135