# Grasshopper Sort points along curve same input - different orders

Dear all,
I made a bunch of wires and come up to sort points along curve component. But the result is not my expectation so I internalized that part and copy it to a new file B (expect to seek for advice on 4rum but it’s different from A)
So I wonder why we have the same input (points and curve) and just copy-paste to another file but having different results?)
Thanks for your time checking this issue.

A.gh (24.5 KB)
B.gh (6.6 KB)

It’s strange, almost a bug.
Probably there is something underneath that just picks the “first found”.
You can replicate the problem just by copy-paste the point list parameter alone.

Anyway…

You have points that have congruent projection on the “guide curve”, that’s your problem!
How can the “Sort Along Curve” component be reliable?
Your points are aligned so they form an exact 90° angle with the guide curve, the order inside of each congruent pair will be, indeed, random. Or at leat, not reliable.

Find a better way to sort them, maybe use curve closest point and sort them by parameter+distance …

Is “B” correct?

1 Like

Thank you Riccardo, yes B is correct and I am not sure if there’s any way to sort these points along curve and the next point is the closest one?

A_re.gh (25.6 KB)

You can create a polyline with moved midpoints towards the center of your curve, doing this will let you avoid having those 90° segments/projections, and so the sorting will be correct.

Sorry Riccardo, I was dizzy after looking at many wires, this is actually what I expect. Thank you for your solution.

A_re2.gh (26.5 KB)

1 Like

Thank you Riccardo, Appreciate it.