[R-sig-Geo] error in trmesh (alphahull package)
José Manuel Blanco Moreno
jmblanco at ub.edu
Sat Apr 4 13:43:09 CEST 2009
Hello,
The problem is that your first three points CANNOT be collinear. This is
a feature of trmesh in tripack. So: either you "unsort" your data
(keeping the indices you can sort them again) or alter (e.g. jitter) the
coordinates very slightly. Either solution will do the work.
Cheers,
José M. Blanco
Murray Richardson escribió:
> 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....
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
---------------------------------------
José M. Blanco Moreno
Dept. de Biologia Vegetal (Botànica)
Universitat de Barcelona
Av. Diagonal 645
08028 Barcelona SPAIN
---------------------------------------
phone: (+34) 934 039 863
fax: (+34) 934 112 842
e-mail: jmblanco at ub.edu
More information about the R-sig-Geo
mailing list