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
Points on an ellipse by brianjn)
If AB extends from (4,1) to (4,1) and CD extends from (4,1) to (4,1), all the endpoints lie on the 'circumference' of an ellipse. In fact I think an ellipse can be constructed using any four points.
Also, what is one to do if the four points given all lie on one line? The algorithm is required to say either yes or no. If point C is between A and B or D is between A and B, then the line segments share points and can be said to intersect, while if line AB is disjoint from line CD, they do not.
As a geometric solution, there is still my original proposal that ACBD forms a nonconcave quadrilateral (either convex, or having a 180degree angle or two).

Posted by Charlie
on 20030708 08:44:37 