Generated by GPT-5-mini| Bresenham's line algorithm | |
|---|---|
| Name | Bresenham's line algorithm |
| Inventor | Jack E. Bresenham |
| Year | 1962 |
| Field | Computer graphics |
| Inputs | Two end points |
| Outputs | Rasterized line pixels |
Bresenham's line algorithm is an incremental rasterization technique for drawing straight lines on pixel grids developed in 1962 by Jack E. Bresenham while at IBM. The method converts continuous geometric primitives into discrete IBM-addressable pixels efficiently, minimizing arithmetic and favoring integer operations, with influence on later work at Bell Labs, Microsoft, Sun Microsystems, and within projects like X Window System and OpenGL. The algorithm's simplicity and speed made it foundational across hardware designs at Intel, Nvidia, and in academic courses at Massachusetts Institute of Technology, Stanford University, and University of California, Berkeley.
Bresenham presented the method while at IBM in a 1962 technical memo and later publications, contemporaneous with raster graphics developments at MIT's Lincoln Laboratory and the graphics efforts of Evans & Sutherland. Early adoption occurred in systems produced by Digital Equipment Corporation and in graphics terminals from Tektronix, with the algorithm informing firmware in devices from Hewlett-Packard and display controllers at IBM. Academic diffusion through texts by authors affiliated with ACM and IEEE led to implementations in educational software at Carnegie Mellon University and in computer graphics curricula promoted by figures associated with SIGGRAPH.
The algorithm computes a sequence of pixel coordinates approximating a straight segment between two points, relying on integer decision variables to choose which adjacent pixel best approximates the continuous line. Bresenham's original description addressed lines with slope between 0 and 1; symmetric handling of other octants uses reflections familiar to implementers at Bell Labs and in microcode at Intel. The core loop increments the major-axis coordinate each step while updating an error term to decide when to increment the minor-axis coordinate; this approach reduces multiplication and division operations favored in contemporary processors from IBM System/360 and early DEC machines. Variants extend the decision criterion to thicker primitives, inspired by raster techniques used in displays by Tektronix and by plotting libraries at Microsoft.
Implementations vary across software libraries and hardware rasterizers: integer-only versions used in embedded systems from Motorola contrast with antialiased adaptations in graphic stacks by Adobe Systems and drivers from Nvidia. Variants include Midpoint algorithms described in texts associated with Peter Shirley and adaptations for circles and ellipses implemented in toolkits from Sun Microsystems and in numeric libraries maintained at University of Cambridge. Anti-aliased and Wu-style implementations influenced rendering engines in Mozilla and in Apple's graphics frameworks; high-precision integer and fixed-point approaches appear in real-time engines by Epic Games and id Software.
Bresenham's algorithm is optimal in the sense of minimizing per-pixel arithmetic for single-line rasterization on digital displays like those manufactured by Hewlett-Packard and Sony. Its error term is bounded and predictable, properties analyzed in academic work published in ACM Transactions on Graphics and proceedings of SIGGRAPH. Complexity is linear in the major-axis length, comparable to other scan-conversion algorithms used in hardware designs by Intel and in early framebuffer systems at Xerox PARC. Stability under integer arithmetic makes it suitable for resource-constrained microcontrollers from Atmel and ARM.
Beyond line drawing in GUIs produced by Microsoft and Apple, Bresenham-style algorithms underpin vector rendering in printers by Canon and Epson, path plotting in CNC controllers from Fanuc and Siemens, and ray-tracing preprocessing in renderers used by studios collaborating with Industrial Light & Magic. Geographic rasterization tasks in GIS packages from Esri sometimes use Bresenham's approach for converting vector data for display, while robotics platforms from Boston Dynamics and research at ETH Zurich apply discrete line traversal in occupancy grid mapping and LiDAR processing.
A common integer-only implementation increments x each step and conditionally increments y based on a decision variable; similar forms appear in textbooks authored by scholars affiliated with Princeton University and Harvard University. Pseudocode typically initializes dx = abs(x1 - x0), dy = abs(y1 - y0), sets a decision parameter p = 2*dy - dx, then loops for dx steps, updating p and y when p >= 0; the same control flow is adapted for steep lines via coordinate swapping, a trick used in graphics libraries by X.Org and rendering engines from Valve Corporation.
Category:Computer graphics algorithms