# Which algorithm is used for line drawing?

## Which algorithm is used for line drawing?

There are following algorithms used for drawing a line: DDA (Digital Differential Analyzer) Line Drawing Algorithm. Bresenham’s Line Drawing Algorithm. Mid-Point Line Drawing Algorithm.

What are the steps of DDA algorithm?

DDA Algorithm

• Step 1 − Get the input of two end points (X0,Y0) and (X1,Y1).
• Step 2 − Calculate the difference between two end points.
• Step 3 − Based on the calculated difference in step-2, you need to identify the number of steps to put pixel.
• Step 4 − Calculate the increment in x coordinate and y coordinate.

What are the advantages of DDA line drawing algorithm?

Advantages : It is simple and easy to implement algorithm. It avoid using multiple operations which have high time complexities. It is faster than the direct use of the line equation because it does not use any floating point multiplication and it calculates points on the line.

### What is difference between DDA and Bresenham algorithm?

The main distinction between DDA algorithm and Bresenham line algorithm is that, the DDA algorithmic rule uses floating purpose values whereas in Bresenham, spherical off functions is used.

Why is DDA algorithm not good & efficient algorithm?

Disadvantages 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.

What are the limitations of DDA line generation algorithm?

## Why do we use line drawing algorithm?

In computer graphics, a line drawing algorithm is an algorithm for approximating a line segment on discrete graphical media, such as pixel-based displays and printers. On such media, line drawing requires an approximation (in nontrivial cases). Basic algorithms rasterize lines in one color.

What are disadvantages of DDA algorithm?

What is the main limitation of DDA algorithm?

Limitations of DDA Algorithm Because of round off, errors are introduced and cause the calculated pixel position to drift away from the true line path. Due to floating point operations the algorithm is time-consuming.