Skip to main content
Reducing the haystack
Source Link
Markus von Broady
  • 42.6k
  • 3
  • 37
  • 107

Sort by two criteria: x and index, in that order, so if there's two points on the same X, the index controls order. Indices are unique so such 2 criteria are enough.

Quadratic Sort (Pre B3.4)

$O(n^2)$ - for each vert, entire geometry This is duplicated. I don't know how it compares to convex hull algorithm, which I'd consider a hacky solution - you're relying on undocumented implementation details - still, quite awesome, so keep it coming!

(left Transfer Attribute could be replaced with Field at Index node)

Accumulate Field counts for each vertex how many other vertices are either before it on X, or exactly on the same X but have lower index. That's the numberone of verticesoutdated answers that should have lower indices, and sowould unnecessarily bury (in 0-based indexingcurrently) it's the desired index ofobjectively the currently evaluated vertexbest - which is saved as ID:

For clarity, this is how you would useanswer by quellenform. You can still access this data to repositionanswer by reading the vertices:

previous revision.

Sort by two criteria: x and index, in that order, so if there's two points on the same X, the index controls order. Indices are unique so such 2 criteria are enough.

$O(n^2)$ - for each vert, entire geometry is duplicated. I don't know how it compares to convex hull algorithm, which I'd consider a hacky solution - you're relying on undocumented implementation details - still, quite awesome, so keep it coming!

(left Transfer Attribute could be replaced with Field at Index node)

Accumulate Field counts for each vertex how many other vertices are either before it on X, or exactly on the same X but have lower index. That's the number of vertices that should have lower indices, and so (in 0-based indexing) it's the desired index of the currently evaluated vertex - which is saved as ID:

For clarity, this is how you would use this data to reposition the vertices:

Quadratic Sort (Pre B3.4)

This is one of outdated answers that would unnecessarily bury (currently) objectively the best answer by quellenform. You can still access this answer by reading the previous revision.

Bounty Ended with 200 reputation awarded by quellenform
repositioning
Source Link
Markus von Broady
  • 42.6k
  • 3
  • 37
  • 107

Sort by two criteria: x and index, in that order, so if there's two points on the same X, the index controls order. Indices are unique so such 2 criteria are enough.

$O(n^2)$ - for each vert, entire geometry is duplicated. I don't know how it compares to convex hull algorithm, which I'd consider a hacky solution - you're relying on undocumented implementation details - still, quite awesome, so keep it coming!

(left Transfer Attribute could be replaced with Field at Index node)

Accumulate Field counts for each vertex how many other vertices are either before it on X, or exactly on the same X but have lower index. That's the number of vertices that should have lower indices, and so (in 0-based indexing) it's the desired index of the currently evaluated vertex - which is saved as ID:

For clarity, this is how you would use this data to reposition the vertices:

Sort by two criteria: x and index, in that order, so if there's two points on the same X, the index controls order. Indices are unique so such 2 criteria are enough.

$O(n^2)$ - for each vert, entire geometry is duplicated. I don't know how it compares to convex hull algorithm, which I'd consider a hacky solution - you're relying on undocumented implementation details - still, quite awesome, so keep it coming!

(left Transfer Attribute could be replaced with Field at Index node)

Accumulate Field counts for each vertex how many other vertices are either before it on X, or exactly on the same X but have lower index. That's the number of vertices that should have lower indices, and so (in 0-based indexing) it's the desired index of the currently evaluated vertex - which is saved as ID:

Sort by two criteria: x and index, in that order, so if there's two points on the same X, the index controls order. Indices are unique so such 2 criteria are enough.

$O(n^2)$ - for each vert, entire geometry is duplicated. I don't know how it compares to convex hull algorithm, which I'd consider a hacky solution - you're relying on undocumented implementation details - still, quite awesome, so keep it coming!

(left Transfer Attribute could be replaced with Field at Index node)

Accumulate Field counts for each vertex how many other vertices are either before it on X, or exactly on the same X but have lower index. That's the number of vertices that should have lower indices, and so (in 0-based indexing) it's the desired index of the currently evaluated vertex - which is saved as ID:

For clarity, this is how you would use this data to reposition the vertices:

added 67 characters in body
Source Link
Markus von Broady
  • 42.6k
  • 3
  • 37
  • 107

Sort by two criteria: x and index, in that order, so if there's two points on the same X, the index controls order. Indices are unique so such 2 criteria are enough.

$O(n^2)$ - for each vert, entire geometry is duplicated. I don't know how it compares to convex hull algorithm, which I'd consider quite a hacky solution - you're relying on undocumented implementation details - still, quite awesome, so keep it coming!

(left Transfer Attribute could be replaced with Field at Index node)

Accumulate Field counts for each vertex how many other vertices are either before it on X, or exactly on the same X but have lower index. That's the number of vertices that should have lower verticesindices, and so (in 0-based indexing) it's the desired index of the currently evaluated vertex - which is saved as ID:

Sort by two criteria: x and index, in that order, so if there's two points on the same X, the index controls order. Indices are unique so such 2 criteria are enough.

$O(n^2)$ - for each vert, entire geometry is duplicated. I don't know how it compares to convex hull algorithm, which I'd consider quite a hacky solution - you're relying on undocumented implementation details - still, quite awesome, so keep it coming!

Accumulate Field counts for each vertex how many other vertices are either before it on X, or exactly on the same X but have lower index. That's the number of vertices that should have lower vertices, and so (in 0-based indexing) it's the desired index of the currently evaluated vertex - which is saved as ID:

Sort by two criteria: x and index, in that order, so if there's two points on the same X, the index controls order. Indices are unique so such 2 criteria are enough.

$O(n^2)$ - for each vert, entire geometry is duplicated. I don't know how it compares to convex hull algorithm, which I'd consider a hacky solution - you're relying on undocumented implementation details - still, quite awesome, so keep it coming!

(left Transfer Attribute could be replaced with Field at Index node)

Accumulate Field counts for each vertex how many other vertices are either before it on X, or exactly on the same X but have lower index. That's the number of vertices that should have lower indices, and so (in 0-based indexing) it's the desired index of the currently evaluated vertex - which is saved as ID:

Source Link
Markus von Broady
  • 42.6k
  • 3
  • 37
  • 107
Loading