Sort list of Vectors by X & Y

Is it possible to sort a list of Vectors by both X & Y? I have the following list of vectors (see image) and I want to re-sort them into sublists based on matching X AND Y values so that they are in this order:

List 1: index 1 & 6

List 2: index 2 & 3

List 3: index 4

List 4: idex 5

sort vector by both X & Y

GroupByKey

I tried that exact sequence of nodes before and it didn’t work… After further investigation, it appears that there is a difference between the output from the Wall.Orientation node (Clockwork package) and a custom list of vectors, even thought they contain identical values. Am I missing something? Is this a bug?

sort vector by both X & Y_2

There’s no bug, don’t always trust what you see :slight_smile:

GroupByKey

Sure enough Paolo, that was the solution… So the Wall.Orientation node was carrying fractions of a number beyond the 3 decimal places and had to be rounded? How did you figure that out, have you seen that before with certain nodes?

Thanks for your help!

To be honest it’s fairly common in coding to get rid of excessive decimals because you can end up with situations like yours, so the nodes are working just fine.

It’s safe to assume that after 3-5 decimals you can truncate the values, so instead of checking for equality between values A and B you can test if A-B<0.0005 and that is going to work smoothly in the majority of the cases.

In general anything beyond the 12th digit is not reliable… if you think of it in terms of length and you are using the metric system, so 1 is 1 meter (roughly 3 feet) when you are looking at the 10th digit you are measuring the distance between atoms :slight_smile: