0% found this document useful (0 votes)
5 views13 pages

DDA Algorithm

The DDA algorithm is a method for plotting straight lines on a raster display by calculating discrete points between two endpoints using the slope-intercept equation. It processes lines based on their slope and direction, offering advantages such as speed and simplicity, but suffers from orientation dependence and potential cumulative errors in floating-point calculations. The algorithm eliminates floating-point multiplication, making it efficient, but still requires floating-point addition for successive point determination.

Uploaded by

simumukkunnoth55
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views13 pages

DDA Algorithm

The DDA algorithm is a method for plotting straight lines on a raster display by calculating discrete points between two endpoints using the slope-intercept equation. It processes lines based on their slope and direction, offering advantages such as speed and simplicity, but suffers from orientation dependence and potential cumulative errors in floating-point calculations. The algorithm eliminates floating-point multiplication, making it efficient, but still requires floating-point addition for successive point determination.

Uploaded by

simumukkunnoth55
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

DDA Algorithm

Presented by: V.Nayana Murali


● Picture described as a set of complex objects, positioned at specified
coordinate locations within the scene.
● Shapes and colours described with pixel arrays or with .straight line
segments.
● Pixel arrays are loaded to frame buffer or scan converting basic
geometric-structure specifications into pixel patterns.
● Point plotting accomplished by converting single coordinate position
furnished by an application program into appropriate operations for the
output device in use.
● Electron beam position depends on display technology.
○ Random scan system stores point plotting instructions in the display list, coordinate values
converted to deflection voltages.
○ For black and white raster system,a point is plotted by setting the bit value corresponding to a
specified screen position within the frame buffer to 1.
○ For RGB,, the frame buffer is loaded with the colour codes for the intensities.
● Plotting straight line
● Plots discrete points between 2 endpoints.
● Coordinate positions are calculated using the equation of a line.
● In raster video display, line colour is loaded into frame buffer for the
corresponding pixel coordinates.
● Video controller plots on the screen by reading the values in frame buffer.
● A computed line position of (10.48,20.51) would be converted to pixel
position (10,21).
● This rounding causes lines to be displayed with a “stair step appearance”
● Noticeable in low resolution systems, but can be improved by displaying in
high resolution systems.
Straight line properties
Cartesian slope-intercept equation for a straight line is

y = m.x + b

Given that the 2 endpoints of the line segment are (x1 , y1) and (x2 , y2)

Slope, m = y2 - y1
x2 - x 1

y intercept, b = y1 - m.x1
△y = m △x △x = △y
m
● These equations form the basis for determining the deflection voltages in
analog devices.
● For slope magnitudes |m|<1, △x can be set proportional to a small horizontal
deflection, corresponding vertical deflection is then set proportional to △y as
calculated above.
● For slope magnitudes |m|>1, it happens the other way round.
● For lines with m=1, △x=△y, both horizontal and vertical deflection voltages
are equal.
Digital Differential Analyzer (DDA)
LINES PROCESSED FROM LEFT TO RIGHT

Positive Slope |m|<=1

△x=1

yk+1 = yk + m

Positive Slope |m|>1

△y=1

xk+1 = xk + 1/m
LINES PROCESSED FROM RIGHT TO LEFT

Positive Slope |m|<=1

△x=-1

yk+1 = yk - m

Positive Slope |m|>1

△y=-1

xk+1 = xk - 1/m
LINES PROCESSED FROM LEFT TO RIGHT

Negative Slope |m|<=1

△x=1

yk+1 = yk + m

Negative Slope |m|>1

△y=1

xk+1 = xk + 1/m
LINES PROCESSED FROM RIGHT TO LEFT

Negative Slope |m|<=1

△x=-1

yk+1 = yk - m

Negative Slope |m|>1

△y=-1

xk+1 = xk - 1/m
Advantages
Advantages

● Faster method
● Eliminates floating point multiplication
● Simplest algorithm and does not require special skills for implementation.

Disadvantages

● It is orientation dependent, due to this endpoint accuracy is poor.


● A floating point addition is still needed in determining each successive point
which is time consuming.
● Cumulative error due to limited precision in the floating point representation
may cause calculated points to drift away from their true position when the
line is relatively long.

You might also like