Randomly Group 50% Of All Edges [Solved]

   2378   4   1
User Avatar
Member
78 posts
Joined: June 2019
Offline
Hello,

How can I randomly select a bunch of edges?

I've seen a few scripts that can easily randomly select points or primitives, but nothing for edges.

I thought I might start with a group by expression, but that won't allow me to select edges as a starting point.

Maybe something more along the lines of first starting with a full selection group of edges, then using that group, deselect a certain percentage?

Extra credit if I can create a slider to select a percentage of edges!

File attached as a starting point, but there really isn't anything there I've been able to achieve
Edited by GlennimusPrime - May 11, 2020 22:02:05

Attachments:
Random_Edge_Select.hipnc (136.6 KB)

User Avatar
Member
555 posts
Joined: Feb. 2017
Offline
sooooooooooooooooooooooo close !!!

if only someone can deliver the Fatality move:

- Remove new points, WITHOUT destroying the edge selection.

C'mon…some VEX guru can do it.

Aside: you'd think selecting new points is damn easy…just get ones with 2 neighbours…but it doesn't work…WTF??? ie. it says the corner points have 2 neighbours !!! HUH ???
Edited by vusta - March 26, 2020 02:52:44

Attachments:
vu_Random_Edge_Select.hipnc (161.7 KB)

User Avatar
Member
8513 posts
Joined: July 2007
Offline
int seed = chi("seed");
float chance = chf("chance");
string grp = chs("out_group");
int hstart = primhedge(0, @primnum);
int h = hstart;
do {
    int isprimary = hedge_isprimary(0, h);
    if (isprimary) {
        int select = rand(h, seed) < chance;
        if (select) setedgegroup(0, grp, hedge_srcpoint(0, h), hedge_dstpoint(0, h), 1) ;
    }
    h = hedge_next(0, h);    
} while (h != hstart && h != -1);

Attachments:
Random_Edge_Select_fix.hipnc (160.6 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
78 posts
Joined: June 2019
Offline
Tamte you legend!

Everything I asked for and more

Big ups for helping me out so much over the past week, you've saved me 3 times now haha.

Many thanks!
User Avatar
Member
77 posts
Joined: Feb. 2017
Offline
I think use prim vertex list or rand select from edge group are also feasible.
but may use more code than tamte's
Edited by zengchen - March 26, 2020 06:07:33
My Youtube Channel [www.youtube.com]
  • Quick Links