• Advertisement
Sign in to follow this  

Fast line drawing algorithm

This topic is 4555 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Depends - what are the exact requirements. Does it have to perform anti-aliasing?

Anyway, the answer is probably the Bresenham line drawing algorithm (google turns up plenty of explanations) - but if you need anti aliasing, you'll want something slightly more complex.

Edit: Beaten like an old rug.

John B

Share this post


Link to post
Share on other sites
Well... maby Bresenham is stanradt but i don't think it's the fastest one around.

Here's link to lecture about line drawing algorithms ->
http://www.cs.unc.edu/~mcmillan/comp136/Lecture6/Lines.html

How about this Two-Step one?
There is not much about it in the lecture tho, is it faster?

Edit:
Quote:
Does it have to perform anti-aliasing?


No.

Share this post


Link to post
Share on other sites
I remember there being some optimizations you can make over standard Bresenham that were mentioned in one of the old Michael Abrash books.

Share this post


Link to post
Share on other sites
Quote:
The other optimizations have been discovered by a number of people (including
myself), including Michael Abrash’s algorithm Run-Slicing, Xialon Wu’s Symmetric
Double Step, and Rokne’s Quadruple Step. Basically, all these algorithms take advantage of the consistency of the pixel patterns that make up a line.


Tricks of the Windows Game Programming Gurus - Andre LaMothe

Do you have implementation of those?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement