Grasshopper

algorithmic modeling for Rhino

I have a small project that I would like to do over the next few days, and I'm looking for any advice people might have on it. I understanding scripting conceptually but I suck at VB.net.

I would like to create a very simplified algorithm that calculates linear flows through a 2 dimensional field of vectors.

For the vector field, I would use a grid of points, and there would be a vector associated with each point. I already know how to make this.

For the linear flows, I would like to input a set of start points, and end up with a curve corresponding to each start point. Creating the curve is the part I am not sure how to do, but I have some ideas.

To create the curve, I imagine an algorithm that would take the start point, find the closest point in the "field" grid, and then use the vector associated with the closest field point to move the start point in a particular direction. Once moved, the moving point would have a new closest field point with a different associated vector, which would move the point again, and so on, recursively, for each start point for a given number of steps.

So for each point:
-find the index of the nearest field point
-get the vector from a list of vectors using the index of the nearest point
-move the point the value of the vector
-append the point's new coordinates to a list of points for it's start point
repeat

I need to maintain a list of flow point coordinates for each start point, so that I can use use them to construct interpolated curves.

I remember a discussion about making water flow down a surface which seems very relevant, but I had trouble finding it.

Thanks for any advice or help. I'll post more as I make it.

Views: 7396

Replies to This Discussion

here is the discussion about recursive descent:
http://www.grasshopper3d.com/forum/topics/gradient-descent
Take a look at the second definition on this page.

That uses a continuously defined vector field, whereas you describe using a discrete grid, but the principle would be just the same.

To read more about these techniques try searching for Numerical Integration, Euler's Method, or Line Integrals.
Thank you so much Daniel. The vb.net component in that definition has the elements I was looking for, and of course much more.

Hey Benjamin,

 

Just wondering how you made out? Were you able to adapt it to 2d?

 

Cheers,

 

Matt

Hi Matt,

 

I did carry this out. I ended up using Python in rhino 5 to do it

I'll post some info and code when I have a moment (I'm pretty busy though so please be patient).

Thanks for your interest.

-Ben

Hi Benjamin,

 

Thanks for the reply, I look forward to seeing how you went about it. I'm trying to do the same thing right now using VB.net. I've managed to get the streamlines working, but now I'm trying to get a nice even distribution of them throughout the field, which seems like its going to be the hardest part. I was hoping to use a similar strategy to the Delaunay Triangulation and largest circle method used in the CGAL 2D Streamline package. Only problem is I'm not sure how to implement Delaunay Triangulation in VB.net... I should start a new thread on this...

 

Thanks again.

 

Matt

 

Hi Matt-

I'm working on a similar project involving a 3D vector field and I was wondering what approach you took.  I'm a VB.net beginner so any tips would be appreciated. 

Thanks!

Angela

 

Some of the progress I made on streamlines on vector fields  might help, but only for surfaces/mesh in 3d space rather than a true 3d vector field, although it might be possible to extrapolate the same approach if there was sample data and the time was available to spend on it.

 

Hello guys!

I'm working with vectors now
And I found some difficulties during the realization of Daniel Picker's script with vector fields (from here). I need to create curves through vectors.

Could somebody show on any vector field how can it work?

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service