Dear colleagues,

I wish to calculate the area covered by the alpha shape based on a sample of points in a 2D plane. For the alpha-convex hull this works fine using the function ahull in the alphahull package. However, I want to get the area of the slightly different alpha shape. How can I do this? Below a short example.

Many thanks in advance for your answers and ideas!


André



x <- c(1,1,1.5,2.8,3,3)
y <- c(1,3,2,3,4,1)
z <- cbind(x,y)
plot(z)

### Calculate the alpha-convex hull
library(alphahull)
alpha <- 3 # Define alpha > 0
achull.obj <- ahull(z, alpha = alpha)

### Plot the sampled points and the alpha-convex hull object
plot(achull.obj, add = TRUE, col = "blue")

### Get the length of the alpha-convex hull
achulllength <- achull.obj$length
achulllength

### Get the area of the alpha-convex hull
achullarea <- areaahull(achull.obj)
achullarea

### Plot the alpha shape
plot(achull.obj$ashape.obj, add = TRUE, col = "red")

### Get the length of the alpha shape
ashapelength <- achull.obj$ashape.obj$length
ashapelength





Ir. A.S.J. van Proosdij
PhD Student
t   +31 317 48 1198
e  andre.vanproosdij@wur.nl<mailto:andre.vanproosdij@wur.nl>

Naturalis Biodiversity Center, section NHN
Biosystematics Group, Wageningen University
Gen. Foulkesweg 37, 6703 BL Wageningen, the Netherlands

www.bis.wur.nl<http://www.bis.wur.nl/>


	[[alternative HTML version deleted]]

