Here is the answer to solving the center point of 2d convex hull: Centroid of the minimum convex polygon
how to find center point of 3d convex hull(package:geometry) in R?
example for bunny data:
library("onion")
library("geometry")
library("rgl")
data(bunny)
bunnyConvexHull <- convhulln(bunny, output.options = TRUE)#convex hull
plot3d(bunny, col = "pink") #bunny poins
plot(bunnyConvexHull, col = "gray", alpha = 0.3, add = TRUE)
Once you have a triangle rgl mesh, you can get its centroid with the packages cgalMeshes. Unfortunately, this package is not on CRAN currently. You can install it by running (this takes a while):
To get a rgl mesh of the convex hull, I didn't manage to use the
to.mesh3dfunction of the geometry package. Here is how to get this mesh with the cxhull package (also based on the C(++) library qhull):Finally:
EDIT
I've finally found how to get the rgl mesh with the geometry package; the point was to use the
FAoption: