Grasshopper

algorithmic modeling for Rhino

I would really love to understand, how exactly this tool works in GH.

 

So you have your source mask, where you write the original tree structure and you have the target mask, where you write the target tree structure.

 

Now let's say, wen have this original tree structure:

{0;0}

0 A

1 B

{0;1}

0 C

1 D

{0;2}

0 E

1 F

{0;3}

0 G

1 H

{0; just joking :D} ... so we have 4 paths and in each of them there is a list with whatever any two objects ... So the source mask should be {0;x}(y), where x = 0,1,2,3?! or is x = 3?! and y = 0,1 or is y=1 ... what's "static", what's "dynamic"? ... How to understand what?! ...

 

So let's say I want to get a tree, that looks that way:

{0;1}

0 A

1 B

2 C

3 D

{0;2}

0 E

1 F

2 G

3 H

 

What do I have to understand here? ... Thank you for the help and support in advance ...

Views: 1101

Replies to This Discussion

To do the following you will need to understand what integer divide "\" does

This is what the path mapper does with the following Mask:

Note you don't need to have a place holder for the index (i) unless you use it in the mapping

{A;B} --> {A;(B\2)+1}

--------------------------

{0;0}(0) --> {0;(0\2)+1}(0) = {0;1}(0)

{0;0}(1) --> {0;(0\2)+1}(1) = {0;1}(1)

{0;1}(0) --> {0;(1\2)+1}(0) = {0;1}(2)

{0;1}(1) --> {0;(1\2)+1}(1) = {0;1}(3)

{0;2}(0) --> {0;(2\2)+1}(0) = {0;2}(0)

{0;2}(1) --> {0;(2\2)+1}(1) = {0;2}(1)

{0;3}(0) --> {0;(3\2)+1}(0) = {0;2}(2)

{0;3}(1) --> {0;(3\2)+1}(1) = {0;2}(3)

Thank you Danny. 

What is mapping? ... Well then, bugger the index (i)

I searched about integer division and came up with: floor(a/b) and a/b represents a normal division. Floor(x) is the largest integer, that is smaller than or equals to x.

floor(0/2) = floor(0) = 0

floor(1/2) = floor(0,5) = 0

floor(2/2) = floor(1) = 1

floor(3/2) = floor(1,5) = 1

ahhhhh ... so if you make a path {0;k} out of paths {0;i}, {0;j}, ... the index will be sorted automatically 0,1,2,... hmmmm ...

Is that "it" about path mapper? ... What other typicall functions are used for this tool? ... Thank you man!

EDIT:

Ahhh ... Unless I use (i) in the mapping (This is the Mapping: {A;(B\2)+1})  I will not need this index (i) at all ... Got it man ... 

The BIG question is:

Is this "Integer division" the one and only operation, that a path mapper does?!

What is Mapping?

Noun: An operation that associates each element of a given set (the domain) with one or more elements of a second set (the range).

The component is called [Path Mapper] because it "maps" a given mask to a target mask.

That is what Integer division is... Do you understand the term "Floor"?

so if you make a path {0;k} out of paths {0;i}, {0;j}, ... the index will be sorted automatically 0,1,2

NO.

The paths are different {0;i} and {0;j} are not on the same branch, unless i=j)

The Path Mapper is only intended to map paths hence the name. It gives a level of customization for manipulating Data Trees that wasn't available to the same extent as the current range of components. It sort of "old school" and is limited in what you can do with it for instance there is no dynamic aspect to it. It will not react to the change in input, you have to manually tweak it if the data paths change.

But it is still very powerful, and is an excellent way to learn about data trees 

Is this "Integer division" the one and only operation, that a path mapper does?!

No. it can use any maths operators and even Boolean arguments

For example Modulo "%"

would give a different set of results.

{A;B} --> {A;(B%2)+1}

--------------------------

{0;0}(0) --> {0;(0%2)+1}(0) = {0;1}(0)

{0;0}(1) --> {0;(0%2)+1}(1) = {0;1}(1)

{0;1}(0) --> {0;(1%2)+1}(0) = {0;2}(0)

{0;1}(1) --> {0;(1%2)+1}(1) = {0;2}(1)

{0;2}(0) --> {0;(2%2)+1}(0) = {0;1}(2)

