A Poor Man’s Hyperbolic Square Mapping
Year: 2018 Authors: Chamberlain Fong; Douglas Dunham
Core claim
A computationally inexpensive explicit disc-to-square mapping can replace conformal methods for hyperbolic visualization and also support elliptification of rectangular imagery.
Topics
Poincaré disk mapping, hyperbolic visualization, interactive art, elliptification
Domains
hyperbolic geometry, complex analysis, Schwarz-Christoffel transformations, inverse mappings, mathematical art, vector art, image remapping, M.C. Escher
Methods
explicit rational mapping, forward and inverse equations, point-based mapping, pixel-based mapping
Media
Poincaré disk patterns, bitmapped images, rectangular paintings, M.C. Escher lithographs
Paper text
The text below is the locally extracted OCR/Markdown version of the paper. Raw PDF files remain local and are not published here.
Bridges 2018 Conference Proceedings
A Poor Man’s Hyperbolic Square Mapping
Chamberlain Fong and Douglas Dunham
San Francisco, California, USA; chamberlain@alum.berkeley.edu University of Minnesota Duluth, USA; ddunham@d.umn.edu
Abstract
We present a novel mapping for converting the Poincaré disk to a square. Although this mapping does not produce results as aesthetically appealing as the conformal mapping, it can be used as a computationally inexpensive substitute to produce satisfactory hyperbolic art. Our mapping is orders of magnitude faster to calculate than the conformal mapping, thereby making our mapping suitable for interactive hyperbolic visualization. We also present some other artistic uses such as the conversion of rectangular paintings into oval regions.
Introduction
In the Bridges 2016 conference, Fong [5] presented a conformal method for converting patterns inside the Poincaré disk to a square, thereby establishing a square model of the hyperbolic plane. Although the method produces aesthetically pleasing results, it requires computationally intensive calculations involving elliptic functions and integrals on the complex plane. It also requires a huge memory footprint while running on a computer. Needless to say, the method is unsuitable for interactive visualization of the hyperbolic plane. This limitation precludes its use in applications such as computer games [7] or interactive demos. Thus began the quest to find a computationally cheap alternative.
Figure 1: Hyperbolic soccer ball pattern (center) flanked by its mapping to the conformal square (left) and a poor man’s hyperbolic square (right)
In this paper, we propose an alternative mapping that can be computed more rapidly. However, we have to admit that this alternative is not as appealing as the conformal method. To illustrate, we show in Figure 1 a hyperbolic soccer ball pattern converted to a square using our proposed mapping, which we call poor man’s hyperbolic square. We also include the conformal square version on the left for comparison. It is quite evident that the conformal square looks much better than our poor man’s hyperbolic square. For one thing, our poor man’s hyperbolic square distorts angles and shapes, whereas the conformal square does not. One can verify this by observing the heptagons on the Poincaré disk (Figure 1, center) and comparing it with the corresponding heptagons on the square mappings. Nonetheless, by itself, our poor man’s hyperbolic square is visually acceptable. The shapes appear crisp and the underlying pattern of heptagons surrounded by hexagons is still discernible.
Fong and Dunham
A Novel Disc to Square Mapping
When mapping circular to square regions or vice versa, areas near the square’s corners often suffer from troublesome shape or size distortions. But in 2017, Fong [6] presented a new mapping that mitigates this problem. The mapping is named “tapered2 squircular”, but in the context of mapping the hyperbolic plane to a square for this paper, we shall simply refer to it as “poor man’s”.
In order to mathematically describe the mapping, we need to introduce some notation and the canonical mapping space. For this mapping, the domain is the unit disc centered at the origin and the range is the square circumscribing it (Figure 2). We shall denote as a point contained in the unit disc and as the corresponding point contained in the square after the mapping.
Figure 2: Canonical mapping space
Mapping Equations. The equations for our proposed poor man’s mapping are provided below in vector form. In order to keep the equations compact, we did not include the case when or . For these degenerate cases with a division by zero, simply set . Likewise, there are degenerate points in the inverse mapping when and when . That is, the center and corner points of the square produce the indeterminate form in the inverse equation. This can be remedied by using the equation’s limiting value instead as one approaches the degenerate points.
Disc to square mapping:
Square to disc mapping:
Figure 3: Disc to square mapping
A Poor Man’s Hyperbolic Square Mapping
Mapping Diagrams. The diagrams in Figures 3 and 4 show the mapping at work. Figure 3 shows the conversion of the circular disc to a square. Figure 4 shows the conversion of the square to a circular disc. We also include the conformal mapping on the left for comparison. However, we do not include the equations for the conformal mapping in this paper because these require a lengthy discussion of elliptic functions and integrals on the complex plane. Instead, we refer the reader to Fong’s 2016 paper [5] for an in depth discussion of the conformal square. Nevertheless, we would like to mention that the conformal mapping of the circular disc to a square is based on the more general theory of Schwarz-Christoffel transformations [1] in complex analysis.
Figure 4: Square to disc mapping
Points versus Pixels
There are two general approaches to converting Poincaré disk patterns to a square. It depends on how the image is represented. The pattern can be stored in terms of vector art where hyperbolic points, lines, and polygons are specified; or it can be stored as a bitmapped image where pixel samples contain color information. We shall call the first approach as point-based mapping and the second approach as pixel-based mapping. In point-based mapping, the basic data structure is a point. For this approach, point coordinates get mapped from circle to square. In pixel-based mapping, the basic data structure is a pixel. For this approach, pixel coordinates get mapped from circle to square. In order to expound further on these two different paradigms, we shall use M.C. Escher’s Circle Limit III and Circle Limit IV as illustrative examples.
Point-based Mapping. This is an approach where every point, line, and polygon in the Poincaré disk pattern gets mapped to a corresponding location in the output square. This is no trivial task and is often laborious. This stems from the fact that vector art patterns are relatively scarce on the Internet. Most Poincaré disk artworks on the Internet are stored as bitmapped images. If one wants a point-based approach to mapping these artworks into squares, one has to recreate every little detail of the pattern for faithful conversion. In other words, one needs the source artwork in vector format for this approach.
The basic procedure for generating a pattern using this approach involves starting with a fundamental polygonal motif and doing repeated reflections of this motif on the Poincaré disk. This is done iteratively until one achieves convergence on the rim of the Poincaré disk; i.e., visual convergence. The core algorithm for this process was devised by Dunham and described in his 1986 paper [4].
As an example, we show the iterative procedure for regenerating M.C. Escher’s Circle Limit IV in Figure 5. First, we had to recreate the polygonal silhouette pattern of Escher’s devil point by point. Next, we repeatedly performed hyperbolic reflections on the pattern until we adequately filled the whole circular disc. This procedure took six iterations to converge on the rim of the Poincaré disk. At this juncture, the polygonal devils were smaller than a pixel when rendered on a computer display.
Fong and Dunham
Figure 5: Visual convergence to Circle Limit IV after 6 iterations.
In order to generate a square mapping of the Poincaré disk, the same iterative procedure has to be done, supplemented by mapping each point into square coordinates. For example, in Figure 6, we show the same iterative steps for generating Escher’s angels and devils pattern inside the square. However, in this case, we do not achieve visual convergence until after 9 iterations. This is the main reason why the conformal mapping is computationally expensive. It simply takes many more iterations to fill every corner of the square.
Figure 6: The conformal square requires 9 iterations to achieve visual convergence
In stark contrast, our poor man’s hyperbolic square does not require 9 iterations to achieve visual convergence. In fact, it only needs 6 iterations. Since each iteration entails an exponential increase in the number of devils, our poor man’s hyperbolic square mapping has far fewer polygonal devils to handle. It also requires much less computer memory to store those little devils.
Pixel-based Mapping. In this approach, every pixel of the output square is fetched from a bitmapped image of the Poincaré disk. This approach is akin to simple texture mapping used in computer graphics. This type of mapping is relatively simple and requires very little work once the source image is at hand. Meanwhile, there are plenty of Poincaré disk artworks readily available on the Internet. One can simply download these images and apply pixel-based image processing to get a hyperbolic square.
In Figure 7, we show pixel-based mappings applied to Escher’s Circle Limit III. We have the conformal square on the left and our poor man’s hyperbolic square on the right. It is quite evident that the conformal square suffers from excessive pixelation near the four corners. This is because of sampling problems in the pixel-based approach. The conformal square needs to fetch features that are much smaller than a pixel from the source image. Since these subpixel data are not available, we get pixelation artifacts. One way to alleviate this problem is to use a higher resolution input image, but this only reduces the pixelation and does not get rid of it completely. In contrast, our poor man’s figure on the right does not suffer from severe pixelation artifacts. In fact, it is a decent square rendition of Circle Limit III.
A Poor Man’s Hyperbolic Square Mapping
conformal
Figure 7: Pixel-based square mapping of Escher’s Circle Limit III.
All M.C. Escher works #2018 The M.C. Escher Company - The Netherlands. All rights reserved. www.mcescher.com
poor man’s
Note that the conformal square on the left is highly pixelated in the corners.
One can revisit the conformal mapping diagram in Figure 4 to see that samples near the corners of the square correspond to vanishingly small regions in the Poincaré disk. In other words, many pixels near the corner of the output conformal square correspond to the same pixel in the source bitmapped image.
To summarize, the conformal square is not suitable for pixel-based mapping. The corners will be highly pixelated. On the other hand, our poor man’s hyperbolic square is quite amenable to pixel-based mapping. In fact, as we will show in the next section, it often produces satisfactory results.
More Results
The best way to demonstrate the mapping at work is to give more examples. All these examples start with an underlying pattern on the Poincaré disk. The pattern is then mapped to our proposed poor man’s hyperbolic square.
Hyperbolic Stop Signs. In 1968, the United Nations ratified the octagonal stop sign as an international standard. Consequently, the stop sign is probably the most common octagonal shape we encounter in our lives. For this paper, we decided to tile the hyperbolic plane with this shape as a symbol of hyperbole.
Figure 8: Tiling the Poincaré disk with stop signs (center) along with renditions on the conformal square (left) and our poor man’s hyperbolic square (right).
Fong and Dunham
Bomford’s Hyperbolic Rugs (top row of Figure 9). These are square renditions of Tony Bomford’s rugs #12, #15, and #17. Bomford’s hyperbolic rugs [8] were all created during the 1980s at the rate of about one rug per year. Our rug mappings were created in a matter of seconds on a modern computer. They are a prime example of where the pixel-based mapping method is preferred. If one were to use the point-based approach to mapping these rugs into squares, one has to learn the craft of hooked rug making and redo every stitch in order to faithfully recreate the design. This is far beyond the capabilities of this paper’s authors. Note that the mapped rugs do not appear perfectly square. None of Tony Bomford’s physical rugs were perfectly circular either.
Although Bomford was probably the first person to use hyperbolic geometry with textiles, he certainly was not the only one into this kind of craft. There is a thriving community of knitters who use hyperbolic geometry and negative curvature in the fiber arts [9].
Hyperbolic Islamic Pattern (bottom left). This pattern was designed by Dunham [3] after drawing inspiration from an Islamic motif found at the Alhambra palace in Spain. It is based on a heptagonal tiling of the hyperbolic plane.
Hyperbolic Celtic Knots (bottom center). This interlocking ring pattern was created by Dunham for his paper [2] on Celtic knots in the hyperbolic plane. It is reminiscent of the ring patterns found in Escher’s final woodcut Snakes (1969). Note that the source image [2] we used did not have full convergence to the circular rim of the Poincaré disk. This is why our mapped square has ragged edges along its perimeter.
Faux 3D Pattern (bottom right). In this example, we show a fake 3D stack of cubes tiling the Poincaré disk. The interlocking juxtaposition of many trivalent vertices contained in convex quadrilaterals produces the ambiguous appearance of cubes in perspective. This is akin to the Necker cube illusion.
Figure 9: More patterns mapped to a poor man’s hyperbolic square. All were generated using the pixel-based mapping method except for the last one.
A Poor Man’s Hyperbolic Square Mapping
Other Artistic Uses
Although we put emphasis on using the disc-to-square mappings to convert the Poincaré disk to hyperbolic squares, we would like to mention that this is not the only use for the mappings. One can certainly use these mappings to convert other artworks from a disc to a square and vice versa. Furthermore, there is a very simple way of introducing eccentricity into the mappings, thereby making them work with rectangles and ellipses. We shall refer to the process of mapping a rectangle to an ellipse as elliptification. The inverse is also viable, but there are far more rectangular artworks available than elliptical artworks, so we will not discuss the inverse process.
Elliptification [6] is very simple if you already have a square-to-disc mapping. Elliptification can be done by simply removing the eccentricity and then reintroducing it back after the square-to-disc mapping is performed. This procedure is illustrated in the top diagram in Figure 10 along with an example showing the elliptification of the U.S. flag at the bottom.
Figure 10: Elliptification: converting rectangular imagery into oval regions
The artistic process of elliptification is not new. For centuries, artists would paint on oval-shaped canvases and photographers would cut their pictures into oval regions. Creating oval-shaped artworks is an important form of artistic expression and stylization. This has traditionally been done by just cropping or cutting out the corner regions of the artwork.
In this paper, we would like to promote the idea of using an explicit mathematical mapping to create oval-shaped artworks. This is possible using any of the square-to-disc mappings covered in this paper and others [5,6]. For example, in Figure 11, we show M.C. Escher’s famous lithograph Belvedere (1958) converted to an oval region. The traditional process of simply cropping the picture produces many undesirable side-effects such as missing portions of the gazebo roof, as well as having the illustrative sketch of the impossible cube completely gone! In contrast, the mathematically mapped lithograph on the right keeps all these features intact, albeit slightly distorted.
Invertible Explicit Mapping. There are infinitely many ways to map a circular disc to a square. For this paper, we focused solely on a mapping with explicit forward and inverse equations. The mapping in itself is mathematically interesting because it provides a one-to-one correspondence between the disc and the square by means of relatively simple rational functions of polynomials with square roots. It just so happens that the mapping gives visually satisfactory results for artistic applications such as squaring the Poincaré disk and elliptification. The mapping also highlights some sort of duality between the point-based and the pixel-based approaches to mapping a circular disc to a square. For point-based mapping, the forward mapping equation is appropriate. For pixel-based mapping, the inverse equation is more fitting.
Fong and Dunham
Belvedere (1958)
plain cropping
elliptification
Figure 11: The elliptification of M.C. Escher’s Belvedere
Summary
We presented an alternative to the conformal mapping for converting the Poincaré disk to a square. This alternative mapping is orders of magnitude faster to compute. Moreover, it is amenable to the pixel-based mapping method, thereby allowing us to forgo the labor-intensive process of regenerating vector art patterns. In addition, we introduced the concept of elliptification of rectangular imagery and then used the mapping for this purpose.
Acknowledgements
We would like to thank Vincent J. Matsko for organizing and facilitating informal gatherings for local mathematical artists in preparation for the Bridges conference.
References
[1] T. Driscoll, L. Trefethen. Schwarz-Christoffel Mapping. Cambridge University Press, 2002. [2] D. Dunham. “Hyperbolic Celtic Knot Patterns.” Bridges Conference Proceedings, Winfield KS USA, July 28–31, 2000, pp.13–22. [3] D. Dunham. “Hyperbolic Islamic Patterns—A Beginning.” Bridges Conference Proceedings, Winfield KS USA, July 27-29, 2001, pp. 247-254. [4] D. Dunham. “Hyperbolic Symmetry.” Computers & Math. with Applications, Volume 12. 1986. [5] C. Fong. “The Conformal Hyperbolic Square and Its Ilk.” Bridges Conference Proceedings, Jyväskylä Finland, August 9–13, 2016, pp. 179–186. [6] C. Fong. “Elliptification of Rectangular Imagery.” (2017 preprint) http://arxiv.org/abs/1709.07875 [7] E. Kopczyński, D. Celińska, M. Čtrnáct. “HyperRogue: Playing with Hyperbolic Geometry.” Bridges Conference Proceedings, Waterloo Canada, July 27–31, 2017, pp. 9–16. [8] D. Schattschneider. “Coxeter and the Artists: Two-Way Inspiration, Part 2.” Bridges Conference Proceedings, Banff Canada, July 31–August 3, 2005, pp. 473–480. [9] D. Taimina. Crocheting Adventures with Hyperbolic Planes. A.K.Peters Limited, 2009.