Grasshopper

algorithmic modeling for Rhino

Hello!

I have a collection of tetrahedral breps which always share at least one common face.

In this simple example (image below) I have two tetrahedra (with numbered vertices) sharing 1 face.

I at trying to extract the following connectivity information in terms of adjacency matrices (1 when the elements connect, 0 else):

Adjacency matrix for the tetrahedral breps (so that would be 1 if they share a common faces, 0 else). In this example it would be: [[0,1],[1,0]]

Adjacency matrix for the (unique) vertices of the brep collection

Adjacency matrix for edges and breps (so the columns would be the tetrahedra and the rows the unique edges of the collection of breps. With 1 if the edge belongs to the cell and 0 else)

I have been using sandbox and plankton plugins but haven't managed to do what I need.

Any help appreciated!

M.

Views: 1677

Replies to This Discussion

Er ... adjacency Matrices are used in order to describe the connection "cost" from A to B (or/and B to A).

You probably mean connectivity trees in the classic sense (vertices, edges, BrepFaces etc etc) exactly like the ones extracted for any mesh (vertices, edges, Faces).

For instance for a given List of vertices a vertex to vertex connectivity tree means branches where the dimension is the reference vertex index in the List and items are the indices of vertices (in the same List) that are connected to the reference vertex. Same kind of logic for any other imaginable combo (edges, BrepFaces and the likes).

This is rather easy but you'll need code to do it (without any "add-on")  Do you speak C#?

Or .. wait a minute ... hmm .. you mean that you want help for "interpreting" what that native component does/means?

Hi,

Thanks for your answer!

I mean adjacency matrix in usual graph theory sense:

http://mathworld.wolfram.com/AdjacencyMatrix.html

So for a set of vertices V it is just a symmetric connectivity (0,1) matrix with 0 in the diagonals and 1 only if the i, j vertices meet through an edge. 

I speak python, but if you have a C++ idea I would be happy as well :)

Hmm ...

Since GH does business with Trees I suspect that you need this (the "translation" from connectivity trees > matrces) for stuff outside GH right?

Anyway I'll prepare a small demo (C#) on that matter (using vertex to vertex connectivity).

exactly! It is that translation that I need to move from trees to graph theory connectivity matrices. 

Since you seam to have SpiderWeb installed here a little sample...

You can choose between a set of Matrix representations:

Adjacency Matrix, Laplacian Matrix, ....

Attachments:

Thanks! It seems I had an ancient version of spiderweb, I am downloading the new one and try this out.

Hi Richard,

Works perfectly for vertices. However, I want to make an adjacency matrix for cells (and ultimately a 'connectivity' matrix for cells and edges)

Just to clarify my 'Global Brep' here is a set of Breps/ cells/ tetrahedra and I need to know: how these cells are connected between them; which (unique in the 'Global Brep' edges belong to which cells through a 0,1 matrix again.

Simple example below: I have a 'Global Brep' comprising 3 cells/ tetrahedra so the adjacency matrix I would expect is: ([0,1,0], [1,0,1], [0,1,0])

I am trying to do this using the graph from cells component but I get errors. Any ides?

Hi,

Graph from Cells only works 2D, sorry...

But here is an example it uses Brep Brep intersection and then converts the DataTree structure into a graph.

Attachments:

No problem I see, The method with Brep Intersection works perfectly.

Last question, Is there a way to import the spiderweb adjacency matrices into python to use them in my script? for example through transforming them to a 2d array?

You can simply use the native Grasshopper components to do this. 

However don't know what your python script is doing (maybe you'd like to share) but you can use spiderweb within vb, c# in ships as dll library, so you could do what is done here directly within the script component....

http://www.gbl.tuwien.ac.at/_docs/SpiderWebLibraryDoc/index.html

Best

Richard

Thanks Richard,

Your comments were very helpful.

Essentially, I am developing a geometrical construction in Python which creates a special kind of dual structure (from cells to points) so if I can import the initial adjacency matrix of the cells I can then apply it to my resulting points in order to connect them,

Best,

M. 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service