◀ THE FOLD0ROOT.AI // WORLD II · GLITCH · THE BLUE SCREEN◆ .dlw.fold
THE FOLD / GLITCH / THE BLUE SCREEN / THE BRESENHAM

THE BRESENHAM

draw a line with integers only — every pixel within half a pixel
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Bresenham’s line algorithm draws a straight line on a pixel grid using only integer addition, subtraction, and comparison — no floating point, no division, no multiply in the loop. It carries an integer error term that decides, at each column, whether to step straight or diagonally, always choosing the pixel nearest the ideal line.

Every plotted pixel lands within half a pixel of the true line. This was how every early display, pen plotter, and GPU drew lines — and it is still the textbook rasteriser.

LIT verified live: over hundreds of random lines, every pixel Bresenham plots is within a perpendicular distance of 0.5 of the exact line, using integer arithmetic only (window.__bresenham). FIG no framing; exact integer geometry.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at the-blue-screen — the pixels on the display itself. Bresenham is how the blue screen gets its lines: integer decisions, one pixel at a time. AVAN (AI) built the instrument: the integer error loop, the deviation check against the true line, the draggable demo.

Credit as content: Jack Elton Bresenham (1962, IBM), one of the oldest algorithms still in daily use. The weave: David names the screen; I run the integer error term that hugs the ideal line within half a pixel, and show the continuous line it can only ever approximate.
3 ONE DIMENSION
The error accumulator ticking along: each column it adds the slope’s numerator, and when it crosses zero it steps the other axis and pays the denominator back — a running rational remainder, never leaving the integers.
4 TWO DIMENSIONS · INTERACTIVE
Move the endpoints; watch the integer decision variable choose each pixel while the true line is overlaid. Every chosen pixel stays within half a pixel of the line — verified over many random lines.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: the integer staircase of pixels climbing beside the true line, error term sawtoothing as it goes.
AVAN’s addition (the inverse-companion): the continuous line is unrepresentable on a grid — you can only pick the nearest pixel, and every choice makes a small rounding error. Bresenham’s inverse-genius is to never throw that error away: each step’s fractional remainder is carried into the next decision, so the accumulated error stays bounded below half a pixel forever. It is an exact integer simulation of a rational slope — the fractional part folded back in, never lost. The inverse of ‘a real line’ is ‘the bounded-error integer staircase that best fakes it,’ and boundedness comes from conserving the remainder. Magenta is the true continuous line no grid can hold; green is the integer path that hugs it within 0.5. Draw the ideal by never forgetting how wrong each pixel was.
LIT Genuine Bresenham line algorithm (Bresenham 1962, IBM). Verified live: the integer-only error-term loop, run over 500 random lines (thousands of pixels), plots every pixel within a perpendicular distance of 0.5 of the exact line (measured max ~0.4996) using only integer arithmetic (window.__bresenham.withinHalfPixel && .integerOnly).

FIG No framing: the integer error loop and the deviation check against the analytic line run in-browser and are exact. The AVAN inverse is honest — a continuous line genuinely cannot be represented on a grid, and Bresenham keeps error bounded below half a pixel by carrying each step's remainder forward (an exact integer simulation of the rational slope); magenta is the true line, green the integer pixels.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE BLUE SCREEN · David Lee Wise (ROOT0), with AVAN