Subdivide given area into randomly sized blocks with no gaps

I have been struggling with this logic for a little while now, I am trying to create a definition to produce surfaces similar to the image attached. I have a feeling I might be approaching it from the wrong angle so would like to get another perspective if possible?

RandomMeshDivide.gh (16.5 KB)

Have you looked at the Substrate component? ‘Mesh | Triangulation’ tab:

I’m aware of it yep, however i’m not so much trying to achieve a particular goal, more as using this as a learning exercise, and substrate seems a bit of a cheat! I am aware that this problem is more complex than i originally thought though. So t’m not looking for a solution as such. But more of advice to point me in the right direction.

It is quite a complicated problem. It will either require some clever custom looping or recursion, and those kinds of algorithms are always hard to replicate using GH.

Visit these topics in the old GH forum and see if they are of some help…



Apologies I should have been able to find these topics myself! Thanks, I will study these.

2 Likes

And this one (with gaps) quite recently ,but reuse old ones.

I finished a script I began some days ago. The idea is quite simple, take a grid with X pixels in width, Y in height try to put random rectangle with given size if not possible try less big rectangle. It gives that. The output is rectangles between in UV space (between 0 to 1). So this could be used for surface or whatever.
If output Count less than nx*ny augment tries.




grid_subdivision_LEGACY.gh (24.0 KB)

Playing withe the nice render with some smoothing.


17 Likes

Hello Laurent!

How did you achieve these nice smoothed corners?

Wow that is incredibly interesting. I’ve been meaning to make a move to c# and this is a fascinating case study. Thanks so much for in input!

See there I put the sript

It is classical Catmull Clark subdivision

Made this once to complete Colombo, Sri Lanka, where OSM had no data (green=OSM, red=script)
Rectangles were rotated to the nearest street, scaled, random reduced and culled if the proportions are over 4x1.

Following a part of the script. It requires Anemone.

uneven subd.gh (16.9 KB)

10 Likes

Such an elegant solution! and beautiful results too.

There’s also this old thread that might be relevant:

2 Likes

Here a version with tileable subdivision. The same logic as previous, I add some mesh output so could be used to make a single mesh or a big tile.



grid_subdivision_LEGACY.gh (38.7 KB)

Continuing to play with the subdivision script and mesh output, here on a torus.

19 Likes

Hey Laurent,t thanks for sharing this that script looks amazing, but when I load it I get the following error message:

  1. Error (CS1061): ‘Rhino.Geometry.Mesh’ does not contain a definition for ‘RebuildNormals’ and no extension method ‘RebuildNormals’ accepting a first argument of type ‘Rhino.Geometry.Mesh’ could be found (are you missing a using directive or an assembly reference?) (line 204)

do you know what this might refer to?

Hello
It is v6 command. I think you use rhinov5

True. Thanks for the reply

The function could be replaced by mesh.faces.compute normals then normals.compute normals … Or something like that.
Daniel Abalde work

1 Like

Mesh.Normals.ComputeNormals() for the vertex normals and Mesh.FaceNormals.ComputeFaceNormals() for the face normals respectively .

1 Like