algorithmic modeling for Rhino
rerouting the faces of a mesh based on their topological distance to one face.
first one selects faces only if they have one adjacent edge and the second one if there is an adjacent point or edge.
done with sandbox, anemone, treefrog
Tags:
Comment
great,
works like a charm!
Christian,
Coming back to an old conversation here, but wanted to put forward some work I have done on this problem trying to find the fastest way to establish vertex "rings" based on topology. This starts with just naked edges, but should work for any predefined Boolean pattern.
Private Sub RunScript(ByVal M As Mesh, ByRef A As Object)
Dim mv As Rhino.Geometry.Collections.MeshVertexList
mv = m.Vertices
Dim arrBln() As Boolean
Dim arrBnd() As Integer
arrBln = m.GetNakedEdgePointStatus()
ReDim arrBnd(ubound(arrBln))
Dim i,j,k,cnt As Integer
Dim tintList As New list(Of Integer)
For i = 0 To ubound(arrBln) Step 1
If arrBln(i) Then
tintList.add(i)
arrBnd(i) = 0
cnt += 1
End If
Next
i = 0
Dim tnxt As New list(Of Integer)
Do
Dim tint As New list(Of Integer)
If i = 0 Then tint = tintList Else tint = tnxt.toarray().tolist()
tnxt.clear()
For j = 0 To tint.count() - 1 Step 1
Dim tnkd() As Integer
tnkd = mv.GetConnectedVertices(tint(j))
For k = 0 To ubound(tnkd) Step 1
If arrBln(tnkd(k)) = False Then
arrBln(tnkd(k)) = True
tnxt.add(tnkd(k))
arrBnd(tnkd(k)) = i + 1
cnt += 1
End If
Next
Next
If cnt >= mv.Count() Then Exit Do
i += 1
Loop
A = arrBnd
End Sub
This approach essentially creates a list of the currently "naked" points, finds connected vertices, checks their status, and if they are not naked, flips the Boolean to true and saves their index to a new list. This is repeated till the initial list is exhausted, loops back and replaces the old naked list with the next "ring" of naked points and repeats. This took about 800 ms for about 6000 points and 1.2 second for 4 meshes and a little over 10000 vertices as shown in the image.
Hi Christian. It could be an issue of missing dependencies. The definition uses the GHPython component for all the scripting bits. The "MeshPaths" component also implements the networkx Python module. If you search the forum for "networkx" there are a few threads explaining how to get it working and which version to use etc. Hope that helps :)
haha this mystery was in fact a very silly human error, the V input (vertex index) I had it greater than the number of mesh vertex xD
So, here it is :)
http://www.grasshopper3d.com/group/milkbox/forum/topics/neighbors-o...
guay daniel! yes, meshes - for such a simple concept they can be quite mysterious.. :)
Hello Anders, interesting indeed your mesh analysis tools. Unfortunately I couldn't open the example file. First I got an error for an unknown datatype and now it opens in a empty file or cluster. Maybe you can give me a hint on what the issue here.
I have posted my definition here:
http://www.grasshopper3d.com/forum/topics/topology-contour-defintion
But bare with me I'm rather a thinker than a programmer :)
@David I doubt this is very efficient way to do it since i used a lot of plugins and the definitions are quite messy. But i will send you the file. I would be happy if you can derive something useful for mesh + even if I rather doubt it. Nevertheless I think there is a potential in this algorithm (see link).
@Robert My motivation was rather to be able to do things like this (see link). Geodesic distances would result in curves or poly-lines and some absolute distance right? This one is about relative distance as the absolute distance depends on the topology of the mesh. But isn't the there a component in millipede that does something similar (Mesh contours)?
Very interesting,
are there any endeavours on the true geodesic distances on a mesh?
Best
© 2020 Created by Scott Davidson. Powered by
You need to be a member of Grasshopper to add comments!
Join Grasshopper