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

Practical No.11

The document contains code for drawing a 3D rectangular bar in C graphics. It includes functions for initializing graphics, drawing the initial bar, getting user input for translation values, and redrawing the bar after translating it based on the user input.

Uploaded by

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

Practical No.11

The document contains code for drawing a 3D rectangular bar in C graphics. It includes functions for initializing graphics, drawing the initial bar, getting user input for translation values, and redrawing the bar after translating it based on the user input.

Uploaded by

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

#include stdio .

h
#include graphics .h
#include math .h
void trans();

//these are left,top,right,bottom parameters for bar3d


function
int maxx,maxy,midx,midy;

void main()
{
int ch;
int gd=DETECT,gm;
detectgraph(&gd,&gm);
initgraph(&gd,&gm," ");
trans();
return 0;
}

//function for translation of a 3d object


void trans()
{
int x,y,z,o,x1,x2,y1,y2;
midx=200;
midy=200;

//function to draw 3D rectangular box


bar3d(midx+50,midy-100,midx+100,midy-
50,20,1);
delay(1000);
printf("Enter translation factor");
scanf("%d%d",&x,&y);
printf("After translation:");
bar3d(midx+x+50,midy-(y+100),midx+x+100,midy-
(y+50),20,1);
}

You might also like