edited by
6,029 views
3 votes
3 votes

Which raster locations would be chosen by Bresenham's algorithm when scan converting a line from $(1,1)$ to $(8,5)$?

  1. $\begin{array}{|c|c|} \hline x & y \\ \hline  1 & 1 \\ 2 & 2 \\ 3 & 3 \\ 4 & 3 \\ 5 & 4 \\ 6 & 4 \\ 7 &  5 \\ 8 & 6 \\ \hline \end{array}$
  2. $\begin{array}{|c|c|} \hline x & y \\ \hline  1 & 1 \\ 2 & 2 \\ 3 & 2 \\ 4 & 3 \\ 5 & 4 \\ 6 & 5 \\ 7 &  6 \\ 8 & 7 \\ \hline \end{array}$
  3. $\begin{array}{|c|c|} \hline x & y \\ \hline  1 & 1 \\ 2 & 2 \\ 3 & 2 \\ 4 & 3 \\ 5 & 3 \\ 6 & 4 \\ 7 &  4 \\ 8 & 5 \\ \hline \end{array}$
  4. $\begin{array}{|c|c|} \hline x & y \\ \hline  1 & 1 \\ 2 & 2 \\ 3 & 2 \\ 4 & 3 \\ 5 & 5 \\ 6 & 4 \\ 7 &  5 \\ 8 & 5 \\ \hline \end{array}$
edited by

1 Answer

Best answer
5 votes
5 votes

ans must be C 

short cut method  since line has to be drawn from (1,1) to (8,5)   choice A,B are out as they are ending up with 8,6 and 8,7

now in choice D after point 4,3 it is 5,5 i.e increment of 2 in y which is not as per rule of line drawing 

so we can safely say ans is C (because such unusual pattern is not seen in this)

for proper method bresenham's algo is

Step 1 − Input the two end-points of line, storing the left end-point in (x0,y0).

Step 2 − Plot the point (x0,y0).

Step 3 − Calculate the constants dx, dy, 2dy, and (2dy – 2dx) and get the first value for the decision parameter as    p0=2dy−dx

Step 4 − 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 update value of parameter p as

pk+1=pk+2dy

Otherwise,

next point to plot is (xk+1 ,yk+1) and update value of parameter p as

pk+1=pk+2dy−2dx

Step 5 − Repeat step 4 (dx – 1) times.

For m > 1, find out whether you need to increment x while incrementing y each time.

After solving, the equation for decision parameter Pk will be very similar, just the x and y in the equation gets interchanged.

edited by
Answer:

Related questions

4 votes
4 votes
1 answer
1
go_editor asked Aug 11, 2016
6,427 views
Consider a unit square centered at origin. The coordinates at the square are translated by a factor $\biggr( \dfrac{1}{2}, 1 \biggl)$ and rotated by an angle of $90^{\cir...
2 votes
2 votes
1 answer
2
go_editor asked Aug 11, 2016
2,750 views
Which of the following is/are the principle components of a memory-tube display?Flooding gunCollectorPhosphorus grainsGround$\text{i and ii}$$\text{iii only}$$\text{iv on...
3 votes
3 votes
1 answer
3
go_editor asked Aug 11, 2016
3,395 views
Which of the following is not a lossy compression technique?JPEGMPEGFFTArithmetic coding
2 votes
2 votes
1 answer
4
go_editor asked Aug 10, 2016
2,440 views
Which of the following graphic primitives are considered as the basic building blocks of computer graphics?PointsLinesPolylinesPolygons$\text{i only}$$\text{i, ii, and ii...