0% found this document useful (0 votes)
15 views2 pages

Digitize The Line A

Uploaded by

wubshet adane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Digitize The Line A

Uploaded by

wubshet adane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Digitize the line A(1,1) and B(5,6) using DDA.

To digitize a line using the Digital Differential Analyzer (DDA) algorithm, we need to
calculate the points on the line between two given coordinates A(1,1)A(1,1)A(1,1) and
B(5,6)B(5,6)B(5,6).

Steps of the DDA algorithm:

1. Calculate the differences in coordinates:

Δx=x2−x1\Delta x = x_2 - x_1Δx=x2−x1 Δy=y2−y1\Delta y = y_2 - y_1Δy=y2−y1

2. Determine the number of steps required: The number of steps is the maximum of the
absolute values of Δx\Delta xΔx and Δy\Delta yΔy.

Steps=max⁡(∣Δx∣,∣Δy∣)\text{Steps} = \max(|\Delta x|, |\Delta y|)Steps=max(∣Δx∣,∣Δy∣)

3. Calculate the increments: The increment for each step along the x-axis and y-axis are:

Increment in x=ΔxSteps\text{Increment in x} = \frac{\Delta x}{\


text{Steps}}Increment in x=StepsΔx Increment in y=ΔySteps\text{Increment in y} = \frac{\Delta
y}{\text{Steps}}Increment in y=StepsΔy

4. Generate the points: Starting from the initial point (x1,y1)(x_1, y_1)(x1,y1), add the
increments to xxx and yyy iteratively until we reach the final point.

Applying DDA to the given points:

 A(1,1)A(1, 1)A(1,1) (starting point)


 B(5,6)B(5, 6)B(5,6) (end point)

Step 1: Calculate Δx\Delta xΔx and Δy\Delta yΔy


Δx=5−1=4\Delta x = 5 - 1 = 4Δx=5−1=4 Δy=6−1=5\Delta y = 6 - 1 = 5Δy=6−1=5

Steps=max⁡(∣4∣,∣5∣)=5\text{Steps} = \max(|4|, |5|) = 5Steps=max(∣4∣,∣5∣)=5


Step 2: Number of steps
Step 3: Calculate the increments
Increment in x=45=0.8\text{Increment in x} = \frac{4}{5} = 0.8Increment in x=54=0.8
Increment in y=55=1\text{Increment in y} = \frac{5}{5} = 1Increment in y=55=1

Step 4: Generate the points

We start at (x1,y1)=(1,1)(x_1, y_1) = (1, 1)(x1,y1)=(1,1) and increment by (0.8,1)(0.8, 1)(0.8,1)


for each step.

Let's calculate the points step by step:

1. Point 1: (x1,y1)=(1,1)(x_1, y_1) = (1, 1)(x1,y1)=(1,1)


2. Point 2: (x2,y2)=(1+0.8,1+1)=(1.8,2)(x_2, y_2) = (1 + 0.8, 1 + 1) = (1.8, 2)(x2,y2
)=(1+0.8,1+1)=(1.8,2)
3. Point 3: (x3,y3)=(1.8+0.8,2+1)=(2.6,3)(x_3, y_3) = (1.8 + 0.8, 2 + 1) = (2.6, 3)(x3,y3
)=(1.8+0.8,2+1)=(2.6,3)
4. Point 4: (x4,y4)=(2.6+0.8,3+1)=(3.4,4)(x_4, y_4) = (2.6 + 0.8, 3 + 1) = (3.4, 4)(x4,y4
)=(2.6+0.8,3+1)=(3.4,4)
5. Point 5: (x5,y5)=(3.4+0.8,4+1)=(4.2,5)(x_5, y_5) = (3.4 + 0.8, 4 + 1) = (4.2, 5)(x5,y5
)=(3.4+0.8,4+1)=(4.2,5)
6. Point 6: (x6,y6)=(4.2+0.8,5+1)=(5,6)(x_6, y_6) = (4.2 + 0.8, 5 + 1) = (5, 6)(x6,y6
)=(4.2+0.8,5+1)=(5,6) (final point)

Resulting Points:

The points on the line from A(1,1)A(1, 1)A(1,1) to B(5,6)B(5, 6)B(5,6) generated by DDA are
approximately:

1. (1,1)(1, 1)(1,1)
2. (1.8,2)(1.8, 2)(1.8,2)
3. (2.6,3)(2.6, 3)(2.6,3)
4. (3.4,4)(3.4, 4)(3.4,4)
5. (4.2,5)(4.2, 5)(4.2,5)
6. (5,6)(5, 6)(5,6)

These are the discrete points you would plot to approximate the line using the DDA algorithm.

You might also like