I have a drainage simulation (see grasshopper file below). Now I want to color that in different colors. That means, there shall be different colors dependent on how much “water” there is. Can anyone help please? I have absolutely no idea how I should do that.
Hello
I am not a specialist but such algoritm must work.
For each point of the mesh
Weight on point =0;
For each curve find closest distance between the curve and the mesh point
Weight = Weight + Kernel(distance)
End For
End For
Kernel could be
if (distance < threshold)
result =1
else
result =0
I can say that the drainage code you use seems pretty bad. It uses mesh vertices. If your mesh vertices are equally spaced en XY plane it is OK, if not it is not good !!!
Each departure of flow represent the rain droplet so it is better to have an uniform distribution.
I continued to look to this subject. There are others ways to get the color that could be fastest. I think of using a bitmap or a 2D array to do that. This will remove the need for using closest point sot it could become more fast. What is strange is that there are not a lot of good tool to do that, but as it is not my domain I surely have missed something.
Another thing is the coloring. There are others metrics than debit. There is also the velocity (~slope).
@laurent_delrieu,
Are you familiar with Gismo? Terrain2STL is using 80-90m terrain resolution, while Gismo is using 20-30m. This is the same Mont Blanc peak with 4x4km
Thanks @djordje I didn’t know Gismo, GIS is not my domain. @djordje do you know a tool to make the drainage coloring ?
I have to discover GIS a bit at the moment. I implemented a GeoJSON reader because for my needs I needs some maps (country, marine domain …). I also need to calculate area (on the earth) and make boolean operation on surface on earth. For that I use Clipper…
Gismo seems very useful. For @Nine.Jates here is the link Drainage is included in Gismo.
Hi @laurent_delrieu,
At the moment Gismo does not support drainage coloring. But @Nine.Jates can use your upper Grasshopper definition and Gismo’s “Terrain Generator” to get the terrain surface by defining latitude/longitude and radius.
As for your tasks, Gismo can generate underwater terrain as well, if this is what you meant with marine domain?
For my use Rhinoceros or Grasshopper are not usable. I have make a standalone application so I use Rhino3dmIO, Clipper, … and many standard .NET library.
Re @djordje, I don’t know if I used well Gismo Flow Path but it seems a bit long. 1 minute for 5000 points on a mesh. My C# component is doing 7.7 s with 20 000 points.
I don’t like to put bad program (no comments no optimization …) like that, but it seems it could be useful
Hi @laurent_delrieu,
No need for apology.
Gismo’s component was created 3 years ago, and it hasn’t been optimized since then. As you just showed there is plenty of room for that.
In Gismo’ case we could probably use generators instead of lists. Increase the tolerance for stopping the flow path. I see you also use RTree, which is something that Gismo should implement as well.
In any case, thank you for sharing the comparison results and sharing your code.
As always they are truly valuable!
No problem,
What I do is going face to face and using Mesh topology. I developed that for Geodesic curve. So it doesn’t use closest Point or things like that. It sticks to the faces and edges. But it seems that I forgot some cases for the drainage. Cases that were difficult for geodesic. So use it with caution. I will try to make a more usable and tested tool.
RTree is no use for drainage, it is used for coloring.