Graphics / Reference / Which pixels form a line
Which pixels form a line
A digital line requires a pixel-selection rule. Two basic choices are selecting every pixel area crossed by the line or selecting one closest pixel in each column.
Two basic pixel-selection criteria are considered for a shallow line.
The first criterion selects every pixel whose square area the continuous mathematical line passes through. Because the line can cross a horizontal pixel boundary while still inside one column, this rule may select either one or two vertically adjacent pixels in a column.
The second criterion selects one closest pixel in each column. At the current column, determine the real-valued position of the line and choose the pixel whose centre is closest to that position. This rule therefore selects exactly one pixel per column under the shallow-line assumption.
For lines with slope less than 45 degrees, the distinction is visible: the every-crossed-pixel rule can produce alternating one-pixel and two-pixel columns, while the closest-pixel-per-column rule keeps one selected pixel in every column.
The standard comparison diagram shows the same continuous line on two grids: all crossed pixels on one, and one closest pixel per column on the other.
Builds on
Read
- Read the chapter: Which pixels form a line