Could someone help to sort a bunch of curves procedurally?

   343   4   3
User Avatar
Member
19 posts
Joined: Nov. 2019
Offline
hi all! I have 12 curves that rise up the Y axis and fan out over x and z. Some of their point orders are reversed. Ideally I would like the highest point number to be at the end of the curve, away from the origin. I can do this using the sort node on individual curves, but I cant figure out how to do it procedurally on the whole bunch. I want to avoid having to re-select the reversed curves if I need to change the curves further up my graph.

Over to you guys! All help appreciated!

Dave

Attachments:
BunchofCurves.png (363.4 KB)

User Avatar
Member
2126 posts
Joined: Sept. 2015
Offline
You could create an attribute based on the points UV on its' prim with the vex function xyzdist()....and use that attribute in a sort SOP.
User Avatar
Member
17 posts
Joined: July 2018
Online
1.create a root group using a bounding sphere 2.add distance along geo node to calculate @dist from the root group 3.Then use for each loop and a sort node to sort by @dist
User Avatar
Member
8777 posts
Joined: July 2007
Offline
1. Primitive Wrangle:
int pts[] = primpoints( 0, @primnum );
vector P0 = point( 0, "P", pts[0] );
vector P1 = point( 0, "P", pts[1] );

i@group_reverse = length(P1) < length(P0);

2. Reverse SOP - Source Group: reverse

3. Sort SOP - Point Sort: By Vertex Order
Edited by tamte - Nov. 14, 2024 14:58:05
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
19 posts
Joined: Nov. 2019
Offline
This is great thank you all for taking the time to reply. I'll try to implement this later today.

Thank you!
  • Quick Links