Hello
I have tested different aproaches of how to thicken a mesh with variable distances. This is a conclusion of what I have found so far. Feel free to comment, contribute and share your experience. I am aiming to minimize computational time due to an online application. (also, I can’t share the original mesh due to NDA, so at least a placeholder with the same params is used)
Source mesh with colour that represents variable thicken data:
Desired thickened mesh:
1) Pufferfish Mesh Offset
An attempt to variable offset the mesh stuck my Rhino so I guess that it’s for uniform offset only. The result is satisfying but way too slow - 11 seconds.
2) Weaverbird Mesh Thicken
Wb Mesh Thicken is cool and fast (600ms), but only works for one side. So I tested Wb Offset Mesh instead. The rest is about stitching naked edges. This part consumes a lot of time as I did it “rough”.
3) My own approach
Moving vertices using normals multiplied by variable distance. C# script finds start and end points and create a quad face of a mesh. Stitching should work way faster if there was a better way to get start / endpoint out of a line. More on that below. Estimated time of my approach is 500ms.
DataTree <Mesh> meshes = new DataTree<Mesh>();
for (int i = 0; i < L1.BranchCount; i++)
{
GH_Path path = new GH_Path(i);
for (int j = 0; j < L1.Branch(i).Count; j++)
{
Rhino.Geometry.Mesh mesh = new Rhino.Geometry.Mesh();
mesh.Vertices.Add(L1.Branch(i)[j].From);
mesh.Vertices.Add(L1.Branch(i)[j].To);
mesh.Vertices.Add(L2.Branch(i)[j].To);
mesh.Vertices.Add(L2.Branch(i)[j].From);
mesh.Faces.AddFace(0, 1, 2, 3);
meshes.Add(mesh, path);
}
}
M = meshes;
Off topic note:
Also, this is interesting. I assumed that it should be faster to get endpoints from “line” geometry type than from “curve”. But obviously it’s the opposite. The component returns “line” and it takes 144ms to get endpoints. Converting the type to “curve” takes 121ms with additional 16ms extracting endpoints. So it’s the same in both cases and it’s interesting to me. Is there a way how to get endpoints that fast just from line without the conversion?
PetrVacek_VariableMeshThickening.gh (2.8 MB)
I am looking forward to your remarks, experience and ideas.