Sign in to follow this  
Error98

Fast line drawing algorithm

Recommended Posts

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this