computer graphics (practical flie)
DESCRIPTION
THIS IS A PRACTICAL FILE FOR COMPUTER GRAPHICS.COMPUTER GRAPHICS IS A SUBJECT OF B.TECH ENGG. (COMPUTER SCIENCE).YOU CAN CHANGE IT ACCORDING TO YOU NEED.TRANSCRIPT
G
Plot no. 2, Knowledge Park III, Greater Noida, UP-201308
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
G. L. Bajaj Institute of Technology & Management
Greater Noida
Uttar Pradesh Technical University
Lucknow
G.L. Bajaj Institute of Technology & Management
B. Tech.
Computer Science & Engineering Department
(Session: 2014-15) ODD SEMESTER
Batch (2011-15)
THIRD YEAR (V SEMESTER)
COMPUTER GRAPHICS LAB FILE
Submitted to Submitted By
Mr. Abhishek Bansal Brij Bhushan Singh
(Asst. Professor) (1219210901)
CONTENTS
S.NO.
NAME OF THE PROGRAM
DATE
REMARKS
1
Implementation of line generation using Bresenhams Algorihtm.
2
Implementation of line generation using DDA.
3
Implementation of circle generation using Mid-point method.
4
Implementation of circle generation using Bresenhams algorithm.
5
Implementation of 2D transformation: Translation, Scaling, Rotation
6
Curve generation using B-spline.
7
Curve generation using bezier curve
8
Implementation of Line Clipping using Cohen-Sutherland algorithm.
9
Implementation of 3D geometric transformations: Translation
10
Implementation of any one of Back face removal algorithms such as Depth-Buffer algorithm
PROGRAM:1
OBJECTIVE:- Implementation of line generation using Bresenhams Algorihtm.
# include # include # include void main(){int dx,dy,x,y,p,x1,y1,x2,y2;int gd,gm;clrscr();printf("\n\n\tEnter the co-ordinates of first point : ");scanf("%d %d",&x1,&y1);printf("\n\n\tEnter the co-ordinates of second point : ");scanf("%d %d",&x2,&y2);dx = (x2 - x1);dy = (y2 - y1);p = 2 * (dy) - (dx);x = x1;y = y1;detectgraph(&gd,&gm);initgraph(&gd,&gm,"e:\\tc\\bgi");putpixel(x,y,WHITE);while(x =dy)
pixel=dx;
else
pixel=dy;
dx=dx/pixel;
dy=dy/pixel;
x=x1;
y=y1;
i=1;
while(i