The function of flatten,puzzled

I have trouble understanding the function of "flatten“ and how to make use of it.

The example is the file from grasshopper primer to make a color wheel.The result between flatten and no flatten are terribly different.And I cannot understand why.
By the way,I’m not a native English speaker,so forgive my poor English please.(lol)

Google Translate can be helpful.

Flatten isn’t a function you want to use, sometimes you have to. Or rather, sometimes it’s good enough. It’s a somewhat dangerous operation since it destroys data layout information and it can be difficult or even impossible to recreate it.

Flatten is named after the photoshop layer flatten command where an image consisting of several layers is “flattened” into a single layer. The analogy isn’t great though, so don’t rely on it too heavily for understanding.

In Grasshopper, when you flatten a data tree, you take all the values in it and put them all into a single list. For example a tree with three branches containing a total of ten items might look like this:


When flattened, that becomes:


Thank you for your answer.

But the exact problem is that,despite I know how the exact ‘flatten’ works,I cannot understand its necessity.For example,when I’m trying to create a color wheel in GH, I’m supposed to draw colors to the surfaces I created from another component. (just as the image I gave before).

But if the surfaces were not flatten,like {0}(untrimmed surface),{1}(untrimmed surface)…I
t will only be drawn with the same color.
Only when they are ‘flatten’ to {0}(untrimmed surface,untrimmed surface,untrimmed surface…) can these components work as I wished.

It’s difficult to say what a specific function is for. The more basic the function, the harder it becomes. What is addition for? Or curve offset?

I mostly use flattening when my data has excessive structure. Like the points that makeup a grid. They’re organised in rows and columns, but sometimes I really don’t care about that, it’s good enough if all points are just dumped into a single heap.

However for more complex files, flatten is often too brutal a tool, and I prefer to use the path mapper to only partially flatten data.