1,049 views

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. $[(0,0),(1,1),(2,1),(3,2)]$
2. $[(0,0),(1,1.5),(2,2),(3,3)]$
3. $[(0,0),(1,1),(2,2.5),(3,3)]$
4. $[(0,0),(1,2),(2,2),(3,2)]$

Option =A is the right ans

### 1 comment

Key point which I mistaken is don't take rounded off value for next iteration. Take original value of y for next iteration, otherwise u ll be in trouble.

According to DDA algorithm,

|dx| = 8, |dy| = 4

since |dx| > |dy|, steps = |dx| = 8

Xinc = |dx|/steps = 1, Yinc  = |dy|/steps = 0.5.

Algorithm:

for k = 1 to steps:

Xk+1 = Y+ Xinc

Yk+1 = Yk + Yinc

// plot round(Xk+1), round(Yk+1)

Since DDA works with integer values only, we need to round the values of coordinates to nearest integer. Consider 0.5 to be rounded to 1.

Thus following the algorithm, we get the first four points as (0, 0), (1, 1), (2, 1), (3, 2).

Hence option 1.

by

### 1 comment

Not the proper algorithm ,question has asked for simple dda while you applied incremental DDA
(1).

y= mx.c

dy= 4

dx= 8

m= dy/dx= 4/8 = 0.5

m< 1

x inc= 1, y inc = 0.5