Fast Lines And Curves Using The Midpoint Method

1. Line Algorithm

Assumptions: Assume we wish to draw a line between points (0,0) and (a,b) with slope m between 0 and 1 (i.e. line lies in first octant).

The general formula for a line is y = mx + B where m is the slope of the line and B is the y-intercept. From our assumptions m = b/a and B=0.

y = (b/a) x + 0 --> f(x,y) = bx - ay = 0 is an equation for the line.

Elaborate