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)

3 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.

1 Like

Dear Riccardo,

I need your help with some problems I’ve encountered with your great work-flow.

In some cases, I have encountered some strange interpolation problem, between the isolines, which leads me to create an overlap of the meshes.

In other cases, I have this error: “insufficient vertices for a mesh”, even if the mesh is formed by a perfect grid, and both the points of each face and their relative value, are congruent. This error leads me to have no division based on the range.

hope you can help me solve the problem.
Thanks for your time
SplitMesh.gh (275.4 KB)

Greeting,
J-Rob

SplitMesh_re.gh (278.2 KB)

The sampling search distance was not scaled for that mesh, I’ve added a note there.
Your values list was just a big list of Nulls!

Then, there were multiple errors.

Your values are ranging from 0.1 to 1.775, but you were giving to c# Laurent script isos values far above that, like 5 or even 500.
Of course the script will outputting invalid/empty meshes as there were no samples at those iso values.

Also, your final color list have 11 colors, but you were using 12 isos.

And, please, avoid using “Faint” wires. You are blinding yourself from understanding what is going on. A default wire can display useful info! Don’t hide it!

Thanks Riccardo,
I didn’t notice the mistake.

any advice about the overlapping meshes in the 1st Example?

Yes, i think it’s related on how your values have few decimals, so there is some rounding that is “unstable”.
See how I added decimals to the isos…
But I don’t know much more other than this…

Thanks Riccardo,

the rounding values was the problem!! Many Thanks

Hallo @maje90,

I am very happy to find your solution, and I wanted to thank you.
I have a question, if I analyze 2 adjacent surfaces (such as 2 walls), the interpolation of 2 values from one surface to another creates a “gradient” error. I wanted to ask if there was the possibility of not interpolating the closest points of the edge of a surface with another.

many thanks.

Maybe… unweld and split the mesh?
You will need also to make 2 unique list of values, but that’s trivial.

Hallo dear @maje90,

the surfaces are only near, but not adjacent.
I tried to split the result lists for each surface, but the way the script is built, doesn’t work.

if I have 2 neighboring surfaces in the same plane, there is no interpolation of the data.

if instead the surfaces are angular (like 2 Fasade), even if divided, I have this problem.

I attached the file, to simplified the visualization of the problem.
Iso_Error_withAdjacentEdges.gh (300.9 KB)

I hope you can have time for one last help, to solve the problem, avoiding to analyze one surface at time.

Best regards and happy new 2021

Please avoid using “faint wire” setting, you are blinding yourself from understanding what is going on.
You had tree management problems.
Also, in this specific case I too were unable to use “List item”, so “Tree item” was the best choice.


This is correctly splitting and coloring according to your values:


Iso_Error_withAdjacentEdges_fix.gh (92.8 KB)

1 Like