The new NodeBox forum is live! Everything from support.nodebox.net moved here: sign in with the same email to pick up your old posts. Something not working? Write to forum-support@nodebox.net.

Show your WorkFrom the old forum

Order Left to Right Top to Bottom

No replies yet

  1. It is sometimes necessary to sort a set of points into a predictable LRTB (Left to Right, Top to Bottom) order.

    The first time I had to do this I thought it was too unusual to merit inclusion in my Node Library. The second time I thought it was still more of a fluke than a regular thing. But the third time I finally decided to make an official Library Node.

    order_LRTB takes a list of points and returns those same points in Left to Right, Top to Bottom order.

    You would think you could do this by simply using a sort points node by X and a second one by Y, but the Y sort does not preserve the previous order for points with the same Y value.

    The attached demo and screenshot show this. I take a 16-sided polygon - which creates points in clockwise order - and feed those points first into a X and Y sort, then into the order_LRTB node. I then divide the points into pairs and draw an arrow from the first point to the second. The X and Y points come out in Y order, but not consistently in an X order for each pair. The order_LRTB node sorts them correctly.

    Not a big deal. But handy every now and then. Included in the next rev of my library COMING SOON!

    John

    Copy link

Know something that helps?

Sign in with your email address to reply. No password needed.

Sign in to reply