You will have to repaste your code. The posting process with Disable HTML unchecked mangles the code, so just unchecking the box does nothing by itself.
You will have to repaste your code. The posting process with Disable HTML unchecked mangles the code, so just unchecking the box does nothing by itself.
I see. Ok, what about now?
Jarrod Davis
Technical Director @ Piradyne Games
Okay, I've solved the problem. I checked out my math book and read that two segments with the same point intersect (i.e. 1;2 and 2;3). :shock:
That was my bad from the very beginning. ops:
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
Games:
Seafox
Pages:
Syntax Error Software
itch.io page
Online Chess
http://gameknot.com/#paul_nicholls
Hello, Paul.
You know, right now I'm using a totally different code and everything seems working OK. Anyway, thanks for your post!
Bookmarks