Grasshopper

algorithmic modeling for Rhino

Hello All,


I have a (somewhat) complicated question regarding list culling. I almost have it figured out, but I cannot get the very last part. Please bear with me...


I start with a 5 clusters of polylines. Each cluster consists of a central "Trunk" polyline and a few "Twig" polylines.

The intention is to find the two closest clusters (let's call them Cluster 'B' and Cluster 'C') to each individual cluster (let call it Cluster 'A') by measuring the distance between the Trunks of those clusters. After Cluster 'B' and Cluster 'C' have been identified, the end goal is to measure the closest distance between the individual Twigs of Cluster 'A' to the Trunks of Cluster 'B' and 'C'.

I have been able to solve the first step, isolating the Trunks of Cluster 'B' and 'C', but I cannot organize my lists correctly in order to draw the shortest distance between the Twigs of Cluster 'A' to the Trunk of Cluster 'B' and 'C'

I have it almost working and seem to have the correct number of lines, but they are not two per each twig as you would expect if the list were aligned properly. 


Any guidance would be helpful!

I have attached a few files to illustrate the problem. 

Views: 80

Attachments:

Reply to This

Replies to This Discussion

the end goal is to measure the closest distance between the individual Twigs of Cluster 'A' to the Trunks of Cluster 'B' and 'C'.

Hello again Ethan,

I've played with this a little bit but don't have a direct answer for you, in part because that statement suggests a complicated data tree indeed!  And in part because I can't quite shake the question "Why?".

It's my nature to "think out of the box" and as you may have noticed, my answers in the other two threads related to this topic weren't quite what you asked for.  The first question that comes to mind in this case is why look for the two closest trunks?  Why not just the closest or why not "N" (all or all those within a given radius)?

The next question is why use a plane intersection at arbitrary height to get a point on each trunk for measuring distances between them?

So please bear with me as I explain how I've explored this problem so far, knowing I don't have an answer yet and, in fact, am not even sure that the question makes sense to me. ;)

First, I got tired of looking at these upside down "trees" so I flipped them right side up.  I used 'Mirror' instead of 'Rotate' which might cause problems?  But lets move on.  I changed your preview colors so they wouldn't conflict with my 'Tree/List Viewer' defaults and to increase contrast a bit.

Then I skipped your methods for finding "Cluster 'B' and 'C'" and used 'Curve Proximity' between the trunks instead.

This is hard to convey with a static image but might make more sense interactively.  There are two copies of 'Tree/List Viewer'; the second one ("slave" group) is driven by the set of sliders in the first one.  As you move the 'path idx' slider, one of the trunks will be cyan in color, as set above.  The others will be blue except for one that is yellow.  As you move the 'list idx' slider, the yellow highlight will move among the blue trunks, showing the closest trunk at 'list idx' = 0 and the furthest at 'list idx' = 3 (five trunks total, one selected by 'path idx' and the other four by 'list idx'.  The result is that for each trunk, we have all the other trunks sorted by distance.

That's all for now!  There is a very simple way to connect the 'Twigs' instead of the 'Trunks' to 'Crv A' with interesting results, but it requires flattening the 'Twigs' so isn't as useful as we want.

The big question for me remains: what is the data/tree structure of the results you seek?  From the statement I quoted above, it sounds like:

  • One branch per trunk.
  • For each trunk, one branch per twig?  (or...?)
  • For each twig branch...?  A list of distances to each of the other trunks?  (or a list of the other trunks sorted by their distances from this twig?)

It sounds like a complicated mess, frankly.  And again begs the question, why?  What's the underlying goal beyond the objectives you have outlined so far?

Attachments:

Joseph thank you (as always) for the help,

I know it looks/sounds like a complicated mess (probably because it is!), but I promise there are reasons for that.

Firstly, I am not an expert at grasshopper and I am probably not doing this as efficiently as an expert would....this being said, your guidance in the past few discussions have really helped me improve my game!

Secondly, I can tell you that this is a smaller piece to a much larger agenda. I have been working on a project for the past few months which attempts to take thousands of nonstandard wood components (scanned with a terrestrial scanner) and use them within an architectural assembly. I start with a point cloud of a 3D scanned tree (a tree made of wood not a data tree), create a mesh from that point cloud, then extract the center-lines of each unique branch. I have been manipulating and reorienting the meshes by using the extracted center-lines as a guide...which is why I have been creating lists which usually contain one mesh and a few polylines. The first polyline of each data tree branch is the large "trunk" of that branch cluster and the other polylines are the smaller "twigs".

The "trunks" I refer to here are actually called scaffold branches in dendrology and the "twigs" are called lateral branches. Scaffold branches work well in compression and lateral branches work well in tension which has informed the upside-down orientation of the branches. I have used karamba to run some structural studies with these branches and create an assembly logic. 

Ultimately, The end goal with this is to use galapagos to maximize the number of connections between clusters. Each cluster is allowed to rotate along a vertical axis as well as move in a limited range both horizontally and vertically. "Twigs" will only be allowed to connect to "Trunks". 

Because I am dealing an assembly of over 500 clusters, I have tried to limit the amount of clusters galapagos will need to search for. I said in the previous post I need to search for the "two closest clusters", but in reality I will raise that number to around 10. The plane intersection currently used to search for neighboring clusters is not exactly arbitrary...this is the roof of my assembly which is flat and at a height of 16ft.    

I apologize for my unclear question--I was having a real difficulty even writing it! I think I know just enough to make things confusing and not enough to ask the write questions.

Regarding your "big question" of "what is the data/tree" I seek:

In order for me to create a fitness for galapagos (I think that) I will need to have a list of distances from each twig to the trunks of neighboring clusters. This distance will then be minimized within a galapagos fitness as the clusters readjust position. 

I will upload a slightly larger portion of the script first thing tomorrow to clarify my intent! 

Thank you again for wrestling through this! 

Interesting.  Glad I asked.  Not sure what more I can say that won't sound discouraging...

If I understand you correctly, you want 500 (or is it "thousands") of these unique wooden trees to be moved in X, Y, Z and rotated 360 degrees until some equilibrium is reached?

Have you tried to simulate this in any simple way?  Not so sure that Galapagos is up to the task, sounds more like a job for Kangaroo.

You might want to consider the enhancements to data trees in GH2?

Datatrees in Grasshopper 2.0
https://discourse.mcneel.com/t/datatrees-in-grasshopper-2-0/24020

I don't think I can be much more help on this though, it's a little too esoteric for me.

It does sound very complicated, but a lot of the hard bits may be solved just by biting the bullet and creating a custom data type for your shapes with a bunch of functionality attached to it.

This data-type would consist of a mesh (and/or the scanned pointcloud), a single polyline marked as Scaffold and a list of polylines marked as Laterals. It would make data management a lot easier if you could just manipulate these entities as individual pieces. Is this assessment correct in your opinion?

Furthermore a method for measuring the distance(s?) between the Laterals of one tree and the Scaffold of another can be implemented in code. I'm not entirely sure yet what this distance metric entails, that'll need more explanation.

After this you'd be left with the hard problem of finding a specific state of instances+transforms that minimizes some sort of cost function. This is still a considerable problem for sure, but at least it's relatively self-contained.

RSS

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2017   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service