algorithmic modeling for Rhino
What I'm aiming to do is create an attractor that causes the cells of a hex grid to change from a full 6 sided hexagon, to 5 sides, to 4 sides, etc.
The end result should leave something similar to my sketch where the further the hex cell is from the attractor, the less sides it has. As the catch, the cells still need to connect by at least one line for fabrication.
My first attempt was close but a polygon cannot have less than 3 sides, so running it through that component wouldn't work. I'm now trying to interpolate a curve(s) through each cell independently, but still affected as a whole.
Any assistance would be much appreciated!
Tags:
Hmm ... I did a "similar" thing (using curves not points) a million years ago.
Have some fun
Thanks! I wonder what life was like a million years ago... ;)
better
So I've never scripted before, and am clearly new to grasshopper, could you make a suggestion about how to randomize which side of the hex cell segments that appear?... with the constraint that there are no floating lines so that each line is connected somewhere like my initial sketch... much thanks!
Er ... that's Catch 22: It's very easy provided that you can script ... but you can't (yet).
For instance
foreach(Polyline poly in polyList){
List<Line> segments = poly.GetSegments().ToList();
segments = GetRandomElements<Line>(segments, rnd.Next(0,6));
}
public static List<T> GetRandomElements<T>(IEnumerable<T> list, int elementsCount)
{
return list.OrderBy(arg => Guid.NewGuid()).Take(elementsCount).ToList();
}
Found some minutes to chop code (*) from here and there (engineers do that Sir all the times) and create a Frankenstein type of stuff that is "suitable"(**) for the scope. Added a rollTheBones and takeRandom options.
(*) code quality is awful due to some recent VERY unfortunate Formula 1 results.
(**) if you buy this you can buy anything.
May the Force (the dark option) be with you.
And the usual update (worst, slower, more bugs == way better).
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by