Kangaroo relaxing mesh on guide-mesh


I have a wrinkled mesh (image 1 in green) that I would like to relax while keeping all of its vertices on a guide mesh (red). Especially I would like to get rid of the cavities that are marked by the arrows. The resulting mesh should follow the guide mesh, but it will have different edge lengths in different areas, especially the left side will probably have less vertices than the right.

The attached script relaxes the cavities after some time (image 2), but it also contracts the mesh and eventually collapses it. I have tried to add a secondary force that pushes non-neighboring vertices apart from each other, as well as faces or edges pushing outwards, but I have not managed to achieve any good results. I can not change the connectivity of the mesh. I would appreciate any suggestion, thank you very much!

KangarooRelaxMeshOnSurface-CK01.gh (142.2 KB)

You could use some smoothing and pressure like this to avoid it collapsing or spanning wrongly across the cavities.
KangarooRelaxMeshOnSurface-CK01_.gh (139.8 KB)
Of course the edges of the wrapping mesh still cut through the interior of the target mesh, since you are only keeping the vertices on the surface, and the mesh connectivity is really not a good fit for the shape, particularly around the base with that one valence 14 vertex.
Why do you have to keep this odd mesh connectivity?


Dear Daniel

Fantastic, thank you very much for looking into this! I had tried pressure before, but in the worst cases where the angle between faces is almost 180° they cancel each other out, so adding smooth makes a lot of sense. I assume the smooth works by pulling vertices towards the center of their neighbors rather than by aligning neighboring face normals.

This is part of an iterative growth simulation. The nodes on the hull have to grow together with what’s happening on the inside of the bone, which is really the interesting thing. I certainly picked an awkward case to illustrate the problem. Eventually the resolution gets much higher.

Thank you very much!