rdelaunayspatstatdirichlet

test for in-tile for Dirichlet tile, using R


So I can take points and use the R libraries deldir or spatstat::dirichlet to find the dirichlet tesselation of those points.

Now I have a point not in the set, and I want to know the indices of the points forming the dirichlet tile which my not-in-set-point is interior to. I can get there by knowing the tile label (or index).

Are there any libraries or methods to do this? I'm thinking spatstat, but not finding something there yet.


Solution

  • The function cut.ppp() can take a point pattern and find which tesselation tile each point in the pattern belongs to. Below is the code for a simple example of a point pattern that only contains a single point (0.5, 0.5).

    library(spatstat)
    dd <- dirichlet(cells)
    plot.tess(dd, do.labels = TRUE)
    xx <- ppp(.5, .5, window = Window(dd))
    plot(xx, add = TRUE, col = "red", cex = 2, pch = 20)
    

    yy <- cut(xx, dd)
    yy
    #> Marked planar point pattern: 1 point
    #> Multitype, with levels = 
    #>    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 
    #> 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
    #> window: rectangle = [0, 1] x [0, 1] units
    marks(yy)
    #> [1] 18
    #> 42 Levels: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ... 42
    

    Created on 2018-12-03 by the reprex package (v0.2.1)