You are on page 1of 2

DDA LINE DRAWING ALGORITHM

The line (vector) generation algorithms which determine the pixels that should be
turned ON are called as digital differential analyzer (DDA). It is one of the
techniques for obtaining a rasterized straight line. DDA algorithm is an
incremental scan conversion method. Here we perform calculations at
each step using the results from the preceding step. The characteristic of
the DDA algorithm is to take unit steps along one coordinate and compute
the corresponding values along the other coordinate.
In DDA algorithm we have to find the new point xi+1 and yi+1 from the
existing points xi and yi. As a first step here we identify the major axis and
the minor axis of the line to be drawn. Once the major axis is found we
sample the major axis at unit intervals and find the value in the other axis
by using the slope equation of the line.

Advantages of DDA Algorithm


1. It is the simplest algorithm and it does not require special skills for
implementation.
2. It is a faster method for calculating pixel positions than the direct use of
equation y = mx + b. It eliminates the multiplication in the equation by
making use of raster characteristics, so that appropriate increments are
applied in the x or v direction to find the pixel positions along the line path.
Disadvantages of DDA Algorithm
1. Floating point arithmetic in DDA algorithm is still time-consuming.
2. The algorithm is orientation dependent. Hence end point accuracy is
poor.

Bresenham's line algorithm

Bresenham's line algorithm is a line drawing algorithm that determines the


points of an n-dimensional raster that should be selected in order to form a
close approximation to a straight line between two points. It is commonly used
to draw line primitives in a bitmap image (e.g. on a computer screen), as it uses
only integer addition, subtraction and bit shifting, all of which are very cheap
operations in standard computer architectures. It is an incremental error
algorithm. It is one of the earliest algorithms developed in the field of
computer graphics. An extension to the original algorithm may be used for
drawing circles.
Advantage:

1. It involves only integer arithmetic, so it is simple.

2. It avoids the generation of duplicate points.

3. It can be implemented using hardware because it does not use multiplication


and division.

4. It is faster as compared to DDA (Digital Differential Analyzer) because it


does not involve floating point calculations like DDA Algorithm.

Disadvantage:

1. This algorithm is meant for basic line drawing only Initializing is not a
part of Bresenham's line algorithm.

You might also like