Sort Points By Distance node doesn't work

Steps causing the bug to occur

  1. Use the Sort Points by Distance node with 2D Points

The attached composition creates a list of 10 random 2D Points and sorts them by distance to an additional random 2D Point. The list is processed and the distances calculated by a Measure Distance node (whose functionality I have verified) and the distances are printed to a console window. Sadly, they are not in order.

Have you found a workaround?

Learn how to implement sorting algorithms in Vuo.

Other notes

  • Vuo version: 1.2.5
  • macOS version: OS X 10.11
  • How severely does this bug affect you? It prevents me from completing a specific task with Vuo.

Here’s a sample output:

0.881216
0.396419
1.15159
1.02665
1.00162
0.880558
0.861636
1.05618
1.02434
1.07352

SortByDistanceBug.vuo (3.1 KB)

I got curious, so I looked a little more into this. I’ve attached a composition (and a video of said composition) demonstrating the (apparently more unusual than I expected) behaviour of the Sort Points by Distance node.

The composition generates a random reference point (orange) and a list of randomly generated points that gets run through the Sort Points by Distance node (blue).

The mouse’s position controls how many of the blue points you’ll see at once using a Cut List node. The horizontal position controls the Start Position (left is 1, right is the last list index) and the vertical position controls the Item Count (bottom is 1, top is list size).

The composition demonstrates that the Sort Points by Distance groups them into ring-shaped regions. You can experiment with different reference points by clicking the mouse. Adjusting the window regenerates all the points so they still fit inside window’s constraints.

Regions.vuo (9.52 KB)

One more demo…

Ack. Thank you for reporting this bug, @Pianomatic, and sorry it’s getting in your way. We’ll get it fixed.

@Pianomatic, we just published a Vuo 1.2.6 alpha release that includes a fix for this bug. Despite it being an alpha release, the changes are few and isolated enough that — other than the new nodes added in the release — I would consider it safe to use in production.

Fixed in 1.2.6.