def ccw(a,b,c): ax, ay = a bx, by = b cx, cy = c return (cy-ay) * (bx-ax) > (by-ay) * (cx-ax) # Return true if line segments AB and CD intersect