Straight or Not?? ZOOM IN Line in Raster Scan Monitor X2,Y2
X1,Y1 Line in Raster Scan Monitor Line Drawing Algorithm
Slope of the Line:-
Let us Consider:- Numericals:- Q) Draw the Line from (1,1) to (4,3) by DDA. Sol.) Step 1:- Assign X1, Y1, X2, Y2 i.e. X1 = 1, X2 = 4, Y1 = 1, Y2 = 3 Step 2 :- Find out dx and dy. i.e. dx = X2 – X1 = 4 – 1 = 3 dy = Y2 – Y1 = 3 – 1 = 2 Step 3 :- Find out slope m i.e. m = dy/dx = 2/3 = 0.67 Step 4 :- Check IdxI > IdyI i.e. 3 > 2 Therefore, dx = 1 Step 5:- Find out Xi+1 & Yi+1 i.e. Xi+1 = Xi + dx = 1 + 1 = 2 Yi+1 = Yi + dy = Yi + m.dx = 1 + 0.67 = 1.67 Step 6:- Repeat step until you reach upto integer value of X2 and Y2. i.e. For next values Xi+1 = Xi + dx = 2 + 1 = 3 Yi+1 = Yi + dy = 1.67 + 0.67 = 2.34 Step 7 :- Generate the table indicating each point. i.e. Points Xi Yi Xi+1 Yi+1 Round Xi+1, Yi+1 Off (Yi+1) P1 1 1 2 1.67 2 (2,2)
P2 2 1.67 3 2.34 2 (3,2)
P3 3 2.34 4 3.01 3 (4,3)
Questions????
Q.1) Apply the Digital Differential Analyzer
algorithm to plot a line from (2,3) to (6,15).
Q.2) If a line is drawn from (1, 7) to (11, 17) with
use of DDA. How many points will needed to generate such line?