Grasshopper

algorithmic modeling for Rhino

Hi,

I was extruding the curves for representing trees, so the height would be from abt 5000~10000, and I extruded them randomly by using 'random component'.

But it seems the heights are not random, and when i plug in a 'slider 1~10' to random values, the extra layer of the extrusion overlap in the original extrusion.

I'm wondering whether or not the extrude height is too much so the value in out of limit, Im a new user, happy to hear from you for any advice

THANKS!

Views: 9655

Attachments:

Replies to This Discussion

You should "map" always apples to apples (see flatten) - not to mention internalize your test data (if GH can memorize them, anyway, he he).

Added 2 options for fun (yellow groups)

Attachments:

Hi Wayne,

if you want each shape to have a different random height, you'll need to generate a different random number for each one. It's a bit trickier if all your shapes are distributed in separate lists as your screenshot seems to indicate. I attached two files, one that works on flat data and the other works on shapes that are stored in multiple lists.

Attachments:

Fantastic!!

now i get what 'lenth list' mean..!

but for the second one I still dont understand what are 'graft' 'flatten' 're..'..these sort of thing, probly because I just started, they seem to be related to the data list

so i'm not sure the reason why you flatten and graft in diff components. I tried to see to diff by randomly did these(like the attached), they look the same Hahaha.

Attachments:

A List is a collection of things "in order".

A Tree is a collection of Lists "in order" (it's NOT a List of List of ...). The nesting (or depth of "organization", so to speak) is controlled by what is called dimensions.

Graft means get a List and make a Tree (for each item) or get a Tree and make a Tree with a higher dimension (for each item in the Lists). Flatten means get a Tree and do a List (by respecting the "order" of things in the Lists within the Tree). Simplify means do a collection with the minimum dimensions required for maintaining things "in order".

All these mean that if you have N items in some sort of collection (List, Tree) you should provide N corresponding - in a "1:1" way - values (in this case the random height) : if you have 5 things in 3 Lists you should provide 5*3 values blah, blah.

Read more about the ways that GH manages collections of things.

Thanks Peter, this helps a lot!!  I kinda get these graft and flatten thing...gotta get familiar with gh logic!

The above is a List : The only thing that we need to find a given bottle is a conversion about where is bottle N1 (the 0 item in List speech) is and ... then the bottle_ID (the number aka the bottle index, that is): Object bottle = bottles[bottle_ID];

This however is a Tree: Several Lists around ... so we need additional information about where to find a bottle: say the rack number/index (= tree branch) and then the item number/index (= the bottle). This is a tree with one dimension: Object bottle = bottles(rack_ID)[bottle_ID]; Note: if it was, say, a matrix it would require 2 "dimensions" (row/column) in order to locate some bottle.

But what happens if we have several racks in several rooms in several floors in several buildings in several towns and ... finally in several planets?

This is when additional hierarchical "indexing" is required : the dimensions in a tree, that is: Object bottle = bottles (planet_ID, town_ID, building_ID, ... , blah blah)[bottle_ID];

woww, this is really clear and straightforward to me, thanks a lot! it makes much sense now!!  :)))

BTW: A topic of confusion for a novice is the Indexing (= "numbering") policy: is zero based meaning that the first bottle has index 0, not 1. Same for the first branch or sub-branch or sub-sub-sub-branch.

If in a given rack we have 5 bottles (meaning that bootles.Count = 5, the amount of items that is) ... the following "piece" of code loops though all indices in a List and is valid:

for(int i = 0; i<bottles.Count; i++) { drinkSomeWine(i,bottles,true);}

However the next one is invalid (because indices are from 0 to 4 thus index 5 points to Planet Zorg):

for(int i = 0; i<=bottles.Count; i++) { drinkSomeWine(i,bottles,true);}

If you google, say, "C# List" you'll get a lot of stuff (for coding) since List is one of the "core" ways to keep collections in order. If you replace List with DataTree you'll get nothing since DataTree is the internal GH (by David Rutten) way to manage ... er ... hmm ... these racks of bottles.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service