How many times have you seen something on the internet that you’ve wanted to try for yourself? [Warning. Do not try this at home. Professional stunt driver on closed course. May result in the medical condition known as “hot dog fingers.”] For me, it was a post by Jason Davies called From Random Polygon to Ellipse.
Jason created an online applet that demonstrates an interesting mathematical phenomenon. If you start with a polygon defined by a random collection of points and then iteratively create a new polygon from the midpoints of each of the original polygon’s segments, the perimeter shape converges to an ellipse.
Jason ran across this in Davis and Hersh’s The Mathematical Experience in which the authors showed that not only is this transformation provable but that the resulting ellipse is tilted 45 degrees.
The “why” remains a mystery to me. But I had to try the “how” for myself and wrote a script for Pointwise using our Tcl-based Glyph scripting language that does the following.
- Select any domain (surface mesh).
- Create a database curve (geometry) that represents the domain’s perimeter by simply connecting all its grid points.
- Apply Jason’s mid-point replacement technique to make a new perimeter.
- Iteratively repeat.
Sure enough, the perimeter curves become ellipses regardless of how complicated the original perimeter’s shape is. You can see some examples in this video on YouTube.

Screenshot of the dom2Ellipse script running in Pointwise. Illustrates the conversion of an arbitrary polygon to an ellipse. Click image for video.
The graphics in the video show the last 88 iterations on the perimeter with the most recent one being white and the 88th being black. So initially you see the first 88 perimeters accumulating and then see them slowly converge to the final ellipse.
Also note that the perimeter at each iteration is scaled up by the relative size of its bounding box to the original bounding box’s perimeter. Otherwise, the perimeters would shrink to nothing.
What was really fun to see was that if the original perimeter is truly 3D, the final perimeter is a planar ellipse, as shown in the video above at the 2:25 mark.
The domain2Ellipse.glf script is available for you to download from the Glyph Script Exchange hosted at GitHub so you can try it for yourself in Pointwise.
And hopefully one of you can read the mathematics and describe in layman’s terms what’s going on here.
Special thanks to:
- Jason Davies for posting his original work online.
- Pat Baker for improving my script for publication.
- Travis Carrigan for making the video.
Is this related to subdivision line/surfaces?
Is this related to subdivision lines/surface?
I don’t know.
I am a bit confused by the description of the algorithm which does not seem to be in accordance to what is shown in the video. Assume starting with a plane square, connecting the midpoints of its four edges will give a square tilted by 45°, and smaller. The next step will be a square again, again tilted, and so on, but the polygon will never have more than four edges, nor leave the plane where it started. Did you maybe miss a step in the description? Unfortunately I’m not really familiar with the Glyph scripting language and can’t easily check in the code.
Sorry for the confusion, Hannes. What you don’t see on the screen is that the shape isn’t just a simple polygon. It’s a mesh with 8 mesh points per edge. It’s the mesh intervals that are bisected iteratively. Thanks for the feedback and for watching the video.