Beruflich Dokumente
Kultur Dokumente
2D Graphics Pipeline
Clipping
Object
World Coordinates
Applying
world window
Object
subset
window to
viewport
mapping
Display
Rasterization
Object
Screen coordinates
Viewport
Transformatio
n
Rasterization
Rasterization
Lines
Circles
Triangles
Polygons
Rasterization Operations
8
7
6
5
4
3
2
1
Which intermediate
pixels to turn on?
0 1 2 3 4 5 6 7 8 9 10 11 12
y = mx + b
Given two end points (x0,y0), (x1, y1), how to compute m
and b?
dy y1 y 0
m
dx x1 x0
(x1,y1)
dy
(x0,y0)
dx
b y 0 m * x0
By Ay 96 41
55
m
0.5392
Bx Ax 125 23 102
(x1,y1)
dy
(x0,y0)
dx
y k 1 y k m
x = x0
(x1,y1)
y = y0
y = y0 + 1 * m
y=y+1*m
(x0, y0)
Until x == x1
x k 1
1
xk
m
x = x0
(x1,y1)
y = y0
x = x0 + 1 * 1/m
x = x + 1 /m
(x0,y0)
Until y == y1
Bresenham algorithm
Define
Width W = Bx Ax
Height H = By - Ay
Based on assumptions:
W, H are +ve
H<W
y Ay H
x Ax W
M(Mx,My)
(x0, y0)
else
Y++, F = F - 2(W H)
References
Hill, chapter 10