algorithmic modeling for Rhino
Hi,
I want to place random L blocks on a grid. I've tried it with random square blocks and done it. But for L blocks, I can't solve the algorithm and don't know how to make it. I want to make it similar to the attached image. I've added my older tryings if you need it.
Thank you very much in advance!
Tags:
This is surprisingly difficult. And my solution is pretty inefficient.
My approach was to first only deal with the central curves, not the outlines. Then generate all possible L-Shapes that reside on integer coordinates within some rectangular region. This list will be ordered, so we need to randomize it using a Jitter component.
Once we have a list of all possible L-shapes, we start testing each one to see if it intersects with any of the previous ones.* If it does, we do not add it to the final collection.
Once we have a list of True/False values (one for each possible shape) where True means it intersects and False means it doesn't, we can then filter the original list of orientations and transform our L-shaped outline onto each one.
* A problem here is that each shape is intersected with all previous shapes, even the ones that were rejected. This means our final set of shapes will in all likelihood have fewer elements than ideally possible. I could not figure out a way to add this conditional to the test, at least not without scripting.
This is using some C# to cull intersecting polylines. It gives a much tighter packing than my previous solution. It's also much faster.
Thank you very very much! Both of the solutions are great! Final products are completely what I want. Mohammed, your solution is really attractive and totaly what I want. But the problem is your solution is so complicated to me. I can't understand and decode it. David's solution is more basic and understandable for a newbie. Thank you again again for you great work and help!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by