def next_index(l, i):
    """
    Returns the index "i" of the next point in the list "l."  Work around 
    for reaching the end to go to the start.
    """
    if i == len(l) - 1:
        i = 0
    else:
        i += 1
    return i
