Grasshopper

algorithmic modeling for Rhino

So I've been playing with adjusting mesh topologies quite a bit, and wanted to better understand how edge splitting, collapsing and flipping worked.  To pursue this I thought it might be fun to try to modify meshes using a 3D approximation of Diffusion Limited Aggregation, whereby random-walking particles will strike the mesh and cause it to grow from the face that it has struck. 

The process itself is actually pretty simple: you start with a closed, triangulated mesh.  Then you set a bounding box around your geometry to define the parameters within which each particle forms.  Then, one by one, you generate particles and have them move around randomly.  If they walk outside of the box, they die and new one forms.  If, however, they strike the mesh by falling within a certain proximity, they "feed" it, and the mesh face they hit expands a little bit.  In this case, the face expands by a combination of its face normal, and the direction vector between the particle's last location and the center of the face it's hitting.

The trick in the mesh's growth lies in how the edges split after the face is pulled out.  After each particle strike is calculated, the mesh edges are tested for their length.  Any edge that exceeds the maximum length (which is determined by the maximum edge length of the input mesh) is split.  I've also added in an option to collapse any edges that get too small.  I've also added in a variable for forcing the pulled faces to expand such that their edge lengths achieve more even sizing.  The script also maintains a list of each mesh iteration generated, which is helpful when you want to make simple animations of it.

The meshes that get generated directly from this process are pretty spiky...they get much more interesting when they're smoothed out, which Weaverbird does an amazing job of.  So for the attached definition to work, you're going to need Weaverbird, as well as Kangaroo (for removing duplicate lines for one of the base mesh's creation) and [UTO]'s MeshEdit components (if you want to play with meshes at all, you really should all three of these fantastic component groups anyway!).  When I'm running the script I disable the smoothing components, because they can make it run very heavy.

The component is also timer-based, and any extensive accretion will take a pretty fair amount of time.  This is due almost entirely to the "random walking" process, as a significant number of the starting particles walk out of the bounding box, or take a little while to finally strike the mesh.

To run it, just set "reset" to false and enable the timer.  Whenever you want to pause it, either block or disable the timer.  Then to start again, just set "reset" to true.

Some last notes...the script isn't bulletproof, for sure, and occasionally the mesh loses its clean edges (non-manifold and open edges sometimes emerge).  Also, it's possible that some input meshes may create infinite loops (I haven't tested it too extensively, pretty much just on the two base meshes in the definition) but if it does you'll have to close out Rhino.

In any event, here's the definition for you to have a play with if you're at all interested.  I'd love to hear some feedback, see any transformations to the script, or see images of anything you create with it.

dla_130527_growth.gh

UDPATE: Here's an image of the definition if you want to try to rebuild it in an earlier version of GH.  Also attached following is the text of the script for the vb component.

dla.txt

Views: 5193

Comment

You need to be a member of Grasshopper to add comments!

Join Grasshopper

Comment by Giulio Piacentino on May 27, 2013 at 6:22am

Really cool stuff!

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2021   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service