After every proposed pixel has passed part (d), insist on exactly one call in every column of the closed endpoint interval:
void final()
{
for (int x = x0; x <= x1; x++) {
if (counter[x] != 1) reject();
}
accept();
}Part (d) already rejected every out-of-range column and every incorrect ordinate. A zero counter now detects an omitted column; a counter greater than one detects a repeated call in that column. Because the residual interval in part (d) allows exactly one integer ordinate in each column, accepted calls in a repeated column must address the same pixel. Conversely, a counter of one in every column forces the complete set of nearest pixels, including both endpoints. Consecutive correct columns differ in ordinate by at most one, which proves that there are no gaps in the resulting thin line segment.
Articles by others on the same topic
There are currently no matching articles.