Grasshopper

algorithmic modeling for Rhino

Newbie needs help. Random 3d points in closed 3d space

Hi,

I'm all new to grasshopper but I find it really interesting and I would like to script a few things but I can't get it done...
For instance, I would like to have 8 random points set inside a cube of 150 units/side and each point should be at 50 units from at least one other point.
I don't know if that is possible or not, but I would like to know how because I tried but I just cannot get anything done for the moment...

Thank to anyone for any help you could give...

Views: 429

Replies to This Discussion

Hi Marco,

this is actually pretty tricky, because for every new point you insert, you have to test all the other points.

When I am confronted with a problem like this, the first thing I always do is try and find a way in which it cannot be done. If that sound backwards, bear with me. Once I know that there are cases in which a problem has no solutions, then I know what kind of problem it is likely to be. Algorithms that have to deal with potentially unsolvable problems are much, much harder to write and they typically require an awful lot of conditionals.

In your case, the might not be a solution. Distributing N points in a finite volume so that the minimum distance between all of them is at least x, will not work under the following circumstances:

N = 2
volume = 10x10x10
x = 20

And there's an infinite list of circumstances that also won't work.

---

That being said, I do think that IF you pick numbers that easily fit, this will be fairly easy to solve in VB.NET or C#. All you need is two nested loops, a dynamic list of partial solutions and a sh*tload of if...thens

Unfortunately all three of these things (loops, conditions and dynamic lists) are difficult if not impossible to do with the current version of Grasshopper.

If you are willing to go VB.NET on this I'll gladly help you out though.

--
David Rutten
david@mcneel.com
Seattle, WA
I've written a small VB script that sort of solves this issue. But it's slow (really slow) and it might not find the best answer.


Definition file.

--
David Rutten
david@mcneel.com
Seattle, WA
Thanks a lot for looking into this
But somehow, I cannot download the definition, it says 'page not found'...
Don't click on the link, that doesn't work (don't know why). Use the "Save Link As..." in the menu to get the file.
Thanks a lot, I'm gonna chack what's that like...
Even right clicking and downloading is not working,..? could you download it,.?
As it is said, you have to use "Save Link As..." that will work fine, but the definition won't open on my computer it seems to have a problem while reading or writing the file !!
So I've downloaded the new version of grasshopper and it has quite usefull things in it such as proximity 3d which I used to resolve my problem.
I added a parameter so it is even more accurate as what I wanted.
It works like this:
- The intervall is -75 to 75 but can of course be easily changed !!
- there are 3 sliders to control randomness of point picking
- there are two sliders to control distance between points (minimum and maximum)
Lines only show between points if all points are between range!!

Here is the definition, if you have any ideas or ways to make it better please tell me !!


P.S: Maybe it is a little bit strange definition but it's my first attempt to do something over than tutorials!!
Attachments:
Sorry? Proximity 3d? Where in GH is it, or what version did you download where?
http://www.grasshopper3d.com/page/next-build this the latest version on this verry website.

and you can right double click to get the search dialog box and type proximity...

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service