Hi Brainer :-)

I'd just thought I'd let you know that the code you posted (http://pastebin.com/f4d5572a7) appears to be incorrect...

I believe the code should be this (ignoring optimizations):

[pascal]function LinesCross(x0, y0, x1, y1, x2, y2, x3, y3 : Integer): Boolean;
var
D, AB, CD: Single;
begin
D := (x1 - x0) * (y3 - y2) - (y1 - y0) * (x3 - x2);
if (Abs(D) < 0.001) then
begin
Result := False;
exit;
end;
AB := ((y0 - y2) * (x3 - x2) -(x0 - x2) * (y3 - y2)) / D;
if (AB > 0.0) and (AB < 1.0) then
begin
CD := ((y0 - y2) * (x1 - x0) - (x0 - x2) * (y1 - y0)) / D;
if (CD > 0.0) and (CD < 1.0) then
begin
Result := True;
exit;
end;
end;
Result := False;
end;[/pascal]

It should only get to the innermost Begin-End block and make the result true if the lines do cross...

This page may help (http://local.wasp.uwa.edu.au/~pbourk...ry/lineline2d/)
cheers,
Paul