def point_line_dist2(p, l1, l2):
    """Distance**2 between sequence of N, M-dimensional points and line l1-l2

    Parameters
    ----------
    p : array_like
        sequence of N, M-dimensional points. shape = (N, M)
    l1 : array_like
        start of line segment len == M
    l2 : array_like
        end of line segment len == M

    Returns
    -------
    dist2 : array_like
        distance**2 between each point and line. shape == N
    """
    p, l1, l2 = np.asarray(p), np.asarray(l1), np.asarray(l2)
    ap = l1 - p
    n = l1 - l2
    n /= np.sqrt(sum(n**2))
    dist = ap - np.outer(n, np.dot(ap, n)).T
    return np.sum(dist**2, 1)
dataset/ETHPy150Open mrterry/yoink/yoink/simplify.py/point_line_dist2/swapped operands of `-`