# Science Bytes: Math in the Movies

What good are triangles, or squares, rectangles, hexagons and so on? Lest we dismiss these as mere playthings of mathematicians, this blog will show how these shapes show up in unexpected ways both in the arts and sciences.

Let’s begin with the arts. More than 2,000 years ago, the Greek thinker Archimedes showed that a circle can be convincingly approximated by many little straight lines, as shown below:

As an aside, it was through such approximations that Archimedes provided the first inkling of the number $\displaystyle \pi$, which we know from school as 3.142…. ad infinitum. Archimedes’s thought experiment led to a far-reaching principle, later fully developed by Issac Newton in the 17th century, and that was the idea that any smooth surface can be convincingly approximated by shapes like triangles and the rest as can be seen from this picture showing the triangulations of a mannequin’s head.

Moving from left to right, we see that more triangles are used to approximate the mannequin’s head, with correspondingly better the approximation.

Now comes a fancier idea. Why not apply the same principle to animation and create orgres, clown fishes, aliens and toy cowboys? This was exactly what Hollywood did, beginning with Toy Story (1995), the first computer-animated movie. Produced by Pixar Animation Studio, it reportedly took 4 years and 800,000 hours of computer time to complete the film.

Soon after Toy Story came Geri’s Game (1997), the first computer-animated film with a human as the main character. The funny/sad story revolves around a lonesome old man (Geri) who plays chess with himself in the park. The film, also produced by Pixar, won the 1998 Academy Award for the Best Animated short film.

As with Toy Story, shapes were used to approximate Geri from tip to toe. For Geri’s head, animators used a complex polyhedron comprising of over 4,000 corners with flat facets in between them to get the smooth shiny surface of his head. The animators then subdivided those facets repeatedly to create an increasingly detailed depiction, a process which took up much less computer memory and was thus faster than earlier methods. The same trick was used to approximate Geri’s wrinkled forehead, his bushy eyebrows, his nose, the folds of skin in his neck and so on. By the time, the film was realized, Geri was so convincingly real, his antics brought tears to many viewers. Alhough this process was revolutionary at the time, its basic principle goes back to Archimedes’s clever insight more than 2,000 years ago.

The spirit of Archimedes also lurks in many scientific applications. A particularly moving application is in facial surgery. In 2006, the German applied mathematicians Peter Deuflhard, Martin Weiser, and Stefan Zachow reported work that showed how calculus combined with computer models could be used to predict the outcomes of complex facial surgeries. To do so, the team first scanned the patients with computerized tomography (CT) or magnetic resonance imaging (MRI) to create a 3D configuration of facial bones in the skull. They then feed the information of the 3D configuration into a computer to create a computer model of the patient’s face. To be useful, the model must be biometrically accurate, i.e., it must give realistic estimates of the material properties of skin and soft tissues such as fat muscles, tendons, ligaments and blood vessels. With the help of the model, the surgeon could then “operate” on the virtual patient – virtual bones in the face, jaw, and skull could be cut, relocated, augmented, or removed entirely. As the virtual operation is in progress, the computer would instantaneously calculate how the virtual soft tissue behind the face would response to stresses produced by the surgical operations, providing important information to the surgeon on how the operation should be carried out in a real situation. The model would also reveal what the patient’s face would look like post-op. Once again, a key idea behind these simulations is that the skull surface and soft tissues inside of it can be approximately by hundreds of thousands of shapes – triangles for the skull surface and tetrahedrons (the 3D counterpart of triangles) for the soft tissues. For example, the image below shows a skull surface approximated by 250,000 triangles (too small to be seen) and the volume of soft tissues approximated by 650,000 tetrahedrons. Once again, a sophisticated surface approximation idea that goes back to Archimedes’s root principle [see note 2].

Notes

[1] To understand subdivision, let’s see how it works in 2D. We’ll begin with a square as seen below to the left. Then, for each line segment, find the midpoint, which is in fact the average of the two endpoints of the line segment. This step is called split and is seen with the new black circles below to the right.

Next, we replace the original vertices of our square with points found by a weighted average. To begin, we’ll use a 1-1 weighted average, also known as the 1-1 rule. That is, our original vertices and midpoints are each given the same weight. In the clockwise direction, we replace each vertex of our square with the average of its value and the next midpoint. This creates a subdivision of our original polygon, now with eight points as seen below to the left.

We now repeat this process by splitting the new line segments to find the midpoints, then in the clockwise direction, we replace each vertex of our current polygon with an average of the vertex and the next midpoint. If we continue to loop through this process, we get a smoother polygon via subdivision, as seen in the image below to the right. This is precisely how Pixar goes from a coarse wireframe to a smooth model, only they do it in 3D instead of 2D, as with Geri’s hand.

[2] In 2006, Deuflard, Weiser, and Zachow tested their model’s predictions against the clinical outcomes of about thirty surgical cases, and found that the model worked remarkably well. For example, it correctly forecast – to within one millimeter – the position of 70 percent of the patient’s facial skin. Only 5 to 10 percent of the skin surface deviated by more than three millimeters from the predictions. Here is the link to the paper by Deuflhard et al that reports their work: https://www.semanticscholar.org/paper/Mathematics-in-Facial-Surgery-Deuflhard-Weiser/380a547aa86cb9fff5d0b77854996483be399c01.

For a semi-popular discussion of math used in computer-animated movies and facial surgery, see Steven Strogatz’s wonderful book, Infinite Powers (2019), chapter 2.