Bresenham Line Algorithm

 BBS: Inland Empire Archive
Date: 08-01-92 (17:26)             Number: 199
From: BRIAN DESSENT                Refer#: NONE
  To: RICHARD VANHOUTEN             Recvd: NO  
Subj: Bresenham Line Algorithm       Conf: (1) 80xxx

> BD> plot dot at (xc + x, yc + y) ; I think there's only 4, but > BD> plot dot at (xc - x, yc + y) ; there may be 8 plotdot routines > BD> plot dot at (xc + x, yc - y) > BD> plot dot at (xc - x, yc - y) > plot dot at (xc + y, yc + x) > plot dot at (xc - y, yc + x) > plot dot at (xc + y, yc - x) > plot dot at (xc - y, yc - x) Thanks, I knew it was probably 8. > I believe the above algorithm is also credited to Bresenham. It > works with square pixels. If your pixels aren't square, you'll need to use > a different algorithm. No need to change algorithms. If you want elipses (or to compensate for non-square pixels), all you have to do is modify it to loop while y > 0 (instead of while y > x), use only the first 4 plot dot routines, and multiply the term (2 * y) by a constant scaling factor when updating d. And, BTW, yes I do believe both were done by Bresenham. (both algorithyms came from the same article anyway.) --- FMail 0.90 * Origin: I'm not an actor, but I play one on TV. (1:3641/202)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET