# Sort point anomalies

Hi All,
I am trying to use the sort points component to rationalise a data set. It mostly seems to work However, there are a few anomalies and I cannot for the life of me work out what is causing them.
In the screenshot below, the first three columns are ordered correctly but point 55 is out of sequence. My understanding is it should sort by x first (which it does fine) and then sort by y but in this case the sort by why is not correct.

Can anyone tell me if I am doing something stupid?

sort points.gh (592.1 KB)

all looks good, youâre doing nothing stupid

but

donât know if this might be relevant at all, if your points proxected on XY Plane are compared to those of an âequal perfect gridâ, it looks like thereâs some distance between points that should be coincident

sort points_Re.gh (598.1 KB)

how was your point grid generated?

HI Inno,
Thanks for the reply, good spot!! I donât understand why that would impact the sort order. However, pinching your âperfect gridâ bit of code seemed to fix the issue .

Alex

well, that has a pretty straightforward explanation: letâs say the circled point at index 55 has a X value slightly bigger than all the other points that look like being on the very same column, then it means that point 55 does not belong to that column (sort by X, then sort by Y, then by Z)

we can test that, letâs take the X coordinate of point 55, compare it with X coordinate of point #42
if the difference is zero then they share the very same X coordinate, but if itâs âsomethingâ then they donât share the very same coordinate

in this case it looks like thereâs a super tiny difference in coordinate, so small that it doesnât get visualized in a panel

this means that the way the X/Y coordinates of the point grid might have gone thorough some troubles

another test, just for the sake of investigating the problem, if you trim the numeric values of the XYZ point-coordinates to just 3 decimals and sort them again, you will see the sorting looks perfect:

2 Likes