Smoothed Contour Mesh from Grid Analyzed Mesh

Hallo dear Grasshopper community,

I have a question to understand if my request is possible to do via Grasshopper or the only way is with C# or Python script.

I have a simulated Grid-Based Mesh

and I would to ask if is possible to generate a colored region Mesh, with smoothed contour, like the below image, having the points list and their respective values.
Smooth

I attached the test file
Internalise.gh (60.9 KB)

Greetings
J. Rob

There some problems to expose before passing to the solution:

  • “mesh” and “smooth” don’t really go along very well;
  • your mesh is colored like a picture, each square face have its color (and is not welded to neighbors), while usually mesh are colored per-vertex.
    Here you could convert each pixel-square in a vertex, resulting in a new mesh which is 1 face shorter in width and height. Or you could calculate the vertex color/value from the neighbor faces, as i did.
  • you didn’t deliver a gradient to “translate” from color to numbers and vice-versa, so i just ignored the colors and worked with the numbers.

Now, the idea would be to move the mesh vertexes on Z by their values, and then slice the mesh into regions. But that’s old story and slow.
Instead, luckily for us @laurent_delrieu exist!
I’m using Laurent’s c# code from Divide mesh along contour line


Mesh_split.gh (72.9 KB)

2 Likes

An alternative, to achieve some more “smoothness”, is to use mesh Z data not for the mesh itself but to build a nurbs surface (possible only with grid-like structure, like your mesh), and then doing the slicing:


Mesh_split_alternative.gh (73.4 KB)

Dear Riccardo,

Amazing!!!
Thank you for your time and for letting me know the Laurent script.

I hope can I still benefit from your experience with GH one more time, and ask if is possible to fill with a color to be defined, the various regions between the ISOs.

Greetings
J-Rob

Yes, but filling areas with colors needs to have a known relations between colors and values, and because

… i had to rebuild the 3D mapping:
2020-08-27 22_33_15-Window
(2x2x2 centered on origin)

Explanation of the process is 20x harder than the definition itself, at least for me.
Just know that you can directly convert RGB colors to XYZ points and vice-versa, and that’s handy for cases like this one!


Mesh_split_V2.gh (93.2 KB)

PS the 0-255 integer rounding make the dark red area actually “flat”, but thanks to the “H(er)DR” of the values we can extract iso curves even inside of it, showing more details of your map.

Probably this all would be done much faster with photoshop+illustrator … :rofl:

Dear Riccardo,

Thanks for your amazing work, for your help and your time.

Greetings,
J-Rob

Dear Riccardo,

This is what I have been looking for many years!! Would also be possible to make the coloring of each region editable and result at end a vertex mesh, that I can bake in Rhino and be able to render, or is to complex?

Best regards,
Chris

I would say “anything is possible”, in this matter…
…but seeing some example would be safer.

Isn’t what i’ve done in my last post?
Can you clarify what you mean?

… what?

Hallo Riccardo, thanks for the answer.

I’m not familiar with all the technical terms, but I hope to be clear.

I have attached and internalized the type of mesh that I wish could come out of your script.
re_Mesh_split.gh (129.6 KB)

I realized that from your script, the coloring is given by the custom preview almost as a type of material, which is then also editable in rhino, but visible only in the “Render” window.

If you could bake the mesh that I saved, you will see that the color is internalized in the mesh and not editable, (and visible, for example, also in the “Shadow” window)


Is it possible to have this type of mesh also from your script, and be able to have a single mesh, with the various regions??

Greetings and Best Regards,

Thanks for your time
Christian

You can deconstruct a mesh and then reconstruct it and adding a fixed color for all the vertexes.
For multiple meshes, graft the color input.
2020-08-30 12_21_38-Grasshopper - re_Mesh_split_
Then you can join your meshes on grasshopper or rhino, no problem in that.

PS you did have 10 colors for 9 mesh, i removed 1 color. Be careful to have same length lists…

1 Like

Do you see how these two lists are identical? The second one uses right-click ‘Reverse’ on its output.

reverse_list

FYI.