Scan Conversion
• When we represent a regular objects in the form of discrete pixels, it is
called Scan Conversion
OR
• The process of representing continuous graphics object as a collection of
discrete pixels is known as scan conversion.
OR
• It is a process of representing graphics objects to collection of pixels.
• The scan conversion is also called “Rasterization”.
Some Examples of scan converted objects:
We can apply the conversion to the following objects.
• Line
• Point
• Polygon
• Rectangle
• Filled Region
• Arc
• Character
• Sector
• Ellipse
Digital Differential Analyser (DDA) Line drawing Algorithm
• Given the starting and ending coordinates of a line,
• DDA Algorithm attempts to generate the points between the starting and ending
coordinates.
Procedure-
Given-
•Starting coordinates = (X0, Y0) •Ending coordinates = (Xn, Yn)
Step-01:
Calculate ΔX, ΔY and M from the given input.
These parameters are calculated as-
•ΔX = Xn – X0
•ΔY =Yn – Y0
•M = ΔY / ΔX
Step 2:
• Suppose the current point is (Xp, Yp) and the next point is (Xp+1, Yp+1).
• Find the next point by following the below three cases-
Step-03:
Keep repeating Step-03 until the end point is reached.
Problem-01:
Calculate the points between the starting point (5, 6) and ending point (8, 12).
Given-
• Starting coordinates = (X0, Y0) = (5, 6)
• Ending coordinates = (Xn, Yn) = (8, 12)
Step-01:
Calculate ΔX, ΔY and M from the given input.
•ΔX = Xn – X0 = 8 – 5 = 3
•ΔY =Yn – Y0 = 12 – 6 = 6
•M = ΔY / ΔX = 6 / 3 = 2
Xp Yp Xp+1 Yp+1 Round off (Xp+1, Yp+1)/ (XPLOT, Y PLOT)
5 6 5.5 7 (6, 7)
6 8 (6, 8)
6.5 9 (7, 9)
7 10 (7, 10)
7.5 11 (8, 11)
8 12 (8, 12)
Assignment:1
Q1. Calculate the points between the starting point (5, 6) and ending point (13, 10).
Q2. Implement the DDA line algorithm using any programming language (note: using of line function is not
allowed)
Drawbacks of DDA Algorithm-
• There is an extra overhead of using round off( ) function.
• Using round off( ) function increases time complexity of the
algorithm.
• Resulted lines are not smooth because of round off( )
function.
• The points generated by this algorithm are not accurate.