{0;2}(1) --> {0;(2%2)+1}(1) = {0;1}(3)

{0;3}(0) --> {0;(3%2)+1}(0) = {0;2}(2)

{0;3}(1) --> {0;(3%2)+1}(1) = {0;2}(3)

Or you could use an IF statement.

{A;B}-->{A;If(B<3,0,3}

---------------------------------

{0;0}(0) --> {0;TRUE(0)}(0) = {0;0}(0)

{0;0}(1) --> {0;TRUE(0)}(1) = {0;0}(1)

{0;1}(0) --> {0;TRUE(0)}(0) = {0;0}(2)

{0;1}(1) --> {0;TRUE(0)}(1) = {0;0}(3)

{0;2}(0) --> {0;TRUE(0)}(0) = {0;0}(4)

{0;2}(1) --> {0;TRUE(0)}(1) = {0;0}(5)

{0;3}(0) --> {0;FALSE(3)}(0) = {0;3}(0)

{0;3}(1) --> {0;FALSE(3)}(1) = {0;3}(1)

I do understand floor, modulo and the conditional statement ...

And now I understand, how to change the numbers in {A;B}, but I am still trying to figure out, how the index (i) changes ... I still can't figure that out ...

Thank you again man ...

EDIT:

so if you make a path {0;k} out of paths {0;i}, {0;j}, ... the index will be sorted automatically 0,1,2

NO.

Why then not? How does the index change then?! ...

EDIT:

INDEX:

Placeholders are a Unique Identifier for a particular part of the Path.

The most typically used are {A;B;C;D;E;F;....} and (i) for the index

But you can have

{x;y;z}(a) it doesn't matter provided they are not Numbers and Provided they are not repeated.

So {A;x;w} is just as valid.

In your question you had {0;i} and {0;j} in this case if i = 1 and j = 2 the the branches {0;1} and {0;2} are not the same.

I think you probably meant {0;0}(i) and {0;0}(j)

Have a look at the next example In one I don't specify (i) inthe target and the other I do

{A;B;C}(i) --> {0,0,0}: put all objects on the trunk ... like flatten ...

{A;B;C}(i) --> {0;0;0}(i): what the heck?!

what does path mapper do in the second example?

why 9? why not 0,1,2,... or 8?! ...  

{A;B;C}(i) --> {0;0;0}

-------------------------------

{0;0;0}(0) --> {0;0;0} add to the heap 0

{0;0;1}(0) --> {0;0;0} add to the heap 1

{0;0;2}(0) --> {0;0;0} add to the heap 2

{0;0;3}(0) --> {0;0;0} add to the heap 3

{0;0;4}(0) --> {0;0;0} add to the heap 4

{0;0;5}(0) --> {0;0;0} add to the heap 5

{0;0;6}(0) --> {0;0;0} add to the heap 6

{0;0;7}(0) --> {0;0;0} add to the heap 7

{0;0;8}(0) --> {0;0;0} add to the heap 8

{0;0;9}(0) --> {0;0;0} add to the heap 9

{A;B;C}(i) --> {0;0;0}(i)

-------------------------------

{0;0;0}(0) --> {0;0;0}(0) contains 0

{0;0;1}(0) --> {0;0;0}(0) now contains 1

{0;0;2}(0) --> {0;0;0}(0) now contains 2

{0;0;3}(0) --> {0;0;0}(0) now contains 3

{0;0;4}(0) --> {0;0;0}(0) now contains 4

{0;0;5}(0) --> {0;0;0}(0) now contains 5

{0;0;6}(0) --> {0;0;0}(0) now contains 6

{0;0;7}(0) --> {0;0;0}(0) now contains 7

{0;0;8}(0) --> {0;0;0}(0) now contains 8

{0;0;9}(0) --> {0;0;0}(0) now contains 9

It must be right, if you say so :)

Now let's say the dara structure is messed up like:

{0;0;0;0;0;1;0}

{0;0;3}

{0;1;0;2;0}

and so on ...

how do you give this in the source mask?!

If you have branches with different lengths, you have to supply a number of different mappings:

However, data like this is pretty rare and most likely indicates some problem with the logic that generates this data. It may be worth looking into why you're getting such a messy datatree rather than trying to fix it after the damage has been done.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

you are right!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service