Hello,
I am currently trying to better acquaint myself with coding with meshes by recreating the effects shown below:
The logic basically creates a minimum spanning tree graph based off of a mesh and creates cuts along the edges where the graph does not traverse an edge. This is very similar to what I imagine the Ivy plugin has under the hood. I am more interested in learning myself on how to implement this myself, so I decided to give it a go using Plankton.
I have managed to implement the creation of the tree graph (in blue) and have isolated the cut lines (in red) in C#.
The trouble I am having is figuring out the best way to “unweld” the edges of the plankton mesh. As opposed to other discussions on mesh clustering/stripping that I have found, my problem is unique because the mesh remains one piece with many unwelded edges as opposed to many separate mesh pieces.
https://discourse.mcneel.com/t/mesh-clustering/63943/15
https://discourse.mcneel.com/t/mesh-pattern-segmentation-for-fabrication/84412/11
To my knowledge Plankton’s data structure only lets you split edges to add vertices in the middle, so I have tried to translate it back to a rhino mesh to split it with no success. I think it has to do with the fact that the un-weld edge function has to happen multiple times around particular vertices and the face ordering gets messed up. The other alternative would be to iteratively construct a new mesh as the graph is being made, but I am also running into mesh face structure ordering problems.
Does anyone have any ideas on how best to achieve this? I am not much of a coder but I imagine the most elegant way would be to have a property stored in a custom mesh class which allows you to do this but I am stuck and curious how others would handle this.
Here is a test gh file with my best attempt, I use Plankton and weaverbird so you will need those. Any advice/pointers would be great. Even if I am going about it completely the wrong way. Once I have the split mesh I hope to implement an unroller function myself to flatten the map. I would also like to add texture unrolling at some point.
PlanktonMeshUnrollCleaned.gh (12.6 KB)
Thanks,
August
1 post - 1 participant