Grasshopper

algorithmic modeling for Rhino

Hello, first question here so might be an obvious one. I am trying to create a random distribution of 3 numbers between 0.0 and 912.0 so that each randomly generated value is always more than 94.0 away from another. (This is to prevent overlap in the resulting geometry.) I am guessing this has to do with standard deviations and If-conditionals hooked up to the random values. Any suggestions would be greatly appreciated. Thanks. 

Views: 626

Replies to This Discussion

Hi Z,

if you're limited to a hard constraint of 3 values, why not assign each random number a domain in which it is allowed to vary? If you want to make this work for x values, then it will become a lot more tricky to implement.

Another approach would be to pick 3 equally spaced values, and then add a random deviation to each, making sure the maximum deviation is never allowed to be so big as to break your constraint.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David, thanks for your reply. I actually tried your first suggestion a few days ago. It so happens that the objects that fall at these random points on the Y-Axis repeat along the X-Axis at a constant increment (with a different random seed value). So what you would see is three randomly distributed points along the Y which repeat in the X but with a different random seed.

What I am finding is that if each of the 3 values are constrained to thirds along the 0.0-912.0 range, all of the successive objects in the X-axis "avoid" the two dividing lines that separate the values along the Y-axis into thirds.

In other words, by constraining the domain into thirds, I get favorable blockages in lines of sight across the X-axis, but always have narrow lines of sight at the two boundary lines which divide the overall domain into thirds. This causes consistent unfavorable "gaps" at the two dividing points on the Y-axis which prevent a truly random result.

Hope that makes sense in words. I suppose what I could do is make the 1/3 domain vary across each strip along the X axis, but that seems to be less elegant because then other strips would be divided into 3 unequal parts. Some sort of script that "kills" any random value whose proximity is <94.0 from another would be good but how to make Grasshopper "ask" for a new random value...? I am working on some If/else conditionals with in the function module to see if that works. 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2025   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service