Skip to content
Prev 19699 / 29559 Next

calculate the area of an alpha shape

Dear Andr?,

You're right! I assumed something that wasn't true - that $x in the ashape.obj 
were the points on the hull. That's what you get for free help, I guess.... 

Fortunately this seems to work. Notice how I index $x by the alpha.extremes 
field to extract just the points I want for bds:

library(sp)
bds <- achull.obj$ashape.obj$x[achull.obj$ashape.obj$alpha.extremes,] 
bds <- rbind(bds, bds[1,])          # close the ring
ashape <- Polygon(bds)            # convert to sp Polygon  
print(ashape at area)

# The following plots the points in ashape superimposed on the hulls
plot(achull.obj, col = "blue")
plot(achull.obj$ashape.obj, add = TRUE, col = "red")
points(coordinates(ashape), pch=16, cex=2, col='gold')
On Monday, November 04, 2013 04:32:42 PM Proosdij, Andre van wrote:
-----
Ashton Shortridge
Associate Professor			ashton at msu.edu
Dept of Geography			http://www.msu.edu/~ashton
235 Geography Building		ph (517) 432-3561
Michigan State University		fx (517) 432-1671