Newbie understanding flatten and grafted data

I am a newbie when it comes to understanding data structures. Well, I made five curves, and divided them as seen in the screenshot. The interpolate curve works if I flatten the data of the points and doesn’t work if the data is not flattened. Why is it so ?

I don’t understand the phenomenon that I am supplying the point data only to the interpolate curve component. Now whehter branched or not, the data remains the same i.e. the X,Y and Z co-ordinate identification of the points. Why is that the data HAS TO BE flattened in order to get the resultant curve joining the point on every curve?

https://www.modelab.is/grasshopper-primer

See the section on lists and data trees.

1 Like

Because the interpolate component operates on lists of points. If you provide more than one list, then the component will run several times and output several curves. However each list must contain at least two points, otherwise the interpolation cannot work.

When you use list item, your output just happens to be several lists, each containing a single value. You need all these values to co-exist within the same list. Flatten does this, but it’s a heavy handed approach. You may need a subtler kind of tree modification at some point.

2 Likes

Okay! Now I understand. Moreover, why is it a heavy handed approach? And what is a more subtle way to do this instead of flattening?

It’s heavy handed because it throws away all tree structuring and puts everything into a single list. You may at some points want to only partially ‘flatten’ data. For example turn a tree containing 100 lists of one item each into a tree containing 5 lists of 20 items. For this you’re going to need a more subtle method, such as the Path Mapper or Path Replace or, … well about a dozen others.

2 Likes