For the grid defined by x-coordinates, xvals, and y-coordinates, yvals, and an owin object W, this function just returns a logical matrix M, whose [i,j] entry is TRUE if the point(xvals[i], yvals[j]) is inside the observation window.
gridInWindow(xvals, yvals, win, inclusion = "touching")
x coordinates
y coordinates
owin object
criterion for cells being included into observation window. Either 'touching' or 'centroid'. The former includes all cells that touch the observation window, the latter includes all cells whose centroids are inside the observation window.
matrix of TRUE/FALSE, which elements of the grid are inside the observation window win