Message Boards Message Boards

0
|
5739 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Adjacency list of convex hull

Posted 10 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

POSTED BY: Bogdan Dragnea
5 Replies
Posted 10 years ago

Horvat: A most helpful answer. Thank you so much. Bogdan

POSTED BY: Bogdan Dragnea

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]

POSTED BY: Szabolcs Horvát

enter image description here

POSTED BY: Simon Cadrin

enter image description here

POSTED BY: Simon Cadrin
Posted 10 years ago

Thanks, but what I am really after is: for each vertex to know either how many neighbors it has OR the list of connected vertexes. I'm still unclear wether that can be done or not.

POSTED BY: Bogdan Dragnea
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract