This method is the first method, even before any of other methods of line drawing like DDA , BLA were defined. The major drawback of this method is the fraction values it is, More the fraction values more would be approximation, more approximation means more loss of information. If the information loss is more then the line drawn would not be smooth. There fore other superior methods like DDA, BLA were developed. Lets understand this methods by an example.
But before that some fundamentals. The equation of the line is y=mx+b, where m is slope of the line and b is the intercept.
Draw a line from (0,0) to (4,6) using slope intercept method.
S-1 : y1=0 and x1=0 with x2=4 and y2=6.
S-2 : dy=y2-y1 => 6-0 = 6 and dx = x2-x1 = 4-0 = 4
S-3 : Slope (m) = dy/dx = 6/4 so m>1 and b will be calculated using x1 and y1 only. As y =m*x+b , set the values of x1 and y1. Therefore, 0=6/4*0 + b so b would be equal to 0. Which means that this line would pass through origin.
S-4 : As a rule, when m =>1 always increase y and calculate x. With every increase of x, y would be calculated. We will use equation of line (y=m*x+b) to calculate y. Just put the values of m, x and b.
So x would be calculated as x=(y-b)/m
Step | Y1 | X1 | Pixel Plotted |
1 | 0 | 0 | (0,0) |
2 | 1 | (1-0)/(6/4) = 4/6=0.67 | (1,1) |
3 | 2 | (2-1)*4/6 = 0.67 | (1,1) |
4 | 3 | (3-1)*4/6 = 1.33 | (1,3) |
5 | 4 | (4-1)*4/6= 2 | (2,4) |
6 | 5 | (5-2)*4/6 = 2 | (2,5) |
7 | 6 | (6-2)*4/6 = 2.67 | (3,6) |
This method takes lot of approximations as seen above so the line drawn cannot be smooth. Therefore new methods were needed hence DDA and BLA algorithms were developed.