I'm trying to understand what the Sort Geometry Node's help [www.sidefx.com] intends when it states:
By attribute Uses the value of an attribute as a “key value” to sort by. For Vector3/Vector4 attributes, the node can only sort by a single component at a time. However, because the Sort SOP uses a stable sort, you can wire together multiple Sort nodes to sort by multiple components, or multiple attributes.
(the emphasis is mine)
Specifically I'd like to sort some points first according to a float attribute @a and then, when multiple points have the same @a value, according to a second float attribute @b.
How can this be done in line with what the help says?
thank you for your reply. What seems to be the obvious way for me to do it, in line with what you say, doesn't seem to work - see the simple attached scene.
What you will see is that the points can be (mentally) arranged by distance from the center, in four concentrical circles. What I am aiming for is for the point numbers in each circle to be consecutive AND radially sorted: i.e. the innermost circle should have points indexes from 0 to 11, increasing clockwise for example, the next circle from 12 to 23 also increasing clockwise, and so on.
1. as I said sort by “b” first then by “a” so in your case by angle first then by radius 2. only if your radius have same values it will keep the CW ordering for points with the same value with floats its deceiving as spreadsheet is rounding the values so they may seem the same, but it's minimal chance they actually are so you need to round them to make sure
A-ha! I had tried changing the order of the sort nodes, but what got me is what you mention in point 2: the points -look- to be at the same distance from the center, but due to unseen differences they aren't and that was fooling the radius sort.
Once I understood the problem I fixed the polar radius attribute with floor() rather than the rint() you used, like so: