Grasshopper

algorithmic modeling for Rhino

[Q] Specific Pairings from Within the Same Tree

I have a very pesky tree.  

 

I know what I'd like to do but my brain has melted trying to figure out how to get it done.  There are too many integers floating around in my head.

 

Hopefully this example is clear enough...

 

TREE

{branch}(index) = value

{0}(0) = 1

{0}(1) = 2

{0}(2) = 3

 

{1}(0) = 0

{1}(1) = 3

{1}(2) = 4

 

{2}(0) = 0

{2}(1) = 3

 

{3}(0) = 0

{3}(1) = 1

{3}(2) = 2

{3}(3) = 4

 

{4}(0) = 1

{4}(1) = 3

 

PAIRINGS (specified by the first occurance of a branch / value combination)

list1 : list2

{0}(0) = 1 : {1}(0) = 0

{0}(1) = 2 : {2}(0) = 0

{0}(2) = 3 : {3}(0) = 0

{1}(0) > this index has now been used, move on to the next one (etc.)

{1}(1) = 3 : {3}(1) = 1

{1}(2) = 4 : {4}(0) = 1

{2}(1) = 3 : {3}(2) = 2

{3}(3) = 4 : {4}(1) = 3

 

Thanks!

Views: 5505

Replies to This Discussion

No idea how one would go about this elegantly without scripting... I figured out one EXTREMELY messy and drawn out way without scripting (effectively manual iteration in the manner described here: http://heumanndesigntech.wordpress.com/2010/08/13/iteration-in-gras...), and then realized that scripting it was a much, much smarter solution. I am still a scripting beginner, so please don't judge my terrible code, but I think it gets the job done. It could be much cleaner still if I knew how to script data trees, but I'm not quite there yet.

I'm dying to know, what is this particular pattern of pairing for?
Attachments:
Hi Andrew,

Thanks for diving into my riddle...

I also realized that scripting is the way it should be done, yet it would be a big struggle for me to get there with the data tree classes 'n stuff. I just started playing around in that direction so I shall take a look at your code with interest.

I will gladly explain what the patterning is for (later...). I think you'll like it!

As a teaser, it's an offshoot of this discussion (back to other work for now).

So my friend has this Maya MEL routine that I wanted to see if I could recreate with GH.  The key thing is the labeling since every face and clip angle are unique.

 

Here's the jist of it with a photo, and it was only devised for triangular faces:

 

I could track all my edge labels (via the neighboring cell discussion) but from that info (the pesky tree) I needed unique face pairs to output a single crease angle.

 

Now (with your scripted component) I have the crease angles.  All the 3D text is temporary for trouble shooting.  This is 3 faces from a dodecaheadron:

So now I have the remaining hurdle as to whether the proper crease angle is the GH angle or the GH reflex angle.

 

The funny thing with the "pesky tree" is the meaning of the pattern doesn't become apparent until it's more complicated than the simpler excerpt from above.

 

I think I could make the scripted component a little cleaner if I use some nested loops instead of your search and remove method, but that may take me a while.

 

But it all the fun comes from this guy:

Actually, I like your code a lot (now that I look at it again)...

 

If David gets the [Item Index] component to work, I think it would be much easier to do everything without scripting.

 

Thanks for your help!

Hi Taz,

 

Not sure if you missed this but there is a very simple VB script to take care of the Item Index work around.

http://www.grasshopper3d.com/forum/topics/problem-with-item-index?c... 

UPDATE:

 

So measuring the angle between vectors turns out to not be necessary.  As always, trigonometry is our friend.

 

The vectors are necessary to draw an arc, but constructing an arc is the same as measuring the angle since the arc subtends the angle.  And if the radius is a unit length, then the arc length is the angle (in radians).

 

Now my crease angle is always correlated with the surface normals (since a polysurface normal is used to construct the arc).

 

-taz

 

UPDATE 2:

 

Basic clip is good to go!  This can really be anything one's GH parametric heart desires, but I'm feeling unoriginal today.

 

Performance of the definition is really not so hot...  It gets bogged down rather easily. 

 

Prepping the panels is next on the list.

 

 

Can now do N clips per edge!  Fixed some glitches and performance is getting better.

 

Would be nice to implement individual edge offsets based on crease angle to compensate for material thickness (instead of a single global offset value).  We'll have to see about that...

 

On to labeling fun.  Yippie! 

hallo,taz

please tell me how can i find those neighborhood surface.

many thanks

 where can i find the gh file so i can learn dome thing out of it !!!

UPDATE 3:

 

Los Labels!

 

Thanks Taz !!

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service