Truchet style subdivision

Hi, I’m actually working for my ceramics projects on drawing curves inside a given geometrical form.
I’m actually working with Truchet style form and I developed the following GH file in order to draw lines inside a rectangle.

I’m starting of with a 2d rectangular grid with a number of sub-rectangles;

I then design a certain number of subdivision models that create lines inside the smaller rectangles, lines that are designed to connected with the adjacent rectangles.

I then distribute these sub-division lines randomly to the different rectangles of the grid in ordert o create the whole picture

this works fairly well, so where’s my problem :slight_smile: you might ask.

I’m not satisfied with the way I randomly distributed the subdivision lines to the grid; let me explain why ; the information about the squares are stored in a Tree with (e.g. 25 branches containing 15 cells), I can’t flatten it because I will loose the information about the sides of the rectangles which I need to rebuild the connecting curves afterwards.

So here’s my question :
is there a command to randomly select elements inside branches of a Tree in order to create a random based subdivison of the lemenst of the Tree ?

I jojn the GH files for information

I hope I was explicit enough

truchet_lines.gh (70.4 KB)

You could try something like this for removing random elements - the nice part with this is that you can use List Item to select the elements being removed

I don’t have all your plugins installed so can’t work this through on your code, but the way I’d do it is with Unflatten Tree to make the random numbers into the same structure as the grid points, then use List Item to assign each tile to a cell. You just need to replace my Curves component with a Merge of your tile generator clusters. If you want random rotations, that could be the next step.

random tiles.gh (12.1 KB)

But I’’m not sure if this is the problem you’re trying to solve. Can you sketch an example?

that looks good, I’l try to integrate this one !

Just a quick note - if you are going to randomly rotate, it would be convenient for your tile generators to output shapes with 0,0 as their centre, rather than the corner.

Hi thanks for your resposnse ands concern !!:grinning_face:

I Tried your proposal but it didn’t work out,
so see below a sketch of my reasoning :slight_smile:

  1. I create a x y 2d grid of cells i.e. a tree with x branches of y cells

  2. I associate a random number to each cell The number represents a different method of filling the cell with lines ( the construction. methods are described inside the clusters and are based on the 4 lines of the cell, so i have to explode the cell in order to address the line items )

I’m adding an image, perhaps this helps.

N.B : My SCRIPT works, but I wanted to make it more elegant and know how to deal with the data tree.
I thought one possible way would be to kind of “dispatch” the contents of the Tree according to a pattern based on the random numbers i.e. if the random number is 0 then the cell ist dispatched to the corresponding method of filling and so on

The scroller is used to determine the quantity of the two types of curves.

truchet_lines a.gh (78.0 KB)

Why do you need cell boundaries to make the cell contents? Just send the X and Y dims and make the lines directly.

Or, rather, all the cell boundaries are identical, so create a square of the appropriate dims and send it to each generator, then use my method to array them.

Thanks again for your reply and your support, yes your proposed method is working fine for the inital setup
I wanted to start with a rectangle divided into squares, but the general idea was to, then , go over to a different division using rectangles or triangles, so therefore I need the cell boundaries.

Great and elegant solution for the given initial reflexion, but is based on the curves to be inserted into the grid, similar to the solution by @Tom_Newsom .
My aim was to work with the cell boundaries and use these for the tranformative lines to be constructed, I’ll try to dig in deeper into solution in order to find if I can use it for generalising my approach
But thnks again for your support

Are you expecting cells to differ in size? Because the same method can still be used if the cells are all the same. You make the cell grid, send a single cell item from that grid to the generators, then use the same randomisation method to assign the tiles to cell locations.

If the pattern is eventually going to be applied to a distorted grid of some kind, then yes a slightly different approach will be needed.

1 Like

A more generic way

And there are many more examples on this forum !

1 Like