Hi guys,
just found a bug in the line draw function. I was
testing a routing algorithm and wondered why it
sometimes did not choose fairly obvious connections (I
almost went nuts trying to tweak parameters in my
algorithm to force it to take those : ) . Well, after
about an hour looking for a bug in my program I figured
it might be the line drawing itself. The problem is in
the Draw_Line.c file at the positions where the x1/y1
is switched with x2/y2. If you switch both points, you
got to switch the starting point of the drawing loop
from the old x1/y1 to the new x1/y1...
So to fix the bug, simply add
....
swap = x2;
x2 = x1;
x1 = swap;
//CHANGE BEGIN
x=x1;
y=y1;
//CHANGE END
}
if (dy < 0) {
....
and of course the same in the part if the ramp is going
into y direction. This assures that the while-loop
starts at the new x1/y1 and goes to the new x2/y2...
Cheers
Alex Klein
(AlexiKlein _AT_ gmx.net)