I’m trying to populate a surface with random points whereby I am able to control number of points. I then want to set an attractor point that remaps the points so that the density of points is reduced as you move away from the attractor, and for this to be controllable density range. I don’t want to do this by culling because the number of points is important. I also think that, though the range of density would be controllable, the distribution would site on an adjustable gradient/curve. Any suggestions?

Have you tried using Point Fields at your attractor points?

If you calculate the field strength at your random points you can then move them towards or away from the attractor points.

Hi Martyn, thanks for your response. I’m not familiar with this command, could you please elaborate on how to set it up? Thanks!

Here’s an example on just a planar surface. You should be able to replace the planar surface for your surface.

It’s not bad but there might be a better way of doing this with Kangaroo.

Perhaps if you must have a fixed number (N) of points you could first have (N+x) points and then cull x points?

POINT_DENSITY.gh (16.1 KB)

You didn’t say if your surface is flat or curved? I started with @martynjhogg’s code *(thank you)* so this works with multiple attractor points or just one. The ‘Effect’ slider *(blue group)* and `Graph Mapper` combine to determine parametric movement of the random points toward the attractor(s).

points_density_2021Apr15a.gh (21.6 KB)

I have this thought in my mind, just wondering…

for having this on a 3d surface would it work if the point field (that determines the direction of the attraction vectors) were replaced by geodesics, and the vector lengths were replaced by evaluate curve (normalized 0-to-1) along the geodesic curves themselves?

I don’t know what you mean by “geodesics” but this works on a curved surface using `CrvSrf` *(Curve On Surface)* and `Evaluate Curve`, refactored from flat version:

points_density_2021Apr15b.gh (55.9 KB)

Hi all, thank you for so much for your suggestions and examples - This is very close to what I’m trying to achieve. I’m using this script to arrange physical objects, so what I am now trying to figure out now is how to cap the point density once it has hit - say - 0.5 sqm point density (so that the objects don’t collide). I’ll be playing around to see if I can set this up!

I did also try using Kangaroo SphereCollide, which you can set a radius, to pull the points together but stop them touching. I didn’t have much luck but it would be interesting if @DanielPiker can see a way that Kangaroo could be used here.

In my definition I used a simple expression to limit how far the points can move but it doesn’t keep them separated.

@Joseph_Oster 's solution looks good and you can see there are many different ways to approach this on flat and curved surfaces.

Are you using a flat or curved surface?

Here is another method with almost identical results but is more accurate on curved surfaces? It doesn’t use `Pull Point` and the linear distance between points and attractors. It relies instead on the lengths of `CrvSrf` *(Curve On Surface)*.

points_density_2021Apr17a.gh (56.1 KB)

You are all amazing, thank you so much! @martynjhogg script is intended to be used for both flat and curved/irregular surfaces, so I’m thrilled it works for both.