Grasshopper

algorithmic modeling for Rhino

Cross Reference; what is it, how does it work, why would I need it?

As of Grasshopper 0.9 components no longer offer a Cross Reference option in their pop-up menus. This feature was removed because I felt it was not flexible enough. Now, you can achieve Cross Reference matching with a dedicated component which creates combinations of items. You can find the [Cross Reference] component in the Sets.List panel.

When Grasshopper iterates over lists of items, it will match the first item in list A with the first item in list B. Then the second item in list A with the second item in list B and so on and so forth. Sometimes however you want all items in list A to combine with all items in list B, the [Cross Reference] component allows you to do this.

Here we have two input lists {A,B,C} and {X,Y,Z}. Normally Grasshopper would iterate over these lists and only consider the combinations {A,X}, {B,Y} and {C,Z}. There are however six more combinations that are not typically considered, to wit: {A,Y}, {A,Z}, {B,X}, {B,Z}, {C,X} and {C,Y}. As you can see the output of the [Cross Reference] component is such that all nine permutations are indeed present.

We can denote the behaviour of data cross referencing using a table. The rows represent the first list of items, the columns the second. If we create all possible permutations, the table will have a dot in every single cell, as every cell represents a unique combination of two source list indices:

Sometimes however you don't want all possible permutations. Sometimes you wish to exclude certain areas because they would result in meaningless or invalid computations. A common exclusion principle is to ignore all cells that are on the diagonal of the table. The image above shows a 'holistic' matching, whereas the 'diagonal' option (available from the [Cross Reference] component menu) has gaps for {0,0}, {1,1}, {2,2} and {3,3}:

If we apply this to our {A,B,C}, {X,Y,Z} example, we should expect to not see the combinations for {A,X}, {B,Y} and {C,Z}:

The rule that is applied to 'diagonal' matching is: "Skip all permutations where all items have the same list index". 'Coincident' matching is the same as 'diagonal' matching in the case of two input lists which is why I won't show an example of it here (since we are only dealing with 2-list examples), but the rule is subtly different: "Skip all permutations where any two items have the same list index".

The four remaining matching algorithms are all variations on the same theme. 'Lower triangle' matching applies the rule: "Skip all permutations where the index of an item is less than the index of the item in the next list", resulting in an empty triangle but with items on the diagonal.

'Lower triangle (strict)' matching goes one step further and also eliminates the items on the diagonal:

'Upper Triangle' and 'Upper Triangle (strict)' are mirror images of the previous two algorithms, resulting in empty triangles on the other side of the diagonal line:

Views: 42896

Replies to This Discussion

Thank you David!

Good thing there is this reference. I doubt I would have understood it on my own.

thanks

This is really helpful David.

I'm not sure if it's out there already or am I asking too much, but a documentation package of all grasshopper component like this it's gonna be like an amazing Easter present:)

We've started working on a better help system. It'll be a very long term project and I'm not sure when the first topics will become available. Possibly not before we get to GH 2.0 Beta.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks David,

It feels as nice knowing it's underway.

Hi,

in this moment I can't understand the table.

I have two list A and B both with 3 item, so I have 9 combinations. why the table has 4 column and not 3?

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service