Skip to content
Prev 6633 / 29559 Next

Finding to which Voronoi/Dirichlet a point belongs

Pierre Roudier wrote:

            
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