[R] Voronoi-Diagrams in R

Raphael Päbst raphael.paebst at gmail.com
Thu May 22 17:36:56 CEST 2014


Hello again,
I have found further depths of confusion concerning delaunay
triangulations to explore.

Here is the code I'm using to create the confusing results:

bm <- getbm(x) # a data.frame with 2 columns and 800 rows, values are
integers ranging from 1 to 82

del <- deldir(bm) # creating an object of type deldir with the 800
coordinates from bm
tri <- triang.list(del) # creating a list of length n, holding the n
triangles created by the delaunay triangulation with deldir(bm) as
data.frames

geodel <- delaunayn(bm) # creating a matrix with 3 columns and m rows
for the m triangles created by the delaunay triangulation using
delaunayn(bm) from geometry-package

now, the following is what I would expect: n and m should be the same,
since both triangulations should give me the same number of triangles,
right?

but this is what I get:

nrow(geodel) = 1584
length(tri) = 1186

This confuses me and I have the feeling I have left out some very
important parameter either in delaunayn() or deldir() to create the
different results.
There is however more confusion to come, this time in the result of
triang.list(del):

Every element in that list is a data.frame holding information on one
triangle. It has 3 columns and 3 rows with column headers 'ptNum', 'x'
and 'y'. Now I would expect, that 'ptNum' would give me the index at
which I can find the coordinates 'x' and 'y' as a row in my original
data.frame of coordinates, bm. And for example

bm[1,] gives me the same 'x' and 'y' that are listed in data.frame
tri[1] as 'ptNum' = 1.
But for some other points this does not work and for example the 'x'
and 'y' of 'ptNum' = 129 do not match bm[129, ]. Have I totally
misunderstood the meaning of 'ptNum' in this case or does my mistake
lie somewhere else?

Once again please excuse my slightly chaotic description of my
problems and my faulty english and thanks for any help you can give!

Raphael

On 5/21/14, Rolf Turner <r.turner at auckland.ac.nz> wrote:
> On 21/05/14 23:34, Raphael Päbst wrote:
>> I believe you are right. A night of sleep has done wonders for my
>> understanding of the problem.
>
> Oh sleep it is a gentle thing
> Beloved from pole to pole!
>
>> Thank you for your patience and help!
>
> Patience?  Moi?  This must be some new use of the word "patience" with
> which I am not familiar! :-)
>
> Glad your tessellations are working out.
>
> cheers,
>
> Rolf
>
>



More information about the R-help mailing list