Consider a line AB with A = (0, 0) and B = (8, 4). Apply a simple DDA…

2017

Consider a line AB with A = (0, 0) and B = (8, 4). Apply a simple DDA algorithm and compute the first four plots on this line.

  1. A.

    [(0, 0), (1, 1), (2, 1), (3, 2)]

  2. B.

    [(0, 0), (1, 1.5), (2, 2), (3, 3)]

  3. C.

    [(0, 0), (1, 1), (2, 2.5), (3, 3)]

  4. D.

    [(0, 0), (1, 2), (2, 2), (3, 2)]

Attempted by 141 students.

Show answer & explanation

Correct answer: A

Key data: A = (0, 0), B = (8, 4)

Compute differences and steps:

  • dx = 8 - 0 = 8

  • dy = 4 - 0 = 4

  • steps = max(|dx|, |dy|) = 8

Increments per step:

  • x increment = dx / steps = 8 / 8 = 1.0

  • y increment = dy / steps = 4 / 8 = 0.5

Generate points starting from (x,y) = (0,0). After each step compute new x and y and round to nearest integer for the pixel plot.

  1. Step 0: x = 0.0, y = 0.0 → plotted pixel (0, 0)

  2. Step 1: x = 1.0, y = 0.5 → round y to 1 → plotted pixel (1, 1)

  3. Step 2: x = 2.0, y = 1.0 → plotted pixel (2, 1)

  4. Step 3: x = 3.0, y = 1.5 → round y to 2 → plotted pixel (3, 2)

Therefore the first four plots are: (0, 0), (1, 1), (2, 1), (3, 2).

Explore the full course: Nta Ugc Net Paper 2

Loading lesson…