@jit(nopython=True)<EOL>def intersection(line1, line2):
x1, y1, x2, y2 = line1<EOL>u1, v1, u2, v2 = line2<EOL>(a, b), (c, d) = (x2 - x1, u1 - u2), (y2 - y1, v1 - v2)<EOL>e, f = u1 - x1, v1 - y1<EOL>denom = float(a * d - b * c)<EOL>if _near(denom, <NUM_LIT:0>):<EOL><INDENT>if b == <NUM_LIT:0> or d == <NUM_LIT:0>:<EOL><INDENT>return None<EOL><DEDENT>if _near(e / b, f / d):<EOL><INDENT>px = x1<EOL>py = y1<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>else:<EOL><INDENT>t = (e * d - b * f) / denom<EOL>px = x1 + t * (x2 - x1)<EOL>py = y1 + t * (y2 - y1)<EOL><DEDENT>return px, py<EOL>
Return the coordinates of a point of intersection given two lines.
Return None if the lines are parallel, but non-colli_near.
Return an arbitrary point of intersection if the lines are colli_near.

Parameters:
line1 and line2: lines given by 4 points (x0,y0,x1,y1).