algorithmic modeling for Rhino
Hi
I am trying to create the polygons placed and sized randomly which is a very common exercise.
Like image 1
But I am facing two problems
1. I want to control some minimum distance between the polygons so that the moment they intersect, the command fails or does not follow.
2. When I am increasing the size of my rectangle, the polygons are going out of the rectangular boundary. I want to control them and not letting them cross the boundary. The moment they exceed the boundary, the command should stop function or does not follow.
I am sending the pictures and .gh file for more clarity.
I have been trying to search this on internet but could not find the apt keywords to explain this problem.
Tags:
Seems like you'd avoid going over the edge by generating your random points and their corresponding radii so they don't overlap the edge which I think you've made at least some attempt to do in your script. In the end, though I would definitely put the "don't overlap each other" test in a C# or VB module and as long as I was doing that, I'd put pretty much the entire logic in there with two outputs - one is the list of centers and another with the list of radii. I think I'd just try a random hex and see if it overlapped anything already placed and if so, try again. I'd give a "Give up after this many tries" parameter because you're not guaranteed how many hexes you can fit in some arbitrary rectangle. Another possibility would be to generate a voronoi tesselation, and then, for each polyline, figure out an arbitrary hex that would fit in the polyline - for instance, use the center point and then randomize on the shortest distance between the center point and one of the edges for a radius. Then they're guaranteed to be in non-overlapping voronoi cells. Perhaps you'd randomly take out some percentage of cells to keep it from looking crowded.
Here's an example of the latter. I've filtered out holes with less than a particular radius and I'm using circles, but it would be easy enough to use hexes instead:
Hi
Thanks a lot for replying. I am also convinced with the second method you suggested.
I tried using your script, but since I am having a lower version of grasshopper, it didn't work well.
I tried doing this again in my grasshopper version but the output of the voronoi is showing null parameters and thus the radii coming from the dispatch component are in turn null.
what could be the possible reason for this ?
Is that the voronoi component ? Is there any difference in the earlier and the latest version of voronoi component ?
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