walls function from pairs of points