CG Lecture3 V
CG Lecture3 V
m = (7-3)/(23-3)
= 4/20
= 0.2
∆x =1 , ∆𝑦 =0.2
Digital Differential Analyzer (DDA):
Case 2: The slop is positive and greter than 1.
Sample at unit y interval (∆𝑦 =1) and compute each
successive y value as :
𝟏
𝒙𝒌+𝟏 = 𝒙𝒌 + ( )
𝒎
K takes integer values starting from 1,at the first
point, and increasing by 1 on each step until reaching
the final endpoint.
The calculated x must be rounded to the nearest
integer.
Example: Describe the line segment which starts at (3,3)
and ends at (7,23).
m = (23-3)/(7-3)
= 20/4
=5
∆x =1/m=1/5=0.2
∆𝑦 =1
Digital Differential Analyzer (DDA):
Case 3: The slop is negative and its absolute value is
less than 1(Follow the same way in case 1).
Case 4: The slop is negative and its absolute value is
greter than 1(Follow the same way in case 2).
In the previous 4 cases, we start from the left to the
right. If the state is reversed then:
If the absolute slop is less than 1, set ∆x=-1
and 𝒚𝒌+𝟏 = 𝒚𝒌 − 𝒎
If the absolute slop is less than 1, set ∆y=-1
𝟏
and 𝒙𝒌+𝟏 = 𝒙𝒌 − ( )
𝒎
DDA Properties:
A faster method for calculating pixel positions than
the direct use: y = m.x +b.
Uses ∆x or ∆y to eliminate the multiplication in the
above equation.
The Rounding successive additions of the floating-
point increment can cause the calculated pixel
positions to drift away from the true line path for
long line segment.
Rounding and floating-point arithmetic are time-
consuming operations.