Endpoint vectors A and B, in 2d space. Third vector, C, might be somewhere between them. This is what we are checking for.:
If A+(B-A)*(Distance(A,C)/Distance(A,B))=C, then the line segments intersect.
if (A + (B - A) * (Distance(A, C) / Distance(A, B)) = C) // line segments intersect.