def sub_point(p1, p2, factor=0.5):
    """
    Returns a point on the line between p1 and p2 according to factor.
    """
    x1 = p1[0]
    y1 = p1[1]
    x2 = p2[0]
    y2 = p2[1]
    x = x1 + factor * (x2 - x1)
    y = y1 + factor * (y2 - y1)
    return (int(x), int(y))