Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of the following points lies over the line when Bresenham's line drawing algorithm is used to draw the line between the points (4, 6) and (15, 12) ?

  • A.(5, 6)
  • B.(7, 7)
  • C.(11, 9)
  • D.(13, 11)

Answer: D

The point on the line is (13, 11).

From (4, 6) to (15, 12): \(\Delta x = 11\), \(\Delta y = 6\), so the slope is below 1 and x steps by 1. The decision parameter starts at \(p_0 = 2\Delta y - \Delta x = 1\). If \(p \ge 0\), y increases and \(p\) changes by \(2\Delta y - 2\Delta x = -10\); otherwise y stays and \(p\) changes by \(2\Delta y = 12\).

x5678910111213
y778899101011

So the plotted points include (5, 7), (7, 8), (11, 10) and (13, 11). The options (5, 6), (7, 7) and (11, 9) each lie one pixel below the line.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.