# Sort points

Hi.

I have two sets of points. The second one is the result of a number of operations, but the order gets wrong.
How do I give the original order back to the second set?

Thank you

POINT ORDER.gh (5.0 KB)

This is a way, maybe be the solution is more simple in your original script

POINT ORDER_r.gh (13.7 KB)

Another way

Brilliant!

Why do you use â€śOrientâ€ť component in both definitions? I want to understand

Thanks!!!

Check this as well.

POINT ORDER_re.gh (8.2 KB)

2 Likes

The first answer, allows me to reorder the areas of which the points are the centroids of. But it depends on â€śclosest pointsâ€ť, a feature that maybe not always is going to work, I think.
The second could not fail, but how do i extract the indexes to apply them to reorder the geometry?

Thanks

Orient i just to move points on top of original one than use sort or closest point

I donâ€™t understand your question, which geometry?

All the points are centroids of individual areas. So with the right order of the points I want to give the right order to that areas (The geometry). Now that you have explained to me the use of the component â€śorientâ€ť and its relation with â€śclosest pointsâ€ť i think it should never fail to give the right order when the same definition will be used to new sets of centroids.
thank you

Both of them work , but i think you donâ€™t need that in your original file

Thanks!
Iâ€™ve tried to understand your solution, but there are things I donâ€™t get:

• why do you transform the points to numbers and then sort the same points according to those numbers? Shouldnâ€™t be already sorted since the numbers came from the points?
• maybe Iâ€™m wrong, but it seems that both sets of resulting numbers are the same. How does the relation between both sets of points work?

Thanks again

Your two point sets are placed directionally in 2d space, so if you sort the point order according to the â€śYâ€ť direction for instance, you would be able to sort their order identically.

And then you can extract the original point order out of the first(correct order) by using the sorted points andMember Index.

I would re-examine the code that caused them to get out of sequence. How/why did that happen?

And why are these points so very far from the origin?

The difference in the sequence, I supposed, is because the original set is a tree with 15 items in 5 branches that operates with another tree with 10 branches and 13 items in total. So it gets messy.

The points are far from the origin because are referenced to coordinates in UTM - DATUM WGS 84. I just forgot to drag them to the origin.