You are given two straight line segments, each defined by the coordinates of its endpoints. Segment AB goes from (Ax,Ay) to (Bx,By) and segment CD  from (Cx,Cy) to (Dx,Dy).
How would you determine if the two line segments intersect?
(Assume that you can't just draw the lines and see)
(In reply to
re(2): Solution by friedlinguini)
When the fl solution is applied to points that are all colinear, each of the four parenthetical factors is zero, satisfying the equality portion of the <= and therefore reporting an intersection, even if the segments are on disjoint portions of the line they share.
This can be verified using 1,1,2,2,3,3,4,4 as Ax,Ay,Bx,By,Cx,Cy,Dx,Dy or 1,5,2,3,3,1,4,1.

Posted by Charlie
on 20030704 06:02:41 