"Ramp Sorting Technique"
...that's what I call this thing now.
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.
Step by step to the solution
First I use the node
Attribute Statistics
to determine the lowest and the highest value, which serves as input range for the nodeMap Range
where these values are mapped to the range $0$ - $1$.Then I reduce these points to the x-axis.
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.
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.
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.