0
|
4873 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
GROUPS:

# Adjacency list of convex hull

Posted 8 years ago
 I would like to know if it is possible to obtain a vertex adjacency list from the result of ConvexHull the way it is possible in 2D when using the VoronoiDiagram. thanks
5 Replies
Sort By:
Posted 8 years ago
 I'm not very familiar with this functionality, but many of the builtin objects such as interpolation functions, mesh regions, etc. can be queried like this obj["propertyName"].If we have hull = ConvexHullMesh@RandomReal[1, {100, 3}];, then we can try hull["Properties"] to get the available properties. Now allt his is undocumented, may not work across versions, may not work at all ... but at least in the current version of Mathematica we see that there's a property called "AdjacencyMatrix". hull["AdjacencyMatrix"] will return this.Once again, this is undocumented, may not work, may break, etc. So use with caution.I would also like to know what is the simplest way to do this using documented functions. MeshPrimitives[hull, 1] does give all the edges, which can be used to extract adjacency information. But it gives them in terms of point coordinates, not point indices, which makes it more difficult and less convenient to do this kind of computation.UPDATE: MeshCells[hull, 1] will give all edges in terms of point indices (instead of point coordinates). This is just the edge list of the graph you are looking for: g = Graph[UndirectedEdge @@@ MeshCells[hull, 1][[All, 1]]] and then e.g. VertexDegree[g]