The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
1.9k views

18. 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)]

asked in CBSE/UGC NET by Active (3.9k points) | 1.9k views

2 Answers

+1 vote
Best answer

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.

answered by Active (1.8k points)
selected by
+2 votes

Option =A is the right ansdda solution

answered by Active (1.2k points)


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

41,069 questions
47,668 answers
147,405 comments
62,387 users