Antialiasing Exercise

Because a mathematical line has no width, it is impossible to see. In computer graphics we need to give lines a width in order to see them. The minimum width is a pixel, so if a line goes at right angles from edge to edge and through the center of a pixel, then the pixel is completely filled. But if a line is between two pixels, then, in theory, it should cover only half of the neighboring pixels. Since an entire pixel can only be one color, the convention is to use shading to approximate the coverage. So, a pixel covered by 50% of a line is shaded at 50% and a pixel covered by 25% of a line is shared at 25%. Note that while a line has width, it does not (by default) extend beyond the endpoint.

In this exercise, draw the line (as in a previous exercise). Then add shading to the pixels around the line by shift-clicking on the pixels. Repeated clicks will cycle through the shading options (25%, 50%, 75%, and 100%). The cell will show one to four dots to identify the shading.

Progress: