Graphics /Discover / Bresenham
Bresenham
scenario
Can the Line Stay Integer?
Your incremental line drawer already avoids recomputing m*x + c in every column. But its inner loop still carries a floating-point slope, a floating-point line height, repeated floating-point additions and a rounding operation.
Now impose a stricter constraint: the endpoints are integer pixel centres, and you want the repeated per-column decision to use integer state and simple arithmetic instead of carrying the full floating-point height. The final raster line must still choose the same kind of staircase through the grid.
The problem is to decide what information about the ideal line must be preserved and what information can be discarded once all you care about is the next pixel.
What smaller piece of state could preserve enough information to choose the next pixel without carrying the complete floating-point line height yi?