factor: relative length (1->no change, 2-> double, 0.5:half)

def resize(line, factor):
    """
    factor: relative length (1->no change, 2-> double, 0.5:half)
    """
    a = angle(line)
    mx, my = middle(line)
    d = length(line) * factor * 0.5
    dx = cos(a) * d
    dy = sin(a) * d
    return mx - dx, my - dy, mx + dx, my + dy