160 likes | 194 Views
This article explores the efficiency of DDA and Bresenham's algorithms for 2D scan-line conversion in computer graphics. DDA is simple but requires floating points, while Bresenham's uses only integer addition, making it more efficient. The Bresenham's Midpoint Algorithm selects between NE and E pixels based on the relative position of the midpoint and the line. By choosing between E and NE based on the sign of the decision variable, these algorithms offer incremental calculation for smoother line rendering.
E N D
2D Scan-line Conversion University of Missouri at Columbia
2D Scan-line Conversion • DDA algorithm • Bresenham’s algorithm
DDA algorithm • The simplest algorithm. • Named after Digital Differential Analyzer. (x1, y1) dy (x0, y0) dx
2D Scan-line Conversion • DDA algorithm • Bresenham’s algorithm
Bresenham’s Midpoint Algorithm • DDA is simple, efficient, but needs floating points. • Bresenham’s use integer addition only. (x1, y1) dy (x0, y0) dx
Bresenham’s Midpoint Algorithm • To choose from the two pixels NE or E depending on the relative position of the midpoint Mand the line. • Choose E if M is above the line, • Choose NE if M is below the line. NE M E (x0, y0)
Bresenham’s Midpoint Algorithm • Choose E if d is positive, • Choose NE if d is negative. NE M E (x0, y0)
Bresenham’s Midpoint Algorithm • Choose E if d is positive, • Choose NE if d is negative. NE M E (x0, y0)
Incremental Calculation of the decision variable dnew NE M E (x0, y0)
Bresenham’s Midpoint Algorithm NE M E (x0, y0)