Recursive Definitions

Hello all, I am hoping someone could help with what I am trying to achieve here.

The definition arrays progressively rotating blocks along a curve, packing them tightly.
To do this it takes a “block 0” and performs a polar array. It then takes the index 1 item of the array and arrays it along the path very densely and through a collision check it only keeps the first item of the list of the arrayed blocks that do not collide with block at index 0. It then merges index 0 and 1 for the next collision check and runs again with index 2 and so on and on and on until the whole curve path is covered.

I have managed to achieve this by means of copying and pasting part of the definition over and over but surely there has to be a better smarter way. I looked into hoopsnake but I am having trouble understanding how to use it in this context. Any help/pointers to useful tutorials on recursive definitions would be greatly appreciated!

151213_Recursive (84.9 KB)151213_Recursive Brick.3dm (25.2 KB)



Phew, that’s a seriously inefficient set up, both in terms of complexity and computation. I think I understand what you’re trying to do, and your current approach requires you to compute each rectangle before you can compute the next one, in which case you have little choice but to do it like this.

There are (to my knowledge at least) two plugins for Grasshopper that seek to provide a looping mechanism not found in the standard UI. These are Hoopsnake and Anemone. I’ve only ever understood how Anemone works, and even then not very well.

Your other option is to pick a different approach, though I have to say I’m sceptical you’ll be able to reduce the complexity, as the position of each block depends on the previous one, meaning you cannot use standard GH iteration logic. You will probably be able to reduce the computational footprint, but again, that’s not a guarantee.

I’ve attached a somewhat different approach which does not require huge amounts of iteration or repeated components, but unfortunately it does not actually work when the repeated shape is large compared to the curvature of the rail. The basic idea is to measure the ‘width’ of each rotated rectangle, then use that width to position all the rotated blocks along the guide curve. However since the measuring always happens along the same direction and the position happens along a curved spline, the two do not necessarily line up…

151213_Recursive (10.3 KB)

1 Like

Wow I wasn’t expecting such a prompt reply, thank you David!
I shall try your suggestions and get back to you with the results, thanks a million.