[R-sig-Geo] Question about spatstat: bdist.tiles()

Rolf Turner r.turner at auckland.ac.nz
Wed Sep 19 23:12:48 CEST 2012


This does indeed appear to be a bug.  I succeeded (very easily) in 
reproducing
the bug with a simulated example as follows:

W <- disc(1,c(0,0))
set.seed(42)
X <- runifpoint(30,win=W)
spatstat.options(gcplib=TRUE)
TX <- dirichlet(X)
DTX <- bdist.tiles(TX)
plot(TX)
points(X$x[11],X$y[11],pch=20,col="red")
print(DTX[11]) # Get 0.2121148, not 0.

I will attempt to track down the source of the bug and then get back
to you.  May take me a while ....

     cheers,

         Rolf Turner


On 20/09/12 04:20, Mudrak, Erika [EEOBS] wrote:
> Hello geo list,
>
> I have a question about the bdist function in spatstat when applied to tiles.    The documentation for bdist.tiles says:
> ----------------------
> Details
> This function computes, for each tile s[[i]] in the tessellation X, the shortest distance from s[[i]] to the boundary of the window W containing the tessellation.
> Value
> A numeric vector, giving the shortest distance from each tile in the tessellation to the boundary of the window. Entries of the vector correspond to the entries of tiles(X).
> ---------------------
> *** From what point on the tile does this function measure?  ****
>
> I am interesting is doing Dirichlet (Voronoi) tessellations  (using dirichlet()), but I want to keep separate tiles that hit the window boundary and points that do not.     I thought I would use the bdist.tiles() function and keep only points where bdist>0.
>
> I realize there can be issues with rounding distances, but I came across a situation where there seems to be a bug or an ambiguity for this function.  I have posted an example jpeg at http://mudrak.public.iastate.edu/bdist.tiles_problem.jpg that shows my tessellation, with bdist.tiles values plotted at the point location, and non-boundary tiles (bdist>0) printed in blue. There is a tile on the right that should be a boundary tile but has a bdist of 0.0269, which is larger than many of the other interior tiles.
>
> ** Is there a fix for this bug, or another way to identify boundary tiles? **
>
> Thank you for any suggestions.



More information about the R-sig-Geo mailing list