Random reduce result analysis

hello everyone, I am trying to generate shapes by randomly reducing a number of squares from a grid of squares.
However, my goal is to get only the cases in which the remaining squares are all connected by at least one vertex. Attached is a more explanatory photo.

Also if anyone knows of a way to calculate the number of possible combinations with these constraints.

I ask for your help because I have been trying for weeks but can’t find solutions (I am a beginner).

Also attached is the GH file.
Thank you for your help
Random Shape.gh (21.7 KB)

I think you could join the srfs together, then just remove all the single srfs. I haven’t tested if the srfs that are diagonal to each other would join, which would then not work, but other than that seems like the simplest solution.

You can’t join surface with only one vertex in common.

This is something that’s difficult to do with vanilla Grasshopper - meaning without scripting -, since ideally you’d have to keep track of each cells live neighbours to know which ones can still be randomly removed.

I don’t think it’s all that difficult. Do brep join, then deconstruct brep and test if the length is greater than 1.

I think you can use the function to group by distance the centers of the faces

of course it works if you have squares of the same dimensions sino you have to find another way,

Find for example if the 4 points of the surfaces have points in common with the others.

Proof please. :wink:

I can think of a few ways to do this. If it doesn’t have to be absolutely perfect, then what I proposed above is a good enough solution. There’s also Jacques’ solution which seems to work. Then you could also find intersections between the polyline edges. I’m sure there’s more than just these. And these are all just with vanilla components.

1 Like



Random Shape.gh (17.1 KB)

2 Likes