cur10us Posted September 10, 2021 Share Posted September 10, 2021 (edited) Hey there! I'm totally new to here and Houdini. Trying to learn it by doing some practical tests. How can I get random points on a grid or any geometry? The condition is that they have to be connected. So, I would give it some number(or a range), it would create one "island" of points with that number. With some seed value I can change the pattern. (example below) Can anyone give me some pointers? Thanks a lot Edited September 10, 2021 by cur10us Quote Link to comment Share on other sites More sharing options...
Atom Posted September 11, 2021 Share Posted September 11, 2021 Well, they are all connected, right? You mean connected by a certain vertex count? You could select a bunch of random points, then throw away the ones that fail the neighbor vertex count test. https://www.sidefx.com/docs/houdini/vex/functions/neighbourcount.html Quote Link to comment Share on other sites More sharing options...
cur10us Posted September 11, 2021 Author Share Posted September 11, 2021 thanks for the reply. actually I meant something more like this. I want to get patterns like this on a geometry. can this be done with neighbourcount ? Quote Link to comment Share on other sites More sharing options...
Librarian Posted September 11, 2021 Share Posted September 11, 2021 ///1 points wrangle float r = rand(@ptnum * chf("randseed")); i@group_sources = r > 0.85; -------------------------------------- /////2 wrangle //group sources int nears[] = nearpoints(0, @P, chf("maxdist")); foreach (int pt; nears) { setpointgroup(0, "nears", pt, 1); } Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted September 11, 2021 Share Posted September 11, 2021 Hi @cur10us, I think I would mainly use the surfacedist() function. First group a few target points: rand(@elemnum, chi('seed')) < chf('chance') Add noise to a custom position attribute: v@pos = v@P + noise(v@P * freq); Then measure the distance over the noised position attribute: int pt_close = -1; float dist = surfacedist(0, 'target', 'pos', i@ptnum, pt_close, 'edge'); And apply random ranges for each island. float range = fit01(rand(pt_close), 0.2, 0.4); i@group_island = dist < range; group_islands.hiplc 1 Quote Link to comment Share on other sites More sharing options...
cur10us Posted September 11, 2021 Author Share Posted September 11, 2021 this is great. thanks guys! I'll check these out as I get the chance and come back If I have question. though, a quick one: is it possible to do this with vops? is one method more preferable over the other? to me this is more readable and faster to analyze. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.