Jump to content

Line drawing algorithm

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by OlliverWithDoubleL (talk | contribs) at 06:40, 29 July 2022 (short description, commented out an irrelevant paragraph (what does the derivation of the slope formula have to do with the algorithms?)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Two rasterized lines. The colored pixels are shown as circles. Above: monochrome screening; below: Gupta-Sproull anti-aliasing; the ideal line is considered here as a surface.

In computer graphics, a line drawing algorithm is an algorithm for approximating a line segment on discrete graphical media, such as pixel-based displays and printers. On such media, line drawing requires an approximation (in nontrivial cases). Basic algorithms rasterize lines in one color. A better representation with multiple color gradations requires an advanced process, spatial anti-aliasing.

On continuous media, by contrast, no algorithm is necessary to draw a line. For example, cathode-ray oscilloscopes use analog phenomena to draw lines and curves.