Sort points by distance from Centroid

Hey everyone,
I’m trying to sort the vertices of a mesh by the distance each vertex has to the centroid of the mesh. My file upload crashed, but here’s a picture:vertices
Now I want to sort all numbers (around 9000, they range from 75 to 20) by their value, which is as you can see at index 19 messed up at the moment. I can’t deconstruct the points and use only one axis value because it’s a circular mesh. And I need to keep the indices (I think), because my final goal would be to split the newly ordered list into seperate branches that each contain one rounded value (f.e. 75, 70, 65…)

In short, I want to be able to pick one tree branch and have all vertices of one circle of the mesh selected. Do you know how I can manage this?

Thanks in advance!

sort list does the obvious: sort by distance. remember to plug in the values (your points) and use those further down the definition.

round rounds to integers. you can change the number of decimals rounded to inside the expression
round(x, 2) for example

create set creates a list of unique occurrences

member index is searching for those occurrences inside the original list

sort_by_distance.gh (9.1 KB)

It took me a while to understand it, but it’s perfect, thanks so much! I’ll have to take a look at the sets-components, since I’m not familiar with them right now, but they definitely seem worth looking into!