[R] Voronoi-Diagrams in R
Rolf Turner
r.turner at auckland.ac.nz
Wed May 21 03:01:21 CEST 2014
It sounds to me as though you are simply getting yourself flummoxed by
the fact that the different packages produce their output in different
formats. The information in the output will be the same (as Boris has
indicated) --- it will just be arranged differently. Learn to interpret
the output of each function (RTFM!) and you will find that there is no
problem.
cheers,
Rolf Turner
(author of "deldir")
On 21/05/14 09:33, Raphael Päbst wrote:
> Thanks for the answer!
>
> I'll post a sample tomorrow, I have however found the following:
> triang.list() gives me the coordinates of the triangle's vertices,
> while delaunayn() gives me the indices of those coordinates. Thus it
> should be more or less simple to convert the output of deldir() into
> that of delaunayn()
>
> Once again, thanks!
>
> Raphael
>
> On 5/20/14, Boris Steipe <boris.steipe at utoronto.ca> wrote:
>> deldir() uses Lee and Schacter's algorithm, while the geometry package is a
>> (partial) implementation of Barber et. al's Quickhull. Since both algorithms
>> are correct, they should give the same results for the same data.
>>
>> How about you post a small input dataset and list the output that you
>> need...
>>
>>
>> B.
>>
>>
>>
>>
>> On 2014-05-20, at 2:04 PM, Raphael Päbst wrote:
>>
>>> Thank you very much, this looks promising.
>>>
>>> I have a follow-up question however, probably due to my thickness when
>>> it comes to the underlying math.
>>>
>>> I am translating (as closely as possible) some code that has
>>> originally been written for Mathlab and uses the delaunay() function
>>> there. Now, if I understand it correctly, Mathlab uses the same
>>> Qhull-Library as a basis, as does the Geometry-Package. So in theory
>>> delaunay(x) in Mathlab and delaunay(x) in R should give me the same
>>> results for the same x, where x is a matrix of coordinates.
>>>
>>> If I use deldir(x1, x2) where x1 and x2 are the first and second
>>> column of that same matrix above, is there any chance to get the same
>>> result as with delaunayn() or at least something similar in format to
>>> the result of delaunayn()?
>>>
>>> Many thanks again and please excuse my crude english.
>>>
>>> Raphael
>>> On 5/14/14, Boris Steipe <boris.steipe at utoronto.ca> wrote:
>>>> Try:
>>>>
>>>> install.packages("deldir")
>>>> library(deldir)
>>>> ?deldir
>>>> set.seed(16180)
>>>> x <- runif(20); y <- runif(20); window <- c(0,1,0,1)
>>>> tess <- deldir(x, y, rw = window)
>>>> plot.deldir(tess, wpoints="real", wlines="tess")
>>>>
>>>> Cheers,
>>>> Boris
>>>>
>>>>
>>>> On 2014-05-14, at 8:18 AM, Raphael Päbst wrote:
>>>>
>>>>> Hello everyone!
>>>>> I have returned to R after a longish break and am currently working on
>>>>> a project where I need Delaunay-Triangulations and Voronoi-Diagrams.
>>>>> If I understood it correctly, the Geometry-Package only offers
>>>>> functions for the Delaunay-Triangulation at the moment. Is this
>>>>> correct and if so, what would be the best way to get Voronoi-Diagrams
>>>>> as well?
More information about the R-help
mailing list