Data Matching Tree

Hi,

For confirmation and generalisation.
In this simple situation, the line component is matching points placed into 2 trees A and B.
A possesses the following branches:
{0;0;1}
{0;0;3}
B possesses the following branches:
{0;0;0}
{0;0;1}

The line component matches the first branch from tree A with the first branch from tree B. And the second branch from tree A with second branch from B regarless of the fact that the first branch of A has the same path as the second branch from B.

Can this be generalized ?
In other words, that matching at the branch level depends ONLY on the order in which the branches appears in the list of tree paths.

Thanks !
Jean

This is a great resource.

grasshopper primer

In other words, that matching at the branch level depends ONLY on the order in which the branches appears in the list of tree paths.

If the parameter accesses are not tree type, you can expect the branches to be related in order and not by path. It depends on the implementation, but I think the usual thing is not to worry about paths if the accesses are not of the tree type.

Just for clarification.
By that I understand that, if the components performing the matching are not of the type found in Set->Tree (or the merging of 2 outputs into a volatile parameter) then the path is ignored and it is the order in which the branches appears in the list of tree paths that determines the matching.

Thanks Dani !

This is correct. Data is matched item-by-item and branch-by-branch in order, unless this default behaviour is specifically overridden by the component. If you have a component operating on two inputs, both of which provide four branches (\{0;0\},\{0;1\},\{1;0\},\{1;1\}) and (\{0;0\},\{1;1\},\{2;2\},\{3;3\}) then they will be matched like so:

\{0;0\} \leftrightarrow \{0;0\}
\{0;1\} \leftrightarrow \{1;1\}
\{1;0\} \leftrightarrow \{2;2\}
\{1;1\} \leftrightarrow \{3;3\}

the fact that \{1;1\} occurs in both trees is irrelevant.

4 Likes

What are the thoughts in GH2 about this?
My biggest wish would be to choose between true path matching and simple matching.
I rely heavily on data trees, and each integer has a specific meaning (building ID, floor ID, beam ID). The data trees are there, and are one of the biggest strengths of grasshopper, but I wish the matching would require less work-arounds by simply matching branches with the same paths.

2 Likes

interesting

I’m having your same problem, using data tree to manage coordinates of the elements { floor ; position X on grid ; position Y on grid ; ecc.. }.
I’m using some component of the Treesloth plugin to match correctly the trees before certain operations


data tree matching.gh (9.5 KB)
It’s not in the package manager, only in foodforrhino, but has some very good components

This is a decent solution, but it’s very location specific. I would love GH2 to have this fundamentally different. In my opinion it should be default or at least a setting on component level that they can do a true path match.

{0} 20
{2} 30
+
{1} 40
{2} 50

Show be
{0} 20
{1} 40
{2} 30+50 = 80

(After discussions with @antoinemaes I’m not sure that the following is necessary. But a rigid direct path match as above is IMO the desired behaviour)
Equally
{0} 20
{2} 30
+
{2;0} 50
{2;1} 60
{3:0} 70
{3;1} 80

should be
{0} 20 (could argue {0;0} 20)
{2;0} 30 + 50
{2;1} 30 + 60
{3;0} 70
{3;1} 80

treesloth has components also for this kind of stuff

I recommend giving this plugin a try and experimenting with its components — I’m sure you’ll make even better use of it than I do