def inBetween(p1, mid, p2):
    """
    Determine whether if point mid in on the line p1p2
    """
    return (mid.x <= max(p1.x, p2.x) and mid.x >= min(p1.x, p1.x) and
            mid.y <= max(p1.y, p2.y) and mid.y >= min(p1.y, p2.y))