0% found this document useful (0 votes)
207 views3 pages

Practical No10

Uploaded by

Shubham Mulik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
207 views3 pages

Practical No10

Uploaded by

Shubham Mulik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Practical No.

10
/*Write a 'C' program for 3D Translation and Scaling.*/
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
int maxx,maxy,midx,midy;
void axis()
{
line(midx,0,midx,maxy);
line(0,midy,maxx,midy);
}
void main()
{
int x,y,z,o,x1,y1,x2,y2;
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\Turboc3\\BGI");
maxx=getmaxx();
maxy=getmaxy();
midx=maxx/2;
midy=maxy/2;
axis();
bar3d(midx+50,midy-100,midx+60,midy-90,10,1);
printf("\nEnter the co-ordinate:");
scanf("%d%d%d",&x,&y,&z);
cleardevice();
axis();
printf("After Translation:");
bar3d(midx+x+50,midy-(y+100),midx+x+60,midy-(y+90),z+10,1);
getch();
cleardevice();
printf("\nEnter Scaling Factors:");
scanf("%d%d%d",&x,&y,&z);
cleardevice();
axis();
printf("After Scaling:");
bar3d(midx+(x*50),midy-(y*100),midx+(x*60),midy-(y*90),5*z,1);
getch();
closegraph();
}

Output: ——------ Translation—------—


——————Scaling——————

You might also like