Pierre Roudier wrote:
I am trying to use the Voronoi tesselation of a point pattern to predict values of a second one. [ ...] To do that, I have to identify, for which point of my.data.set, to which voronoi tile it belongs to.
Using spatstat, I can just extract to which tile belongs each point, using an ugly double loop,
There is no need for a loop. In spatstat, if X is a point pattern and Z is a tessellation, then cut(X,Z) produces a marked point pattern in which each point of X is marked by the tile of Z which contains it. See help(cut.ppp) In the special case of a Voronoi/Dirichlet tessellation, you can also use the fact that the tiles are determined by which of the tile centres is closest. Thus if X and Y are point patterns, then nncross(X,Y)$which produces a vector of integers specifying which point of Y is nearest to each given point of X. Thus, X[i] lies in the tile around nncross(X,Y)$which[i]. Adrian Baddeley