Computer Science, asked by dhanshri889, 5 hours ago

Consider a line from (0, 0) to (6,7) , using  simple DDA algorithm, Rasterize this line​

Answers

Answered by nitishshaw720
9

Answer:

Let us understand how DDA Algorithm works by taking some examples and solving them too. Just keep in mind two things one, Y=mx+b is the line equation. Second, If m is less than one increase X and calculate Y. If m is more than 1 then increase Y and calculate X. DDA Algorithm is explained by taking some examples.

If slope (m) is less than 1 (m<1) then increment x as x1+1 and calculate y as y1=y1+m

If slope (m) is greater than 1 (m>1) then increment y as y1+1 and calculate x1=x1+1/m

If slope is equal to 1 (m=1) then increment both x and y. x1=x1+1 , y1=y1+1.

DDA- Digital Differential Analyser – The Algorithm

S-1: Lets take the starting points of line as (x1,y1) and ending points as (x2,y2)

S-2: m=(y2-y1)/(x2-x1)

S-3: If slope (m) is less than 1 (m<1) then increment x as x1+1 and calculate y as y1=y1+m

S-4: If slope (m) is greater than 1 (m>1) then increment y as y1+1 and calculate x1=x1+1/m

S-5 : If slope is equal to 1 (m=1) then increment both x and y. x1=x1+1 , y1=y1+1

S-6 : Repeat the steps till end of line (x2,y2) is reached.

now try to implement..

If not then I will help you out

Similar questions