Intersect

Find the point of intersection of two co-planar lines defined by four points
import sys def line_intersect(Ax1, Ay1, Ax2, Ay2, Bx1, By1, Bx2, By2): d = (By2 - By1) * (Ax2 - Ax1) - (Bx2 - Bx1) * (Ay2 - Ay1) if d:        uA = ((Bx2 - Bx1) * (Ay1 - By1) - (By2 - By1) * (Ax1 - Bx1)) / d         uB = ((Ax2 - Ax1) * (Ay1 - By1) - (Ay2 - Ay1) * (Ax1 - Bx1)) / d     else: return if not(0 <= uA <= 1 and 0 <= uB <= 1): return x = Ax1 + uA * (Ax2 - Ax1) y = Ay1 + uA * (Ay2 - Ay1) return x, y a = float(sys.argv[1]) b = float(sys.argv[2]) c = float(sys.argv[3]) d = float(sys.argv[4]) e = float(sys.argv[5]) f = float(sys.argv[6]) g = float(sys.argv[7]) h = float(sys.argv[8]) pt = line_intersect(a, b, c, d, e, f, g, h) print(pt)
 * 1) !/usr/bin/python