Grasshopper

algorithmic modeling for Rhino

Hi guys I am completely new to VB/Python and recently I wish to create a model based on the principles of Diffusion Limited Aggregation. I have got a VB script (as attached) that is similar to what I want but I want to know how to restrict the "random walker" to walk only at 90 degrees as if it is following the paths of a lattice grid. Would anyone know how to modify the codes? 

Thanks a million for your help! :) 

Jc

Views: 3505

Attachments:

Replies to This Discussion

The attached file only moves particles parallel to the world X and Y axes, but it has to move the particles in increments smaller than the search radius. Also the points originate randomly on the boundary, so it's not like the ultimate aggregate connector lines are horizontal or vertical.

--

David Rutten

david@mcneel.com

Attachments:

Dear David,

Thanks for your prompt reply - I must admit I am very desperate to seek a solution! 

I understand what you've mentioned that the boundary will affect the path of the walker sometimes the 90 degrees rule can't be followed. However, perhaps more specifically to my project, I would like to create the aggregation effect from a straight line boundary and the walker will travel down to the other edge (as attached). Is it possible to program the random walker to travel according to the points in the lattice as illustrated in the image attached (Black lines illustrate the path of the walker, red line illustrates the aggregate and the bottom point in red is the original attractor)? 

Also, would you know how to incorporate a time factor to control the extent of the growth pattern instead of having an infinite loop? 

Thank you so much for your help in advance. It is difficult to start scripting without learning from examples.. 

Jc

Attachments:

It sounds like the best approach would be to allow the particles to move across the edges of a mesh. That way you have total control over the path geometry. That'll be a lot of coding though.

What do you mean by "time factor"? Would you like to limit the total number of steps in all random walks to some number? Or is it to do with actual runtime?

--

David Rutten

david@mcneel.com

Dear David,

Yes I am referring to limit the total number of steps in all random walk to some number (in which I can change by perhaps a slider). It seems like this is the way to go, would you know how to modify the script to let the particle move on the edges only? The resulting pattern would like something like Amidakuji or Blokus.. 

Thank you for your help in this!

Jc

The attached file uses a mesh and walks along the edges. All the vertices on the boundary of the mesh can spawn new particles, and I think you wanted control over which ones were allowed to.

Also for some reason the boundary tends to fill up very quickly, it's probably just a result of the algorithm rather than a bug.

--

David Rutten

david@mcneel.com

Attachments:

It looks like you are well on your way to a solution already, but in case it is helpful - there's a DLA script I posted a few years ago here:

http://www.grasshopper3d.com/profiles/blogs/diffusion-limited-aggre...

To speed things up I made the boundary radius grow with the aggregation, so the particles don't have to wander too far.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service