Draw a line by clicking and dragging on the pixel grid shown with the left mouse button. An ideal line is displayed until the left button is released. Upon release a discrete approximation of the line is drawn on the display grid using the lineImproved() method described in the previous slide. An ideal line is then overlaid for comparison. |
Notice that the slope-intercept equation of the line is
executed at each step of the inner loop.