Skip to main content
2 of 4
Refined answer
quellenform
  • 39.6k
  • 10
  • 56
  • 149

"Ramp Sorting Technique"

...that's what I call this thing now.

enter image description here

How does this work?

This technique uses as basic mechanism the node Mesh Boolean (and likewise their disadvantages). This leads to less errors than the Circular Sorting Technique, but at extremely high density it is more computationally expensive and also not 100% error-free. Depending on the seed value, the error rate in my tests at 5000 points on 1m x 1m grid was ~0.0001%.

Roughly speaking, I extrude the points on an axis according to their value and create several slices with which I cut the enclosing shape.

Then, by separating a single edge from it and converting it into a curve, I get a line with continuous indexes that is subdivided in the intervals of the sort value.

enter image description here


Step by step to the solution

  1. First I use the node Attribute Statistics to determine the lowest and the highest value, which serves as input range for the node Map Range where these values are mapped to the range $0$ - $1$.

    enter image description here

  2. Then I reduce these points to the x-axis.

    enter image description here

  3. Next, I extrude the points along the Y-axis according to the value to be sorted.

    If I then also extrude the Z-axis, I get faces with which I split the convex hull of the slices.

    enter image description here

  4. If I then filter out the edge that runs along the X-axis and convert it into a curve, I get a curve that is divided in the distances of the points to be sorted and which has sorted indexes.

    enter image description here


Download the file and try it yourself

Important Notes: Since this technique is based on the node Mesh Boolean, but this merges vertices below a distance value, this technique may lead to unexpected results.

For normal densely distributed points it works great, but as soon as the vertices are very close to each other along the sort (or even identical), they are ignored.

Q & A

Q: It does not work at all with my mesh! Why?
A: Since this technique counts the points in the domain Points with the node Domain Size, and a mesh returns Vertices and is not a Point Cloud, you have two options:

  • Either you apply the node Mesh to Points before, which converts your mesh to points.
  • Or you switch the contained node Domain Size from Points to Mesh.
quellenform
  • 39.6k
  • 10
  • 56
  • 149