Flattening multiple meshes while maintaining edge lengths

So I’ve found an old definition by Daniel Piker that helps to flatten double curved quad mesh while maintaining edge lengths. While it works with a single mesh (edge lengths don’t stay exactly the same), it fails when inputing multiple meshes (seems like ‘Smooth’ goal is causing an issue). If I remove ‘Smooth’ goal, the solver works again, however becomes very slow and far from perfect - the mesh doesn’t get flat and edge lengths are not maintained. And if I only leave ‘OnPlane’ goal, meshes get perfectly flat, however their edges towards the corners of the mesh become much shorter than the original ones.

I’ve also tried to use different goals for maintaining edge lengths and play with the strengths of each goal with no success. In attached file you can see original definition by Daniel, and my attempt to adapt it for multiple meshes. Only difference is that I’m using average mesh normal plane to pull the mesh to. Meshes can’t be joined as I need to maintain their order and work with precise mesh topology post-relaxation.

Any ideas what might be wrong or what other approach could be helpful here?

Without ‘EdgeLength’ goal (desired end result in terms of flattening, but the edge lengths are wrong here):

With ‘EdgeLength’ goal (badly flattened + takes MUCH longer to converge):

210914_FlattenMesh-example.gh (209.9 KB)

Are you looking to preserve the edge lengths of the quad mesh?
This is possible to do exactly by allowing the quads to shear.
However in your file I see you have edgeLength goals connected to the triangulated mesh.
It is impossible to flatten a triangulated mesh of a doubly curved surface without changing the edge lengths.

There’s a few other strange things in the way this definition is set up - I’ll make another example that’s hopefully clearer.

1 Like

flatten.gh (153.5 KB)
Here’s an example that flattens multiple quad meshes and strictly preserves edge lengths.

4 Likes

in your file I see you have edgeLength goals connected to the triangulated mesh.

Damn, that’s my mistake, thanks for correcting that. Also, using 2 edgeLength goals for different topologies of the mesh was unheard of for me.

Again, thanks for a quick reply and a pretty easy solution.

1 Like