Page 145 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 145
Unit 8: Implementing of Scaling in 2D Transformation
{ Notes
if(i==j)
Matrix[i][j]=1;
else
Matrix[i][j]=0;
}
}
}
int Create_poly(int poly[][2])
{
poly[0][0]=200;
poly[0][1]=20;
poly[1][0]=300;
poly[1][1]=150;
poly[2][0]=130;
poly[2][1]=280;
return 2;
}
void display_cordinate(char bg_color,char line_color)
{
int i;
setbkcolor(bg_color);
setcolor(line_color);
for(i=0;i<=640;i+=50)
{
line(i,0,i,480);
}
for(i=0;i<=480;i+=50)
{
line(0,i,640,i);
}
rectangle(0,0,639,479);
}
void Translate_to_Relative(int poly[][2],int points,int Xdis,int Ydis)
{
int i;
for(i=0;i<=points;i++)
{
poly[i][0]=poly[i][0]+Xdis;
poly[i][1]=poly[i][1]+Ydis;
}
}
LOVELY PROFESSIONAL UNIVERSITY 139