Posts: 3,368
Threads: 195
Joined: Jan 2003
i have a feeling that this could be impossible.. ah well. here goes:
say you have a line x1-x2, y1-y2.
I want to figure out where to go next according to bresenham, one point per x and one point per y at a time {-1, 0, 1}, without going diagonally then straight. (nice and even..)
Is this possible? :/
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Well, that is what is done in each bresenham loop. If the line is more vertical than horizontal, it will always advance 1 pixel vertically and 0 to 1 horizontally, and if it is more horizontal than vertical, it will always advance 1 pixel horizontally and 0 to 1 vertically, in each loop.
Posts: 3,368
Threads: 195
Joined: Jan 2003
rel's link doesn't work anymore.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 1,166
Threads: 62
Joined: Apr 2003
I have a bresenham line tut in my buffering tutorial
check it out
http://www.venosoft.com/articles/buffers.html
See? I knew this article would be helpful to people!
am an asshole. Get used to it.
Posts: 3,368
Threads: 195
Joined: Jan 2003
Code:
SUB bline (x, y, x2, y2)
dx = x2 - x
dy = y2 - y
IF dy < 0 THEN dy = -dy: yinc = -1 ELSE xinc = 1
IF dx < 0 THEN dx = -dx: xinc = -1 ELSE yinc = 1
IF dx > dy THEN
d1 = dy + dy - dx - dx
d = d1 + dx
d0 = d + dx
DO
IF x = x2 THEN EXIT DO
x = x + xinc
IF d < 0 THEN d = d + d0 ELSE d = d + d1: y = y + yinc
PSET (x, y)
LOOP
ELSE
d1 = dx + dx - dy - dy
d = d1 + dy
d0 = d + dy
DO
IF y = y2 THEN EXIT DO
y = y + yinc
IF d < 0 THEN d = d + d0 ELSE d = d + d1
x = x + xinc
PSET (x, y)
LOOP
END IF
END SUB
eDited.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 566
Threads: 86
Joined: Feb 2003
are implemented in the TC-Lib, downloadable from the Mandelbrot Dazibao. The full documentation is in french, I didn't have time for an english version, but you can try to Babelfish that, it could be fun :lol:
hink Global, Make Symp' All ! ®
Posts: 3,288
Threads: 167
Joined: Nov 2001
Quote:rel's link doesn't work anymore.
Yeah, but why does my link have to do with Bresenham?
Posts: 3,368
Threads: 195
Joined: Jan 2003
cuz you said you had it there somewhere.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 749
Threads: 4
Joined: Jun 2002
Rel, maybe it has something to do with RelLine, huh? :roll:
img]http://usuarios.vtr.net/~disaster/sigs/annoyizer.php[/img]
Posts: 3,288
Threads: 167
Joined: Nov 2001
QBrpgs.com>Utils>RelGFX. :*)