Connect vertices from different meshes

Hello!

I have meshes for gums and teeth (from buffer geometries). The teeth are able to move and rotate and I want to adapt the gum to fill in the gap after the tooth has moved.

Screenshot from 2022-03-23 09-40-51

I’m not exactly sure how to do it, but I have thought of two ways to do it:

  • The first is whenever a tooth moves, find the edge vertices of the gum and apply the same movement to it, and then propagate backwards and update the positions of the neighboring with some sort of gradient. But this might produce really long triangles which might look weird.
  • The second is to track the edge vertices of the gum, then draw lines from those vertices to the tooth vertices (see picture below) and make a new THREE.Shape() from that and use earcut to triangulate it, and finally smooth the vertices near the edge of the gum.

lines

I feel like both ideas have problems with them, mainly the smoothing part as I’d probably have to iterate and modify the positions of a lot of vertices, and that can be costly.

Any ideas or feedback on how to approach this is very welcome!