Grasshopper

algorithmic modeling for Rhino

Hi,

I've been playing around with the various mesh topology related functions in the rhino commons and I'm having pretty mixed results. It seems as though if the mesh hasn't been created directly in rhino from one of the mesh primitives and with equal U and V amounts then the topology is offset at best, and usually what seems to be pretty illogical. The other thing is that when I bring an .obj mesh into rhino that already has clean topology I've gotten some very poor results when trying to use the topology functions. It seems like there's very little correlation with how the vertices and faces data is stored in rhino and GH and how the topology vertices and faces data is stored. Can someone please shed some light on this for me? It's very frustrating try to create a workaround for the topology information whenever I want to process a mesh. I'd also be interested to hear if someone has figured out a nice way to redefine the topology data of a mesh.

Thanks in advance,

Devin

Views: 1736

Replies to This Discussion

Can you be a little more specific about what exactly you're trying to do? to which "topology functions" are you referring? 

I'm calling Mesh.TopologyVertices property to get a MeshTopologyVertexList to be able to use the ConnectedTopologyVertices method on it so that I can get a hold of the neighboring vertices. What keeps happening is that when I import an obj into rhino the mesh (even if it simply x,y,and z data for vertices and the face data) ends up being handled by rhino in such a way that the topology data gets all jumbled around. When I call a vertex's index, the ConnectedTopologyVertices end up being inconsistent and not connected to the indexed vertex.

Hope this helps,
Devin

Could you post an example of a mesh which displays this behaviour? 

Anders, just try using these functions/methods on any imported mesh, or any rhino mesh that has an unequal x and y face count. 

Is it that you're trying to apply TopologyVertices directly to the mesh Vertices?  If so, the two are managed separately, which I also find a bit troublesome.  You have to pass back and forth between them:

'with m as your mesh

Dim vtx As Int32 = my_mesh_vertex 'the mesh vertex you want to find adjacent vertices for
Dim t_vtx As Int32 = m.TopologyVertices.TopologyVertexIndex(vtx) 'get the topology vertex related to your mesh vertex
Dim ct_vtc() As Int32 = m.TopologyVertices.ConnectedTopologyVertices(t_vtx) 'get the connected topology vertices

Dim vtc As New List(Of Int32) 'the list of mesh vertex indices
Dim vtc_pts As New List(Of Point3d) 'the list of vertices as points
For i As int32 = 0 To ct_vtc.length - 1
vtc.Add(m.TopologyVertices.MeshVertexIndices(ct_vtc(i))(0)) 'get the first mesh vertex related to each connected topology vertex
vtc_pts.Add(m.Vertices(vtc.last))
Next

I am right now playing around with making a half-edge .net class so that I can play with triangulated meshes and avoid exactly this sort of thing.

Thanks for the insight David, good to know that the two List types are stored differently, although I was hoping this wasn't the case. Also thanks for the example. 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service