Grasshopper

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

Views: 589

Comment

You need to be a member of Grasshopper to add comments!

Comment by Robert Vier on May 19, 2015 at 3:09am

great,

works like a charm!

Comment by David Mans on May 19, 2015 at 1:08am

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.

Comment by Anders Holden Deleuran on February 13, 2015 at 2:18am

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 :)

Comment by Daniel González Abalde on February 12, 2015 at 1:57pm

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...

Comment by Christian Schmidts on February 12, 2015 at 1:25pm

guay daniel! yes, meshes - for such a simple concept they can be quite mysterious.. :) 

Comment by Daniel González Abalde on February 12, 2015 at 12:50pm


I have managed to codify the neighboring faces a vertex. But does not work on quads, I do not understand why. When I have it ready I will publish it :)

 

Comment by Christian Schmidts on February 12, 2015 at 10:27am

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 :)

 

Comment by Anders Holden Deleuran on February 12, 2015 at 7:10am
Very nice. I recently did something similar using GHPython, except always "burning" from the perimeter. In case you wanted to have a go at scriripting your algorithm. In extension of this I played around with finding shortest face-walks by building a graph representing the face-face topology. This works quite well for discretizing a mesh into strips which can be unrolled. See links here (on my phone):

https://github.com/AndersDeleuran/MeshAnalysis/blob/master/src/Mesh...
https://github.com/AndersDeleuran/MeshAnalysis/blob/master/src/Mesh...
http://vimeo.com/118487290

As far as I can recall Daniel Piker had a successful go at relaxing polylines on a mesh to approximate geodesics. Two anchors, pull to mesh and minimize polyline segments should do it I imagine. Anywho, didn't mean to derail the thread :)
Comment by Christian Schmidts on February 12, 2015 at 5:36am

@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)?  

Comment by Robert Vier on February 12, 2015 at 3:38am

Very interesting,

are there any endeavours on the true geodesic distances on a mesh?

Best

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service