Controlled scattering of objects on a grid of points

Hi all,

Is it possible to scatter objects on a grid of points so that they don’t collide with each other while also maximizing the amount of objects scattered?

Let’s say, I have a hexagonal grid where each of it’s vertex is an anchor point and I have 3 types of geometry that I would like to fill the grid with so that there’s as few unoccupied grid vertices as possible. Every corner of an object has to sit on one of the grid vertices. The objects can be rotated around Z axis to fit.


Since I also want to control the amount of each type of geometry, my initial thinking was to setup a hierarchy and start with scattering the biggest type, then culling the list of points that it occupies and use remaining ones to scatter smaller ones. It’s not a scalable solution and I’m often left with gaps because certain vertices can be used by two or more objects as long as they don’t intersect with each other (I understand that touching is almost as same as intersecting).

I’ve also looked into scatter plugins but they all seem to lack the function of overlapping or manual control of each type of object. I know that such workflow has been long established in other major 3d modelling software so there must be away of applying those methods in grasshopper (I’m sure it’s doable with C# or python but my knowledge in those is pretty lackluster).

Any ideas?

Used the centerpoints of the grid to move and rotate the geometry ‘randomly’.

with the seed pattern you can pick another result.

You could create a set of randomized numbers for the rotations.
scatter.gh (26.3 KB)

1 Like

@ME_Mark thank you for your reply and solution.

I’ve also came up with a solution myself yet I used a different approach which in my opinion is a bit more flexible. What I didn’t specify in my original post that the types of geometries can be larger than the grid cells therefore every time an object is placed I need to check if it doesn’t overlap with already placed objects. That’s where anemone plugin came in handy as it allowed me to iteratively place objects on a grid while also checking for intersections.

I’ve scaled 1 type of geometry just to show what I meant by different sizes. Also, running a loop within a loop gives me different iterations filled up grids which is neat.

If anynone needs the script I could share it.

2 Likes

Yup I would like to see the script, see how I can add random rotation.

There you go. Let me know if you come up with something.

scatter_iterative.gh (18.8 KB)

1 Like