[R] Voronoi/Thiessen polygon neighbors?
Rolf Turner
r.turner at auckland.ac.nz
Wed Oct 29 21:47:46 CET 2014
On 30/10/14 03:16, Michal Kvasnička wrote:
> Hello.
>
> I have a set of points in 2D. I can construct Voronoi polygons around them
> with deldir package and function from this page:
>
>
> http://stackoverflow.com/questions/9403660/how-to-create-thiessen-polygons-from-points-using-r-packages
>
> What I need is to find the list of all polygon neighbors of each original
> point. (Let us say that each original point is represented with its Voronoi
> polygon. These polygons are numbered. I have to find a list of all indices
> of the polygons that share a line segment with polygon 1, polygon 2, etc.)
>
> I can go through all line segments of all polygons and search for the
> polygon that shares the line segment but I guess there is a better way to
> do it. Can you help me to find it please?
Look at the "dirsgs" component of the object returned by deldir(). It
has two columns named "ind1" and "ind2". These are the indices of pairs
of points which are Delaunay neighbours, i.e. points such that the line
joining them is intersected by an edge of a Dirichlet (Voronoi) tile.
This should provide you with the information you want.
cheers,
Rolf Turner (author of the "deldir" package)
--
Rolf Turner
Technical Editor ANZJS
More information about the R-help
mailing list