Search code examples
pythongeometry2dpolygonmorphing

Polygon morphing - Keep interior vertices inside


I have a 2d discrete polygon, made up of inter-connected triangles. In this polygon, we can distinguish two types of vertices: boundary vertices, which delimit the boundary of the polygon, and interior vertices. I would like to morph this polygon and its content so that its boundary matches another one. In the animation below, you can see an illustration of what I would like to achieve: the polygon starts with the red boundary, and I would like to "morph" it, one way or another, so that it has the green boundary.

Example of such morphing

The problem I have is that while I know the start and end coordinates for each boundary vertex, I do not possess such information for the "interior" vertices. I would thus like to find a way to also morph these vertices, in a way that they still fit inside the new boundaries properly: every interior vertex must still be inside the shape after morphing. The start boundary can be constrained to be convex, but the target boundary can be either convex or concave.

An important note: I am not looking for a way to obtain intermediate steps of this morphing with certain properties. I would simply want to obtain the end shape with the new boundary and the triangulated content morphed to fit "inside" the shape.

I tried to look on my own for such methods but struggled quite a bit. I found some results in research on how to achieve similar objectives, as well as results from other users in other software. However, most research results I found seemed to focus on ensuring that the intermediate morphing steps had certain properties, and, from what I understand, possessed the start and end coordinates for every vertex. I am a bit confused now and not sure where to go forward. Any pointers or reading suggestions would be great, and an already existing Python implementation would be amazing!


Solution

  • I ended up using the algorithm proposed in the paper "Bijective Composite Mean Value Mappings" (Schneider et al., 2013). Their method allows for the creation of bijective barycentric mappings, which means no overlap in the final shape. The implementation I used is the one given in the Python bindings of the igl library, see https://libigl.github.io/libigl-python-bindings/igl_docs/#bijective_composite_harmonic_mapping