Hi,
I have s random primids of an object and I want to sort my prims ids based on connectivity/distance from a starting prim.
I want to sort prims like below:
My current setup:
I started with this vex code:
i@prims_nb = polyneighbours(0, 0);
for (int i =0;len(@prims_nb)>i;i++){
if (@primnum == @prims_nb && i@done !=1) {
i@done = 1;
i@primid = i+1;
}
}
/////
for (int i =0;len(i@prims_nb)>i;i++){
i@prims_nb2 = polyneighbours(0, @prims_nb);
if (@primnum == @prims_nb2 && i@done !=1) {
i@done = 1;
int prvprimd = prim(0,"primid",@prims_nb);
i@primid = prvprimd+i+1;
}
}
Thanks
Sort Prims by Connectivity/Distance
898 2 2- seeplus
- Member
- 33 posts
- Joined: Nov. 2019
- Offline
- animatrix_
- Member
- 4495 posts
- Joined: Feb. 2012
- Offline
Hi,
You can easily do this using Group Expand SOP -> Flood Fill and Step Attribute turned on and then use this step attribute in Sort SOP -> By Attribute (step).
You can easily do this using Group Expand SOP -> Flood Fill and Step Attribute turned on and then use this step attribute in Sort SOP -> By Attribute (step).
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
- seeplus
- Member
- 33 posts
- Joined: Nov. 2019
- Offline
-
- Quick Links