pascal082 / alphashape

GNU General Public License v3.0
0 stars 0 forks source link

convex hull indices #1

Closed tretherington closed 4 years ago

tretherington commented 4 years ago

The convex function returns the pairs of points that make up the edges of the convex hull, but the indices for these points need correcting for us by R. It would also be useful to return just a list of the points as well as the edges.

x = c(30,70,20,50,40,70)
y = c(35,80,70,50,60,20)
p =data.frame(x,y)
hull =convex(point=p)
hull$convexhull[is.na(hull$convexhull)] = 0
hull$convexhull = hull$convexhull + 1
nodes = unique(c(hull$convexhull[,1],hull$convexhull[,2]))
plot(p)
points(p[nodes,], col="red", pch=16)
tretherington commented 4 years ago

This applies to the Delaunay triangulation too, so best check all functions

pascal082 commented 4 years ago

@tretherington now fixed