algorithmic modeling for Rhino
Ok, so this is my newest theory on how to color a surface by slope. Here's what I'm trying to do, anyway. I am trying to color a slope based on the angle of the normal. Essentially, I'm trying to color a surface based on how "steep" it is. Then, I want to project curves onto it, but only where the slope is within a certain range. The idea, then, is to color a surface using grasshopper, then somehow restrict where a curve projects onto a surface based on the color (slope) of the surface.
This concept I am trying to apply this to is procedural city generation. If anyone knows of an easier way of doing this, or has any suggestions with adapting a city template and having it respond and adapt to changes in topography, please, I am at a loss.
I tried for a while to extract partial meshes based on slope, but gave up when it was at least an order of magnitude more difficult than I at first thought. Well, I suppose you could do it fairly easily on a per-mesh-face basis and afterwards join everything back together again, but I was specifically trying to trace a continuous line across the mesh. A sort of iso-slope curve if you will.
I imagine this can be fairly easily achieved using a marching cubes approach, similar to what the Metaball components use. Instead of charge potentials you're now solving for slope angles, but that just means replacing one set of numbers with another. However I doubt that the existing metaball code can be used for this end without some serious adaptations.
Incidentally assigning colours is easy (see attached).
Hi David, your definition it's awesome, Im using it to analysis some terrain I have and I was just wondering if theres a way of "baking" the colours to be able to produce drawings or renders instead of just screenshots...
thanks in advance..
This definition should draw on a mesh one or more polylines that run along a given slope value.
It uses only standard components and no scripting so its a bit limited, only works with triangular meshes.
whoa.... this is going to take me weeks to figure out how you did this. Awesome, awesome job! I still wonder if there is a way of doing this by just evaluating surfaces at parametricized points, in order to avoid splitting the surface or converting into a mesh and triangulating, which can take up a lot of processing power in the script...
but this is an amazing script! Thank you so much!
It's loosely based on 'marching triangles' that I think is similar to what David was getting at (well, he was probably thinking of a more proper way of doing it).
Generating a mesh and triangulating it shouldn't take much longer than finding the same number of points in the surface (using the divide surface component, for example),
Speed will be a mater of the size of the point cloud you are dealing with.
This is a very impressive definition indeed. Really nice work. I have one question about it.
How do you read the exact threshold angle that the line is visualizing? I see that you can control the threshold by adjusting the slider plugged into the pi component but how do I know what max or min slope that is representing?
Thanks a lot.
It's not representing a max or min slope, it tries to draw a line through approximately the exact slope value you input.
The definition only really finds the exact slope value at the vertices of the mesh. When a mesh edge has on one end a lower slope value than the input value and on the other end a higher slope value, it assumes that some point along that edge will have the slope value you are looking for.
The points of the polyline representing the slope are calculated by doing a weighted average of the end points of the mesh edge where it's located.