Re: Drawing floating-point lines with Bresenham



Kaba wrote:
Thomas Kindler wrote:
Hi!

I've written a graphics library that supports fast Bresenham line drawing. I can give an integer starting point, integer number of pixels, error increments for minor/major steps, and an initial error value for the first pixel to draw.

Now I would like to draw lines with floating-point endpoints.

Does anyone know how to initialize the error terms to correctly draw lines with non-integer endpoints?!

I don't. However, you could go up to the roots:

"Algorithm for computer control of a digital plotter"
by J.E.Bresenham

That's the paper introducing Bresenham's line algorithm. Google finds it. Maybe you can derive the initial error term based on the paper.


Cool! And I could even download it for free.

That's the problem with basic stuff like this. Everyone knows some version of the algorithm, the basic idea is thaught everywere, but no one can point to a good (and fully correct) implementation.

The sad thing is that all the original papers are available online, but all of them require me to be a member of the ACM or IEEE :-/

Getting the Cohen-Sutherland clipping to work while preserving the slope of the original line was an adventure in it's own right.. I didn't find a single lecture that explains the error-term update, because it always seems to be "out of scope" for a graphics course. (I finally found a good explanation in the x.org library code).

--
"Zuse, Zuse" sprach die Tante, als das Rechenzimmer brannte
www.microsoft-hellhounds.de, www.bredobrothers.de
.



Relevant Pages

  • Re: Drawing floating-point lines with Bresenham
    ... pixels, error increments for minor/major steps, and an initial error ... Now I would like to draw lines with floating-point endpoints. ... That's the paper introducing Bresenham's line algorithm. ...
    (comp.graphics.algorithms)
  • Re: Drawing floating-point lines with Bresenham
    ... pixels, error increments for minor/major steps, and an initial error ... Now I would like to draw lines with floating-point endpoints. ... "Zuse, Zuse" sprach die Tante, als das Rechenzimmer brannte. ...
    (comp.graphics.algorithms)
  • Re: Linux gForth/VFX windows
    ... horizontal nib (3 pixels) ... Draw a circle segment. ... These are hardware coordinates. ... In graphics mode EMIT, TYPE etcetera still work, but now they ...
    (comp.lang.forth)
  • Re: how to square convert to verilog.
    ... That is a VERY expensive way to draw a circular blob, ... of 100 pixels radius, in the centre of the screen. ... DOULOS - Developing Design Know-how ...
    (comp.lang.verilog)
  • Re: Why 1080i?
    ... |> |> | In the real world, unless you get your signal OTA, most people TVs ... |> I've written code to do such scaling. ... There is absolutely no reason to write more than | one algorithm as the general algorithm is simple enough. ... level value goingout at some pixels under some conditions, ...
    (alt.tv.tech.hdtv)

Loading