Professional Documents
Culture Documents
Course Content
Introduction
Scan Conversion Lines, Circles, Ellipses:
Filling polygons and clipping algorithms
Two Dimensional Transformations
Three dimensional Transformations
Projections
Plane Curves and surfaces
Solid Modeling
Visible Surface Determination
2
Books
Principles of Interactive Computer Graphics
Computer graphics
Concept
Model
Image
Modeling
Concept
Model
Image
Rendering
Graphic Devices
Devices
Keyboard
Mouse
Joystick
Trackball and Trace ball
Digitizer
Scanners
Touch Panels
Light Pen
Voice System
9
Introduction
Pixels
Straight Lines
Line Drawing algorithms, straight
Digital Differential Analyzer DDA
Bresenham
10
Pixels
12
Straight Lines
13
14
Line Equation
The equation of a Line is given by
y = mx + b . (1)
Rearranging we get
b = y mx ---------------------(2)
where m = (y2-y1) / (x2- x1) = dy/dx y/x
For any given small x interval x along the line, compute the
corresponding y interval i.e.
y = m x --------------------- (3)
Similarly for any given small y interval y along the line, compute the
corresponding x interval i.e.
x = y / m---------------------(4)
15
DDA Algorithm
Y
(Xk+1,Yk+1)
(Xk, Yk)
16
DDA
y or x .
Case :1 If |m| 1
X k+1 = Xk + 1
Yk+1 = YK + m
Case :2 If |m| > 1
Yk+1 = Yk + 1
Xk+1 = XK + 1 / m
17
DDA
hand side
X k+1 = Xk - 1
Yk+1 = YK - m
Case :4: If |m| > 1 and start point is on the
right hand side
Y k+1 = Yk - 1
Xk+1 = XK 1/ m
18
Assignment Problems
1) Using DDA line drawing algorithm find the pixel co-
Initial
pixel
(Xk,Yk)
(12,12)
Next Pixel
Either
or
(Xk+1,Yk+1)
(13,13)
(13,12)
Xk+1
Next
Yk+1
Y
d1
(Yk+1)
(Yk)
d2
Yk
or
Either
Yk+3
Yk+2
Yk+1
Yk
Xk
Xk+1
Xk Xk+1Xk+2 Xk+A
20
21
22
The difference
d1 d2 = m(xk +1) +b yk [yk+1-m(xk+1)-b]
= 2m(xk+1) + 2b - 2yk 1
= 2.(y/x).xk - 2yk + 2b + 2.(y/x) 1
Let Pk be the decision parameter for the kth step in the line
algorithm. Then
Pk = x.(d1-d2) , x > 0
= x. [2.(y/x).xk - 2yk + 2b + 2.(y/x) 1]
= 2y.xk - 2x.yk + C
(1)
Where C = 2y + x(2b 1)
Contd
23
25
26
P
6=6
6+(-4)=2
2+(-4)=-2
-2+(16)=14
14+(-4)=10
10+(-4)=6
6+(-4)=2
2+(-4)=-2
-2+(16)=14
14+(-4)=10
(x,y)
(11,16)
(12,17)
(13,17)
(14,18)
(15,19)
(16,20)
(17,21)
(18,21)
(19,22)
(20,23)
27