generative 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:
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:
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?
i've been just converting it from mesh to srf, but that's a great idea using kangaroo. thanks
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 !!!!