Graphics /Build / Drawing a line
Drawing a line
goal
You will implement a simple raster line drawer for one controlled case: two integer endpoints, left to right, with a slope between 0 and 1. Your program will examine each integer x coordinate from the first endpoint to the second, find where the mathematical line lies at that x, choose the nearest pixel row, and turn on exactly one pixel in that column. By the end, a line such as (1,1) to (10,5) should appear as a connected staircase of pixels that follows the continuous line closely.