This presentation contains -
- Characteristics of line drawing algorithm
- DDA Line Drawing Algorithm
- Bresenham's Line Drawing Algorithm
- Circle Drawing Algorithm
- Eight way symmetry of a circle
- Breseham's Circle Drawing Algorithm
- Midpoint Circle Algorithm
2. Rasterization
• The process of determining which pixel will
provide the best approximation to the desired
line is known as ‘Rasterization’.
3. Characteristics of Line Drawing Algorithm
• The line should appear straight.
• Displayed line should have constant brightness
along their length.
• The line should be start and end accurately.
• Lines should have constant density,.
• Line density should be independent of line
length and angle.
• Lines should be drawn rapidly.
4. DDA Line Drawing Algorithm
1. Read the line end points (x1, y1) & (x2, y2) such
that they are not equal. (If equal then plot
that single point and exit) .
2. Approximate the line length,
If absolute (x2-x1) >= absolute (y2-y1)
then length = absolute (x2-x1)
else length = absolute (y2-y1)
3.
5. DDA Line Drawing Algorithm
4. Using the sign function, make the algorithm work in all quadrant
x = x1+0.5 * sign ( ∆x)
y = y1 + 0.5 * sign (y)
Here, x1 & y1 are initial values.
5. Begin main loop
i = 1
while (i < = length)
{
plot (integer (x), Integer (y))
x= x+x
y = y+y
i = i + 1
} end while
6. Finish / Stop
6. DDA Line Drawing Algorithm
Advantages:
• It is the simplest algorithm & it does not require special skills for
implementation.
• It is a faster method for calculating pixel positions than the direct
use of equation y = m.x + b
• It eliminates the multiplication in the equation by making use of
raster characteristics, so that appropriate increments are applied in
the x or y direction to find the pixel positions along the line path.
• It is very easy to understand and implement.
Disadvantages:
• Floating point arithmetic in DDA algorithm is still time-consuming.
• The algorithm is orientation dependent. Hence end point accuracy is
poor.
• It drifts away from the actual line path because of rounding off float
values into integer.