Friday, 27 September 2013

3D IMAGE PROJECTION in C Aglorithm | Computer Graphics Lab Manual | IT department | Final Year





AIM:

To visualize projection of 3D images.

ALGORITHM:

1. Start the program.

2. Declare the variables.

3. In the main function maxx, maxy, midx, midy values are calculated.

4. Bar 3D function is used to draw the 3D object.

5. Get the translation vector and perspective projection values.

6. Stop the program.



SOURCE CODE:

#include

#include

#include

int maxx,maxy,midx,midy;

void main()

{

int gd,gm,x,y,z;

detectgraph(&gd,&gm);

initgraph(&gd,&gm,"c:\\tc\\bgi");

setfillstyle(0,getmaxcolor());

maxx=getmaxx();

maxy=getmaxy();

midx=maxx/2;

midy=maxy/2;

bar3d(midx-250,midy+150,midx-150,midy+225,20,4);

printf("\nEnter perspective vectors:");

scanf("%d%d%d",&x,&y,&z);

bar3d(midx-(x*5),midy-(y*9),midx-(x*3),midy-(y*5),10*z,4);

getch();

closegraph();

}



OUTPUT:


Enter the perspective vectors:

25 30 35


No comments:

Don't You Think this Awesome Post should be shared ??
| 3D IMAGE PROJECTION in C Aglorithm | Computer Graphics Lab Manual | IT department | Final Year |
Back To Top Related Posts Plugin for WordPress, Blogger...