Bresenham's Line Algorithm - Advantages, Disadvantages

By:   Last Updated: in: ,

Computer Graphics and Multimedia Application: Q1.What is Bresenham's Algorithm? - Bresenham's Line Algorithm. Q2.Advantages and Disadvantages? Q3.Numerical? (Computer graphics and multimedia application All Notes)


Q1. What is Bresenham's algorithm? Bresenham's Line Algorithm? Explain its use in computer graphics?

Ans. An accurate and efficient raster line-generating algorithm, developed by Bresenham, scan converts line using only incremental integer calculations that can be adapted to display circles and other curves.

To illustrate Bresenham's approach, we first consider the scan-conversion process for lines with positive slope less than 1. Pixel positions along a line path are then determined by sampling at unit x intervals. Starting from the left end point (x0, Y0) of a given line, we step to each successive column (x position) and plot the pixel whose scanline y value is closest to the line path.

Assuming, we have determined that the pixel at (xk, Yk) is to be displayed, our next need to decide with pixel to plot in column xk+1. Our choices are the pixels at positions (Xk+1,Yk) and (Xk+1, Yk+1).
Fig. Bresenham's line drawing algorithm and section of a display screen where a straight line segment is to be plotted, starting from the pixel at column 10 on scan line 11.

Bresenham's line drawing algorithm steps are as follows:
(1) Input the two line end points and store the left end point in (x0, y0)
(ii) Load (x0, y0) into the frame buffer; i.e., plot the first point.
(iii) Calculate constants Δx, Δy, 2Δy and 2Δy-2Δx and obtain the starting value for the decision parameter as :
P0 = 2Δy – Δx
(iv) At each xk along the line, starting at k = 0, perform the following test. If pk < 0, the next point to plot is (Xk+1, Yk) and
Pk+1 = Pk +2Δy
Otherwise, the next point to the plot is (x k+1, y k+1) and
Pk+1 = Pk +2Δy – 2Δx
(v) Repeat step.
(iv) Δx times.

Q2. What are the advantages and disadvantages?

Ans. The advantages of DDA are as follows:
(a) A fast incremental algorithm.
(b) Use only integer calculations.

The disadvantages of DDA are as follows:
(a) It is meant for a basic line drawing.
(b) Anti-aliasing is not part of Bresenham's algorithm, so to draw smooth lines, one had wanted to look into a different algorithm.

Q3. Implement Bresenham's algorithm to draw a line from endpoint (20, 10) to (30, 18) ?

Ans. The Answer of numerical is given below:

[ Topic= Bresenham's Line Algorithm ]

Join us on Facebook, Instagram, and Twitter to get the latest study material. You can also ask us any questions.
Facebook = @allbcaweb
(click on it or search "allbcaweb" on Facebook)
Instagram = @allbcaweb
(click on it or search "allbcaweb" on Instagram)
Twitter = @allbcaweb
(click on it or search "allbcaweb" on Twitter)
Send us your query anytime!

External Links:-

1. Bresenham's Line Algorithm - (click here)

[ Topic= Bresenham's Line Algorithm ]

No comments:
Write comment