12 RasterConversion PDF
12 RasterConversion PDF
and circle
Graphics 2
Line drawing algorithms
06-02408
- DDA (Digital Differential Anayzer)
- Bresenham
Level 3
Circle generating algorithms
10 credits in Semester 2 - Direct method
- Bresenham algorithm
Professor Aleš Leonardis
Theoretical length
Pixel
address
y • visual accuracy
y+1
Pixel
• spatial accuracy
y+2
y+3
• speed
x x+1 x+2 x+3 x+4
Actual length
1
Line (segment) drawing algorithms Line – raster representation
thickness = 4
m = Δy / Δx m =∞
|m| > 1, m > 0
m=1
y = mx + b
m = slope (gradient) |m| < 1, m > 0
b= intercept with y axis b
m=0
m = Δy / Δx
m = -1
2
DDA (digital differential analyzer) DDA ( Digital Differential Analyzer )
3
y = mx + b
• Cartesian coordinates
• Direct
• Polar coordinate based
• Circle equation:
• Bresenham s
( x - x c )2 + ( y - y c )2 = r 2
4
Polar coordinates Optimisation and speed-up
While x < y
Bresenham s circle algorithm if pk < 0
pk+1 = pk + 4xk + 6
• Assumes centre at (0,0) xk+1 = x + 1
yk+1 = yk
Initialisation else
• Input radius r pk+1 = pk + 4(xk – yk ) + 10
• Plot a point at x0=0, y0=r xk+1 = xk + 1
• Set k = 0 yk+1 = yk – 1
• Calculate the initial value of the decision parameter
plot point at (xk+1 , yk+1)
p0 = 3 - 2r
increment k
5
Antialiasing Next topic
• The technique of
minimizing the distortion Splines and spline surfaces
artifacts arising due to
representing smooth
and continuous entities
(fonts, lines, curves) on
a discrete (pixelated)
display.