Grasshopper

algorithmic modeling for Rhino

I made a python script that estimates the direction of drainage paths on a surface.

It does not deal with puddling or accumulation, and if you have any suggestions on how to make it faster or to improve it in any way, let me know -- this is a first draft.

 

you can see the python code in this github gist:

https://gist.github.com/1054969

 

 

 

Views: 42736

Attachments:

Replies to This Discussion

cool, thank you!

is this possible in rh 4? or does the python script only works in rh5?

@Nay: This script only works in Rhino 5, though it would be possible to rewrite it in a language other than python in order to run it in Rhino 4.

thanks for the reply ben, i downloaded rh5, and it works very pretty, and fast. But do you think this could be applied to a mesh face instead of a surface?

The same basic logic could be applied to a mesh. The current logic of the looping algorithm is like this:

  1. find the closest point on the surface
  2. if the new point passes the test (the point is not higher than or too close to the previous point) then ...
  3. get a tangent plane at that point
  4. figure out the "downmost" direction in that plane
  5. move the stepsize distance in that direction

Step 1 would have to be edited to get the closest point on a mesh (instead of a surface).

Step 3 should be different. Instead of falling on a mesh face, the closest point may fall on a mesh edge, and you would have to decide how you want to calculate the new drainage direction at that point (perhaps along the edge in the downmost direction?). Or in that case you could choose which mesh face to use for calculating a new tangent plane.

Perhaps instead of finding points in space and then closest points on the surface geometry, a mesh version should traverse the edges of the mesh?

 

Ben,

I've been thinking about drainage with a mesh...

Worse comes to worse, Kangaroo can be used to make it rain and trace a flowline..



i've been just converting it from mesh to srf, but that's a great idea using kangaroo. thanks

Hi all,
The post speak a surface, but it's intersting for à mesh ...
À mesh is more complicate to assign drainage système ??

Regards

Hi Benjamin,

I test your procedure, but I can not generate a point on a mesh with GHPython.

And for convert:

newFrame = self.mesh.SurfaceAt(self.u, self.v)

For a mesh, GHPython product an error.

 

Thansk for your helping

for people who are interested in how this could be applied to a mesh, it occurred to me that there is a much simpler algorithm that could be used to simulate drainage on a mesh:  traveling the path of least resistance along edges from a particular node in the mesh.

Basically, you start at a particular point in the mesh, and then determine which edge connected to that point is most steeply sloped downwards, and then follow that edge to the next point until reaching a point that has no downward-sloping edges.

I'll post an example in a few days, when I 'm not so busy.

Thank you in advance, I see the procedure for calculating these things.
The thing is more complex if the mesh is made of himself in the mesh.
We should be able to "merge" between the cracks it.

excellent work !!!!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service