Jump to content
cur10us

Get random but connected points on a geometry

Recommended Posts

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

grid.png

Edited by cur10us

Share this post


Link to post
Share on other sites

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 ?

Screenshot_6.png

Share this post


Link to post
Share on other sites
///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);
}

 

Share this post


Link to post
Share on other sites

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;

image.png.b8e04d8fd3a6b6688274ff2d20200976.png

 

group_islands.hiplc

  • Like 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×