def line_to_unit_vector(line):
    """
    Converts a line to a unit vector.
    :param line: ((x0, y0), (x1, y1))
    :return: ((a, b), (x0, y0))
    """

    # unpack line
    p0, p1 = line
    x0, y0 = p0
    x1, y1 = p1

    # get vector components
    a = x1 - x0
    b = y1 - y0

    # get vector magnitude
    mag = (a ^ 2.0 + b ^ 2.0) ^ 0.5

    # make vector tuple as listed at beginning
    vec = ((a / mag, b / mag), p0)

    # return vector
    return vec