Grasshopper

algorithmic modeling for Rhino

# How to give minimum value to random distances

Hello,
With the great help of Chris, I got the definition almost done.

http://www.grasshopper3d.com/forum/topics/divide-a-set-of-lines-in-...

But, the thing is that many times the spheres are intersecting themselves and I cannot find a way to deal with that.. I tried cull, but I guess I use it wrong... Is there any idea of how to give the random machine a minimum value that is greater than the sphere diameter (3, for example)?

Thanks.

Views: 2160

Attachments:

### Replies to This Discussion

In the domain input of the random module you can set it to "3 to 10" for example. Hope it helps.

As far as I understand, Chris's definition doesn't work that way.

I quickly tried to implement an extended random generator, that has an input for minimal distance.

My quick and dirty way was to generate random numbers and check the distance of the new one to all the other ones, skipping those with too little distance.

There is a general issue though, how to detect distance settings that are too strict?

Let's say you want 5 values between 0.0 and 1.0. A min distance of more than 0.25 is obviously nonsense. But although you can find a combination that fullfills a distance requirement of 0.2, the probability decreases and the component takes longer to solve.

I checked the numbers againt the next one of themselves and killed those bigger than 3, I think it is working alright:

Attachments:

Hi man, really elegant solution! Thanks a lot. You rock!

I just modified a bit the last opereation.. the Explode leaves 2 points in the same place, which doubles the quantities, so I just change it to End points, and chose the end points... But the rest really works good. Thanks.

Nankyo.

Oh you're right, thanks for letting me know.

Hi, i think you're looking for a máximum value not a mínimum.
You have to set the domium of the random machine within two values, the min and the Max value.
There is another way, you can dispatch the diameter list those values over a number, i. e. 3, and give it a fixed value.

sorry, i misunderstud, you want to deal with the distance between spheres¡¡¡ let's see

As far as I can tell this definition will keep the spheres from overlapping.  The grouped items in the definition were used for testing and can be deleted.  Two components give warnings but I couldn't find the problems.  As far as I can see the warnings can be ignored.  Apologies for the lack of annotations.

Attachments: