def find_min(a, b, c, d): ab = Vector(a, b) ac = Vector(a, c) ad = Vector(a, d) cd = Vector(c, d) ca = Vector(c, a) cb = Vector(c, b) bd = Vector(b, d) if intersect(a,b,c,d): print("Not intersection") return ab.length() elif ab.cros_product(ac)*ab.cros_product(ad) <= 0 and cd.cros_product(ca)*cd.cros_product(cb) <= 0: print("Intersection") return min(ac.length()+cb.length(), ad.length()+bd.length()) else: print("Not intersection") return ab.length()