def lerp(pt1, pt2, intervals):
    """Linear interpolation.

    Args:
        pt1: Array of points. When interval is 0, the result is pt1.
        pt2: Array of points. When interval is 1, the result is pt2.
        intervals: Array of intervals at which to evaluate the
            linear interpolation

    >>> x = np.array([1, 0, 0])
    >>> y = np.array([0, 0, 1])
    >>> t = np.linspace(0, 1, 4)[:, np.newaxis]
    >>> lerp(x, y, t)
    array([[ 1.        ,  0.        ,  0.        ],
           [ 0.66666667,  0.        ,  0.33333333],
           [ 0.33333333,  0.        ,  0.66666667],
           [ 0.        ,  0.        ,  1.        ]])
    """
    t = intervals
    return (1 - t)*pt1 + t*pt2