There are various ways to do it but there isn't really a straight formula...it's more of a process.

The segments could:

(1) Be parallel and never intersect.

(2) Be parallel and intersect in a point or overlap in a segment.

(3) Be parallel and not intersect, but would if they were extended.

(4) Be non-parallel and intersect in a point.

(5) Be non-parallel and not intersect, but you need to know where they would intersect if one or both segments were extrapolated.