##
Do They Intersect?

Given two line segments, with specified endpoints, how can you determine if they
intersect? Consider one line segment running from (Ax,Ay) to (Bx,By) and
another from (Cx,Cy) to (Dx,Dy).
Since this question doesn't have a precise answer, send a simple description
of a method that would work.

If anyone writes a program, try to solve this: What is the probability of two
line segments intersecting when their endpoints are chosen randomly from a 4x4
grid (shared endpoints and endpoints on lines are considered intersecting)? Zero
length lines are not to be considered.

Extension: How would you solve the 3-D case?

Source: Reader Sudipta Das.

Solution

Mail to Ken