# Triangulations and face morphing

Face morphing has become quite popular in the last years; from mixing the faces of two celebrities to guessing how your baby could look, many TV shows and apps use software which changes one face into another through a continuous and smooth transition.

Among the different mathematical tools that can be used for face morphing, one of the easiest to understand is the morphing of triangulations. In this approach, a number of critical points are selected (e.g., the highest point of the nose, or the leftmost and rightmost points of the mouth) and a triangulation of those points is considered.

Back in 1944, Cairns 1 proved that such a pair of triangulations, topologically equivalent, can be morphed one into the other while preserving planarity (i.e., avoiding segment crossings at the intermediate steps). The proof was by induction, based on contracting a vertex of low degree to a neighbor, and needed an exponential number of steps. It took almost 40 years until, in 1983, Thomassen 2 extended the proof to all planar straight-line drawings, not necessarily triangulations. Nevertheless, the idea of this proof was augmenting those input drawings to isomorphic triangulations, and then using Cairns’ result.

Later in 1999, Floater and Gotsman 3 provided an alternative method for morphing triangulations based on Tutte’s graph drawing algorithm 4, further extended to all planar straight-line drawings by Surazhsky and Gotsman 5. A drawback of these algorithms is that they do not provide explicit trajectories for the vertices, computing instead a snapshot at the requested time points.

Finding vertex trajectories is precisely the achievement of a recent work on how to morph planar graph drawings, by Alamdari et al. 6, where each step is a unidirectional linear morph, i.e., every vertex moves at constant speed along a straight line (although the speeds of the vertices may differ). The authors succeed in obtaining an algorithm which uses only a linear number of steps, beating the exponential number in Cairns’ seminal paper, and they further prove that this complexity is worst-case optimal.

For an overview of the techniques, as above, the approach in the paper has two parts. First, solving the problem for the special case of triangulations, and then reducing the general problem for all planar straight-line drawings to that particular case of triangulations. For the case of triangulations, the idea is similar to the approach by Cairns: Finding a vertex that, in both triangulations, can be contracted to a neighbor while preserving planarity. This contraction provides two planar drawings of a smaller graph, for which recursion is used.

Such a plan has a couple of issues, the first one being that there might not be a vertex as above. The authors overcome this by choosing an interior vertex of degree at most 5 (which exists because of the graph being planar) and morphing the first drawing so that the neighbors of form a polygon such that one of them, chosen as , is able to “see” the whole polygon. Again, this mimics Cairns’ approach, but the authors manage to cut down his exponential number of steps to just two. The second issue is that the contraction should not make a vertex become coincident with another, but making them be close enough. Since Cairns’ solution resulted in a nonlinear motion, here the authors work out a different way of finding suitable positions.

For a bit of further detail, the core of the algorithm is a solution to the quadrilateral convexification problem: given a triangulation which contains a nonconvex quadrilateral, find a morph which makes that quadrilateral convex.

In order to do so, let be the vertices of the quadrilateral and we assume, without loss of generality, that is the reflex vertex of the nonconvex quadrilateral, i.e., the one with interior angle larger than 180 degrees. This implies that is the tip of the arrowhead shape of the quadrilateral and that the triangulation contains the edge (see the previous figure). Then, the authors change the frame of reference so that this edge is almost horizontal, so that they can use a result, by Hong and Nagamochi 7, which allows to redraw a plane graph, with only horizontal movements of the vertices, to achieve convex faces.

This paper by Alamdari et al., which collects the efforts of thirteen authors by combining four different conference papers, is a remarkable example of how collaboration can boost science further than competition to solve a problem with more than one century of history 8.

Note: This text is part of the dissemination activities of the Marie Skłodowska-Curie grant No 734922 in the European Union’s Horizon 2020 research and innovation programme.

## References

1. Cairns, Steward S. “Deformations of plane rectilinear complexes.” The American Mathematical Monthly 51.5 (1944): 247-252. http://dx.doi.org/10.2307/2304300
2. Thomassen, Carsten. “Deformations of plane graphs.” Journal of Combinatorial Theory, Series B 34.3 (1983): 244-257. https://doi.org/10.1016/0095-8956(83)90038-2
3. Floater, Michael S., and Craig Gotsman. “How to morph tilings injectively.” Journal of Computational and Applied Mathematics 101.1-2 (1999): 117-129. https://doi.org/10.1016/S0377-0427(98)00202-7
4. Tutte, William Thomas. “How to draw a graph.” Proceedings of the London Mathematical Society 3.1 (1963): 743-767. http://dx.doi.org/10.1112/plms/s3-13.1.743
5. Surazhsky, Vitaly, and Craig Gotsman. “Intrinsic morphing of compatible triangulations.” International Journal of Shape Modeling 9.02 (2003): 191-201. https://doi.org/10.1142/S0218654303000115
6. Alamdari, Soroush, et al. “How to morph planar graph drawings.” SIAM Journal on Computing 46.2 (2017): 824-852. doi:10.1137/16M1069171
7. Hong, Seok-Hee, and Hiroshi Nagamochi. “Convex drawings of hierarchical planar graphs and clustered planar graphs.” Journal of Discrete Algorithms 8.3 (2010): 282-295. https://doi.org/10.1016/j.jda.2009.05.003
8. Tietze, Heinrich. “Über stetige Abbildungen einer Quadratfläche auf sich selbst.” Rendiconti del Circolo Matematico di Palermo (1884-1940) 38.1 (1914): 247-304. https://doi.org/10.1007/BF03015194