Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Bresenham's line problem

Author
Message
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Jun 2006 04:27
I'm writing the line algorithm as described in this article:
http://www.gamedev.net/reference/articles/article767.asp

The line only seems to work from within a 45 degree range rather than from any angle. Just can't see why.



"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Merk
18
Years of Service
User Offline
Joined: 5th Feb 2006
Location:
Posted: 27th Jun 2006 05:27
Hey,
Not too sure here, but my guess that it has something to do with the d's = 2*deltay. That would mean a gradient of 1/2 (where m = deltax/deltay for a standard linear line) which would always give a 45 degree line. As to how to fix I've got no idea, sorry.


Cheers,
Merk
lower logic
17
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 27th Jun 2006 05:37
This should work:
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 28th Jun 2006 22:20
Thx, it did work. But I found the other way through various sources. Just seems better to me than multiplying by 100000.



"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike

Login to post a reply

Server time is: 2024-03-28 19:58:45
Your offset time is: 2024-03-28 19:58:45