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
Solution by friedlinguini)
OK, probably should have finished converting to legal code:
return (By*Cx - A*yCx + Ax*Cy - B*yCy + Ay*Bx - Ax*By) *
  (By*Dx - Ay*Dx + Ax*Dy - By*Dy + Ay*Bx - Ax*By) > 0
  && (Dy*Ax - Cy*Ax + Cx*Ay - Dy*Ay + Cy*Dx - Cx*Dy) *
  (Dy*Bx - Cy*Bx + Cx*By - Dy*By + Cy*Dx - Cx*Dy) > 0;