Professional Documents
Culture Documents
Bre
Bre
Bre
ALGORITHM
Step1 Input the two line end points and store the left endpoints in (x0, y0)
Step2 Load (x0, y0) into the frame buffer; plot the first point.
Step3 Calculate constants ∆x, ∆y, 2∆y, and 2∆y - 2∆x, and
∆x = xn - x0 and
∆y = yn - y0
p0 = 2∆y - ∆x
Step4 At each xk along the line, starting at k = 0, perform the following test:
pk+1 = pk +2∆y