[R-sig-Geo] error in trmesh (alphahull package)
Murray Richardson
murray.richardson at utoronto.ca
Sat Apr 4 02:55:38 CEST 2009
Hello R community,
I have cross-posted with r-sig-geo as this issue could fall under either
interest group I believe.
I just came accross the alphahull package and am very pleased I may not
need to use CGAL anymore for this purpose. However, I am having a
problem computing alpha shapes with my point data, and it seems to have
to do with the spatial configuration of my points (which form long,
skinny, contiguous clusters). If I use rnorm to generate the same
sample size with the same mean and SD, I can compute the alpha shape
without trouble (which is why I think it might have to do with the
spatial arrangement of my points). See below:
# first here's a quick sample of my data (UTM coordinates)
> xcoords[1:5]
[1] 670080.2 670080.2 670080.2 670080.2 670080.2
> ycoords[1:5]
[1] 5005501 5005499 5005498 5005497 5005495
> xcoords[1:5]
#try the ashape routine with error
> alpha.shape<-ashape(xcoords,ycoords,15)
Error in tri.mesh(X) : error in trmesh
#get statistics to generate a similar dataset to test against
> length(xcoords)
[1] 26257
> length(ycoords)
[1] 26257
> mean(xcoords)
[1] 670462.4
> mean(ycoords)
[1] 5005382
> sd(xcoords)
[1] 149.3114
> sd(ycoords)
[1] 181.5950
#generate the test data
> xtest<-rnorm(26257,670462.4,149.3)
> ytest<-rnorm(26257,5005382,181.60)
# try ashape routine with success
> alpha.shape<-ashape(xtest,ytest,15)
> class(alpha.shape)
[1] "ashape"
Thanks for any insight into this!
Murray
ps I am able to compute the alpha shapes for this same dataset without
problem using CGAL but I find it a pain to work with....
More information about the R-sig-Geo
mailing list