Sign in to follow this  

Fast line drawing algorithm

This topic is 4488 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

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
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

This topic is 4488 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.

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