Categories: Graphics

Draw Line using Line Equation – Slope-Intercept Equation Algo

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

StepY1X1Pixel Plotted
100(0,0)
21(1-0)/(6/4) = 4/6=0.67(1,1)
32(2-1)*4/6 = 0.67(1,1)
43(3-1)*4/6 = 1.33(1,3)
54(4-1)*4/6= 2(2,4)
65(5-2)*4/6 = 2(2,5)
76(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.

VSood

Recent Posts

Class 11 Entrepreneurship – Unit 2 Magic  Words

Class 11 Entrepreneurship - Unit 2 Magic  Words This document provides easy-to-learn magic words and…

1 week ago

Entrepreneurship with Shallu Sood — Class 11 CBSE | 2026–27

Entrepreneurship with Shallu Sood — Class 11 CBSE | 2026–27 Your Complete Self-Study Guide to…

1 month ago

Entrepreneurship with Shallu Sood — Class 12 CBSE | 2026–27

Entrepreneurship with Shallu Sood — Class 12 CBSE | 2026–27 Your Complete Board Exam &…

1 month ago

Class XII Entrepreneurship Business Arithmetic Assignment Economic Order Quantity (EOQ), Reorder Point & Number of Orders

Class XII Entrepreneurship | Business Arithmetic Assignment| Economic Order Quantity (EOQ), Reorder Point & Number…

1 month ago

Class XII Entrepreneurship Assignment: Business Arithmetic – Break-Even Point

Class XII Entrepreneurship Assignment | Business Arithmetic – Break-Even Point Prepared by: Shallu Sood For…

1 month ago