def compute_line_intersection_point(x1, y1, x2, y2, x3, y3, x4, y4):
def _make_line(p1, p2):<EOL><INDENT>A = (p1[<NUM_LIT:1>] - p2[<NUM_LIT:1>])<EOL>B = (p2[<NUM_LIT:0>] - p1[<NUM_LIT:0>])<EOL>C = (p1[<NUM_LIT:0>]*p2[<NUM_LIT:1>] - p2[<NUM_LIT:0>]*p1[<NUM_LIT:1>])<EOL>return A, B, -C<EOL><DEDENT>L1 = _make_line((x1, y1), (x2, y2))<EOL>L2 = _make_line((x3, y3), (x4, y4))<EOL>D = L1[<NUM_LIT:0>] * L2[<NUM_LIT:1>] - L1[<NUM_LIT:1>] * L2[<NUM_LIT:0>]<EOL>Dx = L1[<NUM_LIT:2>] * L2[<NUM_LIT:1>] - L1[<NUM_LIT:1>] * L2[<NUM_LIT:2>]<EOL>Dy = L1[<NUM_LIT:0>] * L2[<NUM_LIT:2>] - L1[<NUM_LIT:2>] * L2[<NUM_LIT:0>]<EOL>if D != <NUM_LIT:0>:<EOL><INDENT>x = Dx / D<EOL>y = Dy / D<EOL>return x, y<EOL><DEDENT>else:<EOL><INDENT>return False<EOL><DEDENT>
Compute the intersection point of two lines.

Taken from https://stackoverflow.com/a/20679579 .

Parameters
----------
x1 : number
    x coordinate of the first point on line 1. (The lines extends beyond this point.)

y1 : number
    y coordinate of the first point on line 1. (The lines extends beyond this point.)

x2 : number
    x coordinate of the second point on line 1. (The lines extends beyond this point.)

y2 : number
    y coordinate of the second point on line 1. (The lines extends beyond this point.)

x3 : number
    x coordinate of the first point on line 2. (The lines extends beyond this point.)

y3 : number
    y coordinate of the first point on line 2. (The lines extends beyond this point.)

x4 : number
    x coordinate of the second point on line 2. (The lines extends beyond this point.)

y4 : number
    y coordinate of the second point on line 2. (The lines extends beyond this point.)

Returns
-------
tuple of number or bool
    The coordinate of the intersection point as a tuple ``(x, y)``.
    If the lines are parallel (no intersection point or an infinite number of them), the result is False.