# Triangle mesh with fixed length close to surface

Hello everyone,

I got stuck with a problem. I want to make a triangle mesh with fixed lengths, for example 5 lengths of 40, 42, 44, 46 and 48. I have a double curved surface which is a reference for the mesh to be as close to as possible.

I started with a GH-file posted by Daniel Piker and made some adjustments. It uses Kangaroo. Here every single length is randomly assigned a rest length (every length has a color-code, just to make it more visual). But the mesh is not close to the surface. I thought maybe to use Galapagos to find the mesh which is the closest to the given surface. But I’m not very experienced in Galapagos.

Thanks

Attachements:
Discrete_triangle_mesh.gh (18.9 KB)

Hi @RobinC

You can use LengthSnap for this - it will snap each curve to the closest integer multiple of some given factor.
Generally though you’ll find it’s not possible to have a really close match to your target surface unless this factor is quite small.
Discrete_triangle_mesh2.gh (15.0 KB)

Thanks a lot @DanielPiker, this is very interesting.

So the mesh you start with has to have edges close to the lengths you want. Is it somehow possible that the curve only snaps to the closest edge length you defined (so 40, 42, 44, 46 or 48)? Now you can only control the distance (or the factor) between the edge lengths.

I got the mesh I wanted, with edge lengths varying between 50, 52, 54, 56, 58, 60. I have another question. Is it possible to have the bottom edges of the bottom triangles to only move in the xy plane? This way it’s parallel with the ground, which isn’t the case now (as you can see in the picture and GH-file).
Discrete_triangle_mesh3.gh (20.4 KB)