def simpvol(p, t):
    """Signed volumes of the simplex elements in the mesh."""
    dim = p.shape[1]
    if dim == 1:
        d01 = p[t[:, (1)]] - p[t[:, (0)]]
        return d01
    elif dim == 2:
        d01 = p[t[:, (1)]] - p[t[:, (0)]]
        d02 = p[t[:, (2)]] - p[t[:, (0)]]
        return (d01[:, (0)] * d02[:, (1)] - d01[:, (1)] * d02[:, (0)]) / 2
    else:
        raise NotImplementedError
